本文整理汇总了Java中edu.stanford.nlp.io.StringOutputStream类的典型用法代码示例。如果您正苦于以下问题:Java StringOutputStream类的具体用法?Java StringOutputStream怎么用?Java StringOutputStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringOutputStream类属于edu.stanford.nlp.io包,在下文中一共展示了StringOutputStream类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConllEvalSummary
import edu.stanford.nlp.io.StringOutputStream; //导入依赖的package包/类
public static String getConllEvalSummary(String conllMentionEvalScript,
String goldFile, String predictFile) throws IOException
{
ProcessBuilder process = new ProcessBuilder(conllMentionEvalScript, "all", goldFile, predictFile, "none");
StringOutputStream errSos = new StringOutputStream();
StringOutputStream outSos = new StringOutputStream();
PrintWriter out = new PrintWriter(outSos);
PrintWriter err = new PrintWriter(errSos);
SystemUtils.run(process, out, err);
out.close();
err.close();
String summary = outSos.toString();
String errStr = errSos.toString();
if (errStr.length() > 0) {
summary += "\nERROR: " + errStr;
}
return summary;
}
示例2: getConllEvalSummary
import edu.stanford.nlp.io.StringOutputStream; //导入依赖的package包/类
public static String getConllEvalSummary(String conllMentionEvalScript,
String goldFile, String predictFile) throws IOException {
if (conllMentionEvalScript == null) return "";
ProcessBuilder process = new ProcessBuilder(conllMentionEvalScript, "all", goldFile, predictFile, "none");
StringOutputStream errSos = new StringOutputStream();
StringOutputStream outSos = new StringOutputStream();
PrintWriter out = new PrintWriter(outSos);
PrintWriter err = new PrintWriter(errSos);
SystemUtils.run(process, out, err);
out.close();
err.close();
String summary = outSos.toString();
String errStr = errSos.toString();
if (errStr.length() > 0) {
summary += "\nERROR: " + errStr;
}
return summary;
}
示例3: answerJson
import edu.stanford.nlp.io.StringOutputStream; //导入依赖的package包/类
public static String answerJson(String question) throws IOException
{
List<String> uris = CubeIndex.INSTANCE.getCubeUris(question);
if(uris.isEmpty()) {return "";}
String cubeName = Cube.linkedSpendingCubeName(uris.get(0));
try(StringOutputStream out = new StringOutputStream())
{
ResultSetFormatter.outputAsJSON(out,
Cube.getInstance(cubeName).sparql.select(
new Algorithm().template(cubeName, question).sparqlQuery()
));
return out.toString();
}
}
示例4: parsesToString
import edu.stanford.nlp.io.StringOutputStream; //导入依赖的package包/类
/**
* Convert list of scored parse trees to string representing scored parses
* (in the charniak parser output format)
* @param parses - list of scored parse trees
* @return string representing scored parses
*/
public String parsesToString(List<ScoredObject<Tree>> parses)
{
if (parses == null) return null;
StringOutputStream os = new StringOutputStream();
PrintWriter pw = new PrintWriter(os);
printScoredTrees(pw, 0, parses);
pw.close();
return os.toString();
}
示例5: documentToString
import edu.stanford.nlp.io.StringOutputStream; //导入依赖的package包/类
public static String documentToString(Document document) {
StringOutputStream s = new StringOutputStream();
printNode(s, document, true, true);
return s.toString();
}
示例6: nodeToString
import edu.stanford.nlp.io.StringOutputStream; //导入依赖的package包/类
public static String nodeToString(Node node, boolean prettyPrint) {
StringOutputStream s = new StringOutputStream();
printNode(s, node, prettyPrint, false);
return s.toString();
}