Reece H. Dunn created OPENNLP-1340:
--------------------------------------

             Summary: Get the probability for a sequence without copying the 
probabilities
                 Key: OPENNLP-1340
                 URL: https://issues.apache.org/jira/browse/OPENNLP-1340
             Project: OpenNLP
          Issue Type: Wish
          Components: POS Tagger
    Affects Versions: 1.9.3
            Reporter: Reece H. Dunn


The "opennlp.tools.util.Sequence" class has a "getOutcomes" method that returns 
the outcomes as the underlying list without copying the data. However, the 
"getProbs" method returns the probabilities as an array copy of the underlying 
probabilities list.

It would be useful to have the following accessor methods to avoid the copy 
(and an accessor for the outcomes for API consistency):
{code:java}
public int getSize() {
    return outcomes.size();
}

public String getOutcome(int index) {
    return outcomes.get(index);
}

public double getProb(int index) {
    return probs.get(index);
}
{code}
The motivation is that I want to convert the "POSTagger.topKSequences" to a 
"Map<String, Double>", in addition to locating the highest probability tag in 
the result.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to