edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation.getSpansMatching()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(69)

本文整理了Java中edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation.getSpansMatching()方法的一些代码示例,展示了TextAnnotation.getSpansMatching()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextAnnotation.getSpansMatching()方法的具体详情如下:
包路径:edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation
类名称:TextAnnotation
方法名:getSpansMatching

TextAnnotation.getSpansMatching介绍

暂无

代码示例

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-edison

private Map<String, List<IntPair>> getMatchingSpans(TextAnnotation ta) {
    Map<String, List<IntPair>> map = new HashMap<>();

    for (Entry<String, List<String>> entry : this.clusterToStrings.entrySet()) {
      String clusterId = entry.getKey();
      List<String> patterns = entry.getValue();

      for (String pattern : patterns) {
        List<IntPair> list = ta.getSpansMatching(pattern);

        if (list.size() > 0) {
          if (!map.containsKey(clusterId))
            map.put(clusterId, new ArrayList<IntPair>());

          map.get(clusterId).addAll(list);
        }
      }

    }
    return map;
  }
}

代码示例来源:origin: CogComp/cogcomp-nlp

private Map<String, List<IntPair>> getMatchingSpans(TextAnnotation ta) {
    Map<String, List<IntPair>> map = new HashMap<>();

    for (Entry<String, List<String>> entry : this.clusterToStrings.entrySet()) {
      String clusterId = entry.getKey();
      List<String> patterns = entry.getValue();

      for (String pattern : patterns) {
        List<IntPair> list = ta.getSpansMatching(pattern);

        if (list.size() > 0) {
          if (!map.containsKey(clusterId))
            map.put(clusterId, new ArrayList<IntPair>());

          map.get(clusterId).addAll(list);
        }
      }

    }
    return map;
  }
}

代码示例来源:origin: CogComp/talen

for(IntPair span : ta.getSpansMatching(context)){
  IntPair nextspan = new IntPair(span.getSecond(), span.getSecond()+1);
  if(span.getSecond() < ta.size()) {
for(IntPair span : ta.getSpansMatching(context)){
  IntPair prevspan = new IntPair(span.getFirst()-1, span.getFirst());
  if(span.getFirst() > 0) {
for(IntPair span : ta.getSpansMatching(surface)){
  Suggestion s = new Suggestion(span, label, String.format("%s for %s, weight: %f", featname, label, patterns.get(feat)));
  suggestions.add(s);

代码示例来源:origin: CogComp/talen

List<IntPair> spans = ta.getSpansMatching(surface);

代码示例来源:origin: CogComp/cogcomp-nlp

for (String pattern : currencies) {
  List<IntPair> list = ta.getSpansMatching(pattern);

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-edison

for (String pattern : currencies) {
  List<IntPair> list = ta.getSpansMatching(pattern);

代码示例来源:origin: CogComp/talen

boolean propagate = true;
if(propagate){
  spans = ta.getSpansMatching(text);

代码示例来源:origin: CogComp/cogcomp-nlp

List<IntPair> startEndPos = ta.getSpansMatching(currStr);
  currSpan = ta.getSpansMatching("2009-2010").get(0);
  charStart = ta.getTokenCharacterOffset(currSpan.getFirst()).getFirst();
  charEnd = ta.getTokenCharacterOffset(currSpan.getFirst()).getSecond()-5;
  currSpan = ta.getSpansMatching("2009-2010").get(0);
  charStart = ta.getTokenCharacterOffset(currSpan.getFirst()).getFirst()+5;
  charEnd = ta.getTokenCharacterOffset(currSpan.getFirst()).getSecond();

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-time

List<IntPair> startEndPos = ta.getSpansMatching(currStr);
  currSpan = ta.getSpansMatching("2009-2010").get(0);
  charStart = ta.getTokenCharacterOffset(currSpan.getFirst()).getFirst();
  charEnd = ta.getTokenCharacterOffset(currSpan.getFirst()).getSecond()-5;
  currSpan = ta.getSpansMatching("2009-2010").get(0);
  charStart = ta.getTokenCharacterOffset(currSpan.getFirst()).getFirst()+5;
  charEnd = ta.getTokenCharacterOffset(currSpan.getFirst()).getSecond();

相关文章