public class BasicFeatureGenerator extends Object implements FeatureGenerator
| Modifier and Type | Field and Description |
|---|---|
protected int |
curEndPos |
protected FeatureType |
currentFeatureType |
protected DataSequence |
curSeq |
protected int |
curStartPos |
protected boolean |
featureCollectingMode |
protected Iterator |
featureIter |
protected FeatureMap |
featureMap |
protected Feature |
featureToReturn |
protected Vector |
featureVector |
protected ModelGraph |
model |
protected boolean |
supportSegment |
protected int |
totalFeatures |
| Constructor and Description |
|---|
BasicFeatureGenerator(ModelGraph model) |
BasicFeatureGenerator(ModelGraph model,
boolean supportSegment) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addFeatureType(FeatureType fType)
Adds wanted feature type to the feature generator
|
protected void |
advance() |
protected void |
collectFeatureIdentifiers(Dataset trainData) |
String |
getFeatureName(int featureIndex) |
int |
getFeatureNum() |
protected FeatureType |
getFeatureType(int i) |
FeatureType |
getFeatureTYpe(int index)
Gets the index-th feature type
|
int |
getFeatureTypeNum()
Gets the number of wanted feature types.
|
boolean |
hasNext()
Tests if next feature exists
|
protected void |
initScanFeaturesAt(DataSequence d) |
protected boolean |
isValidFeature(DataSequence data,
int curStartPos,
int curEndPos,
Feature featureToReturn) |
boolean |
loadFeatureData()
This method will be called in testing mode.
|
Feature |
next()
Gets the next feature.
|
boolean |
readFeatures(String fileName)
Reads feature list from a text file
|
protected boolean |
retainFeature(DataSequence seq,
Feature f) |
boolean |
saveFeatures(String fileName)
Save features to a text file
|
void |
startScanFeaturesAt(DataSequence d,
int startPos,
int endPos)
Starts scanning features for the specified segment
|
boolean |
supportSegment()
Tests if the feature generatore supports the segment labeling problem
|
boolean |
train(Dataset trainData)
This method will be called in training mode.
|
protected ModelGraph model
protected Vector featureVector
protected Iterator featureIter
protected FeatureType currentFeatureType
protected FeatureMap featureMap
protected Feature featureToReturn
protected DataSequence curSeq
protected int curStartPos
protected int curEndPos
protected int totalFeatures
protected boolean featureCollectingMode
protected boolean supportSegment
public BasicFeatureGenerator(ModelGraph model)
public BasicFeatureGenerator(ModelGraph model, boolean supportSegment)
public boolean supportSegment()
FeatureGeneratorsupportSegment in interface FeatureGeneratorpublic boolean addFeatureType(FeatureType fType)
FeatureGeneratoraddFeatureType in interface FeatureGeneratorfType - the wanted feature typepublic int getFeatureTypeNum()
FeatureGeneratorgetFeatureTypeNum in interface FeatureGeneratorpublic FeatureType getFeatureTYpe(int index)
FeatureGeneratorgetFeatureTYpe in interface FeatureGeneratorindex - the index of the feature typeprotected FeatureType getFeatureType(int i)
public boolean train(Dataset trainData)
FeatureGeneratortrain in interface FeatureGeneratortrainData - the dataset for trainingpublic boolean loadFeatureData()
FeatureGeneratorloadFeatureData in interface FeatureGeneratorprotected void collectFeatureIdentifiers(Dataset trainData)
protected void advance()
protected boolean isValidFeature(DataSequence data, int curStartPos, int curEndPos, Feature featureToReturn)
protected boolean retainFeature(DataSequence seq, Feature f)
protected void initScanFeaturesAt(DataSequence d)
public void startScanFeaturesAt(DataSequence d, int startPos, int endPos)
FeatureGeneratorstartScanFeaturesAt in interface FeatureGeneratord - the sequence datastartPos - the start position of the segmentendPos - the end position of the segmentpublic boolean hasNext()
FeatureGeneratorhasNext in interface FeatureGeneratorpublic Feature next()
FeatureGeneratornext in interface FeatureGeneratorpublic int getFeatureNum()
getFeatureNum in interface FeatureGeneratorpublic String getFeatureName(int featureIndex)
getFeatureName in interface FeatureGeneratorfeatureIndex - the index of the featurepublic boolean readFeatures(String fileName)
FeatureGeneratorreadFeatures in interface FeatureGeneratorfileName - the name of the file containing the feature informationpublic boolean saveFeatures(String fileName)
FeatureGeneratorsaveFeatures in interface FeatureGeneratorfileName - the name of the file all features will be save toCopyright © 2018 JULIE Lab, Germany. All rights reserved.