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


Java IntTuple.get方法代码示例

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


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

示例1: printLink

import edu.stanford.nlp.util.IntTuple; //导入方法依赖的package包/类
/** Print coref link info */
private static void printLink(Logger logger, String header, IntTuple src, IntTuple dst, List<List<Mention>> orderedMentionsBySentence) {
  Mention srcMention = orderedMentionsBySentence.get(src.get(0)).get(src.get(1));
  Mention dstMention = orderedMentionsBySentence.get(dst.get(0)).get(dst.get(1));
  if(src.get(0)==dst.get(0)) {
    logger.fine(header + ": ["+srcMention.spanToString()+"](id="+srcMention.mentionID
        +") in sent #"+src.get(0)+" => ["+dstMention.spanToString()+"](id="+dstMention.mentionID+") in sent #"+dst.get(0) + " Same Sentence");
  } else {
    logger.fine(header + ": ["+srcMention.spanToString()+"](id="+srcMention.mentionID
        +") in sent #"+src.get(0)+" => ["+dstMention.spanToString()+"](id="+dstMention.mentionID+") in sent #"+dst.get(0));
  }
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:13,代码来源:SieveCoreferenceSystem.java

示例2: printLogs

import edu.stanford.nlp.util.IntTuple; //导入方法依赖的package包/类
/** Print pass results */
private static void printLogs(CorefCluster c1, CorefCluster c2, Mention m1,
    Mention m2, Document document, int sieveIndex) {
  Map<Mention, IntTuple> positions = document.positions;
  List<List<Mention>> orderedMentionsBySentence = document.getOrderedMentions();
  List<Pair<IntTuple, IntTuple>> goldLinks = document.getGoldLinks();

  IntTuple p1 = positions.get(m1);
  assert(p1 != null);
  IntTuple p2 = positions.get(m2);
  assert(p2 != null);

  int menDist = 0;
  for (int i = p2.get(0) ; i<= p1.get(0) ; i++){
    if(p1.get(0)==p2.get(0)) {
      menDist = p1.get(1)-p2.get(1);
      break;
    }
    if(i==p2.get(0)) {
      menDist += orderedMentionsBySentence.get(p2.get(0)).size()-p2.get(1);
      continue;
    }
    if(i==p1.get(0)) {
      menDist += p1.get(1);
      continue;
    }
    if(p2.get(0)<i && i < p1.get(0)) menDist += orderedMentionsBySentence.get(i).size();
  }
  String correct = (goldLinks.contains(new Pair<IntTuple, IntTuple>(p1,p2)))? "\tCorrect" : "\tIncorrect";
  logger.finest("\nsentence distance: "+(p1.get(0)-p2.get(0))+"\tmention distance: "+menDist + correct);

  if(!goldLinks.contains(new Pair<IntTuple,IntTuple>(p1,p2))){
    logger.finer("-------Incorrect merge in pass"+sieveIndex+"::--------------------");
    c1.printCorefCluster(logger);
    logger.finer("--------------------------------------------");
    c2.printCorefCluster(logger);
    logger.finer("--------------------------------------------");
  }
  logger.finer("antecedent: "+m2.spanToString()+"("+m2.mentionID+")\tmention: "+m1.spanToString()+"("+m1.mentionID+")\tsentDistance: "+Math.abs(m1.sentNum-m2.sentNum)+"\t"+correct+" Pass"+sieveIndex+":");
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:41,代码来源:SieveCoreferenceSystem.java


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