opennlp.tools.util
Class Sequence

java.lang.Object
  extended by opennlp.tools.util.Sequence
All Implemented Interfaces:
java.lang.Comparable

public class Sequence
extends java.lang.Object
implements java.lang.Comparable

Represents a weighted sequence of outcomes.


Constructor Summary
Sequence()
          Creates a new sequence of outcomes.
Sequence(java.util.List outcomes)
           
Sequence(Sequence s)
           
Sequence(Sequence s, java.lang.String outcome, double p)
           
 
Method Summary
 void add(java.lang.String outcome, double p)
          Adds an outcome and probability to this sequence.
 int compareTo(java.lang.Object o)
           
 java.util.List getOutcomes()
          Returns a list of outcomes for this sequence.
 double[] getProbs()
          Returns an array of probabilities associated with the outcomes of this sequence.
 void getProbs(double[] ps)
          Populates an array with the probabilities associated with the outcomes of this sequece.
 double getScore()
          Returns the score of this sequence.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Sequence

public Sequence()
Creates a new sequence of outcomes.


Sequence

public Sequence(Sequence s)

Sequence

public Sequence(Sequence s,
                java.lang.String outcome,
                double p)

Sequence

public Sequence(java.util.List outcomes)
Method Detail

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

add

public void add(java.lang.String outcome,
                double p)
Adds an outcome and probability to this sequence.

Parameters:
outcome - the outcome to be added.
p - the probability associated with this outcome.

getOutcomes

public java.util.List getOutcomes()
Returns a list of outcomes for this sequence.

Returns:
a list of outcomes.

getProbs

public double[] getProbs()
Returns an array of probabilities associated with the outcomes of this sequence.

Returns:
an array of probabilities.

getScore

public double getScore()
Returns the score of this sequence.

Returns:
The score of this sequence.

getProbs

public void getProbs(double[] ps)
Populates an array with the probabilities associated with the outcomes of this sequece.

Parameters:
ps - a pre-allocated array to use to hold the values of the probabilities of the outcomes for this sequence.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright 2008 Jason Baldridge, Gann Bierner, and Thomas Morton. All Rights Reserved.