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


Java LabelFactory.newLabel方法代码示例

本文整理汇总了Java中edu.stanford.nlp.ling.LabelFactory.newLabel方法的典型用法代码示例。如果您正苦于以下问题:Java LabelFactory.newLabel方法的具体用法?Java LabelFactory.newLabel怎么用?Java LabelFactory.newLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.stanford.nlp.ling.LabelFactory的用法示例。


在下文中一共展示了LabelFactory.newLabel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deepCopy

import edu.stanford.nlp.ling.LabelFactory; //导入方法依赖的package包/类
/**
 * Makes a deep copy of not only the Tree structure but of the labels as well.
 * Each tree is copied with the given TreeFactory.
 * Each Label is copied using the given LabelFactory.
 * That is, the tree and label factories can transform the nature of the
 * data representation.
 *
 * @param tf The TreeFactory used to make all nodes in the copied
 *           tree structure
 * @param lf The LabelFactory used to make all nodes in the copied
 *           tree structure
 * @return A Tree that is a deep copy of the tree structure and
 *         Labels of the original tree.
 */

@SuppressWarnings({"unchecked"})
public Tree deepCopy(TreeFactory tf, LabelFactory lf) {
  Label label = lf.newLabel(label());
  if (isLeaf()) {
    return tf.newLeaf(label);
  }
  Tree[] kids = children();
  // NB: The below list may not be of type Tree but TreeGraphNode, so we leave it untyped
  List newKids = new ArrayList(kids.length);
  for (Tree kid : kids) {
    newKids.add(kid.deepCopy(tf, lf));
  }
  return tf.newTreeNode(label, newKids);
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:30,代码来源:Tree.java

示例2: deeperCopy

import edu.stanford.nlp.ling.LabelFactory; //导入方法依赖的package包/类
/**
 * Same as deepCopy but will copy the labels over as well.
 * Each tree is copied with the given TreeFactory.
 * Each Label is copied using the given LabelFactory.
 *
 * @param tf The TreeFactory used to make all nodes in the copied
 *           tree structure
 * @param lf The LabelFactory used to make all nodes in the copied
 *           tree structure
 * @return A Tree that is a deep copy of the tree structure and
 *         Labels of the original tree.
 */
public Tree deeperCopy(TreeFactory tf, LabelFactory lf) {
  Label label = lf.newLabel(label());
  if (isLeaf()) {
    return tf.newLeaf(label);
  }
  Tree[] kids = children();
  // NB: The below list may not be of type Tree but TreeGraphNode, so we leave it untyped
  List newKids = new ArrayList(kids.length);
  for (Tree kid : kids) {
    newKids.add(kid.deeperCopy(tf, lf));
  }
  return tf.newTreeNode(label, newKids);
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:26,代码来源:Tree.java


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