当前位置: 首页>>代码示例>>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;未经允许,请勿转载。