jsat.text.tokenizer
Class StopWordTokenizer
- java.lang.Object
-
- jsat.text.tokenizer.StopWordTokenizer
-
- All Implemented Interfaces:
- java.io.Serializable, Tokenizer
public class StopWordTokenizer extends java.lang.Object implements Tokenizer
This tokenizer wraps another such that any stop words that would have been returned by the base tokenizer are removed. The stop list is case sensitive.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static java.util.Set<java.lang.String>ENGLISH_STOP_SMALL_BASEThis unmodifiable set contains a very small and simple stop word list for English based on the 100 most common English words and includes all characters.
-
Constructor Summary
Constructors Constructor and Description StopWordTokenizer(Tokenizer base, java.util.Collection<java.lang.String> stopWords)Creates a new Stop Word tokenizerStopWordTokenizer(Tokenizer base, java.lang.String... stopWords)Creates a new Stop Word tokenizer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.util.List<java.lang.String>tokenize(java.lang.String input)Breaks the input string into a series of tokens that may be used as features for a classifier.voidtokenize(java.lang.String input, java.lang.StringBuilder workSpace, java.util.List<java.lang.String> storageSpace)Breaks the input string into a series of tokens that may be used as features for a classifier.
-
-
-
Field Detail
-
ENGLISH_STOP_SMALL_BASE
public static final java.util.Set<java.lang.String> ENGLISH_STOP_SMALL_BASE
This unmodifiable set contains a very small and simple stop word list for English based on the 100 most common English words and includes all characters. All tokens the set are lowercase.
This stop list is not meant to be authoritative or complete, but only a reasonable starting point that shouldn't degrade any common tasks.
Significant gains can be realized by deriving a stop list better suited to your individual needs.
-
-
Constructor Detail
-
StopWordTokenizer
public StopWordTokenizer(Tokenizer base, java.util.Collection<java.lang.String> stopWords)
Creates a new Stop Word tokenizer- Parameters:
base- the base tokenizer to usestopWords- the collection of stop words to remove from tokenizations. A copy of the collection will be made
-
StopWordTokenizer
public StopWordTokenizer(Tokenizer base, java.lang.String... stopWords)
Creates a new Stop Word tokenizer- Parameters:
base- the base tokenizer to usestopWords- the array of strings to use as stop words
-
-
Method Detail
-
tokenize
public java.util.List<java.lang.String> tokenize(java.lang.String input)
Description copied from interface:TokenizerBreaks the input string into a series of tokens that may be used as features for a classifier. The returned tokens must be either new string objects or interned strings. If a token is returned that is backed by the original document, memory may get leaked by processes consuming the token.
This method should be thread safe
-
tokenize
public void tokenize(java.lang.String input, java.lang.StringBuilder workSpace, java.util.List<java.lang.String> storageSpace)Description copied from interface:TokenizerBreaks the input string into a series of tokens that may be used as features for a classifier. The returned tokens must be either new string objects or interned strings. If a token is returned that is backed by the original document, memory may get leaked by processes consuming the token.
This method should be thread safe
-
-
DataMelt 3.0 © DataMelt by jWork.ORG