當前位置: 首頁>>代碼示例>>Java>>正文


Java StringOutputStream類代碼示例

本文整理匯總了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;
  }
 
開發者ID:benblamey,項目名稱:stanford-nlp,代碼行數:19,代碼來源:SieveCoreferenceSystem.java

示例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;
}
 
開發者ID:aznotins,項目名稱:LVCoref,代碼行數:19,代碼來源:LVCoref.java

示例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();
	}
}
 
開發者ID:AskNowQA,項目名稱:cubeqa,代碼行數:16,代碼來源:Service.java

示例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();
}
 
開發者ID:benblamey,項目名稱:stanford-nlp,代碼行數:16,代碼來源:CharniakScoredParsesReaderWriter.java

示例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();
}
 
開發者ID:benblamey,項目名稱:stanford-nlp,代碼行數:6,代碼來源:XMLUtils.java

示例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();
}
 
開發者ID:benblamey,項目名稱:stanford-nlp,代碼行數:6,代碼來源:XMLUtils.java


注:本文中的edu.stanford.nlp.io.StringOutputStream類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。