Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BEAM_SIZE |
Constructor and Description |
---|
ChunkerME(ChunkerModel model)
Initializes the current instance with the specified model.
|
Modifier and Type | Method and Description |
---|---|
String[] |
chunk(String[] toks,
String[] tags)
Generates chunk tags for the given sequence returning the result in an array.
|
Span[] |
chunkAsSpans(String[] toks,
String[] tags)
Generates tagged chunk spans for the given sequence returning the result in a span array.
|
double[] |
probs()
Returns an array with the probabilities of the last decoded sequence.
|
void |
probs(double[] probs)
Populates the specified array with the probabilities of the last decoded sequence.
|
Sequence[] |
topKSequences(String[] sentence,
String[] tags)
Returns the top k chunk sequences for the specified sentence with the specified pos-tags
|
Sequence[] |
topKSequences(String[] sentence,
String[] tags,
double minSequenceScore)
Returns the top k chunk sequences for the specified sentence with the specified pos-tags
|
static ChunkerModel |
train(String lang,
ObjectStream<ChunkSample> in,
TrainingParameters mlParams,
ChunkerFactory factory) |
public static final int DEFAULT_BEAM_SIZE
public ChunkerME(ChunkerModel model)
model
- public String[] chunk(String[] toks, String[] tags)
Chunker
public Span[] chunkAsSpans(String[] toks, String[] tags)
Chunker
chunkAsSpans
in interface Chunker
toks
- an array of the tokens or words of the sequence.tags
- an array of the pos tags of the sequence.public Sequence[] topKSequences(String[] sentence, String[] tags)
Chunker
topKSequences
in interface Chunker
sentence
- The tokens of the sentence.tags
- The pos-tags for the specified sentence.public Sequence[] topKSequences(String[] sentence, String[] tags, double minSequenceScore)
Chunker
topKSequences
in interface Chunker
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.public void probs(double[] probs)
chunk
. The
specified array should be at least as large as the numbe of tokens in the previous
call to chunk
.probs
- An array used to hold the probabilities of the last decoded sequence.public double[] probs()
chunk
.chunk
when it was last called.public static ChunkerModel train(String lang, ObjectStream<ChunkSample> in, TrainingParameters mlParams, ChunkerFactory factory) throws IOException
IOException
Copyright © 2020 The Apache Software Foundation. All rights reserved.