本文整理汇总了Java中edu.stanford.nlp.trees.tregex.tsurgeon.Tsurgeon.processPatternsOnTree方法的典型用法代码示例。如果您正苦于以下问题:Java Tsurgeon.processPatternsOnTree方法的具体用法?Java Tsurgeon.processPatternsOnTree怎么用?Java Tsurgeon.processPatternsOnTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.stanford.nlp.trees.tregex.tsurgeon.Tsurgeon
的用法示例。
在下文中一共展示了Tsurgeon.processPatternsOnTree方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: UCPtransform
import edu.stanford.nlp.trees.tregex.tsurgeon.Tsurgeon; //导入方法依赖的package包/类
/**
* Transforms t if it contains an UCP, it will change the UCP tag
* into the phrasal tag of the first word of the UCP
* (UCP (JJ electronic) (, ,) (NN computer) (CC and) (NN building))
* will become
* (ADJP (JJ electronic) (, ,) (NN computer) (CC and) (NN building))
*
* @param t a tree to be transformed
* @return t transformed
*/
public static Tree UCPtransform(Tree t) {
Tree firstChild = t.firstChild();
if (firstChild != null) {
List<Pair<TregexPattern,TsurgeonPattern>> ops = Generics.newArrayList();
for (int i = 0; i < operations.length; i++) {
for (TregexPattern pattern : matchPatterns[i]) {
ops.add(Generics.newPair(pattern, operations[i]));
}
}
return Tsurgeon.processPatternsOnTree(ops, t);
} else {
return t;
}
}
示例2: UCPtransform
import edu.stanford.nlp.trees.tregex.tsurgeon.Tsurgeon; //导入方法依赖的package包/类
/**
* Transforms t if it contains an UCP, it will change the UCP tag
* into the phrasal tag of the first word of the UCP
* (UCP (JJ electronic) (, ,) (NN computer) (CC and) (NN building))
* will become
* (ADJP (JJ electronic) (, ,) (NN computer) (CC and) (NN building))
*
* @param t a tree to be transformed
* @return t transformed
*/
public static Tree UCPtransform(Tree t) {
if (t == null) {
return null;
}
Tree firstChild = t.firstChild();
if (firstChild != null) {
List<Pair<TregexPattern,TsurgeonPattern>> ops = Generics.newArrayList();
for (int i = 0; i < operations.length; i++) {
for (TregexPattern pattern : matchPatterns[i]) {
ops.add(Generics.newPair(pattern, operations[i]));
}
}
return Tsurgeon.processPatternsOnTree(ops, t);
} else {
return t;
}
}
示例3: stripEmptyNode
import edu.stanford.nlp.trees.tregex.tsurgeon.Tsurgeon; //导入方法依赖的package包/类
protected static Tree stripEmptyNode(Tree t) {
List<Pair<TregexPattern, TsurgeonPattern>> ops = Generics.newArrayList();
ops.add(Generics.newPair(matchPattern, operation));
return Tsurgeon.processPatternsOnTree(ops, t);
}
示例4: visitTree
import edu.stanford.nlp.trees.tregex.tsurgeon.Tsurgeon; //导入方法依赖的package包/类
public void visitTree(Tree t) {
Tsurgeon.processPatternsOnTree(ops, t);
}
示例5: transformTree
import edu.stanford.nlp.trees.tregex.tsurgeon.Tsurgeon; //导入方法依赖的package包/类
public Tree transformTree(Tree t) {
return Tsurgeon.processPatternsOnTree(ops, t);
}