Package opennlp.tools.postag
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.
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionThreadSafePOSTaggerME(String language) Deprecated.Initializes aThreadSafePOSTaggerMEby downloading a default model for a givenlanguage.ThreadSafePOSTaggerME(String language, POSTagFormat format) Deprecated.Initializes aThreadSafePOSTaggerMEby downloading a default model for a givenlanguage.ThreadSafePOSTaggerME(POSModel model) Deprecated.Initializes aThreadSafePOSTaggerMEwith the specifiedmodel.ThreadSafePOSTaggerME(POSModel model, POSTagFormat format) Deprecated.Initializes aThreadSafePOSTaggerMEwith the specifiedmodel. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Deprecated.double[]probs()Deprecated.Retrieves the probabilities of the last decoded sequence.String[]Deprecated.Assigns the sentence of tokens pos tags.String[]Deprecated.Assigns the sentence of tokens pos tags.Sequence[]topKSequences(String[] sentence) Deprecated.Assigns the sentence the top-ksequences.Sequence[]topKSequences(String[] sentence, Object[] additionaContext) Deprecated.Assigns the sentence the top-ksequences.
-
Field Details
-
Constructor Details
-
ThreadSafePOSTaggerME
Deprecated.Initializes aThreadSafePOSTaggerMEby downloading a default model for a givenlanguage.- Parameters:
language- An ISO conform language code.- Throws:
IOException- Thrown if the model could not be downloaded or saved.
-
ThreadSafePOSTaggerME
Deprecated.Initializes aThreadSafePOSTaggerMEby downloading a default model for a givenlanguage.- Parameters:
language- An ISO conform language code.format- A validPOSTagFormat.- Throws:
IOException- Thrown if the model could not be downloaded or saved.
-
ThreadSafePOSTaggerME
Deprecated.Initializes aThreadSafePOSTaggerMEwith the specifiedmodel.- Parameters:
model- A validPOSModel.
-
ThreadSafePOSTaggerME
Deprecated.Initializes aThreadSafePOSTaggerMEwith the specifiedmodel.- Parameters:
model- A validPOSModel.format- A validPOSTagFormat.
-
-
Method Details
-
tag
Deprecated.Description copied from interface:POSTaggerAssigns the sentence of tokens pos tags. -
tag
Deprecated.Description copied from interface:POSTaggerAssigns the sentence of tokens pos tags. -
topKSequences
Deprecated.Description copied from interface:POSTaggerAssigns the sentence the top-ksequences.- Specified by:
topKSequencesin interfacePOSTagger- Parameters:
sentence- The sentence of tokens to be tagged.- Returns:
- An array of
sequencesfor each token provided insentence.
-
topKSequences
Deprecated.Description copied from interface:POSTaggerAssigns the sentence the top-ksequences.- Specified by:
topKSequencesin interfacePOSTagger- Parameters:
sentence- The sentence of tokens to be tagged.additionaContext- The context to provide additional information with.- Returns:
- An array of
sequencesfor each token provided insentence.
-
probs
public double[] probs()Deprecated.Description copied from interface:ProbabilisticRetrieves the probabilities of the last decoded sequence.- Specified by:
probsin interfaceProbabilistic- 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:
closein interfaceAutoCloseable
-
POSTaggerMEis itself thread-safe. Use it directly instead.