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


Java StringUtils类代码示例

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


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

示例1: toString_old

import edu.berkeley.nlp.util.StringUtils; //导入依赖的package包/类
public String toString_old() {
	Numberer n = Numberer.getGlobalNumberer("tags");
	return "\""
			+ StringUtils.escapeString(n.object(parentState).toString(),
					charsToEscape, '\\')
			+ "\" -> \""
			+ StringUtils.escapeString(n.object(childState).toString(),
					charsToEscape, '\\') + "\" "
			+ ArrayUtil.toString(scores);
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:11,代码来源:UnaryRule.java

示例2: toString_old

import edu.berkeley.nlp.util.StringUtils; //导入依赖的package包/类
public String toString_old() {
	Numberer n = Numberer.getGlobalNumberer("tags");
	return "\""
			+ StringUtils.escapeString(n.object(parentState).toString(),
					charsToEscape, '\\')
			+ "\" -> \""
			+ StringUtils.escapeString(n.object(leftChildState).toString(),
					charsToEscape, '\\')
			+ "\" \""
			+ StringUtils.escapeString(
					n.object(rightChildState).toString(), charsToEscape,
					'\\') + "\" " + ArrayUtil.toString(scores);
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:14,代码来源:BinaryRule.java

示例3: showScores

import edu.berkeley.nlp.util.StringUtils; //导入依赖的package包/类
public void showScores(double[][][][] scores, String title) {
	System.out.println(title);
	for (int diff = 1; diff <= length; diff++) {
		for (int start = 0; start < (length - diff + 1); start++) {
			int end = start + diff;
			System.out.print("[" + start + " " + end + "]: ");
			// List<Integer> possibleSt = possibleStates[start][end];
			List<Integer> possibleSt = null;
			if (noConstrains) {
				possibleSt = new ArrayList<Integer>();
				for (int i = 0; i < numStates; i++) {
					possibleSt.add(i);
				}
			} else {
				possibleSt = possibleStates[start][end];
			}
			for (int state : possibleSt) {
				if (scores[start][end][state] != null) {
					for (int s = 0; s < grammar.numSubStates[state]; s++) {
						Numberer n = grammar.tagNumberer;
						System.out.print("("
								+ StringUtils.escapeString(n.object(state)
										.toString(), new char[] { '\"' },
										'\\') + "[" + s + "] "
								+ scores[start][end][state][s] + ")");
					}
				}
			}
			System.out.println();
		}
	}
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:33,代码来源:ConstrainedArrayParser.java

示例4: main

import edu.berkeley.nlp.util.StringUtils; //导入依赖的package包/类
public static void main(String[] argv) {
	PTBLineLexer tokenizer = new PTBLineLexer();
	try {
		for (String line : Iterators.able(IOUtils.lineIterator(argv[0]))) {
			final List<String> tokenizeLine = tokenizer.tokenizeLine(line);
			if (tokenizeLine.get(tokenizeLine.size() - 1) == null)
				tokenizeLine.remove(tokenizeLine.size() - 1);
			System.out.println(StringUtils.join(tokenizeLine));
		}
	} catch (IOException e) {
		// TODO Auto-generated catch block
		throw new RuntimeException(e);

	}
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:16,代码来源:PTBLineLexer.java

示例5: toString

import edu.berkeley.nlp.util.StringUtils; //导入依赖的package包/类
public String toString() {
	return "[" + StringUtils.join(num2name) + "]";
}
 
开发者ID:weizh,项目名称:geolocator-3.0,代码行数:4,代码来源:Vocabulary.java

示例6: ptb2Text

import edu.berkeley.nlp.util.StringUtils; //导入依赖的package包/类
/**
 * Returns a presentable version of the given PTB-tokenized words. Pass in a
 * List of Words or Strings, or a Document and this method will join the
 * words with spaces and call {@link #ptb2Text(String) } on the output. This
 * method will check if the elements in the list are subtypes of Word, and
 * if so, it will take the word() values to prevent additional text from
 * creeping in (e.g., POS tags). Otherwise the toString value will be used.
 */
public static String ptb2Text(List ptbWords) {
	for (int i = 0; i < ptbWords.size(); i++)
		if (ptbWords.get(i) instanceof String)
			ptbWords.set(i, (ptbWords.get(i)));

	return (ptb2Text(StringUtils.join(ptbWords)));
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:16,代码来源:PTBTokenizer.java


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