org.apache.uima.jcas.tcas.Annotation.getEnd()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(117)

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

Annotation.getEnd介绍

暂无

代码示例

代码示例来源:origin: org.apache.ctakes/ctakes-relation-extractor

private static boolean hasOverlap(Annotation event1, Annotation event2) {
  if(event1.getEnd()>=event2.getBegin()&&event1.getEnd()<=event2.getEnd()){
    return true;
  }
  if(event2.getEnd()>=event1.getBegin()&&event2.getEnd()<=event1.getEnd()){
    return true;
  }
  return false;
}

代码示例来源:origin: org.apache.ctakes/ctakes-relation-extractor

private static boolean hasOverlap(Annotation event1, Annotation event2) {
  if(event1.getEnd()>=event2.getBegin()&&event1.getEnd()<=event2.getEnd()){
    return true;
  }
  if(event2.getEnd()>=event1.getBegin()&&event2.getEnd()<=event1.getEnd()){
    return true;
  }
  return false;
}

代码示例来源:origin: org.apache.uima/uimaj-tools

/**
 * Gets the end.
 *
 * @return the end
 */
public int getEnd() {
 return isAnnotation() ? ((Annotation)fs).getEnd() : -1;
}

代码示例来源:origin: org.cleartk/cleartk-util

public static int[] getAnnotationsExtent(List<? extends Annotation> annotations) {
  int start = Integer.MAX_VALUE;
  int end = 0;

  for (Annotation annotation : annotations) {
   if (annotation.getBegin() < start)
    start = annotation.getBegin();
   if (annotation.getEnd() > end)
    end = annotation.getEnd();
  }

  return new int[] { start, end };
 }
}

代码示例来源:origin: org.cleartk/cleartk-util

public static boolean contains(Annotation bigAnnotation, Annotation smallAnnotation) {
 if (bigAnnotation == null || smallAnnotation == null)
  return false;
 if (bigAnnotation.getBegin() <= smallAnnotation.getBegin()
   && bigAnnotation.getEnd() >= smallAnnotation.getEnd())
  return true;
 else
  return false;
}

代码示例来源:origin: org.cleartk/cleartk-util

public int compare(T o1, T o2) {
  if (o1.getBegin() != o2.getBegin())
   return o1.getBegin() < o2.getBegin() ? -1 : 1;
  else if (o1.getEnd() != o2.getEnd())
   return o1.getEnd() < o2.getEnd() ? -1 : 1;
  return 0;
 }
});

代码示例来源:origin: uk.gov.dstl.baleen/baleen-uima

/**
  * Overlaps.
  *
  * @param a the a
  * @param b the b
  * @return true, if successful
  */
 public static boolean overlaps(Annotation a, Annotation b) {
  return !(a.getEnd() < b.getBegin() || b.getEnd() < a.getBegin());
 }
}

代码示例来源:origin: de.unistuttgart.ims/uimautil

public int compare(Annotation o1, Annotation o2) {
  if (useEnd)
    return Integer.compare(o1.getEnd(), o2.getEnd());
  return Integer.compare(o1.getBegin(), o2.getBegin());
}

代码示例来源:origin: org.apache.ctakes/ctakes-coreference

public static int countPoint (Collection<? extends Annotation> c, int b, int e) {
    //TODO: substitute hard-coded boundaries to flexible conditions
    int ret = 0;
    for (Annotation a : c) {
      int begin = a.getBegin();
      int end = a.getEnd();
      if (begin<end && begin>b && begin<=e) ++ret;
    }
    return ret;
  }
}

代码示例来源:origin: org.apache.ctakes/ctakes-coreference

public static int countInterval (Collection<? extends Annotation> c, int b, int e) {
  //TODO: substitute hard-coded boundaries to flexible conditions
  int ret = 0;
  for (Annotation a : c)
    if (a.getBegin()>b && a.getEnd()<e) ++ret;
  return ret;
}

代码示例来源:origin: org.apache.ctakes/ctakes-coreference

public int compare (Annotation a1, Annotation a2) {
    int ret = a1.getBegin() - a2.getBegin();
    return ret==0 ? a1.getEnd()-a2.getEnd() : ret;
  }
}

代码示例来源:origin: org.apache.ctakes/ctakes-core

