|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.classify.feature.Feature
de.fu_berlin.ties.context.LocalFeature
An immutable representation of the local part of a feature, useful to cache
and re-use the parts of feature representation that do not depend on the
relative position of the element to classify. Must be wrapped in a
GlobalFeature
for classification.
Field Summary | |
protected static char |
CLOSE
Character closing a quoted value. |
protected static LocalFeature |
MARKER_START
Constant for a marker feature that marks the start of an axis. |
protected static char |
OPEN
Character opening a quoted value. |
protected static char |
SPLIT_MARK
Character marking subsequences resulting from splitting a feature value containing whitespace. |
Constructor Summary | |
protected |
LocalFeature(String element,
FeatureType myType,
String myName,
String myValue,
String myComment)
Non-public constructor. |
Method Summary | |
static List |
createAttributeFeatures(String element,
String attributeName,
String featureValue,
int splitMaximum)
Factory method creating a feature that wraps an attribute value. |
static LocalFeature |
createCalculatedFeature(String element,
String calcName,
String featureValue)
Factory method creating a feature that wraps a calculated value. |
static List |
createCalculatedFeatures(String element,
String calcName,
String featureValue,
int splitMaximum)
Factory method creating a feature that wraps a calculated value that might contain whitespace. |
static LocalFeature |
createElementFeature(String element)
Factory method creating a feature that just represents an element itself. |
static List |
createTextFeatures(String element,
String featureValue,
int splitMaximum)
Factory method creating a feature that wraps textual content of an element. |
String |
getElementName()
Returns the name of the element this feature is attached to. |
String |
getName()
Returns the name of this feature. |
String |
getRepresentation()
Returns the representation of this feature, to be used for classification. |
FeatureType |
getType()
Returns the type of this feature. |
String |
getValue()
Returns the value wrapped by this feature. |
static String |
quote(String text)
Quotes a value text (by enclosing it between OPEN and
CLOSE character). |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class de.fu_berlin.ties.classify.feature.Feature |
equals, getComment, getFullRepresentation, getFullRepresentation, hashCode |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static final LocalFeature MARKER_START
protected static final char OPEN
protected static final char CLOSE
protected static final char SPLIT_MARK
Constructor Detail |
protected LocalFeature(String element, FeatureType myType, String myName, String myValue, String myComment)
element
- the name of the element this feature is attached to
(should be empty for marker features)myType
- the type of this featuremyName
- the name of this feature (should be empty for textual
or element features)myValue
- the value wrapped by this feature (might be
null
for marker or element features)myComment
- a comment on this feature, ignored for classification;
might be null
Method Detail |
public static List createAttributeFeatures(String element, String attributeName, String featureValue, int splitMaximum) throws IllegalArgumentException
featureValue
contains whitespace, it is
split and up to splitMaximum
different features are created
for the subsequences (discarding initial surplus sequences, if any).
element
- the name of the element this feature is attached toattributeName
- the name of the attribute; must not be emptyfeatureValue
- the textual content to wrapsplitMaximum
- the maximum number of features to generate
IllegalArgumentException
- if the specified attribute name is
empty (and thus not a valid name)public static LocalFeature createCalculatedFeature(String element, String calcName, String featureValue)
element
- the name of the element this feature is attached tocalcName
- the name identifying the calculated valuefeatureValue
- the calculated value to wrap; should not contain
whitespace (otherwise the classifier will get confesed)
public static List createCalculatedFeatures(String element, String calcName, String featureValue, int splitMaximum) throws IllegalArgumentException
featureValue
contains whitespace, it is
split and up to splitMaximum
different features are created
for the subsequences (discarding initial surplus sequences, if any).
element
- the name of the element this feature is attached tocalcName
- the name identifying the calculated valuefeatureValue
- the textual content to wrapsplitMaximum
- the maximum number of features to generate
IllegalArgumentException
- if the specified calcName
is empty (and thus not a valid name)public static LocalFeature createElementFeature(String element)
element
- the name of the element this feature is attached to
public static List createTextFeatures(String element, String featureValue, int splitMaximum)
featureValue
contains whitespace, it is
split and up to splitMaximum
different features are created
for the subsequences (discarding initial surplus sequences, if any).
element
- the name of the element this feature is attached tofeatureValue
- the textual content to wrapsplitMaximum
- the maximum number of features to generate
public static String quote(String text)
OPEN
and
CLOSE
character).
text
- the text to quote (might be null
)
text
is
null
public String getElementName()
public String getName()
public String getRepresentation()
getRepresentation
in class Feature
null
if this feature
contains only a commentpublic FeatureType getType()
public String getValue()
public String toString()
toString
in class Feature
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |