|
||||||||||
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
public abstract class FeatureVector
A feature vector contains the features representing an instance. Subclasses
must implement the store()
method to provide a collection for
storing the features.
Instances of this class are thread-safe if and only if the provided collection is thread-safe (normally this won't be the case).
Constructor Summary | |
---|---|
FeatureVector()
Creates a new instance. |
Method Summary | |
---|---|
void |
add(Feature feature)
Adds a feature to this vector. |
void |
addAll(Collection coll)
Adds all of the features in the specified Collection to this vector, in the order they are returned by the specified Collection's Iterator. |
void |
addAll(FeatureVector fv)
Adds all of the features in the specified feature vector to this vector, in the order they are returned by the specified feature vector. |
void |
addAllTokens(CharSequence text,
TextTokenizer tokenizer)
Tokenizes a text, creating and adding a feature for each token. |
CharSequence |
flatten()
Flattens the contained features into a single character sequence, without including comments. |
CharSequence |
flatten(boolean inclComments)
Flattens a list of features into a single character sequence. |
FeatureVector |
getTransformed()
Returns a reference to a transformed representation of this feature vector; null if this instance
has never been transformed. |
Iterator |
iterator()
Returns an iterator over the Feature s stored in this vector. |
FeatureVector |
lastTransformation()
Invokes the static lastTransformation(FeatureVector) method,
passing this instance as argument. |
static FeatureVector |
lastTransformation(FeatureVector features)
Recursively follows transformations of a feature vector, returning the last transformation. |
void |
setTransformed(FeatureVector newTransformed)
Sets a new reference to a transformed representation of this feature vector. |
int |
size()
Returns the number of features stored in this vector. |
protected abstract Collection<Feature> |
store()
Returns the collection used for storing the features. |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FeatureVector()
Method Detail |
---|
public static FeatureVector lastTransformation(FeatureVector features)
features
- the feature vector to use
public void add(Feature feature)
feature
- the feature to addpublic void addAll(Collection coll) throws ClassCastException
coll
- a collection of features to add
ClassCastException
- if the collection contains elements that are
not Feature
spublic void addAll(FeatureVector fv)
fv
- the vector of features to addpublic void addAllTokens(CharSequence text, TextTokenizer tokenizer)
text
- the text to tokenizetokenizer
- the tokenizer to usepublic FeatureVector getTransformed()
null
if this instance
has never been transformed.
public CharSequence flatten()
Feature.getRepresentation()
on each feature in the vector; each
feature representation is followed by a newlinepublic CharSequence flatten(boolean inclComments)
inclComments
- whether or not to include comments
Feature.getRepresentation()
on each feature in the vector; each
feature representation is followed by a newlinepublic Iterator iterator()
Feature
s stored in this vector.
public FeatureVector lastTransformation()
lastTransformation(FeatureVector)
method,
passing this instance as argument.
public void setTransformed(FeatureVector newTransformed)
newTransformed
- the new value of the attributepublic int size()
protected abstract Collection<Feature> store()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |