use of java.io.StringWriter in project CoreNLP by stanfordnlp.
the class KillAllIncomingEdges method toEditString.
@Override
public String toEditString() {
StringWriter buf = new StringWriter();
buf.write(LABEL);
buf.write("\t");
buf.write(Ssurgeon.NODENAME_ARG);
buf.write("\t");
buf.write(nodeName);
return buf.toString();
}
use of java.io.StringWriter in project CoreNLP by stanfordnlp.
the class RemoveEdge method toEditString.
@Override
public String toEditString() {
StringWriter buf = new StringWriter();
buf.write(LABEL);
buf.write("\t");
buf.write(Ssurgeon.RELN_ARG);
buf.write(" ");
buf.write(relation.toString());
buf.write("\t");
buf.write(Ssurgeon.GOV_NODENAME_ARG);
buf.write(" ");
buf.write(govName);
buf.write("\t");
buf.write(Ssurgeon.DEP_NODENAME_ARG);
buf.write(" ");
buf.write(depName);
return buf.toString();
}
use of java.io.StringWriter in project CoreNLP by stanfordnlp.
the class RVFDataset method toSummaryString.
public String toSummaryString() {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println("Number of data points: " + size());
pw.print("Number of labels: " + labelIndex.size() + " [");
Iterator<L> iter = labelIndex.iterator();
while (iter.hasNext()) {
pw.print(iter.next());
if (iter.hasNext()) {
pw.print(", ");
}
}
pw.println("]");
pw.println("Number of features (Phi(X) types): " + featureIndex.size());
pw.println("Number of active feature types: " + numFeatureTypes());
pw.println("Number of active feature tokens: " + numFeatureTokens());
return sw.toString();
}
use of java.io.StringWriter in project CoreNLP by stanfordnlp.
the class ResultsPrinter method printResults.
public String printResults(List<String> goldStandard, List<String> extractorOutput) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
printResultsUsingLabels(pw, goldStandard, extractorOutput);
return sw.getBuffer().toString();
}
use of java.io.StringWriter in project CoreNLP by stanfordnlp.
the class ResultsPrinter method printResults.
/**
* Given a set of sentences with annotations from an information extractor class, and the same sentences
* with gold-standard annotations, print results on how the information extraction performed.
*/
public String printResults(CoreMap goldStandard, CoreMap extractorOutput) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
List<CoreMap> mutableGold = new ArrayList<>();
mutableGold.addAll(goldStandard.get(CoreAnnotations.SentencesAnnotation.class));
List<CoreMap> mutableOutput = new ArrayList<>();
mutableOutput.addAll(extractorOutput.get(CoreAnnotations.SentencesAnnotation.class));
printResults(pw, mutableGold, mutableOutput);
return sw.getBuffer().toString();
}
Aggregations