StructSimilarityScore<T>
Represents a score indicating the similarity of an item to a reference point.
Definition
Namespace:Telerik.Documents.AI.Core
Assembly:Telerik.Documents.AI.Core.dll
Type Parameters:
T
The type of the item being compared.
Syntax:
public readonly struct SimilarityScore<T>
Inherited Members
Constructors
SimilarityScore(float, T)
Represents a score indicating the similarity of an item to a reference point.
Declaration
public SimilarityScore(float similarity, T item)
Parameters
similarity
The similarity score indicating how closely the item matches the comparison criteria. Higher values represent greater similarity.
item
T
The item of type T that is associated with the similarity score.
Remarks
This structure is used to encapsulate the similarity score of an item, along with the item itself. It is particularly useful in scenarios where items need to be ranked or sorted based on their similarity to a reference point. The Comparer ensures that items with the same similarity score are distinguished by a unique index, which is useful for operations that require distinct results.
Fields
Comparer
Gets a comparer that orders SimilarityScore<T> instances by descending similarity, using the unique index as a tiebreaker.
Declaration
public static readonly IComparer<SimilarityScore<T>> Comparer
Field Value
Remarks
This comparer is useful for sorting collections of SimilarityScore<T> so that items with higher similarity values appear first. If two items have the same similarity, the one with the lower unique index is considered less than the other.
Properties
Similarity
Gets the similarity score between two compared entities.
Methods
ToString()
Returns a string that represents the current object, including its similarity value and item.
Declaration
public override string ToString()
Returns
A string containing the similarity value and item of this instance, formatted for readability.
Overrides