Class LemmatizerME
- Namespace
- NOpenNLP.Tools.Lemmatizer
- Assembly
- NOpenNLP.Tools.dll
A probabilistic lemmatizer. Tries to predict the induced permutation class for each word depending on its surrounding context. Based on Grzegorz Chrupała. 2008. Towards a Machine-Learning Architecture for Lexical Functional Grammar Parsing. PhD dissertation, Dublin City University. http://grzegorz.chrupala.me/papers/phd-single.pdf
public class LemmatizerME : ILemmatizer
- Inheritance
-
LemmatizerME
- Implements
- Inherited Members
Constructors
LemmatizerME(LemmatizerModel)
Initializes the current instance with the provided model and the default beam size of 3.
public LemmatizerME(LemmatizerModel model)
Parameters
modelLemmatizerModelthe model
Fields
DEFAULT_BEAM_SIZE
public const int DEFAULT_BEAM_SIZE = 3
Field Value
LEMMA_NUMBER
public const int LEMMA_NUMBER = 29
Field Value
beamSize
protected readonly int beamSize
Field Value
Methods
DecodeLemmas(string[], string[])
Decodes the lemma from the word and the induced lemma class.
public static string[] DecodeLemmas(string[] toks, string[] preds)
Parameters
Returns
- string[]
the array of decoded lemmas
EncodeLemmas(string[], string[])
public static string[] EncodeLemmas(string[] toks, string[] lemmas)
Parameters
Returns
- string[]
Lemmatize(IList<string>, IList<string>)
Generates a lemma tags for the word and postag returning the result in a list of every possible lemma for each token and postag.
public virtual IList<IList<string>> Lemmatize(IList<string> toks, IList<string> tags)
Parameters
Returns
Lemmatize(string[], string[])
Generates lemmas for the word and postag returning the result in an array.
public virtual string[] Lemmatize(string[] toks, string[] tags)
Parameters
Returns
- string[]
an array of possible lemmas for each token in the sequence.
PredictLemmas(int, string[], string[])
Predict all possible lemmas (using a default upper bound).
public virtual string[][] PredictLemmas(int numLemmas, string[] toks, string[] tags)
Parameters
Returns
- string[][]
a double array containing all posible lemmas for each token and postag pair
PredictSES(string[], string[])
Predict Short Edit Script (automatically induced lemma class).
public virtual string[] PredictSES(string[] toks, string[] tags)
Parameters
Returns
- string[]
an array containing the lemma classes
Probs()
Returns an array with the probabilities of the last decoded sequence. The sequence was determined based on the previous call to PredictSES(string[], string[]).
public virtual double[] Probs()
Returns
- double[]
An array with the same number of probabilities as tokens were sent to PredictSES(string[], string[]) when it was last called.
Probs(double[])
Populates the specified array with the probabilities of the last decoded sequence. The sequence was determined based on the previous call to PredictSES(string[], string[]). The specified array should be at least as large as the number of tokens in the previous call to PredictSES(string[], string[]).
public virtual void Probs(double[] probs)
Parameters
probsdouble[]An array used to hold the probabilities of the last decoded sequence.
TopKLemmaClasses(string[], string[])
public virtual Sequence[] TopKLemmaClasses(string[] sentence, string[] tags)
Parameters
Returns
- Sequence[]
TopKLemmaClasses(string[], string[], double)
public virtual Sequence[] TopKLemmaClasses(string[] sentence, string[] tags, double minSequenceScore)
Parameters
Returns
- Sequence[]
TopKSequences(string[], string[])
public virtual Sequence[] TopKSequences(string[] sentence, string[] tags)
Parameters
Returns
- Sequence[]
TopKSequences(string[], string[], double)
public virtual Sequence[] TopKSequences(string[] sentence, string[] tags, double minSequenceScore)
Parameters
Returns
- Sequence[]
Train(string, IObjectStream<LemmaSample?>, TrainingParameters, LemmatizerFactory)
public static LemmatizerModel Train(string languageCode, IObjectStream<LemmaSample?> samples, TrainingParameters trainParams, LemmatizerFactory posFactory)
Parameters
languageCodestringsamplesIObjectStream<LemmaSample>trainParamsTrainingParametersposFactoryLemmatizerFactory