ThreadSafePOSTaggerME (Apache OpenNLP :: Core :: Runtime 3.0.0-M4 API)
Description: declaration: package: opennlp.tools.postag, class: ThreadSafePOSTaggerME

Package opennlp.tools.postag

# Class ThreadSafePOSTaggerME

java.lang.Object
opennlp.tools.postag.ThreadSafePOSTaggerME

All Implemented Interfaces:
  `AutoCloseable`, `opennlp.tools.ml.Probabilistic`, `opennlp.tools.postag.POSTagger`

@Deprecated(since="3.0.0") @ThreadSafe public class ThreadSafePOSTaggerME extends Object implements opennlp.tools.postag.POSTagger, opennlp.tools.ml.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:
  - `POSTagger`
  - `POSTaggerME`
  - `Probabilistic`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ThreadSafePOSTaggerME(String language)`
  Deprecated.
  Initializes a `ThreadSafePOSTaggerME` by downloading a default model for a given `language`.
  `ThreadSafePOSTaggerME(String language, POSTagFormat format)`
  Deprecated.
  Initializes a `ThreadSafePOSTaggerME` by downloading a default model for a given `language`.
  `ThreadSafePOSTaggerME(POSModel model)`
  Deprecated.
  Initializes a `ThreadSafePOSTaggerME` with the specified `model`.
  `ThreadSafePOSTaggerME(POSModel model, POSTagFormat format)`
  Deprecated.
  Initializes a `ThreadSafePOSTaggerME` with the specified `model`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Deprecated.
  `double[]`
  `probs()`
  Deprecated.
  `String[]`
  `tag(String[] sentence)`
  Deprecated.
  `String[]`
  `tag(String[] sentence, Object[] additionaContext)`
  Deprecated.
  `opennlp.tools.util.Sequence[]`
  `topKSequences(String[] sentence)`
  Deprecated.
  `opennlp.tools.util.Sequence[]`
  `topKSequences(String[] sentence, Object[] additionaContext)`
  Deprecated.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ThreadSafePOSTaggerME

    public ThreadSafePOSTaggerME(String language) throws IOException
    Deprecated.
    Initializes a `ThreadSafePOSTaggerME` by downloading a default model for a given `language`.
    Parameters:
      `language` - An ISO conform language code.
    Throws:
      `IOException` - Thrown if the model could not be downloaded or saved.

  - ### ThreadSafePOSTaggerME

    public ThreadSafePOSTaggerME(String language, POSTagFormat format) throws IOException
    Deprecated.
    Initializes a `ThreadSafePOSTaggerME` by downloading a default model for a given `language`.
    Parameters:
      `language` - An ISO conform language code.
      `format` - A valid `POSTagFormat`.
    Throws:
      `IOException` - Thrown if the model could not be downloaded or saved.

  - ### ThreadSafePOSTaggerME

    public ThreadSafePOSTaggerME(POSModel model)
    Deprecated.
    Initializes a `ThreadSafePOSTaggerME` with the specified `model`.
    Parameters:
      `model` - A valid `POSModel`.

  - ### ThreadSafePOSTaggerME

    public ThreadSafePOSTaggerME(POSModel model, POSTagFormat format)
    Deprecated.
    Initializes a `ThreadSafePOSTaggerME` with the specified `model`.
    Parameters:
      `model` - A valid `POSModel`.
      `format` - A valid `POSTagFormat`.

- ## Method Details

  - ### tag

    public String[] tag(String[] sentence)
    Deprecated.
    Specified by:
      `tag` in interface `opennlp.tools.postag.POSTagger`

  - ### tag

    public String[] tag(String[] sentence, Object[] additionaContext)
    Deprecated.
    Specified by:
      `tag` in interface `opennlp.tools.postag.POSTagger`

  - ### topKSequences

    public opennlp.tools.util.Sequence[] topKSequences(String[] sentence)
    Deprecated.
    Specified by:
      `topKSequences` in interface `opennlp.tools.postag.POSTagger`

  - ### topKSequences

    public opennlp.tools.util.Sequence[] topKSequences(String[] sentence, Object[] additionaContext)
    Deprecated.
    Specified by:
      `topKSequences` in interface `opennlp.tools.postag.POSTagger`

  - ### probs

    public double[] probs()
    Deprecated.
    Specified by:
      `probs` in interface `opennlp.tools.ml.Probabilistic`

  - ### close

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