public class BeamSearch<T> extends Object implements SequenceClassificationModel<T>
Sequence
,
SequenceValidator
,
BeamSearchContextGenerator
Modifier and Type | Field and Description |
---|---|
static String |
BEAM_SIZE_PARAMETER |
Constructor and Description |
---|
BeamSearch(int size,
MaxentModel model)
Creates new search object.
|
BeamSearch(int size,
MaxentModel model,
int cacheSize) |
Modifier and Type | Method and Description |
---|---|
Sequence |
bestSequence(T[] sequence,
Object[] additionalContext,
BeamSearchContextGenerator<T> cg,
SequenceValidator<T> validator)
Finds the sequence with the highest probability.
|
Sequence[] |
bestSequences(int numSequences,
T[] sequence,
Object[] additionalContext,
BeamSearchContextGenerator<T> cg,
SequenceValidator<T> validator)
Finds the n most probable sequences.
|
Sequence[] |
bestSequences(int numSequences,
T[] sequence,
Object[] additionalContext,
double minSequenceScore,
BeamSearchContextGenerator<T> cg,
SequenceValidator<T> validator)
Returns the best sequence of outcomes based on model for this object.
|
String[] |
getOutcomes()
Returns all possible outcomes.
|
public static final String BEAM_SIZE_PARAMETER
public BeamSearch(int size, MaxentModel model)
size
- The size of the beam (k).model
- the model for assigning probabilities to the sequence outcomes.public BeamSearch(int size, MaxentModel model, int cacheSize)
public Sequence[] bestSequences(int numSequences, T[] sequence, Object[] additionalContext, double minSequenceScore, BeamSearchContextGenerator<T> cg, SequenceValidator<T> validator)
bestSequences
in interface SequenceClassificationModel<T>
sequence
- The input sequence.additionalContext
- An Object[] of additional context. This is passed to the context generator blindly with the assumption that the context are appropiate.public Sequence[] bestSequences(int numSequences, T[] sequence, Object[] additionalContext, BeamSearchContextGenerator<T> cg, SequenceValidator<T> validator)
SequenceClassificationModel
bestSequences
in interface SequenceClassificationModel<T>
public Sequence bestSequence(T[] sequence, Object[] additionalContext, BeamSearchContextGenerator<T> cg, SequenceValidator<T> validator)
SequenceClassificationModel
bestSequence
in interface SequenceClassificationModel<T>
public String[] getOutcomes()
SequenceClassificationModel
getOutcomes
in interface SequenceClassificationModel<T>
Copyright © 2015 The Apache Software Foundation. All rights reserved.