public class WordNetFeatureExtractor extends WordFeatureExtractor
The behavior for multiple word constituents is just like the WordFeatureExtractor
:
If the input constituent is not a word, then the feature extractor can do one of two things: If a
flag is set in the constructor, then it will generate features from the last word of the
constituent. If the flag is not set, then it will throw a FeatureException
.
Note: you must call addFeatureType(WordNetFeatureClass)
in order
to specify which types of WordNet features you would like. If you do not add any feature types,
no features will be returned. See WordNetFeatureExtractor.WordNetFeatureClass
to learn about WordNet feature
types.
Modifier and Type | Class and Description |
---|---|
static class |
WordNetFeatureExtractor.WordNetFeatureClass
Feature types as used in
addFeatureType(WordNetFeatureClass) . |
Modifier and Type | Field and Description |
---|---|
static WordNetManager |
wnManager |
Constructor and Description |
---|
WordNetFeatureExtractor()
Creates a new WordNetFeatureExtractor.
|
WordNetFeatureExtractor(boolean useLastWord)
Creates a new WordNetFeatureExtractor.
|
Modifier and Type | Method and Description |
---|---|
void |
addFeatureType(WordNetFeatureExtractor.WordNetFeatureClass name)
Specify which types of features you would like this feature extractor to extract.
|
String |
getName() |
Set<Feature> |
getWordFeatures(TextAnnotation ta,
int tokenPosition) |
convertToWordFeatureExtractor, getFeatures
public static WordNetManager wnManager
public WordNetFeatureExtractor(boolean useLastWord) throws FileNotFoundException, net.didion.jwnl.JWNLException
It is probably safest to the parameter useLastWord
to true. This will provide a check
to ensure that the WordNetFeatureExtractor only sees words.
FileNotFoundException
net.didion.jwnl.JWNLException
public WordNetFeatureExtractor() throws FileNotFoundException, net.didion.jwnl.JWNLException
new WordNetFeatureExtractor(false)
.net.didion.jwnl.JWNLException
FileNotFoundException
WordNetFeatureExtractor(boolean)
public void addFeatureType(WordNetFeatureExtractor.WordNetFeatureClass name)
name
- feature typepublic Set<Feature> getWordFeatures(TextAnnotation ta, int tokenPosition) throws EdisonException
getWordFeatures
in class WordFeatureExtractor
EdisonException
public String getName()
getName
in interface FeatureExtractor
getName
in class WordFeatureExtractor
Copyright © 2017. All rights reserved.