Table of Contents

Property Similarity

Namespace
LMKit.Retrieval
Assembly
LM-Kit.NET.dll

Similarity

Gets the similarity score between the associated TextPartition and a specific content.

public float Similarity { get; }

Property Value

float

A floating-point number between 0 and 1, where 0 indicates no similarity and 1 indicates identical content.

Examples

var matches = ragEngine.FindMatchingPartitions("machine learning", topK: 5);

// Filter results by a custom similarity threshold.
var highQuality = matches.Where(m => m.Similarity >= 0.7f).ToList();
Console.WriteLine($"{highQuality.Count} partitions above 0.7 similarity.");
Share