Class ShingleFilter.CircularSequence
java.lang.Object
org.apache.lucene.analysis.shingle.ShingleFilter.CircularSequence
- Enclosing class:
ShingleFilter
An instance of this class is used to maintain the number of input stream tokens that will be
used to compose the next unigram or shingle:
ShingleFilter.gramSize.
gramSize will take on values from the circular sequence { [ 1, ] ShingleFilter.minShingleSize [ , ... , ShingleFilter.maxShingleSize ] }.
1 is included in the circular sequence only if ShingleFilter.outputUnigrams = true.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate intprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadvance()Increments this circular number's value to the next member in the circular sequencegramSizewill take on values from the circular sequence { [ 1, ]ShingleFilter.minShingleSize[ , ...booleanReturns true if the current value is the first member of the circular sequence.intintgetValue()voidreset()Sets this circular number's value to the first member of the circular sequence
-
Field Details
-
value
private int value -
previousValue
private int previousValue -
minValue
private int minValue
-
-
Constructor Details
-
CircularSequence
public CircularSequence()
-
-
Method Details
-
getValue
public int getValue()- Returns:
- the current value.
- See Also:
-
advance
public void advance()Increments this circular number's value to the next member in the circular sequencegramSizewill take on values from the circular sequence { [ 1, ]ShingleFilter.minShingleSize[ , ... ,ShingleFilter.maxShingleSize] }.1 is included in the circular sequence only if
ShingleFilter.outputUnigrams= true. -
reset
public void reset()Sets this circular number's value to the first member of the circular sequencegramSizewill take on values from the circular sequence { [ 1, ]ShingleFilter.minShingleSize[ , ... ,ShingleFilter.maxShingleSize] }.1 is included in the circular sequence only if
ShingleFilter.outputUnigrams= true. -
atMinValue
public boolean atMinValue()Returns true if the current value is the first member of the circular sequence.If
ShingleFilter.outputUnigrams= true, the first member of the circular sequence will be 1; otherwise, it will beShingleFilter.minShingleSize.- Returns:
- true if the current value is the first member of the circular sequence; false otherwise
-
getPreviousValue
public int getPreviousValue()- Returns:
- the value this instance had before the last advance() call
-