public class SequenceLabelerME extends Object implements SequenceLabeler
| Modifier and Type | Field and Description |
|---|---|
protected SequenceLabelerContextGenerator |
contextGenerator |
static Pattern |
contPattern |
static int |
DEFAULT_BEAM_SIZE |
static Pattern |
lastPattern |
protected opennlp.tools.ml.model.SequenceClassificationModel<String> |
model |
static Pattern |
otherPattern |
static Pattern |
startPattern |
static Pattern |
unitPattern |
| Constructor and Description |
|---|
SequenceLabelerME(SequenceLabelerModel model) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearAdaptiveData()
Forgets all adaptive data which was collected during previous calls to one
of the find methods.
|
String[] |
decodeSequences(String[] preds)
Decode Sequences from an array of Strings.
|
static Span[] |
dropOverlappingSpans(Span[] spans)
Removes spans with are intersecting or crossing in anyway.
|
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.
|
double[] |
probs(Span[] spans)
Returns an array of probabilities for each of the specified spans which is
the arithmetic mean of the probabilities for each of the outcomes which
make up the span.
|
Span[][] |
tag(int numTaggings,
String[] tokens)
Returns at most the specified number of taggings for the specified sentence.
|
Span[] |
tag(String[] tokens)
Generates tags for the given sequence, typically a sentence, returning token spans for any identified sequences.
|
Span[] |
tag(String[] tokens,
String[][] additionalContext)
Generates sequence tags for the given sequence, returning
spans for any identified sequences.
|
String[] |
tagToStrings(String[] tokens) |
opennlp.tools.util.Sequence[] |
topKSequences(String[] tokens) |
opennlp.tools.util.Sequence[] |
topKSequences(String[] tokens,
String[] tags,
double minSequenceScore) |
static SequenceLabelerModel |
train(String languageCode,
String type,
opennlp.tools.util.ObjectStream<SequenceLabelSample> samples,
opennlp.tools.util.TrainingParameters trainParams,
SequenceLabelerFactory factory) |
public static final int DEFAULT_BEAM_SIZE
public static Pattern startPattern
public static Pattern contPattern
public static Pattern lastPattern
public static Pattern unitPattern
public static Pattern otherPattern
protected opennlp.tools.ml.model.SequenceClassificationModel<String> model
protected SequenceLabelerContextGenerator contextGenerator
public SequenceLabelerME(SequenceLabelerModel model)
public Span[] tag(String[] tokens)
SequenceLabelertag in interface SequenceLabelertokens - an array of the tokens or words of the sequence, typically a sentence.public Span[] tag(String[] tokens, String[][] additionalContext)
tokens - an array of the tokens or words, typically a
sentence.additionalContext - features which are based on context outside of the
sentence but which should also be used.public Span[][] tag(int numTaggings, String[] tokens)
numTaggings - the number of labels to be returned.tokens - an array of tokens which make up a sentence.public opennlp.tools.util.Sequence[] topKSequences(String[] tokens)
public opennlp.tools.util.Sequence[] topKSequences(String[] tokens, String[] tags, double minSequenceScore)
public void clearAdaptiveData()
clearAdaptiveData in interface SequenceLabelerpublic void probs(double[] probs)
chunk. The specified array should be at least as large as the
number 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 double[] probs(Span[] spans)
spans - The spans of the names for which probabilities are desired.public static SequenceLabelerModel train(String languageCode, String type, opennlp.tools.util.ObjectStream<SequenceLabelSample> samples, opennlp.tools.util.TrainingParameters trainParams, SequenceLabelerFactory factory) throws IOException
IOExceptionpublic static Span[] dropOverlappingSpans(Span[] spans)
The following rules are used to remove the spans:
Identical spans: The first span in the array after sorting it remains
Intersecting spans: The first span after sorting remains
Contained spans: All spans which are contained by another are removed
spans - the spansCopyright © 2016 IXA pipes. All rights reserved.