com.aliasi.lm
Interface LanguageModel.Conditional

All Superinterfaces:
LanguageModel
All Known Implementing Classes:
CompiledNGramBoundaryLM, CompiledNGramProcessLM, NGramBoundaryLM, NGramProcessLM
Enclosing interface:
LanguageModel

public static interface LanguageModel.Conditional
extends LanguageModel

A LanguageModel.Conditional is a language model that implements conditional estimates of characters given previous characters. A conditional model should also be marked as either a LanguageModel.Process or LanguageModel.Sequence model.

A conditional language model should have conditional estimates that are appropriate for the joint estimates. For a process language model:

log2Estimate(cs,start,end)
  = Σstart < i <= end log2ConditionalEstimate(cs,start,i)
For a sequence language model, the situation is more complex. The joint estimate includes an estimate of the end-of-stream or a length estimate in addition to the per-character conditional log estimate.

Since:
LingPipe2.0
Version:
2.0
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
 
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 cSeq)
          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.
 char[] observedCharacters()
          Returns the array of characters that have been observed for this model.
 
Methods inherited from interface com.aliasi.lm.LanguageModel
log2Estimate, log2Estimate
 

Method Detail

log2ConditionalEstimate

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.

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.
Throws:
IndexOutOfBoundsException - If the start and end minus one points are outside of the bounds of the character array.

log2ConditionalEstimate

double log2ConditionalEstimate(CharSequence cSeq)
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.

Parameters:
cSeq - Character sequence to estimate.
Returns:
The log conditional probability estimate.
Throws:
IndexOutOfBoundsException - If the character sequence is length zero.

observedCharacters

char[] observedCharacters()
Returns the array of characters that have been observed for this model. The character array will be sorted into ascending unicode order.

Returns:
The array of observed characters for this model.