Table of Contents

Method GetScore

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

GetScore(string, string, CancellationToken)

Computes a similarity score for a single document synchronously.

public float GetScore(string query, string document, CancellationToken cancellationToken = default)

Parameters

query string

The input text query. Must not be null.

document string

The document text to compare against the query. Must not be null.

cancellationToken CancellationToken

A token to cancel the operation if needed.

Returns

float

A float score representing the similarity between the query and document.

Exceptions

ArgumentNullException

Thrown if query or document is null.

GetScore(string, IEnumerable<string>, CancellationToken)

Computes similarity scores for a collection of documents synchronously.

public float[] GetScore(string query, IEnumerable<string> documents, CancellationToken cancellationToken = default)

Parameters

query string

The input text query. Must not be null.

documents IEnumerable<string>

An enumerable of document texts. Must not be null or empty.

cancellationToken CancellationToken

A token to cancel the operation if needed.

Returns

float[]

An array of float scores corresponding to each document.

Exceptions

ArgumentNullException

Thrown if query is null or documents is null or empty.

GetScore(string, TextPartition, CancellationToken)

Computes a similarity score for a single text partition synchronously.

public float GetScore(string query, TextPartition partition, CancellationToken cancellationToken = default)

Parameters

query string

The input text query. Must not be null.

partition TextPartition

The text partition to compare against the query. Must not be null.

cancellationToken CancellationToken

A token to cancel the operation if needed.

Returns

float

A float score representing the similarity between the query and partition.

Exceptions

ArgumentNullException

Thrown if query is null or partition is null.

GetScore(string, IEnumerable<TextPartition>, CancellationToken)

Computes similarity scores for a collection of text partitions synchronously.

public float[] GetScore(string query, IEnumerable<TextPartition> partitions, CancellationToken cancellationToken = default)

Parameters

query string

The input text query. Must not be null.

partitions IEnumerable<TextPartition>

An enumerable of text partitions. Must not be null or empty.

cancellationToken CancellationToken

A token to cancel the operation if needed.

Returns

float[]

An array of float scores corresponding to each partition.

Exceptions

ArgumentNullException

Thrown if query is null or partitions is null or empty.