Package opennlp.tools.chunker
Class ThreadSafeChunkerME
java.lang.Object
opennlp.tools.chunker.ThreadSafeChunkerME
- All Implemented Interfaces:
AutoCloseable,Chunker,Probabilistic
@Deprecated(since="3.0.0")
@ThreadSafe
public class ThreadSafeChunkerME
extends Object
implements Chunker, Probabilistic, AutoCloseable
Deprecated.
A thread-safe version of the
ChunkerME. 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
ChunkerME 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
ConstructorsConstructorDescriptionThreadSafeChunkerME(ChunkerModel model) Deprecated.Initializes aThreadSafeChunkerMEwith the specifiedmodel. -
Method Summary
Modifier and TypeMethodDescriptionString[]Deprecated.Generates chunk tags for the given sequence returning the result in an array.Span[]chunkAsSpans(String[] toks, String[] tags) Deprecated.voidclose()Deprecated.double[]probs()Deprecated.Retrieves the probabilities of the last decoded sequence.Sequence[]topKSequences(String[] sentence, String[] tags) Deprecated.Computes the top k chunksequencesfor the specified sentence with the specified pos-tags.Sequence[]topKSequences(String[] sentence, String[] tags, double minSequenceScore) Deprecated.Computes the top k chunksequencesfor the specified sentence with the specified pos-tags.
-
Field Details
-
Constructor Details
-
ThreadSafeChunkerME
Deprecated.Initializes aThreadSafeChunkerMEwith the specifiedmodel.- Parameters:
model- A validChunkerModel.
-
-
Method Details
-
chunk
Deprecated.Description copied from interface:ChunkerGenerates chunk tags for the given sequence returning the result in an array. -
chunkAsSpans
Deprecated.Description copied from interface:Chunker- Specified by:
chunkAsSpansin interfaceChunker- Parameters:
toks- an array of the tokens or words of the sequence.tags- an array of the pos tags of the sequence.- Returns:
- an array of
spanswith chunk tags for each chunk in the sequence.
-
topKSequences
Deprecated.Description copied from interface:ChunkerComputes the top k chunksequencesfor the specified sentence with the specified pos-tags.- Specified by:
topKSequencesin interfaceChunker- Parameters:
sentence- The tokens of the sentence.tags- The pos-tags for the specified sentence.- Returns:
- the top k chunk
sequencesfor the specified sentence.
-
topKSequences
Deprecated.Description copied from interface:ChunkerComputes the top k chunksequencesfor the specified sentence with the specified pos-tags.- Specified by:
topKSequencesin interfaceChunker- Parameters:
sentence- The tokens of the sentence.tags- The pos-tags for the specified sentence.minSequenceScore- A lower bound on the score of a returned sequence.- Returns:
- the top k chunk
sequencesfor the specified sentence.
-
close
public void close()Deprecated.- Specified by:
closein interfaceAutoCloseable
-
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.
-
ChunkerMEis itself thread-safe. Use it directly instead.