当前位置: 首页>>代码示例>>Java>>正文


Java Trees.spliceNodes方法代码示例

本文整理汇总了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;
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:17,代码来源:TreeAnnotations.java

示例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;
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:20,代码来源:TreeAnnotations.java

示例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");
	}

}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:24,代码来源:GermanSharedTask.java

示例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;
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:15,代码来源:TreeAnnotations.java


注:本文中的edu.berkeley.nlp.syntax.Trees.spliceNodes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。