|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.classify.feature.FeatureVector
de.fu_berlin.ties.classify.feature.FeatureSet
public class FeatureSet
This feature vector implementation stores a multi-set of features.
The order of features is not preserved. Internally it uses a
HashBag
as storage.
Instances of this class are not thread-safe and must be synchronized externally, if required.
Field Summary | |
---|---|
static String |
STRENGTH_CONSTANT
Constants specifying that feature frequencies are not considered when calculating strength values. |
static String |
STRENGTH_LINEAR
Constants specifying that feature frequencies are considered linear (as is) when calculating strength values (a feature occurring twice as frequently will be twice as strong). |
static String |
STRENGTH_LOG
Constants specifying that the logarithm of feature frequencies is considered when calculating strength values (1.0 is added to log(f) to avoid the result becoming 0). |
static String |
STRENGTH_SQUARE_ROOT
Constants specifying that the square root of feature frequencies is considered when calculating strength values. |
Constructor Summary | |
---|---|
FeatureSet(String strengthMethod)
Creates a new instance. |
Method Summary | |
---|---|
String |
getStrengthType()
Returns the type of method used to consider feature frequencies when determining strength values. |
Iterator |
iterator()
Returns an iterator over the Feature s stored in this vector. |
protected void |
preAddHook(Feature feature)
Implementation of the hook provided by the superclass to ensure that the summed strength is updated correctly. |
int |
size()
Returns the number of features stored in this vector. |
protected Collection<Feature> |
store()
Returns the collection used for storing the features. |
double |
strength(Feature feature)
Returns a strength value for a feature contained in this vector. |
Methods inherited from class de.fu_berlin.ties.classify.feature.FeatureVector |
---|
add, addAll, addAll, addAllTokens, flatten, flatten, getSummedStrength, setSummedStrength, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String STRENGTH_CONSTANT
public static final String STRENGTH_LOG
public static final String STRENGTH_SQUARE_ROOT
public static final String STRENGTH_LINEAR
Constructor Detail |
---|
public FeatureSet(String strengthMethod)
strengthMethod
- The type of method used to consider feature
frequencies when determining strength
values -- should be one of the STRENGTH
constants
defined in this classMethod Detail |
---|
public Iterator iterator()
Feature
s stored in this vector.
iterator
in class FeatureVector
public String getStrengthType()
STRENGTH
constants defined in this classprotected void preAddHook(Feature feature)
preAddHook
in class FeatureVector
feature
- the feature to addpublic int size()
size
in class FeatureVector
protected Collection<Feature> store()
store
in class FeatureVector
public double strength(Feature feature)
Feature.getStrength()
.
strength
in class FeatureVector
feature
- the feature to consider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |