Package opennlp.tools.util
Class Sequence
- java.lang.Object
-
- opennlp.tools.util.Sequence
-
- All Implemented Interfaces:
Comparable<Sequence>
public class Sequence extends Object implements Comparable<Sequence>
Represents a weighted sequence of outcomes.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(String outcome, double p)Adds an outcome and probability to this sequence.intcompareTo(Sequence s)booleanequals(Object obj)StringgetOutcome(int index)List<String>getOutcomes()doublegetProb(int index)double[]getProbs()voidgetProbs(double[] ps)Populates an array with the probabilities associated with theSequenceoutcomes.doublegetScore()intgetSize()inthashCode()StringtoString()
-
-
-
Method Detail
-
compareTo
public int compareTo(Sequence s)
- Specified by:
compareToin interfaceComparable<Sequence>
-
add
public void add(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 List<String> getOutcomes()
- Returns:
- Retrieves a list of outcomes for this
Sequence.
-
getSize
public int getSize()
- Returns:
- Retrieves the size of the outcomes for this
Sequence.
-
getOutcome
public String getOutcome(int index)
- 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
public 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 thisSequence.
-
-