Class LanguageModel

java.lang.Object
  |
  +--LanguageModel

public class LanguageModel
extends java.lang.Object

A data structure consisting of a collection of language model (i.e., n-gram) probabilities relevant to the current alignment.

Author:
Noah A. Smith
See Also:
SPTableModel

Field Summary
static SPTableModel emptyLMTM
           
 
Constructor Summary
LanguageModel(Web inwb)
          Instantiate a new language model for the target sentence in Web 'inwb'.
 
Method Summary
 void addNgram(int index, java.lang.String s, Probability prob, boolean corr)
          Add an n-gram culminating in position 'index' with word 's' with probability 'prob' and correctness 'c'.
 void clear()
          Clear the language model - use only when loading a new translation.
 SPTableModel getCurrNgrams()
          Return a vector of the N-grams which apply to the current position.
 SPTableModel getNgrams(int p)
          Return a vector of the N-grams which apply to the given position 'p'.
 void readNgrams(java.io.StreamTokenizer st, Sentence sent)
          Read n-gram information; see documentation on .aln format.
 void setGram(int g)
          Set the value of N (e.g., 3 for trigram).
 void setPos(int x)
          Change the current position to 'p'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

emptyLMTM

public static SPTableModel emptyLMTM
Constructor Detail

LanguageModel

public LanguageModel(Web inwb)
Instantiate a new language model for the target sentence in Web 'inwb'.
Method Detail

addNgram

public void addNgram(int index,
                     java.lang.String s,
                     Probability prob,
                     boolean corr)
Add an n-gram culminating in position 'index' with word 's' with probability 'prob' and correctness 'c'.

clear

public void clear()
Clear the language model - use only when loading a new translation.

setPos

public void setPos(int x)
Change the current position to 'p'.

getCurrNgrams

public SPTableModel getCurrNgrams()
Return a vector of the N-grams which apply to the current position.

getNgrams

public SPTableModel getNgrams(int p)
Return a vector of the N-grams which apply to the given position 'p'.

readNgrams

public void readNgrams(java.io.StreamTokenizer st,
                       Sentence sent)
                throws FormatException
Read n-gram information; see documentation on .aln format.

setGram

public void setGram(int g)
Set the value of N (e.g., 3 for trigram).