cc.mallet.types
Class FeatureSelection

java.lang.Object
  extended by cc.mallet.types.FeatureSelection
All Implemented Interfaces:
AlphabetCarrying, java.io.Serializable

public class FeatureSelection
extends java.lang.Object
implements AlphabetCarrying, java.io.Serializable

See Also:
Serialized Form

Constructor Summary
FeatureSelection(Alphabet dictionary)
           
FeatureSelection(Alphabet dictionary, java.util.BitSet selectedFeatures)
           
FeatureSelection(RankedFeatureVector rsv, int numFeatures)
           
 
Method Summary
 void add(int index)
           
 void add(java.lang.Object o)
           
 int cardinality()
           
 java.lang.Object clone()
           
 boolean contains(int index)
           
 boolean contains(java.lang.Object o)
           
static FeatureSelection createFromRegex(Alphabet dictionary, java.util.regex.Pattern regex)
          Creates a FeatureSelection that includes only those features whose names match a given regex.
 Alphabet getAlphabet()
           
 Alphabet[] getAlphabets()
           
 java.util.BitSet getBitSet()
           
 int nextDeselectedIndex(int index)
           
 int nextSelectedIndex(int index)
           
 void or(FeatureSelection fs)
           
 void remove(int index)
           
 void remove(java.lang.Object o)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureSelection

public FeatureSelection(Alphabet dictionary,
                        java.util.BitSet selectedFeatures)

FeatureSelection

public FeatureSelection(Alphabet dictionary)

FeatureSelection

public FeatureSelection(RankedFeatureVector rsv,
                        int numFeatures)
Method Detail

createFromRegex

public static FeatureSelection createFromRegex(Alphabet dictionary,
                                               java.util.regex.Pattern regex)
Creates a FeatureSelection that includes only those features whose names match a given regex. A static factory method.

Parameters:
dictionary - A dictionary of fetaure names. Entries must be string.
regex - Features whose names match this pattern will be included.
Returns:
A new FeatureSelection.

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

getAlphabet

public Alphabet getAlphabet()
Specified by:
getAlphabet in interface AlphabetCarrying

getAlphabets

public Alphabet[] getAlphabets()
Specified by:
getAlphabets in interface AlphabetCarrying

cardinality

public int cardinality()

getBitSet

public java.util.BitSet getBitSet()

add

public void add(java.lang.Object o)

add

public void add(int index)

remove

public void remove(java.lang.Object o)

remove

public void remove(int index)

contains

public boolean contains(java.lang.Object o)

contains

public boolean contains(int index)

or

public void or(FeatureSelection fs)

nextSelectedIndex

public int nextSelectedIndex(int index)

nextDeselectedIndex

public int nextDeselectedIndex(int index)