@Override public String toString() { if (this.files.length == 0) { return "Empty corpus"; } else { return this.files.length + " document(s) corpus (path: " + path() + ")"; } }
public static void renderParsing(final Appendable out, final KAFDocument document, final int sentence, final boolean emitDependencies, final boolean emitSRL, final Iterable<Markable> markables) throws IOException { new ParsingRenderer(out, document, sentence).render(emitDependencies, emitSRL, markables); }
public static Evaluator evaluator() { return new Evaluator(); }
public synchronized Evaluator add(final OpinionPrecisionRecall opr) { this.score = null; this.polarityCMEvaluator.add(opr.getPolarityCM()); for (int i = 0; i < this.polarityByValueEvaluators.length; ++i) { this.polarityByValueEvaluators[i].add(opr.polaritySPRsByValue[i]); } this.polarityEvaluator.add(opr.getPolaritySPR()); this.expressionEvaluator.add(opr.getExpressionSPR()); this.holderEvaluator.add(opr.getHolderSPR()); this.targetEvaluator.add(opr.getTargetSPR()); return this; }
void render(final boolean emitDependencies, final boolean emitSRL, final Iterable<Markable> markables) throws IOException { this.out.append("<table class=\"txt\" cellspacing=\"0\" cellpadding=\"0\">\n"); if (emitDependencies) { renderDependencies(); } renderTerms(markables); if (emitSRL) { renderSRL(); } this.out.append("</table>\n"); }
public static Corpus create(final boolean recursive, final Object... filesOrDirs) { return create(recursive, Arrays.asList(filesOrDirs)); }
@Override public KAFDocument next() { return get(this.index++); }
public Stream<KAFDocument> stream() { return StreamSupport.stream(spliterator(), false); }
private <T extends Appendable> T renderText(final T out, final KAFDocument document, final Iterable<Term> terms, final QuadModel model) throws IOException { final List<Term> termList = Ordering.from(Term.OFFSET_COMPARATOR).sortedCopy(terms); NafRenderUtils.renderText(out, document, terms, extractMarkables(termList, model, this.colorMap)); return out; }
private <T extends Appendable> T renderParsing(final T out, final KAFDocument document, @Nullable final QuadModel model, final int sentence) throws IOException { NafRenderUtils.renderParsing(out, document, sentence, true, true, extractMarkables(document.getTermsBySent(sentence), model, this.colorMap)); return out; }
@Override public String toString() { return toString(true); }
public Corpus transform(final Consumer<KAFDocument> transformer) { return transform((final Path file, final KAFDocument document) -> { transformer.accept(document); }); }
private static Multimap<Set<Object>, Opinion> indexOpinionsByExpression( final Iterable<Opinion> opinions) { final Multimap<Set<Object>, Opinion> map = HashMultimap.create(); for (final Opinion opinion : opinions) { final Set<Object> expression = getExpression(opinion); map.put(expression, opinion); } return map; }
@Override public Spliterator<KAFDocument> spliterator() { return spliteratorHelper(Arrays.spliterator(this.files)); }
public Corpus transform(final BiConsumer<Path, KAFDocument> transformer) { return new Corpus(this.files, this.transformer == null ? transformer : this.transformer.andThen(transformer)); }
@Override public boolean tryAdvance(final Consumer<? super KAFDocument> action) { return delegate.tryAdvance(file -> { action.accept(get(file)); }); }
public Stream<KAFDocument> parallelStream() { return StreamSupport.stream(spliterator(), true); }
public void renderText(final Appendable out, final KAFDocument document, final Iterable<Term> terms, final Model model) throws IOException { final List<Term> termList = Ordering.from(Term.OFFSET_COMPARATOR).sortedCopy(terms); NafRenderUtils.renderText(out, document, terms, extractMarkables(termList, model, this.colorMap)); }
public void renderParsing(final Appendable out, final KAFDocument document, @Nullable final Model model, final int sentence) throws IOException { NafRenderUtils.renderParsing(out, document, sentence, true, true, extractMarkables(document.getTermsBySent(sentence), model, this.colorMap)); }