use of edu.illinois.cs.cogcomp.edison.features.factory.WordNetFeatureExtractor in project cogcomp-nlp by CogComp.
the class FeatureManifest method getWordNetFeatureExtractor.
private FeatureExtractor getWordNetFeatureExtractor(List<String> wnLabels, Map<String, FeatureExtractor> cf) throws EdisonException {
String uniqueLabel = uniquify(wnLabels);
if (cf.containsKey(uniqueLabel))
return cf.get(uniqueLabel);
try {
WordNetFeatureExtractor wn = new WordNetFeatureExtractor();
for (String label : wnLabels) {
if (!WordNetClasses.wnClasses.containsKey(label))
throw new EdisonException("Unknown wordnet feature extractor '" + label + "', expecting one of " + WordNetClasses.wnClasses.keySet());
wn.addFeatureType(WordNetClasses.wnClasses.get(label));
}
CachedFeatureCollection f = new CachedFeatureCollection("", wn);
cf.put(uniqueLabel, f);
return f;
} catch (Exception e) {
throw new EdisonException(e);
}
}
Aggregations