FeatureGenImpl is a class that implements FeatureGenerator interface. If you
look at the basic definition of a feature in CRF, then it has three
parameters for transition feature - position, currlabel, prevlabel, and two
parameters for state feature - position and currLabel.
While enumerating all the features that are fired at dataSeq.x(i), you need
to fire for all the states for which the feature will hold true. In
FeatureGenImpl class, this thing is acheived by either
1. Wrapping the feature inside FeatureTypesEachLabel (like addFeature(new
FeatureTypesEachLabel(new FeatureTypesConcat())) or
2. Firing features for each state for which the feature will hold (like in
If you look at the code of FeaturesTypeEachLabel, then things will become
lot more clear. One good thing about FeatureGenImpl classs is that you can
fire features with ids in sparse space, and it maps the feature Ids to a
contiguous ids, which is then used by CRF Trainer.
If you need more pointers in understanding FeatureGenImpl class/FeatureTypes
then please ask.
Get latest updates about Open Source Projects, Conferences and News.