org.carrot2.text.preprocessing.filter
Class MinLengthLabelFilter

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

public class MinLengthLabelFilter
extends SingleLabelFilterBase

Accepts labels whose length in characters is greater or equal to the provided value.


Field Summary
 boolean enabled
          Remove labels shorter than 3 characters.
 
Constructor Summary
MinLengthLabelFilter()
           
 
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 labels shorter than 3 characters. Removes labels whose total length in characters, including spaces, is less than 3.

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

MinLengthLabelFilter

public MinLengthLabelFilter()
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