本文整理汇总了Java中edu.berkeley.nlp.util.StrUtils.join方法的典型用法代码示例。如果您正苦于以下问题:Java StrUtils.join方法的具体用法?Java StrUtils.join怎么用?Java StrUtils.join使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.berkeley.nlp.util.StrUtils
的用法示例。
在下文中一共展示了StrUtils.join方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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));
}
}
示例3: 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);
}