@Override public String toString() { List<Constituent> constituents = new ArrayList<>(this.getConstituents()); Collections.sort(constituents, TextAnnotationUtilities.constituentStartComparator); StringBuilder sb = new StringBuilder(); for (Constituent c : constituents) sb.append("[").append(c.getLabel()).append(" ").append(c.getTokenizedSurfaceForm()) .append(" ] "); return sb.toString(); } }
@Override public String toString() { List<Constituent> constituents = new ArrayList<>(this.getConstituents()); Collections.sort(constituents, TextAnnotationUtilities.constituentStartComparator); StringBuilder sb = new StringBuilder(); for (Constituent c : constituents) sb.append("[").append(c.getLabel()).append(" ").append(c.getTokenizedSurfaceForm()) .append(" ] "); return sb.toString(); } }
/** * get the start and end offsets of all constituents and store them * note that these are based on the cleaned-up text, so need to be mapped back * to the original text. * * @param tokens SpanLabelView containing Token info (from TextAnnotation) */ protected void compileOffsets(SpanLabelView tokens) { List<Constituent> constituents = tokens.getConstituents(); int n = constituents.size(); starts = new int[n]; ends = new int[n]; int i = 0; for (Constituent cons : tokens.getConstituents()) { starts[i] = cons.getStartCharOffset(); ends[i] = cons.getEndCharOffset(); i++; } }
/** * get the start and end offsets of all constituents and store them * note that these are based on the cleaned-up text, so need to be mapped back * to the original text. * * @param tokens SpanLabelView containing Token info (from TextAnnotation) */ protected void compileOffsets(SpanLabelView tokens) { List<Constituent> constituents = tokens.getConstituents(); int n = constituents.size(); starts = new int[n]; ends = new int[n]; int i = 0; for (Constituent cons : tokens.getConstituents()) { starts[i] = cons.getStartCharOffset(); ends[i] = cons.getEndCharOffset(); i++; } }
return; SpanLabelView wikipedia_view = (SpanLabelView) ta.getView(ViewNames.WIKIFIER); if(wikipedia_view.getConstituents().size() < 5 || page.getTitle().contains("/")) return; System.out.println(wikipedia_view.getConstituents().size());
List<Constituent> chunkConstituents = chunkView.getConstituents();
List<Constituent> nerConstituents = nerView.getConstituents();
for (Constituent entityConstituent : entityView.getConstituents()) { String entityId = entityConstituent.getAttribute(EntityIDAttribute); String entityMentionId = entityConstituent.getAttribute(EntityMentionIDAttribute);
for (Constituent entityConstituent : entityView.getConstituents()) { String entityId = entityConstituent.getAttribute(EntityIDAttribute); String entityMentionId = entityConstituent.getAttribute(EntityMentionIDAttribute);
for (Constituent entityConstituent : entityView.getConstituents()) { String entityId = entityConstituent.getAttribute(EntityIDAttribute); String entityMentionId = entityConstituent.getAttribute(EntityMentionIDAttribute);
SpanLabelView cv = (SpanLabelView) ta.getView(clauseViewName); List<Constituent> clauses = cv.getConstituents();
SpanLabelView cv = (SpanLabelView) ta.getView(clauseViewName); List<Constituent> clauses = cv.getConstituents();