|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.classify.feature.FeatureTransformer
de.fu_berlin.ties.classify.feature.OSBTransformer
public class OSBTransformer
Transforms a feature vector using the orthogonal sparse bigrams (OSB) technique developed by Fidelis Assis. This transformer discard all comment-only features. It slides of window of length N over the remaining original features. At each window position it generates N-1 joint features as exemplified above (assumping the pipe character "|" is used as separator and N=5:
- - - w4 | w5 - - w3 | | w5 - w2 | | | w5 w1 | | | | w5
If isPreserving()
, the original features are preserved as well;
otherwise they are discarded.
Instances of this class are thread-safe.
Field Summary | |
---|---|
(package private) static QName |
ATTRIB_LENGTH
Attribute name used for XML serialization. |
(package private) static QName |
ATTRIB_SEPARATOR
Attribute name used for XML serialization. |
Fields inherited from class de.fu_berlin.ties.classify.feature.FeatureTransformer |
---|
CONFIG_TRANSFORMERS, ELEMENT_MAIN |
Constructor Summary | |
---|---|
OSBTransformer(Element element)
Creates a new instance from an XML element, fulfilling the recommandation of the XMLStorable interface. |
|
OSBTransformer(FeatureTransformer precTrans,
int len,
String sepString,
boolean preserve)
Creates a new instance. |
|
OSBTransformer(FeatureTransformer precTrans,
TiesConfiguration config)
Creates a new instance. |
Method Summary | |
---|---|
protected FeatureVector |
doTransform(FeatureVector orgFeatures)
Transforms a feature vector. |
int |
getLength()
Returns the maximum number of original features joined. |
String |
getSeparator()
Returns the string used to separate original features (by default a space character). |
boolean |
isPreserving()
Whether original features are preserved as well in addition to the generated joint features. |
ObjectElement |
toElement()
Stores all relevant fields of this object in an XML element for serialization. An equivalent object can be created by calling ObjectElement.createObject(org.dom4j.Element,
Class) on the created element. |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class de.fu_berlin.ties.classify.feature.FeatureTransformer |
---|
createTransformer, createTransformer, getPrecedingTransformer, transform |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static final QName ATTRIB_LENGTH
static final QName ATTRIB_SEPARATOR
Constructor Detail |
---|
public OSBTransformer(Element element) throws InstantiationException
XMLStorable
interface.
element
- the XML element containing the serialized representation
InstantiationException
- if the given element does not contain
a valid transformer descriptionpublic OSBTransformer(FeatureTransformer precTrans, int len, String sepString, boolean preserve) throws IllegalArgumentException
precTrans
- the preceding transformer to use if this transformer
is part of a chain; null
otherwiselen
- the maximum number of original features joined; minimum value
is 2sepString
- the string used to separate original features -- this
string should never occur within original featurespreserve
- whether to preserve the original features as well or
only to use joint features
IllegalArgumentException
- if len < 2
or if
strengthArray
is emptypublic OSBTransformer(FeatureTransformer precTrans, TiesConfiguration config)
precTrans
- the preceding transformer to use if this transformer
is part of a chain; null
otherwiseconfig
- used to configure this instanceMethod Detail |
---|
protected FeatureVector doTransform(FeatureVector orgFeatures)
doTransform
in class FeatureTransformer
orgFeatures
- the original feature vector to transform
public int getLength()
public String getSeparator()
public boolean isPreserving()
public ObjectElement toElement()
ObjectElement.createObject(org.dom4j.Element,
Class)
on the created element.
toElement
in interface XMLStorable
toElement
in class FeatureTransformer
public String toString()
toString
in class FeatureTransformer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |