Package org.apache.lucene.analysis.morph
Class ViterbiNBest<T extends Token,U extends MorphData>
java.lang.Object
org.apache.lucene.analysis.morph.Viterbi<T,ViterbiNBest.PositionNBest>
org.apache.lucene.analysis.morph.ViterbiNBest<T,U>
public abstract class ViterbiNBest<T extends Token,U extends MorphData>
extends Viterbi<T,ViterbiNBest.PositionNBest>
Viterbi
subclass for n-best path calculation.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final class
ViterbiNBest.Lattice<U extends MorphData>
Yet another lattice data structure for keeping n-best path.static final class
Viterbi.Position
extension; this holds all forward pointers to calculate n-best path.Nested classes/interfaces inherited from class org.apache.lucene.analysis.morph.Viterbi
Viterbi.Position, Viterbi.WrappedPositionArray<U extends Viterbi.Position>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final EnumMap
<TokenType, Dictionary<? extends U>> protected ViterbiNBest.Lattice
<U> Fields inherited from class org.apache.lucene.analysis.morph.Viterbi
buffer, costs, enableSpacePenaltyFactor, end, lastBackTracePos, MAX_UNKNOWN_WORD_LENGTH, outputLongestUserEntryOnly, outputNBest, pending, pos, positions, VERBOSE, wordIdRef
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ViterbiNBest
(TokenInfoFST fst, FST.BytesReader fstReader, BinaryDictionary<? extends MorphData> dictionary, TokenInfoFST userFST, FST.BytesReader userFSTReader, Dictionary<? extends MorphData> userDictionary, ConnectionCosts costs) -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
backtraceNBest
(Viterbi.Position endPosData, boolean useEOS) Backtrace the n-best path.protected final void
Remove duplicated tokens from the pending list; this is needed becauseViterbi.backtrace(Position, int)
andViterbi.backtraceNBest(Position, boolean)
can add same tokens to the list.int
protected int
int
probeDelta
(int start, int end) protected abstract void
registerNode
(int node, char[] fragment) Add n-best tokens to the pending list.protected void
setNBestCost
(int value) Methods inherited from class org.apache.lucene.analysis.morph.Viterbi
add, backtrace, computePenalty, computeSpacePenalty, forward, getPending, getPos, isEnd, isOutputNBest, processUnknownWord, resetBuffer, resetState, shouldSkipProcessUnknownWord
-
Field Details
-
dictionaryMap
-
lattice
-
-
Constructor Details
-
ViterbiNBest
protected ViterbiNBest(TokenInfoFST fst, FST.BytesReader fstReader, BinaryDictionary<? extends MorphData> dictionary, TokenInfoFST userFST, FST.BytesReader userFSTReader, Dictionary<? extends MorphData> userDictionary, ConnectionCosts costs)
-
-
Method Details
-
backtraceNBest
Description copied from class:Viterbi
Backtrace the n-best path. Subclasses that support n-best paths should implement this method.- Overrides:
backtraceNBest
in classViterbi<T extends Token,
ViterbiNBest.PositionNBest> - Throws:
IOException
-
registerNode
protected abstract void registerNode(int node, char[] fragment) Add n-best tokens to the pending list. -
fixupPendingList
protected final void fixupPendingList()Description copied from class:Viterbi
Remove duplicated tokens from the pending list; this is needed becauseViterbi.backtrace(Position, int)
andViterbi.backtraceNBest(Position, boolean)
can add same tokens to the list. Subclasses that support n-best paths should implement this method.- Overrides:
fixupPendingList
in classViterbi<T extends Token,
ViterbiNBest.PositionNBest>
-
setNBestCost
protected void setNBestCost(int value) -
getNBestCost
protected int getNBestCost() -
getLatticeRootBase
public int getLatticeRootBase() -
probeDelta
public int probeDelta(int start, int end)
-