本文整理汇总了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;
}
示例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();
}
示例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;
}