Monday, June 1, 2009

opennlp.ccg.lexicon.Lexicon

The constructor method of the opennlp.ccg.grammar.Grammar class contains the following code:

public final Lexicon lexicon;
lexicon = new Lexicon(this);
lexicon.init(lexiconUrl,morphUrl);

Here we turn to the code for the opennlp.ccg.lexicon.Lexicon class. Here are two basic fields and the constructor:

public final Grammar grammar;
public final Tokenizer tokenizer;

public Lexicon(Grammar g) {
    this.grammar = g;
    this.tokenizer = new DefaultTokenizer();
}

The init method starts as follows, where there are two input parameters, lexiconUrl and morphUrl:

List<Family> lexicon = null;
List<MorphItem> morph = null;
List<MacroItem> macroModel = null;
lexicon = getLexicon(lexiconUrl);
Pair<List<MorphItem>,List<MacroItem>> morphInfo = getMorph(morphUrl);
morph = morphInfo.a;
macroModel = morphInfo.b;

See also opennlp.ccg.lexicon.Family, opennlp.ccg.lexicon.MorphItem, and opennlp.ccg.lexicon.MacroItem.

No comments:

Post a Comment