static String format(Annotation ann) {
 String result;
 if (ann.getEnd() == Integer.MIN_VALUE || ann.getBegin() == Integer.MAX_VALUE) {
  result = "<no-spanned-text>";
 } else {
  result = String.format("\"%s\"[%d,%d]", ann.getCoveredText(), ann.getBegin(), ann.getEnd());
 }
 return String.format("%s(%s)", ann.getClass().getSimpleName(), result);
}

代码示例来源:origin: org.apache.ctakes/ctakes-assertion

static String format(Annotation ann) {
 String result;
 if (ann.getEnd() == Integer.MIN_VALUE || ann.getBegin() == Integer.MAX_VALUE) {
  result = "<no-spanned-text>";
 } else {
  result = String.format("\"%s\"[%d,%d]", ann.getCoveredText(), ann.getBegin(), ann.getEnd());
 }
 return String.format("%s(%s)", ann.getClass().getSimpleName(), result);
}

代码示例来源:origin: de.julielab/jcore-jnet-ae

@Override
public int compare(Annotation o1, Annotation o2) {
  if (o1.getBegin() == o2.getBegin() && o1.getEnd() == o2.getEnd())
    return 0;
  else if (o1.getBegin() - o2.getBegin() == 0)
    return o1.getEnd() - o2.getEnd();
  return o1.getBegin() - o2.getBegin();
}

代码示例来源:origin: org.apache.ctakes/ctakes-dependency-parser

/** Checks if one annotation subsumes another */
public static boolean doesSubsume(Annotation annot1,Annotation annot2) {
  if (annot1==null || annot2==null) 
    return false;
  return annot1.getBegin()<=annot2.getBegin() && 
    annot1.getEnd()>=annot2.getEnd() && 
    annot1.getCoveredText().contains(annot2.getCoveredText());
}

代码示例来源:origin: org.apache.ctakes/ctakes-dependency-parser

/** Equality expressions to aid in converting between DepNodes and CAS objects */
public static boolean equalCoverage(Annotation annot1,Annotation annot2) {
  if (annot1==null || annot2==null) 
    return false;
  return annot1.getBegin()==annot2.getBegin() && 
    annot1.getEnd()==annot2.getEnd() && 
    annot1.getCoveredText().equals(annot2.getCoveredText());
}

代码示例来源:origin: edu.utah.bmi.nlp/nlp-core

private Annotation hasAnnotation(JCas jCas, Class evidenceType, Annotation scopeAnnotation) {
  if (evidenceAnnotationTree.get(evidenceType) == null) {
    return null;
  }
  Annotation res = evidenceAnnotationTree.get(evidenceType).get(new Interval1D(scopeAnnotation.getBegin(), scopeAnnotation.getEnd()));
  return res;
}

代码示例来源:origin: edu.utah.bmi.nlp/nlp-core

public static IntervalST<Annotation> indexAnnotation(JCas jcas, Class<? extends Annotation> type) {
    Iterator<? extends Annotation> annotationIter = JCasUtil.iterator(jcas, type);
    IntervalST<Annotation> index = new IntervalST<>();
    while (annotationIter.hasNext()) {
      Annotation annotation = type.cast(annotationIter.next());
//           assume there is no overlapping annotations
      index.put(new Interval1D(annotation.getBegin(), annotation.getEnd()), annotation);
    }
    return index;
  }

代码示例来源:origin: edu.utah.bmi.nlp/nlp-core

private void indexAnnotations(JCas jCas) {
  for (Class conceptType : evidenceAnnotationTree.keySet()) {
    FSIndex annoIndex = jCas.getAnnotationIndex(conceptType);
    Iterator annoIter = annoIndex.iterator();
    IntervalST<Annotation> intervalST = new IntervalST<>();
    while (annoIter.hasNext()) {
      Annotation anno = (Annotation) annoIter.next();
      intervalST.put(new Interval1D(anno.getBegin(), anno.getEnd()), anno);
    }
    evidenceAnnotationTree.put(conceptType, intervalST);
  }
}

代码示例来源:origin: org.dkpro.argumentation/dkpro-argumentation-io

@Override
public ImmutableSpanTextLabel apply(final Annotation annotation)
{
  final ImmutableSpan span = new ImmutableSpan(annotation.getBegin(), annotation.getEnd());
  final ImmutableSpanText spanText = new ImmutableSpanText(span, annotation.getCoveredText());
  final Map<Attribute, Object> attrs = createAttrMap(annotation);
  return new ImmutableSpanTextLabel(spanText, annotation.getType().getShortName(), attrs);
}

相关文章