当前位置: 首页>>代码示例>>Java>>正文


Java StrUtils类代码示例

本文整理汇总了Java中edu.berkeley.nlp.util.StrUtils的典型用法代码示例。如果您正苦于以下问题:Java StrUtils类的具体用法?Java StrUtils怎么用?Java StrUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StrUtils类属于edu.berkeley.nlp.util包,在下文中一共展示了StrUtils类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeProgram

import edu.berkeley.nlp.util.StrUtils; //导入依赖的package包/类
private void writeProgram(File temp) {
	PrintWriter out = IOUtils.openOutHard(temp);

	writeObjective(out);
	for (String c : constraints) {
		out.println(c);
	}
	String intCons = "int " + StrUtils.join(integerVariables, ", ") + ";";
	if (!relaxIntegerConstraint)
		out.println(intCons);
	out.close();
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:13,代码来源:IntegerProgram.java

示例2: main

import edu.berkeley.nlp.util.StrUtils; //导入依赖的package包/类
public static void main(String[] args) {
	// Basic Test
	String parse = "((S (NP (DT the) (JJ quick) (JJ brown) (NN fox)) (VP (VBD jumped) (PP (IN over) (NP (DT the) (JJ lazy) (NN dog)))) (. .)))";
	if (args.length > 0) {
		parse = StrUtils.join(args);
	}
	final PennTreeReader reader = new PennTreeReader(
			new StringReader(parse));
	final Tree<String> tree = reader.next();
	System.out.println(PennTreeRenderer.render(tree));
	System.out.println(tree);

	// Robustness Tests
	if (args.length == 0) {
		System.out.println("Testing robustness");
		String unbalanced1 = "((S (NP (DT the) (JJ quick) (JJ brown) (NN fox)) (VP (VBD jumped) (PP (IN over) (NP (DT the) (JJ lazy) (NN dog)))) (. .))";
		String unbalanced2 = "((S (NP (DT the) (JJ quick) (JJ brown) (NN fox))) (VP (VBD jumped) (PP (IN over) (NP (DT the) (JJ lazy) (NN dog)))) (. .)))";
		System.out.println("\nMissing a paren:");
		System.out.println(unbalanced1);
		System.out.println(PennTreeReader.parseEasy(unbalanced1, false));
		System.out.println("\nExtra paren:");
		System.out.println(unbalanced2);
		System.out.println(PennTreeReader.parseEasy(unbalanced2, false));
		String parens = "((S (NP (DT the) (SYM () (JJ quick) (JJ brown) (SYM )) (NN fox)) (VP (VBD jumped) (PP (IN over) (NP (DT the) (JJ lazy) (NN dog)))) (. .)))";
		System.out.println("\nParens as characters:");
		System.out.println(parens);
		System.out.println(PennTreeReader.parseEasy(parens, false));
	}
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:30,代码来源:Trees.java

示例3: main

import edu.berkeley.nlp.util.StrUtils; //导入依赖的package包/类
public static void main(String argv[]) throws FileNotFoundException {
	BufferedReader inputData = (argv.length == 0) ? new BufferedReader(
			new InputStreamReader(System.in)) : new BufferedReader(
			new InputStreamReader(new FileInputStream(argv[0])));
	for (Tree<String> tree : Iterators.able(new Trees.PennTreeReader(
			inputData))) {
		tree = new Trees.EmptyNodeStripper().transformTree(tree);
		System.out.println(StrUtils.join(tree.getYield()));
	}
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:11,代码来源:TreeStripper.java

示例4: addLines

import edu.berkeley.nlp.util.StrUtils; //导入依赖的package包/类
public final void addLines(int row, int column, String text) {
	Pair<Integer, Integer> key = new Pair<Integer, Integer>(row, column);
	String currentString = StrUtils.join(table.entries.get(key), "\n");
	if (!currentString.equals(""))
		currentString = currentString + "\n";
	currentString += text;
	set(row, column, currentString);
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:9,代码来源:Table.java


注:本文中的edu.berkeley.nlp.util.StrUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。