本文整理汇总了Java中edu.berkeley.nlp.syntax.Trees.spliceNodes方法的典型用法代码示例。如果您正苦于以下问题:Java Trees.spliceNodes方法的具体用法?Java Trees.spliceNodes怎么用?Java Trees.spliceNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.berkeley.nlp.syntax.Trees
的用法示例。
在下文中一共展示了Trees.spliceNodes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unAnnotateTreeSpecial
import edu.berkeley.nlp.syntax.Trees; //导入方法依赖的package包/类
public static Tree<String> unAnnotateTreeSpecial(Tree<String> annotatedTree) {
// Remove intermediate nodes (labels beginning with "Y"
// Remove all material on node labels which follow their base symbol
// (cuts at the leftmost -, ^, or : character)
// Examples: a node with label @NP->DT_JJ will be spliced out, and a
// node with label NP^S will be reduced to NP
Tree<String> debinarizedTree = Trees.spliceNodes(annotatedTree,
new Filter<String>() {
public boolean accept(String s) {
return s.startsWith("Y");
}
});
Tree<String> unAnnotatedTree = (new Trees.FunctionNodeStripper())
.transformTree(debinarizedTree);
return unAnnotatedTree;
}
示例2: unAnnotateTree
import edu.berkeley.nlp.syntax.Trees; //导入方法依赖的package包/类
public static Tree<String> unAnnotateTree(Tree<String> annotatedTree,
boolean keepFunctionLabel) {
// Remove intermediate nodes (labels beginning with "@"
// Remove all material on node labels which follow their base symbol
// (cuts at the leftmost -, ^, or : character)
// Examples: a node with label @NP->DT_JJ will be spliced out, and a
// node with label NP^S will be reduced to NP
Tree<String> debinarizedTree = Trees.spliceNodes(annotatedTree,
new Filter<String>() {
public boolean accept(String s) {
return s.startsWith("@") && !s.equals("@");
}
});
if (keepFunctionLabel)
return debinarizedTree;
Tree<String> unAnnotatedTree = (new Trees.FunctionNodeStripper())
.transformTree(debinarizedTree);
return unAnnotatedTree;
}
示例3: labelTrees
import edu.berkeley.nlp.syntax.Trees; //导入方法依赖的package包/类
private void labelTrees(Grammar grammar, List<Tree<String>> trainTrees,
List<List<String>> goldPOStags) {
List<Tree<String>> trainTreesNoGF = stripOffGF(trainTrees);
StateSetTreeList stateSetTrees = new StateSetTreeList(trainTreesNoGF,
grammar.numSubStates, false, tagNumberer);
int index = 0;
for (Tree<StateSet> stateSetTree : stateSetTrees) {
List<String> goldPOS = goldPOStags.get(index++);
Tree<String> labeledTree = guessGF(stateSetTree, grammar, goldPOS);
Tree<String> debinarizedTree = Trees.spliceNodes(labeledTree,
new Filter<String>() {
public boolean accept(String s) {
return s.startsWith("@");
}
});
System.out.println(debinarizedTree + "\n");
}
}
示例4: debinarizeTree
import edu.berkeley.nlp.syntax.Trees; //导入方法依赖的package包/类
public static Tree<String> debinarizeTree(Tree<String> annotatedTree) {
// Remove intermediate nodes (labels beginning with "@"
// Remove all material on node labels which follow their base symbol
// (cuts at the leftmost -, ^, or : character)
// Examples: a node with label @NP->DT_JJ will be spliced out, and a
// node with label NP^S will be reduced to NP
Tree<String> debinarizedTree = Trees.spliceNodes(annotatedTree,
new Filter<String>() {
public boolean accept(String s) {
return s.startsWith("@") && !s.equals("@");
}
});
return debinarizedTree;
}