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