Examples of FeatureMap


Examples of gate.FeatureMap

      String typeName) {
    for (Annotation ann : inSet) {
      if (typeName == null) {
        addAnn(outSet, ann);
      } else {
        FeatureMap fm = ann.getFeatures();
        fm.put("original_ann_type", ann.getType());
        addAnn(outSet, ann, typeName, ann.getFeatures());
      }
    }
  }
View Full Code Here

Examples of gate.FeatureMap

   *        if the existing featuremaps should get copied unchanged.
   */
  public static void addAnns(AnnotationSet outSet, AnnotationSet inSet,
      String typeName, FeatureMap featureMap) {
    for (Annotation ann : inSet) {
      FeatureMap newfm = ann.getFeatures();
      String type = typeName;
      if (type == null) {
        type = ann.getType();
      }     
      if(featureMap != null) {
        newfm.putAll(featureMap);
      }
      addAnn(outSet, ann, type, ann.getFeatures());
    }
  }
View Full Code Here

Examples of gate.FeatureMap

            // System.out.println("No feature found, ignoring");
            continue;
          }
          // Make a feature map that contains the feature=value constraint
          // which is needed to check the other elements of the chain.
          FeatureMap constraint = Factory.newFeatureMap();
          constraint.put(feature, val);
          List<Annotation> chain = new ArrayList<Annotation>();
          // 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
View Full Code Here

Examples of gate.FeatureMap

   * @param name
   * @return
   */
  public static Object getParmValue(ActionContext ctx, String name) {
    if(ctx instanceof ExtendedActionContext) {
      FeatureMap fm = ((ExtendedActionContext)ctx).getParameters();
      if(fm != null) {
        return fm.get(name);
      } else {
        return null;
      }
    } else {
      throw new GateRuntimeException("ActionContext is not an ExtendedActionContext");
View Full Code Here

Examples of gate.FeatureMap

        continue;
      }
      logger.debug("Got annotation: "+ann);
      int specNo = it.getSpecNo();
      String spec = sourceSpecificationsVector.get(it.getSpecNo());
      FeatureMap fm = Factory.newFeatureMap();
      fm.putAll(ann.getFeatures());
      fm.put("annID",ann.getId());
      fm.put("annSet", inputAnnotationSetName);
      String content = it.getContent();
      fm.put("content", content);
      fm.put("specNo",specNo+"");
      fm.put("spec", spec);
      os.add(ann.getStartNode(),ann.getEndNode(),outputAnnotationTypeName,fm);
    }
    fireStatusChanged("AnnotatedBySpecPR completed");

  }
View Full Code Here

Examples of gate.FeatureMap

      throw new GateRuntimeException("Can only handle DocumentImpl not " +
          document.getClass());
    }
    String newText = annotatedDocumentTransformer.getStringForDocument(
            getDocument(), inputAnnotationSetName);
    FeatureMap theparms = Factory.newFeatureMap();
    theparms.put("collectRepositioningInfo", document.getCollectRepositioningInfo());
    theparms.put("encoding", ((DocumentImpl) document).getEncoding());
    theparms.put("markupAware", document.getMarkupAware());
    theparms.put("mimeType", ((DocumentImpl) document).getMimeType());
    theparms.put("preserveOriginalContent", document.getPreserveOriginalContent());
    theparms.put("stringContent", newText);
    FeatureMap thefeats = Factory.newFeatureMap();
    FeatureMap docfeats = document.getFeatures();
    thefeats.putAll(docfeats);

    String theName = document.getName();
    // create a copy of the current document
    Document newDoc;
View Full Code Here

Examples of gate.FeatureMap

          curoffset += actualSeparatorString.length();
        }
      }
    }
   
    FeatureMap theparms = Factory.newFeatureMap();
    theparms.put("collectRepositioningInfo", document.getCollectRepositioningInfo());
    theparms.put("encoding", ((DocumentImpl) document).getEncoding());
    theparms.put("markupAware", document.getMarkupAware());
    theparms.put("mimeType", ((DocumentImpl) document).getMimeType());
    theparms.put("preserveOriginalContent", document.getPreserveOriginalContent());
    theparms.put("stringContent", newText.toString());
    FeatureMap thefeats = Factory.newFeatureMap();
    FeatureMap docfeats = document.getFeatures();
    thefeats.putAll(docfeats);

    String theName = document.getName();
    // create a copy of the current document
    Document newDoc;
    try {
      newDoc = (Document) Factory.createResource(
              "gate.corpora.DocumentImpl",
              theparms,
              thefeats,
              theName+"_virtual");
    } catch (ResourceInstantiationException ex) {
      throw new GateRuntimeException(ex);
    }

    // set the initial annotations in the virtual document
    AnnotationSet newSet = newDoc.getAnnotations(virtualSpecificationSet);
    for(AnnotationSpec annspec : annspecs) {
      FeatureMap fm = Factory.newFeatureMap();
      fm.putAll(annspec.annotation.getFeatures());
      fm.put("orig_id",annspec.origId);     
      try {
        newSet.add(annspec.fromOffset, annspec.toOffset, virtualSpecificationType, fm);
      } catch(InvalidOffsetException ex) {
        throw new GateRuntimeException(
          "Invalid offset when creating annotation for virtual document: from/to/doclength: "+
View Full Code Here

Examples of gate.FeatureMap

      if (!(document instanceof DocumentImpl)) {
        throw new GateRuntimeException("Can only handle DocumentImpl not " + document.getClass());
      }
      String theclass = document.getClass().toString();
      FeatureMap theparms = Factory.newFeatureMap();
      theparms.put("collectRepositioningInfo", document.getCollectRepositioningInfo());
      theparms.put("encoding", ((DocumentImpl) document).getEncoding());
      theparms.put("markupAware", document.getMarkupAware());
      theparms.put("mimeType", ((DocumentImpl)document).getMimeType());
      theparms.put("preserveOriginalContent", document.getPreserveOriginalContent());
      theparms.put("stringContent", newText);
      FeatureMap thefeats = Factory.newFeatureMap();
      FeatureMap docfeats = document.getFeatures();
      for(Object k : docfeats.keySet()) {
        thefeats.put(k, docfeats.get(k));
      }

      String theName = document.getName();
      // create a copy of the current document
      Document newDoc;
View Full Code Here

Examples of gate.FeatureMap

        jTextFieldAuthor.addFocusListener(this);
        jTextFieldVersion.setName("version");
        jTextFieldVersion.addFocusListener(this);
        jTextAreaComment.setName("comment");
        jTextAreaComment.addFocusListener(this);
        FeatureMap fm = owner.theTarget.getFeatures();
        //System.out.println("Feature map is "+fm);
        String comment = getFMValue("@comment");
        if(comment == null) {
          comment = "";
        }
View Full Code Here

Examples of gate.FeatureMap

        System.err.println("Could not register plugin") ;
        ex.printStackTrace(System.err);
        System.exit(1);
      }
     
      FeatureMap parms = Factory.newFeatureMap();
      parms.put("configFileURL", url);
      parms.put("caseSensitive", caseSensitive);
      parms.put("caseConversionLanguage", locale);
      parms.put("gazetteerFeatureSeparator","\\t");
      try {
        gate.ProcessingResource pr =
          (gate.ProcessingResource) Factory.createResource(
                "com.jpetrak.gate.stringannotation.extendedgazetteer2.ExtendedGazetteer2",
                parms);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.