Class WindowFeatureGenerator
java.lang.Object
opennlp.tools.util.featuregen.WindowFeatureGenerator
- All Implemented Interfaces:
opennlp.tools.util.featuregen.AdaptiveFeatureGenerator
public class WindowFeatureGenerator
extends Object
implements opennlp.tools.util.featuregen.AdaptiveFeatureGenerator
Generates previous (left-sided) and next (right-sided) features for a
given
AdaptiveFeatureGenerator. The window size can be specified.
Features:
- Current token is always included unchanged,
- Previous tokens are prefixed with
pdistance, - Next tokens are prefix with
ndistance.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWindowFeatureGenerator(int prevWindowSize, int nextWindowSize, opennlp.tools.util.featuregen.AdaptiveFeatureGenerator... generators) Initializes aWindowFeatureGeneratorwith the given parameters.WindowFeatureGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator generator) Initializes aWindowFeatureGenerator.WindowFeatureGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator... generators) Initializes aWindowFeatureGenerator.WindowFeatureGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator generator, int prevWindowSize, int nextWindowSize) Initializes aWindowFeatureGeneratorwith the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidcreateFeatures(List<String> features, String[] tokens, int index, String[] preds) toString()voidupdateAdaptiveData(String[] tokens, String[] outcomes)
-
Field Details
-
PREV_PREFIX
- See Also:
-
NEXT_PREFIX
- See Also:
-
-
Constructor Details
-
WindowFeatureGenerator
public WindowFeatureGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator generator, int prevWindowSize, int nextWindowSize) Initializes aWindowFeatureGeneratorwith the given parameters.- Parameters:
generator- TheAdaptiveFeatureGeneratorto apply to the window.prevWindowSize- Size of the window to the left of the current token.nextWindowSize- Size of the window to the right of the current token.
-
WindowFeatureGenerator
public WindowFeatureGenerator(int prevWindowSize, int nextWindowSize, opennlp.tools.util.featuregen.AdaptiveFeatureGenerator... generators) Initializes aWindowFeatureGeneratorwith the given parameters.- Parameters:
prevWindowSize- Size of the window to the left of the current token.nextWindowSize- Size of the window to the right of the current token.generators- One or moreAdaptiveFeatureGeneratorto apply to the window.
-
WindowFeatureGenerator
public WindowFeatureGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator generator) Initializes aWindowFeatureGenerator. The previous and next window size is 5.- Parameters:
generator- TheAdaptiveFeatureGeneratorto apply to the window.
-
WindowFeatureGenerator
public WindowFeatureGenerator(opennlp.tools.util.featuregen.AdaptiveFeatureGenerator... generators) Initializes aWindowFeatureGenerator. The previous and next window size is 5.- Parameters:
generators- One or moreAdaptiveFeatureGeneratorto apply to the window.
-
-
Method Details
-
createFeatures
-
updateAdaptiveData
-
clearAdaptiveData
public void clearAdaptiveData()- Specified by:
clearAdaptiveDatain interfaceopennlp.tools.util.featuregen.AdaptiveFeatureGenerator
-
toString
-