Package cc.mallet.types
Class FeatureSelection
- java.lang.Object
-
- 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
Constructors Constructor Description FeatureSelection(Alphabet dictionary)FeatureSelection(Alphabet dictionary, java.util.BitSet selectedFeatures)FeatureSelection(RankedFeatureVector rsv, int numFeatures)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index)voidadd(java.lang.Object o)intcardinality()java.lang.Objectclone()booleancontains(int index)booleancontains(java.lang.Object o)static FeatureSelectioncreateFromRegex(Alphabet dictionary, java.util.regex.Pattern regex)Creates a FeatureSelection that includes only those features whose names match a given regex.AlphabetgetAlphabet()Alphabet[]getAlphabets()java.util.BitSetgetBitSet()intnextDeselectedIndex(int index)intnextSelectedIndex(int index)voidor(FeatureSelection fs)voidremove(int index)voidremove(java.lang.Object o)
-
-
-
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:
clonein classjava.lang.Object
-
getAlphabet
public Alphabet getAlphabet()
- Specified by:
getAlphabetin interfaceAlphabetCarrying
-
getAlphabets
public Alphabet[] getAlphabets()
- Specified by:
getAlphabetsin interfaceAlphabetCarrying
-
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)
-
-