Examples of FeatureMap


Examples of ch.miranet.commons.container.FeatureMap

public class FeatureMapTest {
 
  @Test
  public void testMap() {
    final FeatureMap map = new FeatureMap();
   
    map.putFeature(Name.First, "Homer");
    map.putFeature(Name.Last,  "Simpson");   
   
    assert map.getFeature(Name.First).equals("Homer");
    assert map.getFeature(Name.Last).equals("Simpson");
   
    assert map.getFeatureKeys().size() == 2;
    assert map.getFeatureKeys().contains(Name.First);
    assert map.getFeatureKeys().contains(Name.Last);
   
   
    assert map.removeFeature(Name.First).equals("Homer");
    assert map.getFeature(Name.First) == null;
    assert map.getFeatureKeys().size() == 1;
    assert map.getFeatureKeys().contains(Name.Last);
  }
View Full Code Here

Examples of com.enigmastation.classifier.FeatureMap

    public void load(Classifier classifier) throws IOException, ClassNotFoundException {
        FileInputStream fos=new FileInputStream(filename);
        ObjectInputStream oos=new ObjectInputStream(fos);

        ClassifierMap cc= (ClassifierMap) oos.readObject();
        FeatureMap fc= (FeatureMap) oos.readObject();

        //classifier.getCategoryDocCount().clear();
        classifier.getCategoryFeatureMap().clear();

        classifier.getCategoryDocCount().putAll(cc);
View Full Code Here

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

Examples of gate.FeatureMap

  }
 
  @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

Examples of gate.FeatureMap

   * @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

Examples of gate.FeatureMap

   *          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

Examples of gate.FeatureMap

        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

Examples of gate.FeatureMap

  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

Examples of gate.FeatureMap

   * @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

Examples of gate.FeatureMap

   * @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
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.