net.java.sen.dictionary
Class Viterbi

java.lang.Object
  extended by net.java.sen.dictionary.Viterbi

public class Viterbi
extends Object

An implementation of the Viterbi algorithm used to find the most likely sequence of morphemes comprising a sentence

Thread Safety: Objects of this class are NOT thread safe and should not be accessed simultaneously by multiple threads. Note that creating additional instances using SenFactory is relatively cheap in both memory and time


Constructor Summary
Viterbi(Tokenizer tokenizer)
          Creates a Viterbi instance using the given Tokenizer
 
Method Summary
 List<Token> getBestTokens(Sentence sentence)
          Deprecated. use getBestTokens(Sentence, List) instead
 List<Token> getBestTokens(Sentence sentence, List<Token> reuse)
          Analyses a sentence to find the most likely sequence of morphemes
 List<Token> getPossibleTokens(Sentence sentence, int position)
          Gets the possible tokens from a Sentence at a given position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Viterbi

public Viterbi(Tokenizer tokenizer)
Creates a Viterbi instance using the given Tokenizer

Parameters:
tokenizer - The Tokenizer to use
Method Detail

getPossibleTokens

public List<Token> getPossibleTokens(Sentence sentence,
                                     int position)
                              throws IOException
Gets the possible tokens from a Sentence at a given position. Any reading constraints on the Sentence are ignored

Parameters:
sentence - The Sentence to search within
position - The position to search at
Returns:
A list of possible Tokens
Throws:
IOException

getBestTokens

public List<Token> getBestTokens(Sentence sentence,
                                 List<Token> reuse)
                          throws IOException
Analyses a sentence to find the most likely sequence of morphemes

Parameters:
sentence - The sentence to analyse
Returns:
The most likely list of morphemes
Throws:
IOException

getBestTokens

@Deprecated
public List<Token> getBestTokens(Sentence sentence)
                          throws IOException
Deprecated. use getBestTokens(Sentence, List) instead

Throws:
IOException


Copyright © 2012. All Rights Reserved.