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 Classes
Modifier and Type
Class
Description
`protected static final class`
`ViterbiNBest.Lattice<U extends MorphData>`
Yet another lattice data structure for keeping n-best path.
`static final class`
`ViterbiNBest.PositionNBest`
`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

Fields
Modifier and Type
Field
Description
`protected final EnumMap<TokenType,Dictionary<? extends U>>`
`dictionaryMap`
`protected ViterbiNBest.Lattice<U>`
`lattice`

### 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

Constructors
Modifier
Constructor
Description
`protected`
`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 Type
Method
Description
`protected final void`
`backtraceNBest(Viterbi.Position endPosData, boolean useEOS)`
Backtrace the n-best path.
`protected final void`
`fixupPendingList()`
Remove duplicated tokens from the pending list; this is needed because `Viterbi.backtrace(Position, int)` and `Viterbi.backtraceNBest(Position, boolean)` can add same tokens to the list.
`int`
`getLatticeRootBase()`
`protected int`
`getNBestCost()`
`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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### dictionaryMap

protected final EnumMap<TokenType,Dictionary<? extends U extends MorphData>> dictionaryMap

### lattice

protected ViterbiNBest.Lattice<U extends MorphData> 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

protected final void backtraceNBest(Viterbi.Position endPosData, boolean useEOS) throws IOException
Description copied from class: `Viterbi`
Backtrace the n-best path. Subclasses that support n-best paths should implement this method.

Overrides:
  `backtraceNBest` in class `Viterbi<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 because `Viterbi.backtrace(Position, int)` and `Viterbi.backtraceNBest(Position, boolean)` can add same tokens to the list. Subclasses that support n-best paths should implement this method.

Overrides:
  `fixupPendingList` in class `Viterbi<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)