public class UniformPrior<IN extends CoreMap> extends java.lang.Object implements ListeningSequenceModel
Modifier and Type | Field and Description |
---|---|
protected int |
backgroundSymbol |
protected Index<java.lang.String> |
classIndex |
protected java.util.List<IN> |
doc |
protected int |
numClasses |
protected int[] |
possibleValues |
protected int[] |
sequence |
Constructor and Description |
---|
UniformPrior(java.lang.String backgroundSymbol,
Index<java.lang.String> classIndex,
java.util.List<IN> doc) |
Modifier and Type | Method and Description |
---|---|
int[] |
getPossibleValues(int position)
Return the valid sequence labels (as integer indices) for a particular
position in the sequence.
|
int |
leftWindow()
How many label positions to the left influence the label assignment
at a particular position.
|
int |
length() |
int |
rightWindow()
How many label positions to the right influence the label assignment
at a particular position.
|
double |
scoreOf(int[] sequence)
Computes the score assigned by this model to the whole sequence.
|
double |
scoreOf(int[] sequence,
int position)
Computes the score of the element at the given position in the sequence,
conditioned on the values of the elements in all other positions of the
provided sequence.
|
double[] |
scoresOf(int[] sequence,
int position)
Computes the scores of labels for the element at the given position in
the sequence, conditioned on the values of the labels at all other
positions of the provided sequence.
|
void |
setInitialSequence(int[] sequence)
Informs this sequence listener that the value of the whole sequence is initialized to sequence.
|
void |
updateSequenceElement(int[] sequence,
int pos,
int oldVal)
Informs this sequence listener that the value of the element at position pos has changed.
|
protected int[] sequence
protected final int backgroundSymbol
protected final int numClasses
protected final int[] possibleValues
protected final Index<java.lang.String> classIndex
public double scoreOf(int[] sequence)
SequenceModel
scoreOf
in interface SequenceModel
sequence
- The sequence of labels to compute a score forpublic double[] scoresOf(int[] sequence, int position)
SequenceModel
scoresOf
in interface SequenceModel
sequence
- The sequence containing the rest of the values to condition onposition
- The position of the element to give a distribution forpublic int[] getPossibleValues(int position)
SequenceModel
getPossibleValues
in interface SequenceModel
position
- The positionpublic int leftWindow()
SequenceModel
leftWindow
in interface SequenceModel
public int length()
length
in interface SequenceModel
public int rightWindow()
SequenceModel
rightWindow
in interface SequenceModel
public double scoreOf(int[] sequence, int position)
SequenceModel
scoreOf
in interface SequenceModel
sequence
- The sequence containing the prediction and the rest of the
labels to condition onposition
- The position of the element to give a score forpublic void setInitialSequence(int[] sequence)
SequenceListener
setInitialSequence
in interface SequenceListener
public void updateSequenceElement(int[] sequence, int pos, int oldVal)
SequenceListener
updateSequenceElement
in interface SequenceListener