Package opennlp.tools.util
Class Sequence
java.lang.Object
opennlp.tools.util.Sequence
- All Implemented Interfaces:
- Comparable<Sequence>
Represents a weighted sequence of outcomes.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds an outcome and probability to this sequence.intbooleangetOutcome(int index) doublegetProb(int index) double[]getProbs()voidgetProbs(double[] ps) Populates an array with the probabilities associated with theSequenceoutcomes.doublegetScore()intgetSize()inthashCode()toString()
- 
Constructor Details- 
Sequencepublic Sequence()Initializes a newSequenceof outcomes.
- 
Sequence- Parameters:
- s- An existing- Sequenceused as input.
 
- 
Sequence- Parameters:
- s- An existing- Sequenceused as input.
- outcome- An extra outcome to add to- s.
- p- A extra probability of the- outcome.
 
- 
SequenceInitializes a newSequenceof outcomes from a list ofoutcomes. The probabilities for each outcome will be equally initialized toONE.- Parameters:
- outcomes- Several existing outcomes used as input.
 
 
- 
- 
Method Details- 
compareTo- Specified by:
- compareToin interface- Comparable<Sequence>
 
- 
hashCodepublic int hashCode()
- 
equals
- 
addAdds an outcome and probability to this sequence.- Parameters:
- outcome- the outcome to be added.
- p- the probability associated with this outcome.
 
- 
getOutcomes- Returns:
- Retrieves a list of outcomes for this Sequence.
 
- 
getSizepublic int getSize()- Returns:
- Retrieves the size of the outcomes for this Sequence.
 
- 
getOutcome- Parameters:
- index- must be greater than or equal to zero and must be less than- getSize().
- Returns:
- the outcome at the specified index.
- Throws:
- IndexOutOfBoundsException- thrown if the given index is out of range.
 
- 
getProbpublic double getProb(int index) - Parameters:
- index- must be greater than or equal to zero and must be less than- getSize().
- Returns:
- the probability at the specified index.
- Throws:
- IndexOutOfBoundsException- thrown if the given index is out of range.
 
- 
getProbspublic double[] getProbs()- Returns:
- Retrieves an array of probabilities associated with the Sequenceoutcomes.
 
- 
getScorepublic double getScore()- Returns:
- Retrieves the score of this Sequence.
 
- 
getProbspublic void getProbs(double[] ps) Populates an array with the probabilities associated with theSequenceoutcomes.- Parameters:
- ps- A pre-allocated array to hold the values of the probabilities of the outcomes for this- Sequence.
 
- 
toString
 
-