Package opennlp.tools.tokenize
Class ThreadSafeTokenizerME
java.lang.Object
opennlp.tools.tokenize.ThreadSafeTokenizerME
- All Implemented Interfaces:
AutoCloseable,Probabilistic,Tokenizer
@Deprecated(since="3.0.0")
@ThreadSafe
public class ThreadSafeTokenizerME
extends Object
implements Tokenizer, Probabilistic, AutoCloseable
Deprecated.
A thread-safe version of
TokenizerME. 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
TokenizerME 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
ConstructorsConstructorDescriptionThreadSafeTokenizerME(String language) Deprecated.Initializes aThreadSafeTokenizerMEby downloading a default model for a givenlanguage.Deprecated.Initializes aThreadSafeTokenizerMEwith the specifiedmodel.ThreadSafeTokenizerME(TokenizerModel model, Dictionary abbDict) Deprecated.Instantiates aThreadSafeTokenizerMEwith an existingTokenizerModel. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Deprecated.double[]Deprecated, for removal: This API element is subject to removal in a future version.Useprobs()instead.double[]probs()Deprecated.Retrieves the probabilities of the last decoded sequence.String[]Deprecated.Splits a string into its atomic parts.Span[]Deprecated.Finds the boundaries of atomic parts in a string.
-
Field Details
-
Constructor Details
-
ThreadSafeTokenizerME
Deprecated.Initializes aThreadSafeTokenizerMEby 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.
-
ThreadSafeTokenizerME
Deprecated.Initializes aThreadSafeTokenizerMEwith the specifiedmodel.- Parameters:
model- A validTokenizerModel.
-
ThreadSafeTokenizerME
Deprecated.Instantiates aThreadSafeTokenizerMEwith an existingTokenizerModel.- Parameters:
model- TheTokenizerModelto be used.abbDict- TheDictionaryto be used. It must fit the language of themodel.
-
-
Method Details
-
tokenize
Deprecated.Description copied from interface:TokenizerSplits a string into its atomic parts. -
tokenizePos
Deprecated.Description copied from interface:TokenizerFinds the boundaries of atomic parts in a string.- Specified by:
tokenizePosin interfaceTokenizer- Parameters:
s- The string to be tokenized.- Returns:
- The
spans (offsets intofor each token as the individuals array elements.s)
-
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.
-
getProbabilities
Deprecated, for removal: This API element is subject to removal in a future version.Useprobs()instead. -
close
public void close()Deprecated.- Specified by:
closein interfaceAutoCloseable
-
TokenizerMEis itself thread-safe. Use it directly instead.