@Override public boolean hasView(String viewName) { return this.textAnnotation.hasView(viewName); }
@Override public boolean hasView(String viewName) { return this.textAnnotation.hasView(viewName); }
@Override protected boolean prerequisiteCheck(TextAnnotation ta) { return ta.hasView(SenseManager.getGoldViewName()); }
@Override protected boolean prerequisiteCheck(TextAnnotation ta) { return ta.hasView(manager.getGoldViewName()); }
@Override protected boolean prerequisiteCheck(TextAnnotation ta) { return ta.hasView(SenseManager.getGoldViewName()); }
private void addViews(TextAnnotation ta) throws AnnotatorException { for (String view : requiredViews) { if (!ta.hasView(view)) annotator.addView(ta, view); } if (!ta.hasView(ViewNames.CLAUSES_STANFORD)) ta.addView(ClauseViewGenerator.STANFORD); if (!ta.hasView(ViewNames.DEPENDENCY + ":" + ViewNames.PARSE_STANFORD)) ta.addView(new HeadFinderDependencyViewGenerator(ViewNames.PARSE_STANFORD)); } }
public void readData() { while (reader.hasNext()) { TextAnnotation ta = reader.next(); if (!ta.hasView(ViewNames.SRL_VERB)) continue; textAnnotations.add(ta); } } }
private void addPredicateArgs(List<String[]> columns, TextAnnotation ta) { PredicateArgumentView predArgView = null; if (ta.hasView(predicateArgumentViewName)) predArgView = (PredicateArgumentView) ta.getView(predicateArgumentViewName); convertPredicateArgView(ta, predArgView, columns, true); }
/** * Add the required views to the {@link TextAnnotation}. The views are specified in * {@link PreprocessorConfigurator#VIEWS_TO_ADD}. * * @param ta The {@link TextAnnotation} to be annotated */ public void annotate(TextAnnotation ta) throws AnnotatorException { for (String view : rm.getCommaSeparatedValues(PreprocessorConfigurator.VIEWS_TO_ADD)) { if (ta.hasView(view)) continue; annotator.addView(ta, view); } } }
private static TreeView getDependencyView(TextAnnotation ta, Annotator viewGenerator) { if (!ta.hasView(viewGenerator.getViewName())) { synchronized (FeatureInputTransformer.class) { if (!ta.hasView(viewGenerator.getViewName())) { try { ta.addView(viewGenerator); } catch (AnnotatorException e) { throw new RuntimeException(e); } } } } return (TreeView) ta.getView(viewGenerator.getViewName()); }
private static TreeView getDependencyView(TextAnnotation ta, Annotator viewGenerator) { if (!ta.hasView(viewGenerator.getViewName())) { synchronized (FeatureInputTransformer.class) { if (!ta.hasView(viewGenerator.getViewName())) { try { ta.addView(viewGenerator); } catch (AnnotatorException e) { throw new RuntimeException(e); } } } } return (TreeView) ta.getView(viewGenerator.getViewName()); }
public Pair<SentenceInstance, SentenceStructure> getExamples(TextAnnotation ta) throws Exception { List<SenseInstance> predicates = new ArrayList<>(); List<SenseStructure> structures = new ArrayList<>(); if (ta.hasView(SenseManager.getGoldViewName())) getTreebankExamples(ta, predicates, structures); else getExamples(ta, predicates); SentenceInstance sx = new SentenceInstance(predicates); SentenceStructure sy = new SentenceStructure(sx, structures); return new Pair<>(sx, sy); }
public Pair<SRLSentenceInstance, SRLSentenceStructure> getExamples(TextAnnotation ta) throws Exception { List<SRLPredicateInstance> predicates = new ArrayList<>(); List<SRLPredicateStructure> structures = new ArrayList<>(); if (ta.hasView(manager.getGoldViewName())) getTreebankExamples(ta, predicates, structures); else getExamples(ta, predicates); SRLSentenceInstance sx = new SRLSentenceInstance(predicates); SRLSentenceStructure sy = new SRLSentenceStructure(sx, structures); return new Pair<>(sx, sy); }
public Pair<SentenceInstance, SentenceStructure> getExamples(TextAnnotation ta) throws Exception { List<SenseInstance> predicates = new ArrayList<>(); List<SenseStructure> structures = new ArrayList<>(); if (ta.hasView(SenseManager.getGoldViewName())) getTreebankExamples(ta, predicates, structures); else getExamples(ta, predicates); SentenceInstance sx = new SentenceInstance(predicates); SentenceStructure sy = new SentenceStructure(sx, structures); return new Pair<>(sx, sy); }
@Override public void addView(TextAnnotation ta) throws AnnotatorException { assert (ta.hasView(ViewNames.SENTENCE)); SpanLabelView quantifierView = new SpanLabelView(ViewNames.QUANTITIES, "illinois-quantifier", ta, 1d); List<QuantSpan> quantSpans = getSpans(ta.getTokenizedText(), true, ta); for (QuantSpan span : quantSpans) { int startToken = ta.getTokenIdFromCharacterOffset(span.start); int endToken = ta.getTokenIdFromCharacterOffset(span.end); quantifierView.addSpanLabel(startToken, endToken, span.object.toString(), 1d); } ta.addView(ViewNames.QUANTITIES, quantifierView); }
@Override public void addView(TextAnnotation ta) throws AnnotatorException { assert (ta.hasView(ViewNames.SENTENCE)); SpanLabelView quantifierView = new SpanLabelView(ViewNames.QUANTITIES, "illinois-quantifier", ta, 1d); List<QuantSpan> quantSpans = getSpans(ta.getTokenizedText(), true, ta); for (QuantSpan span : quantSpans) { int startToken = ta.getTokenIdFromCharacterOffset(span.start); int endToken = ta.getTokenIdFromCharacterOffset(span.end); quantifierView.addSpanLabel(startToken, endToken, span.object.toString(), 1d); } ta.addView(ViewNames.QUANTITIES, quantifierView); }
@Override public Boolean transform(Pair<Constituent, SpanLabelView> input) { if (!input.getFirst().getLabel().equals(CLOTHES)) return true; TextAnnotation ta = input.getFirst().getTextAnnotation(); int last = input.getFirst().getEndSpan() - 1; return !ta.hasView(ViewNames.POS) || POSUtils.isPOSNoun(WordHelpers.getPOS(ta, last)); } });
@Override public Boolean transform(Pair<Constituent, SpanLabelView> input) { if (!input.getFirst().getLabel().equals(CLOTHES)) return true; TextAnnotation ta = input.getFirst().getTextAnnotation(); int last = input.getFirst().getEndSpan() - 1; return !ta.hasView(ViewNames.POS) || POSUtils.isPOSNoun(WordHelpers.getPOS(ta, last)); } });
private String getLemma(Constituent c) { if (c.hasAttribute(PredicateArgumentView.LemmaIdentifier)) { return c.getAttribute(PredicateArgumentView.LemmaIdentifier); } else if (c.getTextAnnotation().hasView(ViewNames.LEMMA)) { return WordHelpers.getLemma(c.getTextAnnotation(), c.getEndSpan() - 1); } else return null; }
private String getLemma(Constituent c) { if (c.hasAttribute(PredicateArgumentView.LemmaIdentifier)) { return c.getAttribute(PredicateArgumentView.LemmaIdentifier); } else if (c.getTextAnnotation().hasView(ViewNames.LEMMA)) { return WordHelpers.getLemma(c.getTextAnnotation(), c.getEndSpan() - 1); } else return null; }