当前位置: 首页>>代码示例>>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;未经允许,请勿转载。