Package gate

Examples of gate.FeatureMap


 

  @Test
  public void test01() throws ResourceInstantiationException, MalformedURLException {
    // create an instance of the ExtendedGazetteer
    FeatureMap fm = Factory.newFeatureMap();
    File defFile = new File(testingDir,"extgaz1.def");
    URL defURL = defFile.toURI().toURL();
    fm.put("listsURL", defURL);
    ExtendedGazetteer gaz = (ExtendedGazetteer)Factory.createResource(
            "at.ofai.gate.extendedgazetteer.ExtendedGazetteer", fm);
    String origclass = gaz.getClass().getName();
    ExtendedGazetteer dup = (ExtendedGazetteer)Factory.duplicate(gaz);
    assertEquals(origclass, dup.getClass().getName());
View Full Code Here


  }
 
  @Test
  public void test02() throws ResourceInstantiationException, MalformedURLException {
    // create an instance of the ExtendedGazetteer
    FeatureMap fm = Factory.newFeatureMap();
    File defFile = new File(testingDir,"extgaz1.def");
    URL defURL = defFile.toURI().toURL();
    fm.put("listsURL", defURL);
    ExtendedGazetteer gaz = (ExtendedGazetteer)Factory.createResource(
            "at.ofai.gate.extendedgazetteer.ExtendedGazetteer", fm);
    String origclass = gaz.getClass().getName();
    // create a serial corpus controller and add the PR
    SerialAnalyserController cont =
View Full Code Here

   * @param otherFeatureMap
   *          the other feature map to copy
   * @return a new FeatureMap object that is a copy of the otherFeatureMap
   */
  public static FeatureMap copyFeatureMap(FeatureMap otherFeatureMap) {
    FeatureMap fm = Factory.newFeatureMap();
    fm.putAll(otherFeatureMap);
    return fm;
  }
View Full Code Here

   *          the annotation from which to copy the FeatureMap from
   * @return a new FeatureMap object that is a copy of the annotation's feature
   *         map
   */
  public static FeatureMap copyFeatureMap(Annotation ann) {
    FeatureMap fm = Factory.newFeatureMap();
    fm.putAll(ann.getFeatures());
    return fm;
  }
View Full Code Here

        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 copyFeaturesFrom
   */
  public static void addAnn(AnnotationSet outSet, AnnotationSet spanSet,
      String type, Annotation copyFeaturesFrom) {
    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

   * @param type
   * @param fm
   */
  public static void addAnn(AnnotationSet outSet, Annotation ann) {
    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

      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

   *        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

TOP

Related Classes of gate.FeatureMap

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.