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


Java Tsurgeon.processPatternsOnTree方法代码示例

本文整理汇总了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;
  }
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:27,代码来源:CoordinationTransformer.java

示例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;
  }
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:30,代码来源:CoordinationTransformer.java

示例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);
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:6,代码来源:DependencyTreeTransformer.java

示例4: visitTree

import edu.stanford.nlp.trees.tregex.tsurgeon.Tsurgeon; //导入方法依赖的package包/类
public void visitTree(Tree t) {
  Tsurgeon.processPatternsOnTree(ops, t);
}
 
开发者ID:amark-india,项目名称:eventspotter,代码行数:4,代码来源:MWETreeVisitor.java

示例5: transformTree

import edu.stanford.nlp.trees.tregex.tsurgeon.Tsurgeon; //导入方法依赖的package包/类
public Tree transformTree(Tree t) {
  return Tsurgeon.processPatternsOnTree(ops, t);
}
 
开发者ID:amark-india,项目名称:eventspotter,代码行数:4,代码来源:ATBCorrector.java


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