[
https://issues.apache.org/jira/browse/OPENNLP-1340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17654042#comment-17654042
]
ASF GitHub Bot commented on OPENNLP-1340:
-----------------------------------------
jzonthemtn merged PR #481:
URL: https://github.com/apache/opennlp/pull/481
> 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
> Assignee: Richard Zowalla
> Priority: Trivial
> Labels: easyfix
> Fix For: 2.1.1
>
>
> 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.20.10#820010)