• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LabelFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: transformQP

import edu.stanford.nlp.ling.LabelFactory; //导入依赖的package包/类
private static void transformQP(Tree t) {
  List<Tree> children = t.getChildrenAsList();
  TreeFactory tf = t.treeFactory();
  LabelFactory lf = t.label().labelFactory();

  //create the new XS having the first two children of the QP
  Tree left = tf.newTreeNode(lf.newLabel("XS"), null);
  for (int i = 0; i < 2; i++) {
    left.addChild(children.get(i));
  }

  // remove all the two first children of t before
  for (int i = 0; i < 2; i++) {
    t.removeChild(0);
  }

  // add XS as the first child
  t.addChild(0, left);
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:20,代码来源:QPTreeTransformer.java


示例2: 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


示例3: 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


示例4: labelFactory

import edu.stanford.nlp.ling.LabelFactory; //导入依赖的package包/类
/**
 * Returns a factory that makes labels of the same type as this one.
 * May return <code>null</code> if no appropriate factory is known.
 *
 * @return the LabelFactory for this kind of label
 */
public LabelFactory labelFactory() {
  Label lab = label();
  if (lab == null) {
    return null;
  }
  return lab.labelFactory();
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:14,代码来源:Tree.java


示例5: transformCC

import edu.stanford.nlp.ling.LabelFactory; //导入依赖的package包/类
private static void transformCC(Tree t, List<Tree> left, Tree conj, List<Tree> right) {
  TreeFactory tf = t.treeFactory();
  LabelFactory lf = t.label().labelFactory();
  Tree leftQP = tf.newTreeNode(lf.newLabel("NP"), left);
  Tree rightQP = tf.newTreeNode(lf.newLabel("NP"), right);
  List<Tree> newChildren = new ArrayList<Tree>();
  newChildren.add(leftQP);
  newChildren.add(conj);
  newChildren.add(rightQP);
  t.setChildren(newChildren);
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:12,代码来源:QPTreeTransformer.java


示例6: labelFactory

import edu.stanford.nlp.ling.LabelFactory; //导入依赖的package包/类
/**
 * Returns a factory that makes labels of the same type as this one.
 * May return <code>null</code> if no appropriate factory is known.
 *
 * @return the LabelFactory for this kind of label
 */
@Override
public LabelFactory labelFactory() {
  Label lab = label();
  if (lab == null) {
    return null;
  }
  return lab.labelFactory();
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:15,代码来源:Tree.java


示例7: labelFactory

import edu.stanford.nlp.ling.LabelFactory; //导入依赖的package包/类
@Override
public LabelFactory labelFactory() {
  return OffsetLabelFactory.instance();
}
 
开发者ID:leebird,项目名称:legonlp,代码行数:5,代码来源:OffsetTree.java


示例8: Debinarizer

import edu.stanford.nlp.ling.LabelFactory; //导入依赖的package包/类
public Debinarizer(boolean forceCNF, LabelFactory lf) {
  this.forceCNF = forceCNF;
  tf = new LabeledScoredTreeFactory(lf);
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:5,代码来源:Debinarizer.java


示例9: labelFactory

import edu.stanford.nlp.ling.LabelFactory; //导入依赖的package包/类
@Override
public LabelFactory labelFactory() {
  return new NegraLabelFactory();
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:5,代码来源:NegraLabel.java


示例10: TreeGraphNodeFactory

import edu.stanford.nlp.ling.LabelFactory; //导入依赖的package包/类
public TreeGraphNodeFactory(LabelFactory mlf) {
  this.mlf = mlf;
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:4,代码来源:TreeGraphNodeFactory.java


示例11: LabeledScoredTreeReaderFactory

import edu.stanford.nlp.ling.LabelFactory; //导入依赖的package包/类
public LabeledScoredTreeReaderFactory(LabelFactory lf) {
  this.lf = lf;
  tm = new BobChrisTreeNormalizer();
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:5,代码来源:LabeledScoredTreeReaderFactory.java


示例12: Debinarizer

import edu.stanford.nlp.ling.LabelFactory; //导入依赖的package包/类
public Debinarizer(boolean forceCNF, LabelFactory lf) {
  this.forceCNF = forceCNF;
  tf = new LabeledScoredTreeFactory(lf);
  boundaryRemover = new BoundaryRemover();
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:6,代码来源:Debinarizer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Operation类代码示例发布时间:2022-05-23
下一篇:
Java ServiceInstanceExistsException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap