blog.distrib
Class StringEditModelWithJumps
java.lang.Object
blog.AbstractCondProbDistrib
blog.distrib.StringEditModel
blog.distrib.StringEditModelWithJumps
- All Implemented Interfaces:
- CondProbDistrib
public abstract class StringEditModelWithJumps
- extends StringEditModel
Subclass of StringEditModel that allows "jumps", that is, deletions of
whole substrings of the original string (rather than just single
characters). This is an abstract class. Subclasses must override the
initJumps method to specify what jumps are allowed in a given input
string, and what their probabilities are.
Fields inherited from class blog.distrib.StringEditModel |
charDistrib, DIGIT_PROB, DIGITS, IGNORE_CASE, LETTER_PROB, LETTERS, PROB_COPY, PROB_DELETE, PROB_INSERT, PROB_INSERT_AT_END, PROB_STOP, PROB_SUBST, PUNCT, PUNCT_PROB, SPACE_PROB, UNIFORM_WEIGHT |
Method Summary |
protected void |
addJump(int origin,
int dest,
double prob)
Allows a jump from before character origin to before
character dest , with probability prob . |
protected double |
getProbInternal(java.lang.String input,
java.lang.String output)
Method that can be overridden by subclasses to compute the probability
of the output string given the input string. |
protected abstract void |
initJumps(java.lang.String input)
Figures out what jumps are allowed for the given input string, and
calls addJump for each one. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
StringEditModelWithJumps
public StringEditModelWithJumps()
StringEditModelWithJumps
public StringEditModelWithJumps(java.util.List params)
getProbInternal
protected double getProbInternal(java.lang.String input,
java.lang.String output)
- Description copied from class:
StringEditModel
- Method that can be overridden by subclasses to compute the probability
of the output string given the input string.
- Overrides:
getProbInternal
in class StringEditModel
initJumps
protected abstract void initJumps(java.lang.String input)
- Figures out what jumps are allowed for the given input string, and
calls addJump for each one.
addJump
protected void addJump(int origin,
int dest,
double prob)
- Allows a jump from before character
origin
to before
character dest
, with probability prob
. The
destination must be greater than the origin. For any origin,
the jump probabilities should sum to something <= 1.0; the
remaining probability is distributed over non-jump moves. If
you add several jumps from an origin to the same destination,
the probabilities are added together.