com.aliasi.lm
Class CompiledNGramBoundaryLM

java.lang.Object
  extended by com.aliasi.lm.CompiledNGramBoundaryLM
All Implemented Interfaces:
LanguageModel, LanguageModel.Conditional, LanguageModel.Sequence, Model<CharSequence>

public class CompiledNGramBoundaryLM
extends Object
implements LanguageModel.Sequence, LanguageModel.Conditional, Model<CharSequence>

A CompiledNGramBoundaryLM is constructed by reading the serialized form of an instance of NGramBoundaryLM.

The serialization format is the boundary character followed by the serialization of an n-gram process language model.

Since:
LingPipe2.0
Version:
3.5.1
Author:
Bob Carpenter

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.aliasi.lm.LanguageModel
LanguageModel.Conditional, LanguageModel.Dynamic, LanguageModel.Process, LanguageModel.Sequence, LanguageModel.Tokenized
 
Nested classes/interfaces inherited from interface com.aliasi.lm.LanguageModel
LanguageModel.Conditional, LanguageModel.Dynamic, LanguageModel.Process, LanguageModel.Sequence, LanguageModel.Tokenized
 
Method Summary
 double log2ConditionalEstimate(char[] cs, int start, int end)
          Returns the log (base 2) of the probability estimate for the conditional probability of the last character in the specified slice given the previous characters.
 double log2ConditionalEstimate(CharSequence cs)
          Returns the log (base 2) of the probabilty estimate for the conditional probability of the last character in the specified character sequence given the previous characters.
 double log2Estimate(char[] cs, int start, int end)
          Returns an estimate of the log (base 2) probability of the specified character slice.
 double log2Estimate(CharSequence cs)
          Returns an estimate of the log (base 2) probability of the specified character sequence.
 double log2Prob(CharSequence cSeq)
          This method is a convenience impelementation of the Model interface which delegates the call to log2Estimate(CharSequence).
 char[] observedCharacters()
          Returns the characters that have been observed for this language model, including the special boundary character.
 double prob(CharSequence cSeq)
          This method is a convenience implementation of the Model interface which returns the result of raising 2.0 to the power of the result of a call to log2Estimate(CharSequence).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

observedCharacters

public char[] observedCharacters()
Returns the characters that have been observed for this language model, including the special boundary character.

Specified by:
observedCharacters in interface LanguageModel.Conditional
Returns:
The observed characters for this langauge model.

log2ConditionalEstimate

public double log2ConditionalEstimate(CharSequence cs)
Description copied from interface: LanguageModel.Conditional
Returns the log (base 2) of the probabilty estimate for the conditional probability of the last character in the specified character sequence given the previous characters.

Specified by:
log2ConditionalEstimate in interface LanguageModel.Conditional
Parameters:
cs - Character sequence to estimate.
Returns:
The log conditional probability estimate.

log2ConditionalEstimate

public double log2ConditionalEstimate(char[] cs,
                                      int start,
                                      int end)
Description copied from interface: LanguageModel.Conditional
Returns the log (base 2) of the probability estimate for the conditional probability of the last character in the specified slice given the previous characters.

Specified by:
log2ConditionalEstimate in interface LanguageModel.Conditional
Parameters:
cs - Underlying array of characters.
start - Index of first character in slice.
end - One plus the index of the last character in the slice.
Returns:
The log conditional probability estimate.

log2Estimate

public double log2Estimate(CharSequence cs)
Description copied from interface: LanguageModel
Returns an estimate of the log (base 2) probability of the specified character sequence.

Specified by:
log2Estimate in interface LanguageModel
Parameters:
cs - Character sequence to estimate.
Returns:
Log estimate of likelihood of specified character sequence.

log2Estimate

public double log2Estimate(char[] cs,
                           int start,
                           int end)
Description copied from interface: LanguageModel
Returns an estimate of the log (base 2) probability of the specified character slice.

Specified by:
log2Estimate in interface LanguageModel
Parameters:
cs - Underlying array of characters.
start - Index of first character in slice.
end - One plus index of last character in slice.
Returns:
Log estimate of likelihood of specified character sequence.

log2Prob

public double log2Prob(CharSequence cSeq)
This method is a convenience impelementation of the Model interface which delegates the call to log2Estimate(CharSequence).

Specified by:
log2Prob in interface Model<CharSequence>
Parameters:
cSeq - Character sequence whose probability is returned.
Returns:
The log (base 2) probability of the specified character sequence.

prob

public double prob(CharSequence cSeq)
This method is a convenience implementation of the Model interface which returns the result of raising 2.0 to the power of the result of a call to log2Estimate(CharSequence).

Specified by:
prob in interface Model<CharSequence>
Parameters:
cSeq - Character sequence whose probability is returned.
Returns:
The log probability of the specified character sequence.