Class DictionaryLemmatizer

Namespace
NOpenNLP.Tools.Lemmatizer
Assembly
NOpenNLP.Tools.dll

Lemmatize by simple dictionary lookup into a hashmap built from a file containing, for each line, word\tabpostag\tablemma.

public class DictionaryLemmatizer : ILemmatizer
Inheritance
DictionaryLemmatizer
Implements
Inherited Members

Remarks

Version 2014-07-08.

Constructors

DictionaryLemmatizer(FileInfo)

public DictionaryLemmatizer(FileInfo dictionaryFile)

Parameters

dictionaryFile FileInfo

DictionaryLemmatizer(Stream)

Construct a hashmap from the input tab separated dictionary.

The input file should have, for each line, word\tabpostag\tablemma. Alternatively, if multiple lemmas are possible for each word,postag pair, then the format should be word\tab\postag\tablemma01#lemma02#lemma03

public DictionaryLemmatizer(Stream dictionary)

Parameters

dictionary Stream

the input dictionary via inputstream

DictionaryLemmatizer(string)

public DictionaryLemmatizer(string dictionaryFile)

Parameters

dictionaryFile string

Properties

DictMap

Get the Map containing the dictionary.

public virtual IDictionary<IList<string>, IList<string>> DictMap { get; }

Property Value

IDictionary<IList<string>, IList<string>>

dictMap the Map

Methods

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> tokens, IList<string> posTags)

Parameters

tokens IList<string>
posTags IList<string>

Returns

IList<IList<string>>

a list of every possible lemma for each token in the sequence.

Lemmatize(string[], string[])

Generates lemmas for the word and postag returning the result in an array.

public virtual string[] Lemmatize(string[] tokens, string[] postags)

Parameters

tokens string[]
postags string[]

Returns

string[]

an array of possible lemmas for each token in the sequence.