org.carrot2.text.preprocessing.filter
Class StopLabelFilter

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

public class StopLabelFilter
extends SingleLabelFilterBase

Accepts labels that are not declared as stop labels in the stoplabels.<lang> files.


Field Summary
 boolean enabled
          Remove stop labels.
 
Constructor Summary
StopLabelFilter()
           
 
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.
 void filter(PreprocessingContext context, boolean[] acceptedStems, boolean[] acceptedPhrases)
          Called to perform label filtering.
 boolean isEnabled()
           
 
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 stop labels. Removes labels that are declared as stop labels in the stoplabels.<lang> files. Please note that adding a long list of regular expressions to the stoplabels file may result in a noticeable performance penalty.

Attribute label:
Remove stop labels
Attribute level:
Basic
Attribute group:
Label filtering
Constructor Detail

StopLabelFilter

public StopLabelFilter()
Method Detail

filter

public void filter(PreprocessingContext context,
                   boolean[] acceptedStems,
                   boolean[] acceptedPhrases)
Description copied from interface: ILabelFilter
Called to perform label filtering.

Specified by:
filter in interface ILabelFilter
Overrides:
filter in class SingleLabelFilterBase
Parameters:
context - contains words and phrases to be filtered
acceptedStems - the filter should set to false those elements that correspond to the stems to be filtered out
acceptedPhrases - the filter should set to false those elements that correspond to the phrases to be filtered out

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