use of edu.illinois.cs.cogcomp.core.datastructures.textannotation.TokenLabelView in project cogcomp-nlp by CogComp.
the class SentenceStructure method getView.
public TokenLabelView getView(SenseManager manager, TextAnnotation ta) {
String viewName = SenseManager.getPredictedViewName();
TokenLabelView view = new TokenLabelView(viewName, VerbSenseConstants.systemIdentifier, ta, 1.0);
for (SenseStructure y : this.ys) {
SenseInstance senseInstance = y.getInstance();
IntPair predicateSpan = senseInstance.getConstituent().getSpan();
String sense = manager.getSense(y.getLabel());
view.addTokenLabel(predicateSpan.getFirst(), sense, 1.0);
}
return view;
}
use of edu.illinois.cs.cogcomp.core.datastructures.textannotation.TokenLabelView in project cogcomp-nlp by CogComp.
the class SenseExampleGenerator method getTreebankExamples.
private void getTreebankExamples(TextAnnotation ta, List<SenseInstance> predicates, List<SenseStructure> structures) {
TokenLabelView view = (TokenLabelView) ta.getView(SenseManager.getGoldViewName());
for (Constituent predicate : view.getConstituents()) {
if (!predicate.hasAttribute(PredicateArgumentView.LemmaIdentifier)) {
System.out.println(ta);
System.out.println(view);
System.out.println(predicate + " has no lemma!");
assert false;
}
SenseInstance x = new SenseInstance(predicate, manager);
int sense = manager.getSenseId(predicate.getLabel());
SenseStructure y = new SenseStructure(x, sense, manager);
predicates.add(x);
structures.add(y);
}
}
Aggregations