Monday, June 1, 2009

opennlp.ccg.lexicon.EntriesItem

This class is used to parse entry elements from inside family elements in lexicon.xml files:

entry @name (@stem) (@active) (@indexRel)
  > category

The fields for this class are:

private String name;
private String stem;
private Boolean active;
private String indexRel;
private Category cat;
private Family family;

The constructor method is obvious too:

public EntriesItem(org.jdom.Element e, Family f) {
    this.family = f;
    ...
    cat = CatReader.getCat((Element) e.getChildren().get(0));
}

If there is no 'stem' attribute, this field gets the value Lexicon.DEFAULT_VAL, i.e. "[*DEFAULT*]". The default value of 'active' is Boolean.TRUE. If there is no 'indexRel' attribute, then the value of this field comes from that of the family. Obviously, the last line is the most interesting - it takes the first child only and converts it into a category? What if there are other children?

There are the usual 'get' methods, as well as a couple that get attributes of the immediate superfamily, as well a toString() method.

No comments:

Post a Comment