org.carrot2.text.preprocessing.filter
Class StopWordLabelFilter

java.lang.Object
  extended by org.carrot2.text.preprocessing.filter.SingleLabelFilterBase
      extended by org.carrot2.text.preprocessing.filter.StopWordLabelFilter
All Implemented Interfaces:
ILabelFilter

public class StopWordLabelFilter
extends SingleLabelFilterBase

Accepts words that are not stop words and phrases that do not start nor end in a stop word.


Field Summary
 boolean enabled
          Remove leading and trailing stop words.
 
Constructor Summary
StopWordLabelFilter()
           
 
Method Summary
 boolean acceptPhrase(PreprocessingContext context, int phraseIndex)
          Should return true if the phrase located at phraseIndex is to be accepted, false otherwise.
 boolean acceptWord(PreprocessingContext context, int wordIndex)
          Should return true if the word located at wordIndex is to be accepted, false otherwise.
 boolean isEnabled()
           
 
Methods inherited from class org.carrot2.text.preprocessing.filter.SingleLabelFilterBase
filter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enabled

public boolean enabled
Remove leading and trailing stop words. Removes labels that consist of, start or end in stop words.

Attribute level:
Basic
Attribute group:
Label filtering
Constructor Detail

StopWordLabelFilter

public StopWordLabelFilter()
Method Detail

acceptPhrase

public boolean acceptPhrase(PreprocessingContext context,
                            int phraseIndex)
Description copied from class: SingleLabelFilterBase
Should return true if the phrase located at phraseIndex is to be accepted, false otherwise.

Specified by:
acceptPhrase in class SingleLabelFilterBase
Parameters:
context - provides access to all information about the phrase
phraseIndex - index of the phrase for which decision is to be made

acceptWord

public boolean acceptWord(PreprocessingContext context,
                          int wordIndex)
Description copied from class: SingleLabelFilterBase
Should return true if the word located at wordIndex is to be accepted, false otherwise.

Specified by:
acceptWord in class SingleLabelFilterBase
Parameters:
context - provides access to all information about the word
wordIndex - index of the word for which decision is to be made

isEnabled

public boolean isEnabled()
Returns:
true if the filter is to be applied, false if the filter should be omitted by the LabelFilterProcessor.


Copyright (c) Dawid Weiss, Stanislaw Osinski