Package gate.util

Examples of gate.util.GateRuntimeException


   * @return
   */
  public static AnnotationSet getLongestAnns(AnnotationSet annset) {
    List<Annotation> anns = new LinkedList<Annotation>();
    if (annset.size() == 0) {
      throw new GateRuntimeException("Annotation set is empty");
    }
    int length = 0;
    for (Annotation a : annset) {
      if (Utils.length(a) > length) {
        length = Utils.length(a);
View Full Code Here


   * @return
   */
  public static AnnotationSet getShortestAnns(AnnotationSet annset) {
    List<Annotation> anns = new LinkedList<Annotation>();
    if (annset.size() == 0) {
      throw new GateRuntimeException("Annotation set is empty");
    }
    int length = Integer.MAX_VALUE;
    for (Annotation a : annset) {
      if (Utils.length(a) < length) {
        length = Utils.length(a);
View Full Code Here

   */
  public static AnnotationSet getAnnsLongerThan(AnnotationSet annset,
      int longerthanthis) {
    List<Annotation> anns = new LinkedList<Annotation>();
    if (annset.size() == 0) {
      throw new GateRuntimeException("Annotation set is empty");
    }
    for (Annotation a : annset) {
      if (Utils.length(a) > longerthanthis) {
        anns.add(a);
      }
View Full Code Here

   */
  public static AnnotationSet getAnnsShorterThan(AnnotationSet annset,
      int shorterthanthis) {
    List<Annotation> anns = new LinkedList<Annotation>();
    if (annset.size() == 0) {
      throw new GateRuntimeException("Annotation set is empty");
    }
    for (Annotation a : annset) {
      if (Utils.length(a) < shorterthanthis) {
        anns.add(a);
      }
View Full Code Here

   * exception if there is not exactly one annotation. This is useful when a
   * binding set is expected to contain exactly one interesting annotation.
   */
  public static Annotation getOnlyAnn(AnnotationSet annset) {
    if (annset.size() != 1) {
      throw new GateRuntimeException(
          "Annotation set does not contain exactly 1 annotation but "
              + annset.size());
    } else {
      return annset.iterator().next();
    }
View Full Code Here

  public static void addAnn(AnnotationSet outSet, AnnotationSet spanSet,
      String type, FeatureMap fm) {
    try {
      outSet.add(startOffsetLong(spanSet), endOffsetLong(spanSet), type, fm);
    } catch (InvalidOffsetException ex) {
      throw new GateRuntimeException("Offset error adding new annotation: ", ex);
    }
  }
View Full Code Here

  public static void addAnn(AnnotationSet outSet, int startOffset, int endOffset,
      String type, FeatureMap fm) {
    try {
      outSet.add((long)startOffset, (long)endOffset, type, fm);
    } catch (InvalidOffsetException ex) {
      throw new GateRuntimeException("Offset error adding new annotation: ", ex);
    }
  }
View Full Code Here

    try {
      FeatureMap fm = Factory.newFeatureMap();
      fm.putAll(copyFeaturesFrom.getFeatures());
      outSet.add(startOffsetLong(spanSet), endOffsetLong(spanSet), type, fm);
    } catch (InvalidOffsetException ex) {
      throw new GateRuntimeException("Offset error adding new annotation: ", ex);
    }
  }
View Full Code Here

  public static void addAnn(AnnotationSet outSet, Annotation spanAnn,
      String type, FeatureMap fm) {
    try {
      outSet.add(startOffsetLong(spanAnn), endOffsetLong(spanAnn), type, fm);
    } catch (InvalidOffsetException ex) {
      throw new GateRuntimeException("Offset error adding new annotation: ", ex);
    }
  }
View Full Code Here

    try {
      FeatureMap fm = Factory.newFeatureMap();
      fm.putAll(ann.getFeatures());
      outSet.add(startOffsetLong(ann), endOffsetLong(ann), ann.getType(), fm);
    } catch (InvalidOffsetException ex) {
      throw new GateRuntimeException("Offset error adding new annotation: ", ex);
    }
  }
View Full Code Here

TOP

Related Classes of gate.util.GateRuntimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.