Package opennlp.tools.tokenize
Class ThreadSafeTokenizerME
java.lang.Object
opennlp.tools.tokenize.ThreadSafeTokenizerME
- All Implemented Interfaces:
AutoCloseable,opennlp.tools.ml.Probabilistic,opennlp.tools.tokenize.Tokenizer
@Deprecated(since="3.0.0")
@ThreadSafe
public class ThreadSafeTokenizerME
extends Object
implements opennlp.tools.tokenize.Tokenizer, opennlp.tools.ml.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:
-
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
-
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.- Specified by:
tokenizein interfaceopennlp.tools.tokenize.Tokenizer
-
tokenizePos
Deprecated.- Specified by:
tokenizePosin interfaceopennlp.tools.tokenize.Tokenizer
-
probs
public double[] probs()Deprecated.- Specified by:
probsin interfaceopennlp.tools.ml.Probabilistic
-
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.