Search in sources :

Example 1 with WordNetFeatureExtractor

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);
    }
}
Also used : WordNetFeatureExtractor(edu.illinois.cs.cogcomp.edison.features.factory.WordNetFeatureExtractor) EdisonException(edu.illinois.cs.cogcomp.edison.utilities.EdisonException) EdisonException(edu.illinois.cs.cogcomp.edison.utilities.EdisonException)

Aggregations

WordNetFeatureExtractor (edu.illinois.cs.cogcomp.edison.features.factory.WordNetFeatureExtractor)1 EdisonException (edu.illinois.cs.cogcomp.edison.utilities.EdisonException)1