edu.stanford.nlp.sequences
Interface SequenceModel

All Known Implementing Classes:
CRFClassifier.TestSequenceModel, CRFCliqueTree, EntityCachingAbstractSequencePrior, FactoredSequenceModel

public interface SequenceModel

Class capable of scoring sequences of a fixed length, typically with a probability distribution over such sequences.

Author:
Teg Grenager (grenager@stanford.edu)

Method Summary
 int[] getPossibleValues(int position)
          0...leftWindow-1 etc are null, leftWindow...length+leftWindow-1 are words, length+leftWindow...length+leftWindow+rightWindow-1 are null;
 int leftWindow()
          How many positions to the left a position is dependent on.
 int length()
           
 int rightWindow()
          How many positions to the right a position is dependent on.
 double scoreOf(int[] sequence)
          Computes the score assigned by this model to the whole sequence.
 double scoreOf(int[] sequence, int position)
          Computes the unnormalized log conditional distribution over values of the element at position pos 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 unnormalized log conditional distribution over values of the element at position pos in the sequence, conditioned on the values of the elements in all other positions of the provided sequence.
 

Method Detail

length

int length()
Returns:
the length of the sequences modeled by this SequenceModel

leftWindow

int leftWindow()
How many positions to the left a position is dependent on.

Returns:
the size of the left window used by this sequence model

rightWindow

int rightWindow()
How many positions to the right a position is dependent on.

Returns:
the size of the right window used by this sequence model

getPossibleValues

int[] getPossibleValues(int position)
0...leftWindow-1 etc are null, leftWindow...length+leftWindow-1 are words, length+leftWindow...length+leftWindow+rightWindow-1 are null;

Parameters:
position - the position
Returns:
the set of possible int values at this position, as an int array

scoresOf

double[] scoresOf(int[] sequence,
                  int position)
Computes the unnormalized log conditional distribution over values of the element at position pos in the sequence, conditioned on the values of the elements in all other positions of the provided sequence.

Parameters:
sequence - the sequence containing the rest of the values to condition on
position - the position of the element to give a distribution for
Returns:
the scores of the possible tokens at the specified position in the sequence

scoreOf

double scoreOf(int[] sequence,
               int position)
Computes the unnormalized log conditional distribution over values of the element at position pos in the sequence, conditioned on the values of the elements in all other positions of the provided sequence.

Parameters:
sequence - the sequence containing the rest of the values to condition on
position - the position of the element to give a distribution for
Returns:
the log score of the token at the specified position in the sequence

scoreOf

double scoreOf(int[] sequence)
Computes the score assigned by this model to the whole sequence. Typically this will be an unnormalized probability in log space (since the probabilities are small).

Parameters:
sequence - the sequence to compute a score for
Returns:
the score for the sequence


Stanford NLP Group