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


Java IntPair.get方法代码示例

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


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

示例1: print

import edu.stanford.nlp.util.IntPair; //导入方法依赖的package包/类
public void print(PrintStream pf) {
  for (int i = 0; i < indexedValues.length; i++) {
    IntPair iP = getPair(indexedValues[i]);
    int x = iP.get(0);
    int y = iP.get(1);
    // int y=indexedValues[i]-x*domain.ySize;
    pf.println(x + ", " + y + ' ' + valuesI[i]);
  }
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:10,代码来源:Feature.java

示例2: extractEnumerations

import edu.stanford.nlp.util.IntPair; //导入方法依赖的package包/类
/** Extract enumerations (A, B, and C) */
protected void extractEnumerations(CoreMap s, List<Mention> mentions, Set<IntPair> mentionSpanSet, Set<IntPair> namedEntitySpanSet){
  List<CoreLabel> sent = s.get(CoreAnnotations.TokensAnnotation.class);
  Tree tree = s.get(TreeCoreAnnotations.TreeAnnotation.class);
  SemanticGraph dependency = s.get(SemanticGraphCoreAnnotations.CollapsedDependenciesAnnotation.class);

  final String mentionPattern = "NP < (/^(?:NP|NNP|NML)/=m1 $.. (/^CC|,/ $.. /^(?:NP|NNP|NML)/=m2))";
  TregexPattern tgrepPattern = TregexPattern.compile(mentionPattern);
  TregexMatcher matcher = tgrepPattern.matcher(tree);
  Map<IntPair, Tree> spanToMentionSubTree = Generics.newHashMap();
  while (matcher.find()) {
    matcher.getMatch();
    Tree m1 = matcher.getNode("m1");
    Tree m2 = matcher.getNode("m2");

    List<Tree> mLeaves = m1.getLeaves();
    int beginIdx = ((CoreLabel)mLeaves.get(0).label()).get(CoreAnnotations.IndexAnnotation.class)-1;
    int endIdx = ((CoreLabel)mLeaves.get(mLeaves.size()-1).label()).get(CoreAnnotations.IndexAnnotation.class);
    spanToMentionSubTree.put(new IntPair(beginIdx, endIdx), m1);

    mLeaves = m2.getLeaves();
    beginIdx = ((CoreLabel)mLeaves.get(0).label()).get(CoreAnnotations.IndexAnnotation.class)-1;
    endIdx = ((CoreLabel)mLeaves.get(mLeaves.size()-1).label()).get(CoreAnnotations.IndexAnnotation.class);
    spanToMentionSubTree.put(new IntPair(beginIdx, endIdx), m2);
  }

  for(IntPair mSpan : spanToMentionSubTree.keySet()){
    if(!mentionSpanSet.contains(mSpan) && !insideNE(mSpan, namedEntitySpanSet)) {
      int mentionID = assignIds? ++maxID:-1;
      Mention m = new Mention(mentionID, mSpan.get(0), mSpan.get(1), dependency,
                              new ArrayList<CoreLabel>(sent.subList(mSpan.get(0), mSpan.get(1))), spanToMentionSubTree.get(mSpan));
      mentions.add(m);
      mentionSpanSet.add(mSpan);
    }
  }
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:37,代码来源:RuleBasedCorefMentionFinder.java

示例3: insideNE

import edu.stanford.nlp.util.IntPair; //导入方法依赖的package包/类
/** Check whether a mention is inside of a named entity */
private static boolean insideNE(IntPair mSpan, Set<IntPair> namedEntitySpanSet) {
  for (IntPair span : namedEntitySpanSet){
    if(span.get(0) <= mSpan.get(0) && mSpan.get(1) <= span.get(1)) return true;
  }
  return false;
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:8,代码来源:RuleBasedCorefMentionFinder.java

示例4: getXInstance

import edu.stanford.nlp.util.IntPair; //导入方法依赖的package包/类
int getXInstance(int index) {
  IntPair iP = getPair(index);
  return iP.get(0);
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:5,代码来源:Feature.java

示例5: getYInstance

import edu.stanford.nlp.util.IntPair; //导入方法依赖的package包/类
int getYInstance(int index) {
  IntPair iP = getPair(index);
  return iP.get(1);
}
 
开发者ID:benblamey,项目名称:stanford-nlp,代码行数:5,代码来源:Feature.java


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