Class TokenPairConcatenatingFilter
- java.lang.Object
-
- org.apache.lucene.util.AttributeSource
-
- org.apache.lucene.analysis.TokenStream
-
- org.apache.lucene.analysis.TokenFilter
-
- org.owasp.dependencycheck.data.lucene.TokenPairConcatenatingFilter
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,org.apache.lucene.util.Unwrappable<org.apache.lucene.analysis.TokenStream>
@NotThreadSafe public final class TokenPairConcatenatingFilter extends org.apache.lucene.analysis.TokenFilterTakes a TokenStream and adds additional tokens by concatenating pairs of words.
Example: "Spring Framework Core" -> "Spring SpringFramework Framework FrameworkCore Core".
- Author:
- Jeremy Long
-
-
Constructor Summary
Constructors Constructor Description TokenPairConcatenatingFilter(org.apache.lucene.analysis.TokenStream stream)Constructs a new TokenPairConcatenatingFilter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Resets the filter.booleanequals(java.lang.Object obj)inthashCode()booleanincrementToken()Increments the underlying TokenStream and sets CharTermAttributes to construct an expanded set of tokens by concatenating tokens with the previous token.-
Methods inherited from class org.apache.lucene.util.AttributeSource
addAttribute, addAttributeImpl, captureState, clearAttributes, cloneAttributes, copyTo, endAttributes, getAttribute, getAttributeClassesIterator, getAttributeFactory, getAttributeImplsIterator, hasAttribute, hasAttributes, reflectAsString, reflectWith, removeAllAttributes, restoreState, toString
-
-
-
-
Method Detail
-
incrementToken
public boolean incrementToken() throws java.io.IOExceptionIncrements the underlying TokenStream and sets CharTermAttributes to construct an expanded set of tokens by concatenating tokens with the previous token.- Specified by:
incrementTokenin classorg.apache.lucene.analysis.TokenStream- Returns:
- whether or not we have hit the end of the TokenStream
- Throws:
java.io.IOException- is thrown when an IOException occurs
-
clear
public void clear() throws java.io.IOExceptionResets the filter. This must be manually called between searching and indexing. Unable to rely on `reset` as it appears to be called between terms.- Throws:
java.io.IOException- thrown if there is an error reseting the tokenizer
-
hashCode
public int hashCode()
- Overrides:
hashCodein classorg.apache.lucene.util.AttributeSource
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classorg.apache.lucene.util.AttributeSource
-
-