public class LemmatizerME extends Object implements Lemmatizer
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BEAM_SIZE |
Constructor and Description |
---|
LemmatizerME(LemmatizerModel model)
Initializes the current instance with the provided model
and the default beam size of 3.
|
Modifier and Type | Method and Description |
---|---|
String[] |
decodeLemmas(String[] toks,
String[] preds)
Decodes the lemma from the word and the induced lemma class.
|
String[] |
lemmatize(String[] toks,
String[] tags)
Generates lemma tags for the word and postag returning the result in an 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[] |
topKLemmaClasses(String[] sentence,
String[] tags) |
Sequence[] |
topKLemmaClasses(String[] sentence,
String[] tags,
double minSequenceScore) |
Sequence[] |
topKSequences(String[] sentence,
String[] tags) |
Sequence[] |
topKSequences(String[] sentence,
String[] tags,
double minSequenceScore) |
static LemmatizerModel |
train(String languageCode,
ObjectStream<LemmaSample> samples,
TrainingParameters trainParams,
LemmatizerFactory posFactory) |
public static final int DEFAULT_BEAM_SIZE
public LemmatizerME(LemmatizerModel model)
model
- the modelpublic String[] lemmatize(String[] toks, String[] tags)
Lemmatizer
lemmatize
in interface Lemmatizer
toks
- an array of the tokenstags
- an array of the pos tagspublic String[] decodeLemmas(String[] toks, String[] preds)
toks
- the array of tokenspreds
- the predicted lemma classespublic Sequence[] topKSequences(String[] sentence, String[] tags, double minSequenceScore)
public void probs(double[] probs)
lemmatize
. The
specified array should be at least as large as the number of tokens in the previous call to lemmatize
.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 LemmatizerModel train(String languageCode, ObjectStream<LemmaSample> samples, TrainingParameters trainParams, LemmatizerFactory posFactory) throws IOException
IOException
Copyright © 2016 The Apache Software Foundation. All rights reserved.