de.fu_berlin.ties.classify.feature
Class OSBTransformer

java.lang.Object
  extended byde.fu_berlin.ties.classify.feature.FeatureTransformer
      extended byde.fu_berlin.ties.classify.feature.OSBTransformer

public class OSBTransformer
extends FeatureTransformer

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.

Version:
$Revision: 1.1 $, $Date: 2004/04/28 16:54:26 $, $Author: siefkes $
Author:
Christian Siefkes

Field Summary
 
Fields inherited from class de.fu_berlin.ties.classify.feature.FeatureTransformer
CONFIG_TRANSFORMERS
 
Constructor Summary
OSBTransformer(FeatureTransformer precTrans, int len, String sep, 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.
 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
 

Constructor Detail

OSBTransformer

public OSBTransformer(FeatureTransformer precTrans,
                      int len,
                      String sep,
                      boolean preserve)
               throws IllegalArgumentException
Creates a new instance.

Parameters:
precTrans - the preceding transformer to use if this transformer is part of a chain; null otherwise
len - the maximum number of original features joined; minimum value is 2
sep - the string used to separate original features -- this string should never occur within original features
preserve - whether to preserve the original features as well or only to use joint features
Throws:
IllegalArgumentException - if len < 2

OSBTransformer

public OSBTransformer(FeatureTransformer precTrans,
                      TiesConfiguration config)
Creates a new instance.

Parameters:
precTrans - the preceding transformer to use if this transformer is part of a chain; null otherwise
config - used to configure this instance
Method Detail

doTransform

protected FeatureVector doTransform(FeatureVector orgFeatures)
Transforms a feature vector.

Specified by:
doTransform in class FeatureTransformer
Parameters:
orgFeatures - the original feature vector to transform
Returns:
a new feature vector containing the transformed features

getLength

public int getLength()
Returns the maximum number of original features joined.

Returns:
the value of the attribute

getSeparator

public String getSeparator()
Returns the string used to separate original features (by default a space character). This string should never occur within original features.

Returns:
the value of the attribute

isPreserving

public boolean isPreserving()
Whether original features are preserved as well in addition to the generated joint features.

Returns:
the value of the attribute

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class FeatureTransformer
Returns:
a textual representation


Copyright © 2003-2004 Christian Siefkes. All Rights Reserved.