
ixa.kaflib.NonTerminal Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kaflib-naf Show documentation
Show all versions of kaflib-naf Show documentation
Kaflib-naf is a java library to create and edit NAF documents.
The newest version!
package ixa.kaflib;
import ixa.kaflib.KAFDocument.AnnotationType;
import ixa.kaflib.KAFDocument.Utils;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
public class NonTerminal extends TreeNode implements SentenceLevelAnnotation {
/** Label */
private String label;
/** Nodes' children */
private List children;
NonTerminal(String id, String label) {
super(id, false, false);
this.label = label;
this.children = new ArrayList();
}
public String getLabel() {
return this.label;
}
public void setLabel(String label) {
this.label = label;
}
public void addChild(TreeNode tn) throws Exception {
this.children.add(tn);
}
public List getChildren() {
return this.children;
}
Map> getReferencedAnnotations() {
Map> referenced = new HashMap>();
List terms = new ArrayList();
for (TreeNode node : this.children) {
terms.addAll(node.getReferencedAnnotations().get(AnnotationType.TERM));
}
referenced.put(AnnotationType.TERM, terms);
return referenced;
}
public Integer getSent() {
return this.children.get(0).getSent();
}
public Integer getPara() {
return this.children.get(0).getPara();
}
/*
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof NonTerminal)) return false;
NonTerminal ann = (NonTerminal) o;
return Utils.areEquals(this.label, ann.label) &&
Utils.areEquals(this.children, ann.children);
}
*/
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy