|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectopennlp.tools.chunker.ChunkerME
public class ChunkerME
The class represents a maximum-entropy-based chunker. Such a chunker can be used to find flat structures based on sequence inputs such as noun phrases or named entities.
| Field Summary | |
|---|---|
static int |
DEFAULT_BEAM_SIZE
|
| Constructor Summary | |
|---|---|
ChunkerME(ChunkerModel model)
Initializes the current instance with the specified model. |
|
ChunkerME(ChunkerModel model,
int beamSize)
Initializes the current instance with the specified model and the specified beam size. |
|
ChunkerME(ChunkerModel model,
int beamSize,
SequenceValidator<String> sequenceValidator)
Deprecated. Use ChunkerME(ChunkerModel, int) instead
and use the ChunkerFactory to configure the SequenceValidator. |
|
ChunkerME(ChunkerModel model,
int beamSize,
SequenceValidator<String> sequenceValidator,
ChunkerContextGenerator contextGenerator)
Deprecated. Use ChunkerME(ChunkerModel, int) instead
and use the ChunkerFactory to configure the SequenceValidator and ChunkerContextGenerator. |
|
ChunkerME(opennlp.model.MaxentModel mod)
Deprecated. |
|
ChunkerME(opennlp.model.MaxentModel mod,
ChunkerContextGenerator cg)
Deprecated. |
|
ChunkerME(opennlp.model.MaxentModel mod,
ChunkerContextGenerator cg,
int beamSize)
Deprecated. |
|
| Method Summary | |
|---|---|
List<String> |
chunk(List<String> toks,
List<String> tags)
Deprecated. |
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(List<String> sentence,
List<String> tags)
Deprecated. |
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,
ChunkerContextGenerator contextGenerator,
TrainingParameters mlParams)
Deprecated. Use #train(String, ObjectStream, ChunkerContextGenerator, TrainingParameters, ChunkerFactory)
instead. |
static ChunkerModel |
train(String lang,
ObjectStream<ChunkSample> in,
int cutoff,
int iterations)
Deprecated. use train(String, ObjectStream, ChunkerContextGenerator, TrainingParameters)
instead and pass in a TrainingParameters object. |
static ChunkerModel |
train(String lang,
ObjectStream<ChunkSample> in,
int cutoff,
int iterations,
ChunkerContextGenerator contextGenerator)
Deprecated. use train(String, ObjectStream, ChunkerContextGenerator, TrainingParameters)
instead and pass in a TrainingParameters object. |
static ChunkerModel |
train(String lang,
ObjectStream<ChunkSample> in,
TrainingParameters mlParams,
ChunkerFactory factory)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_BEAM_SIZE
| Constructor Detail |
|---|
public ChunkerME(ChunkerModel model,
int beamSize,
SequenceValidator<String> sequenceValidator,
ChunkerContextGenerator contextGenerator)
ChunkerME(ChunkerModel, int) instead
and use the ChunkerFactory to configure the SequenceValidator and ChunkerContextGenerator.
model - The model for this chunker.beamSize - The size of the beam that should be used when decoding sequences.sequenceValidator - The SequenceValidator to determines whether the outcome
is valid for the preceding sequence. This can be used to implement constraints
on what sequences are valid.
public ChunkerME(ChunkerModel model,
int beamSize,
SequenceValidator<String> sequenceValidator)
ChunkerME(ChunkerModel, int) instead
and use the ChunkerFactory to configure the SequenceValidator.
model - The model for this chunker.beamSize - The size of the beam that should be used when decoding sequences.sequenceValidator - The SequenceValidator to determines whether the outcome
is valid for the preceding sequence. This can be used to implement constraints
on what sequences are valid.
public ChunkerME(ChunkerModel model,
int beamSize)
model - The model for this chunker.beamSize - The size of the beam that should be used when decoding sequences.public ChunkerME(ChunkerModel model)
model - @Deprecated public ChunkerME(opennlp.model.MaxentModel mod)
mod - The maximum entropy model for this chunker.
@Deprecated
public ChunkerME(opennlp.model.MaxentModel mod,
ChunkerContextGenerator cg)
mod - The maximum entropy model for this chunker.cg - The context generator to be used by the specified model.
@Deprecated
public ChunkerME(opennlp.model.MaxentModel mod,
ChunkerContextGenerator cg,
int beamSize)
mod - The maximum entropy model for this chunker.cg - The context generator to be used by the specified model.beamSize - The size of the beam that should be used when decoding sequences.| Method Detail |
|---|
@Deprecated
public List<String> chunk(List<String> toks,
List<String> tags)
Chunker
chunk in interface Chunkertoks - a list of the tokens or words of the sequence.tags - a list of the pos tags of the sequence.
public String[] chunk(String[] toks,
String[] tags)
Chunker
chunk in interface Chunkertoks - an array of the tokens or words of the sequence.tags - an array of the pos tags of the sequence.
public Span[] chunkAsSpans(String[] toks,
String[] tags)
Chunker
chunkAsSpans in interface Chunkertoks - an array of the tokens or words of the sequence.tags - an array of the pos tags of the sequence.
@Deprecated
public Sequence[] topKSequences(List<String> sentence,
List<String> tags)
Chunker
topKSequences in interface Chunkersentence - The tokens of the sentence.tags - The pos-tags for the specified sentence.
public Sequence[] topKSequences(String[] sentence,
String[] tags)
Chunker
topKSequences in interface Chunkersentence - 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 Chunkersentence - 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
public static ChunkerModel train(String lang,
ObjectStream<ChunkSample> in,
ChunkerContextGenerator contextGenerator,
TrainingParameters mlParams)
throws IOException
#train(String, ObjectStream, ChunkerContextGenerator, TrainingParameters, ChunkerFactory)
instead.
IOException
public static ChunkerModel train(String lang,
ObjectStream<ChunkSample> in,
int cutoff,
int iterations,
ChunkerContextGenerator contextGenerator)
throws IOException
train(String, ObjectStream, ChunkerContextGenerator, TrainingParameters)
instead and pass in a TrainingParameters object.
IOException
@Deprecated
public static ChunkerModel train(String lang,
ObjectStream<ChunkSample> in,
int cutoff,
int iterations)
throws IOException,
ObjectStreamException
train(String, ObjectStream, ChunkerContextGenerator, TrainingParameters)
instead and pass in a TrainingParameters object.
ChunkerME.
in - cutoff - iterations -
IOException
ObjectStreamException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||