當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。