Interface ILanguageModel

Namespace
NOpenNLP.Tools.Languagemodel
Assembly
NOpenNLP.Tools.dll

A language model can calculate the probability p (between 0 and 1) of a certain sequence of tokens, given its underlying vocabulary.

public interface ILanguageModel

Methods

CalculateProbability(StringList)

Calculate the probability of a series of tokens (e.g. a sentence), given a vocabulary.

[Obsolete("Use CalculateProbability(string[]) instead.")]
double CalculateProbability(StringList tokens)

Parameters

tokens StringList

the text tokens to calculate the probability for

Returns

double

the probability of the given text tokens in the vocabulary

Remarks

Deprecated: Use CalculateProbability(params string[]) instead.

CalculateProbability(params string[])

Calculate the probability of a series of tokens (e.g. a sentence), given a vocabulary.

double CalculateProbability(params string[] tokens)

Parameters

tokens string[]

the text tokens to calculate the probability for

Returns

double

the probability of the given text tokens in the vocabulary

PredictNextTokens(StringList)

Predict the most probable output sequence of tokens, given an input sequence of tokens.

[Obsolete("Use PredictNextTokens(string[]) instead.")]
StringList? PredictNextTokens(StringList tokens)

Parameters

tokens StringList

a sequence of tokens

Returns

StringList

the most probable subsequent token sequence

Remarks

Deprecated: Use PredictNextTokens(params string[]) instead.

PredictNextTokens(params string[])

Predict the most probable output sequence of tokens, given an input sequence of tokens.

string[]? PredictNextTokens(params string[] tokens)

Parameters

tokens string[]

a sequence of tokens

Returns

string[]

the most probable subsequent token sequence