common
Interface StringDistrib


public interface StringDistrib

Interface for objects that define probability distributions over strings. In addition to passing strings to the getProb or getLogProb methods, a client can pass one string to setString and then call versions of getProb and getLogProb that operate on substrings of that string. Some implementations may be able to preprocess the string passed to setString and return the probabilities of substrings very efficiently.


Method Summary
 double getLogProb(int start, int end)
          Returns the natural log probability of the substring from the given start index up to the given end index in the string passed to the last call to setString
 double getLogProb(java.lang.String str)
          Returns the natural log probability of the given string.
 double getProb(int start, int end)
          Returns the probability of the substring from the given start index up to the given end index in the string passed to the last call to setString
 double getProb(java.lang.String str)
          Returns the probability of the given string.
 void setString(java.lang.String str)
          Sets the string to be used by subsequent calls to the substring versions of getProb and getLogProb.
 

Method Detail

setString

void setString(java.lang.String str)
Sets the string to be used by subsequent calls to the substring versions of getProb and getLogProb.


getProb

double getProb(java.lang.String str)
Returns the probability of the given string.


getProb

double getProb(int start,
               int end)
Returns the probability of the substring from the given start index up to the given end index in the string passed to the last call to setString

Throws:
java.lang.IllegalStateException - if setString has not been called
java.lang.IllegalArgumentException - if the given start and end indices are not valid in the specified string

getLogProb

double getLogProb(java.lang.String str)
Returns the natural log probability of the given string.


getLogProb

double getLogProb(int start,
                  int end)
Returns the natural log probability of the substring from the given start index up to the given end index in the string passed to the last call to setString

Throws:
java.lang.IllegalStateException - if setString has not been called
java.lang.IllegalArgumentException - if the given start and end indices are not valid in the specified string