Class ThreadSafePOSTaggerME

java.lang.Object
opennlp.tools.postag.ThreadSafePOSTaggerME
All Implemented Interfaces:
AutoCloseable, Probabilistic, POSTagger

@Deprecated(since="3.0.0") @ThreadSafe public class ThreadSafePOSTaggerME extends Object implements POSTagger, Probabilistic, AutoCloseable
Deprecated.
As of OPENNLP-1816, POSTaggerME is itself thread-safe. Use it directly instead.
A thread-safe version of the POSTaggerME. Using it is completely transparent. You can use it in a single-threaded context as well, it only incurs a minimal overhead.

Note: This class is deprecated and now delegates to a single shared POSTaggerME instance, which is thread-safe as of OPENNLP-1816. Calling close() clears the current thread's thread-local state for compatibility.

See Also:
  • Field Details

    • sharedTagger

      private final POSTaggerME sharedTagger
      Deprecated.
  • Constructor Details

  • Method Details

    • tag

      public String[] tag(String[] sentence)
      Deprecated.
      Description copied from interface: POSTagger
      Assigns the sentence of tokens pos tags.
      Specified by:
      tag in interface POSTagger
      Parameters:
      sentence - The sentence of tokens to be tagged.
      Returns:
      An array of pos tags for each token provided in sentence.
    • tag

      public String[] tag(String[] sentence, Object[] additionaContext)
      Deprecated.
      Description copied from interface: POSTagger
      Assigns the sentence of tokens pos tags.
      Specified by:
      tag in interface POSTagger
      Parameters:
      sentence - The sentence of tokens to be tagged.
      additionaContext - The context to provide additional information with.
      Returns:
      An array of pos tags for each token provided in sentence.
    • topKSequences

      public Sequence[] topKSequences(String[] sentence)
      Deprecated.
      Description copied from interface: POSTagger
      Assigns the sentence the top-k sequences.
      Specified by:
      topKSequences in interface POSTagger
      Parameters:
      sentence - The sentence of tokens to be tagged.
      Returns:
      An array of sequences for each token provided in sentence.
    • topKSequences

      public Sequence[] topKSequences(String[] sentence, Object[] additionaContext)
      Deprecated.
      Description copied from interface: POSTagger
      Assigns the sentence the top-k sequences.
      Specified by:
      topKSequences in interface POSTagger
      Parameters:
      sentence - The sentence of tokens to be tagged.
      additionaContext - The context to provide additional information with.
      Returns:
      An array of sequences for each token provided in sentence.
    • probs

      public double[] probs()
      Deprecated.
      Description copied from interface: Probabilistic
      Retrieves the probabilities of the last decoded sequence.
      Specified by:
      probs in interface Probabilistic
      Returns:
      An array with the same number of probabilities as tokens were sent to the computational method when it was last called.
    • close

      public void close()
      Deprecated.
      Specified by:
      close in interface AutoCloseable