當前位置: 首頁>>代碼示例>>Java>>正文


Java Tree.preTerminalYield方法代碼示例

本文整理匯總了Java中edu.stanford.nlp.trees.Tree.preTerminalYield方法的典型用法代碼示例。如果您正苦於以下問題:Java Tree.preTerminalYield方法的具體用法?Java Tree.preTerminalYield怎麽用?Java Tree.preTerminalYield使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.stanford.nlp.trees.Tree的用法示例。


在下文中一共展示了Tree.preTerminalYield方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: hasSuspectedImperativeParseTreeError

import edu.stanford.nlp.trees.Tree; //導入方法依賴的package包/類
/**
 * Checks for suspected imperative parse tree errors. In recipes, most
 * sentences are supposed to be imperatives, so if the first tag is a 
 * noun or an adjective, we will mark it as incorrect.
 * 
 * @param tree Parse tree to investigate
 * @return True if there is a suspected error, False otherwise
 */
private static boolean hasSuspectedImperativeParseTreeError(Tree tree) {
	List<Label> preleaves = tree.preTerminalYield();
	if (preleaves.get(0).value().startsWith("N") || preleaves.get(0).value().startsWith("J")
			|| preleaves.get(0).value().equals("CD") || preleaves.get(0).value().startsWith("RB")) {
		return true;
	}
	return false;
}
 
開發者ID:uwnlp,項目名稱:recipe-interpretation,代碼行數:17,代碼來源:RecipeArgParser.java

示例2: initialize

import edu.stanford.nlp.trees.Tree; //導入方法依賴的package包/類
@Override
public void initialize(int sourceInputId,
    Sequence<IString> source) {
    Tree parseTree = CoreNLPCache.get(sourceInputId).get(TreeAnnotation.class);
    this.posTags = parseTree.preTerminalYield();
    
    
}
 
開發者ID:stanfordnlp,項目名稱:phrasal,代碼行數:9,代碼來源:DistortionProbability.java

示例3: isSuspectedDeclarativeSentence

import edu.stanford.nlp.trees.Tree; //導入方法依賴的package包/類
/**
 * Checks for suspected declarative sentences. In recipes, these will
 * be few, but we can safely assume sentences where the first word is
 * a determiner or a pronoun are declarative, as those are hard
 * tags to mislabel.
 * 
 * @param tree Parse tree to investigate
 * @return True if the sentence is suspected to be declarative, False otherwise
 */
private static boolean isSuspectedDeclarativeSentence(Tree tree) {
	List<Label> preleaves = tree.preTerminalYield();
	if (preleaves.get(0).value().equals("DT") || preleaves.get(0).value().startsWith("PR")) {
		return true;
	}
	return false;
}
 
開發者ID:uwnlp,項目名稱:recipe-interpretation,代碼行數:17,代碼來源:RecipeArgParser.java


注:本文中的edu.stanford.nlp.trees.Tree.preTerminalYield方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。