Log in Help
Print
Homewikijape-repository 〉 features.html
 

JAPE Features

Contents

1. To check on the RHS that an annotation has a certain feature value (in this case, a Token that's an adjective)

if (anAnn.getType().equals("Token") &&
   anAnn.getFeatures().containsKey("category") &&
   anAnn.getFeatures().get("category").equals("JJ")  )

2. Clone a feature map

FeatureMap fm = (FeatureMap)((SimpleFeatureMapImpl)ann.getFeatures()).clone();

3. Copy all the features from one annotation to another

FeatureMap newAnnFeatures = Factory.newFeatureMap();
newAnnFeatures.putAll(oldAnn.getFeatures());