Uploaded image for project: 'OpenNLP'
  1. OpenNLP
  2. OPENNLP-1340

Get the probability for a sequence without copying the probabilities

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 1.9.3
    • 2.1.1
    • POS Tagger

    Description

      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):

      public int getSize() {
          return outcomes.size();
      }
      
      public String getOutcome(int index) {
          return outcomes.get(index);
      }
      
      public double getProb(int index) {
          return probs.get(index);
      }
      

      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.

      Attachments

        Activity

          People

            rzo1 Richard Zowalla
            msclrhd Reece H. Dunn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: