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

Java TreeTransformer类代码示例

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

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



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

示例1: TaggedFileRecord

import edu.stanford.nlp.trees.TreeTransformer; //导入依赖的package包/类
private TaggedFileRecord(String file, Format format, 
                         String encoding, String tagSeparator,
                         TreeTransformer treeTransformer,
                         TreeNormalizer treeNormalizer,
                         NumberRangesFileFilter treeRange,
                         Filter<Tree> treeFilter,
                         Integer wordColumn, Integer tagColumn) {
  this.file = file;
  this.format = format;
  this.encoding = encoding;
  this.tagSeparator = tagSeparator;
  this.treeTransformer = treeTransformer;
  this.treeNormalizer = treeNormalizer;
  this.treeRange = treeRange;
  this.treeFilter = treeFilter;
  this.wordColumn = wordColumn;
  this.tagColumn = tagColumn;
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:19,代码来源:TaggedFileRecord.java


示例2: TaggedFileRecord

import edu.stanford.nlp.trees.TreeTransformer; //导入依赖的package包/类
private TaggedFileRecord(String file, Format format,
                         String encoding, String tagSeparator,
                         TreeTransformer treeTransformer,
                         TreeNormalizer treeNormalizer,
                         NumberRangesFileFilter treeRange,
                         Filter<Tree> treeFilter,
                         Integer wordColumn, Integer tagColumn) {
  this.file = file;
  this.format = format;
  this.encoding = encoding;
  this.tagSeparator = tagSeparator;
  this.treeTransformer = treeTransformer;
  this.treeNormalizer = treeNormalizer;
  this.treeRange = treeRange;
  this.treeFilter = treeFilter;
  this.wordColumn = wordColumn;
  this.tagColumn = tagColumn;
}
 
开发者ID:jaimeguzman,项目名称:data_mining,代码行数:19,代码来源:TaggedFileRecord.java


示例3: CTBErrorCorrectingTreeNormalizer

import edu.stanford.nlp.trees.TreeTransformer; //导入依赖的package包/类
/**
 * Build a CTBErrorCorrectingTreeNormalizer.
 *
 * @param splitNPTMP Temporal annotation on NPs
 * @param splitPPTMP Temporal annotation on PPs
 * @param splitXPTMP Temporal annotation on any phrase marked in CTB
 * @param charTags Whether you wish to push POS tags down on to the
 *           characters of a word (for unsegmented text)
 */
public CTBErrorCorrectingTreeNormalizer(boolean splitNPTMP, boolean splitPPTMP, boolean splitXPTMP, boolean charTags) {
  this.splitNPTMP = splitNPTMP;
  this.splitPPTMP = splitPPTMP;
  this.splitXPTMP = splitXPTMP;
  if (charTags) {
    try {
      tagExtender = (TreeTransformer) Class.forName("edu.stanford.nlp.trees.international.pennchinese.CharacterLevelTagExtender").newInstance();
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:22,代码来源:CTBErrorCorrectingTreeNormalizer.java


示例4: collinizer

import edu.stanford.nlp.trees.TreeTransformer; //导入依赖的package包/类
/**
 * returns a NegraPennCollinizer
 */
@Override
public TreeTransformer collinizer() {
  return new NegraPennCollinizer(this);
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:8,代码来源:NegraPennTreebankParserParams.java


示例5: collinizerEvalb

import edu.stanford.nlp.trees.TreeTransformer; //导入依赖的package包/类
/**
 * returns a NegraPennCollinizer
 */
@Override
public TreeTransformer collinizerEvalb() {
  return new NegraPennCollinizer(this, false);
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:8,代码来源:NegraPennTreebankParserParams.java


示例6: NodePruner

import edu.stanford.nlp.trees.TreeTransformer; //导入依赖的package包/类
public NodePruner(ExhaustivePCFGParser parser, TreeTransformer debinarizer) {
  this.parser = parser;
  this.debinarizer = debinarizer;
}
 
开发者ID:FabianFriedrich,项目名称:Text2Process,代码行数:5,代码来源:NodePruner.java


示例7: main

import edu.stanford.nlp.trees.TreeTransformer; //导入依赖的package包/类
/**
 * Execute with no arguments for usage.
 */
public static void main(String[] args) {

  if(!validateCommandLine(args)) {
    System.err.println(usage);
    System.exit(-1);
  }

  final TreebankLangParserParams tlpp = Languages.getLanguageParams(LANGUAGE);
  final PrintWriter pwOut = tlpp.pw();

  final Treebank guessTreebank = tlpp.diskTreebank();
  guessTreebank.loadPath(guessFile);
  pwOut.println("GUESS TREEBANK:");
  pwOut.println(guessTreebank.textualSummary());

  final Treebank goldTreebank = tlpp.diskTreebank();
  goldTreebank.loadPath(goldFile);
  pwOut.println("GOLD TREEBANK:");
  pwOut.println(goldTreebank.textualSummary());

  final LeafAncestorEval metric = new LeafAncestorEval("LeafAncestor");

  final TreeTransformer tc = tlpp.collinizer();

  //The evalb ref implementation assigns status for each tree pair as follows:
  //
  //   0 - Ok (yields match)
  //   1 - length mismatch
  //   2 - null parse e.g. (()).
  //
  //In the cases of 1,2, evalb does not include the tree pair in the LP/LR computation.
  final Iterator<Tree> goldItr = goldTreebank.iterator();
  final Iterator<Tree> guessItr = guessTreebank.iterator();
  int goldLineId = 0;
  int guessLineId = 0;
  int skippedGuessTrees = 0;
  while( guessItr.hasNext() && goldItr.hasNext() ) {
    Tree guessTree = guessItr.next();
    List<Label> guessYield = guessTree.yield();
    guessLineId++;

    Tree goldTree = goldItr.next();
    List<Label> goldYield = goldTree.yield();
    goldLineId++;

    // Check that we should evaluate this tree
    if(goldYield.size() > MAX_GOLD_YIELD) {
      skippedGuessTrees++;
      continue;
    }

    // Only trees with equal yields can be evaluated
    if(goldYield.size() != guessYield.size()) {
      pwOut.printf("Yield mismatch gold: %d tokens vs. guess: %d tokens (lines: gold %d guess %d)%n", goldYield.size(), guessYield.size(), goldLineId, guessLineId);
      skippedGuessTrees++;
      continue;
    }
    
    final Tree evalGuess = tc.transformTree(guessTree);
    final Tree evalGold = tc.transformTree(goldTree);

    metric.evaluate(evalGuess, evalGold, ((VERBOSE) ? pwOut : null));
  }
  
  if(guessItr.hasNext() || goldItr.hasNext()) {
    System.err.printf("Guess/gold files do not have equal lengths (guess: %d gold: %d)%n.", guessLineId, goldLineId);
  }
  
  pwOut.println("================================================================================");
  if(skippedGuessTrees != 0) pwOut.printf("%s %d guess trees\n", "Unable to evaluate", skippedGuessTrees);
  metric.display(true, pwOut);
  pwOut.close();
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:77,代码来源:LeafAncestorEval.java


示例8: collinizer

import edu.stanford.nlp.trees.TreeTransformer; //导入依赖的package包/类
@Override
public TreeTransformer collinizer() {
  return new TreeCollinizer(treebankLanguagePack());
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:5,代码来源:FrenchTreebankParserParams.java


示例9: collinizerEvalb

import edu.stanford.nlp.trees.TreeTransformer; //导入依赖的package包/类
@Override
public TreeTransformer collinizerEvalb() {
  return new TreeCollinizer(treebankLanguagePack(),collinizerRetainsPunctuation,false);
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:5,代码来源:FrenchTreebankParserParams.java


示例10: collinizer

import edu.stanford.nlp.trees.TreeTransformer; //导入依赖的package包/类
@Override
public TreeTransformer collinizer() {
  return new TreeCollinizer(tlp, true, false);
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:5,代码来源:HebrewTreebankParserParams.java


示例11: collinizerEvalb

import edu.stanford.nlp.trees.TreeTransformer; //导入依赖的package包/类
/**
 * Stand-in collinizer does nothing to the tree.
 */
@Override
public TreeTransformer collinizerEvalb() {
  return collinizer();
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:8,代码来源:HebrewTreebankParserParams.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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