Package gate

Examples of gate.Annotation


      String featurename) {
    AnnotationSet toSet = getAnnsForType(getBindings(bindings, toBindings),
        toType);
    AnnotationSet fromSet = getAnnsForType(getBindings(bindings, fromBindings),
        fromType);
    Annotation toAnn = getLongestAnn(toSet);
    Annotation fromAnn = getLongestAnn(fromSet);
    FeatureMap toFm = toAnn.getFeatures();
    FeatureMap fromFm = fromAnn.getFeatures();
    toFm.put(featurename, fromFm.get(featurename));
  }
View Full Code Here


   */
  public static void copyFeature(Map<String, AnnotationSet> bindings,
      String fromBindings, String fromType, Annotation toAnn, String featurename) {
    AnnotationSet fromSet = getAnnsForType(getBindings(bindings, fromBindings),
        fromType);
    Annotation fromAnn = getLongestAnn(fromSet);
    FeatureMap toFm = toAnn.getFeatures();
    FeatureMap fromFm = fromAnn.getFeatures();
    toFm.put(featurename, fromFm.get(featurename));
  }
View Full Code Here

   *
   * @param annset
   * @return
   */
  public static Annotation getLongestAnn(AnnotationSet annset) {
    Annotation ann = null;
    if (annset.size() == 0) {
      throw new GateRuntimeException("Annotation set is empty");
    }
    for (Annotation a : annset) {
      if (ann == null) {
View Full Code Here

   * if more than one, an unspecified one
   *
   *
   */
  public static Annotation getLongestLeftmostAnn(AnnotationSet annset) {
    Annotation ann = null;
    if (annset.size() == 0) {
      throw new GateRuntimeException("Annotation set is empty");
    }
    int offset = Integer.MAX_VALUE;
    for (Annotation a : annset) {
View Full Code Here

   *
   * @param annset
   * @return
   */
  public static Annotation getLongestRightmostAnn(AnnotationSet annset) {
    Annotation ann = null;
    if (annset.size() == 0) {
      throw new GateRuntimeException("Annotation set is empty");
    }
    int offset = 0;
    for (Annotation a : annset) {
View Full Code Here

          // add the candidate head to this chain candidate
          chain.add(ann);
          int chainlength = 0;
          // curann is the annotation we process in a loop to find
          // something to append
          Annotation curann = ann;
          while (true) {
            // System.out.println("Chain finding: "+curann);
            // Find the next offset that is a) behind the end of curann and
            // b) a known offset where we have elements
            int curend = curann.getEndNode().getOffset().intValue();
            int nextOffset = offset;
            for (int o : sortedOffsets) {
              if (o >= curend) {
                nextOffset = o;
                break;
View Full Code Here

      // also mark as added
      // start a new chain at each annotation that was not already added
      // to a chain.
      Set<Annotation> addedAnnotations = new HashSet<Annotation>();
      for (AnnotationChain chain : chains) {
        Annotation lastEl = chain.getLast();
        // is the end of the last element not beyond the current offset?
        // then the chain can potentially be made longer with annotations
        // from this offset.
        Object value = lastEl.getFeatures().get(feature);
        if (endOffset(lastEl) <= offset) {
          Set<Annotation> candidates = new HashSet<Annotation>();
          for (Annotation offsetAnn : offsetAnns) {
            Object annValue = offsetAnn.getFeatures().get(feature);
            if (annValue == null) {
              continue;
            } // ignore anns with no value
            if (annValue.equals(value)) {
              candidates.add(offsetAnn);
            }
          }
          if (candidates.isEmpty()) {
            continue;
          } // no candidates for this chain
          if (candidates.size() == 1) {
            // add the annotation to the current chain
            Annotation a = candidates.iterator().next();
            chain.addLast(a);
            addedAnnotations.add(a);
          } else {
            // more than one canditate, we need to duplicate the current chain
            System.err.println("Need to duplicate chain, not yet implemented!");
            Annotation a = candidates.iterator().next();
            chain.addLast(a);
            addedAnnotations.add(a);
          }
        } // offset compatible with current chain
      } // for each chain
View Full Code Here

  @Override
  public boolean doMatch(Object annotValue, AnnotationSet context)
    throws JapeException {

    Annotation annot = (Annotation) annotValue;
    AnnotationSet containedSet = doMatch(annot, context);

    Collection<Annotation> filteredSet = filterMatches(containedSet);

    return filteredSet.isEmpty();
View Full Code Here

  @Override
  public boolean doMatch(Object annotValue, AnnotationSet context)
    throws JapeException {

    Annotation annot = (Annotation) annotValue;
    AnnotationSet containedSet = doMatch(annot, context);

    Collection<Annotation> filteredSet = filterMatches(containedSet);

    return filteredSet.isEmpty();
View Full Code Here

  @Override
  public boolean doMatch(Object annotValue, AnnotationSet context)
    throws JapeException {

    Annotation annot = (Annotation) annotValue;
    AnnotationSet containedSet = doMatch(annot, context);

    Collection<Annotation> filteredSet = filterMatches(containedSet);

    return filteredSet.isEmpty();
View Full Code Here

TOP

Related Classes of gate.Annotation

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.