Package opennlp.tools.util.featuregen
Class POSTaggerNameFeatureGenerator
java.lang.Object
opennlp.tools.util.featuregen.POSTaggerNameFeatureGenerator
- All Implemented Interfaces:
opennlp.tools.util.featuregen.AdaptiveFeatureGenerator
@ThreadSafe
public class POSTaggerNameFeatureGenerator
extends Object
implements opennlp.tools.util.featuregen.AdaptiveFeatureGenerator
Adds the token POS tag as feature. Requires a
POSTagger at runtime.
The "is this still the same sentence?" cache (a String[] of POS tags reused across the
tokens of one sentence) is held per-thread via ThreadLocal, so a single instance is safe
to share across multiple threads — for example when the enclosing
NameFinderME is shared. Cache identity uses
Arrays.equals(Object[], Object[]) (content equality), preserving the original
single-threaded semantics.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPOSTaggerNameFeatureGenerator(POSModel aPosModel) Initializes aPOSTaggerNameFeatureGeneratorwith the specifiedPOSModel.POSTaggerNameFeatureGenerator(opennlp.tools.postag.POSTagger aPosTagger) Initializes aPOSTaggerNameFeatureGeneratorwith the specifiedPOSTagger. -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateFeatures(List<String> feats, String[] toks, int index, String[] preds) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface opennlp.tools.util.featuregen.AdaptiveFeatureGenerator
clearAdaptiveData, updateAdaptiveData
-
Constructor Details
-
POSTaggerNameFeatureGenerator
public POSTaggerNameFeatureGenerator(opennlp.tools.postag.POSTagger aPosTagger) Initializes aPOSTaggerNameFeatureGeneratorwith the specifiedPOSTagger.- Parameters:
aPosTagger- A POSTagger instance to be used.
-
POSTaggerNameFeatureGenerator
Initializes aPOSTaggerNameFeatureGeneratorwith the specifiedPOSModel.- Parameters:
aPosModel- APOSModelto be used for the internalPOSTagger.
-
-
Method Details
-
createFeatures
- Specified by:
createFeaturesin interfaceopennlp.tools.util.featuregen.AdaptiveFeatureGenerator
-