Class Sequence
java.lang.Object
opennlp.tools.util.Sequence
- All Implemented Interfaces:
Comparable<Sequence>
Represents a weighted sequence of outcomes.
-
Constructor Summary
Constructors -
Method Summary
Modifier 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
-
Sequence
public Sequence()Initializes a newSequenceof outcomes. -
Sequence
-
Sequence
-
Sequence
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<Sequence>
-
hashCode
-
equals
-
add
Adds an outcome and probability to this sequence.- Parameters:
outcome- the outcome to be added.p- the probability associated with this outcome.
-
getOutcomes
-
getSize
public 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 thangetSize().- Returns:
- the outcome at the specified index.
- Throws:
IndexOutOfBoundsException- thrown if the given index is out of range.
-
getProb
public double getProb(int index) - Parameters:
index- must be greater than or equal to zero and must be less thangetSize().- Returns:
- the probability at the specified index.
- Throws:
IndexOutOfBoundsException- thrown if the given index is out of range.
-
getProbs
public double[] getProbs()- Returns:
- Retrieves an array of probabilities associated with the
Sequenceoutcomes.
-
getScore
public double getScore()- Returns:
- Retrieves the score of this
Sequence.
-
getProbs
-
toString
-