本文整理匯總了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();
}