Class MappingCharFilter
- java.lang.Object
-
- java.io.Reader
-
- org.apache.lucene.analysis.CharFilter
-
- org.apache.lucene.analysis.charfilter.BaseCharFilter
-
- org.apache.lucene.analysis.charfilter.MappingCharFilter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Readable
public class MappingCharFilter extends BaseCharFilter
SimplisticCharFilter
that applies the mappings contained in aNormalizeCharMap
to the character stream, and correcting the resulting changes to the offsets. Matching is greedy (longest pattern matching at a given point wins). Replacement is allowed to be the empty string.
-
-
Field Summary
Fields Modifier and Type Field Description private RollingCharBuffer
buffer
private CharObjectHashMap<FST.Arc<CharsRef>>
cachedRootArcs
private FST.BytesReader
fstReader
private int
inputOff
private FST<CharsRef>
map
private Outputs<CharsRef>
outputs
private CharsRef
replacement
private int
replacementPointer
private FST.Arc<CharsRef>
scratchArc
-
Fields inherited from class org.apache.lucene.analysis.CharFilter
input
-
-
Constructor Summary
Constructors Constructor Description MappingCharFilter(NormalizeCharMap normMap, java.io.Reader in)
Default constructor that takes aReader
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
read()
int
read(char[] cbuf, int off, int len)
void
reset()
-
Methods inherited from class org.apache.lucene.analysis.charfilter.BaseCharFilter
addOffCorrectMap, correct, getLastCumulativeDiff
-
Methods inherited from class org.apache.lucene.analysis.CharFilter
close, correctOffset
-
-
-
-
Field Detail
-
fstReader
private final FST.BytesReader fstReader
-
buffer
private final RollingCharBuffer buffer
-
cachedRootArcs
private final CharObjectHashMap<FST.Arc<CharsRef>> cachedRootArcs
-
replacement
private CharsRef replacement
-
replacementPointer
private int replacementPointer
-
inputOff
private int inputOff
-
-
Constructor Detail
-
MappingCharFilter
public MappingCharFilter(NormalizeCharMap normMap, java.io.Reader in)
Default constructor that takes aReader
.
-
-
Method Detail
-
reset
public void reset() throws java.io.IOException
- Overrides:
reset
in classjava.io.Reader
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException
- Overrides:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
read
public int read(char[] cbuf, int off, int len) throws java.io.IOException
- Specified by:
read
in classjava.io.Reader
- Throws:
java.io.IOException
-
-