Modifier and Type | Field and Description |
---|---|
protected BeamSearch<String> |
beam
The search object used for search multiple sequences of tags.
|
protected POSContextGenerator |
contextGen
The feature context generator.
|
static int |
DEFAULT_BEAM_SIZE |
protected Dictionary |
ngramDictionary |
protected AbstractModel |
posModel
The maximum entropy model to use to evaluate contexts.
|
protected int |
size
The size of the beam to be used in determining the best sequence of pos tags.
|
protected TagDictionary |
tagDictionary
Tag dictionary used for restricting words to a fixed set of tags.
|
protected boolean |
useClosedClassTagsFilter
Says whether a filter should be used to check whether a tag assignment
is to a word outside of a closed class.
|
Constructor and Description |
---|
POSTaggerME(AbstractModel model,
Dictionary dict)
Deprecated.
|
POSTaggerME(AbstractModel model,
Dictionary dict,
TagDictionary tagdict)
Deprecated.
|
POSTaggerME(AbstractModel model,
POSContextGenerator cg)
Deprecated.
|
POSTaggerME(AbstractModel model,
POSContextGenerator cg,
TagDictionary tagdict)
Deprecated.
|
POSTaggerME(AbstractModel model,
TagDictionary tagdict)
Deprecated.
|
POSTaggerME(int beamSize,
AbstractModel model,
POSContextGenerator cg,
TagDictionary tagdict)
Deprecated.
|
POSTaggerME(POSModel model)
Initializes the current instance with the provided model
and the default beam size of 3.
|
POSTaggerME(POSModel model,
int beamSize,
int cacheSize)
Initializes the current instance with the provided
model and provided beam size.
|
POSTaggerME(POSModel model,
int beamSize,
int cacheSize,
SequenceValidator<String> sequenceValidator)
Deprecated.
use
POSTaggerME(POSModel, int, int) instead. The model
knows which SequenceValidator to use. |
Modifier and Type | Method and Description |
---|---|
static Dictionary |
buildNGramDictionary(ObjectStream<POSSample> samples,
int cutoff) |
int |
getNumTags()
Returns the number of different tags predicted by this model.
|
String[] |
getOrderedTags(List<String> words,
List<String> tags,
int index) |
String[] |
getOrderedTags(List<String> words,
List<String> tags,
int index,
double[] tprobs) |
static void |
populatePOSDictionary(ObjectStream<POSSample> samples,
MutableTagDictionary dict,
int cutoff) |
double[] |
probs()
Returns an array with the probabilities for each tag of the last tagged sentence.
|
void |
probs(double[] probs)
Populates the specified array with the probabilities for each tag of the last tagged sentence.
|
String[][] |
tag(int numTaggings,
String[] sentence)
Returns at most the specified number of taggings for the specified sentence.
|
List<String> |
tag(List<String> sentence)
Deprecated.
|
String |
tag(String sentence)
Deprecated.
|
String[] |
tag(String[] sentence)
Assigns the sentence of tokens pos tags.
|
String[] |
tag(String[] sentence,
Object[] additionaContext) |
Sequence[] |
topKSequences(List<String> sentence)
Deprecated.
|
Sequence[] |
topKSequences(String[] sentence) |
Sequence[] |
topKSequences(String[] sentence,
Object[] additionaContext) |
static POSModel |
train(String languageCode,
ObjectStream<POSSample> samples,
ModelType modelType,
POSDictionary tagDictionary,
Dictionary ngramDictionary,
int cutoff,
int iterations)
Deprecated.
use
train(String, ObjectStream, TrainingParameters, POSTaggerFactory)
instead and pass in a POSTaggerFactory and a
TrainingParameters . |
static POSModel |
train(String languageCode,
ObjectStream<POSSample> samples,
TrainingParameters trainParams,
POSDictionary tagDictionary,
Dictionary ngramDictionary)
Deprecated.
use
train(String, ObjectStream, TrainingParameters, POSTaggerFactory)
instead and pass in a POSTaggerFactory . |
static POSModel |
train(String languageCode,
ObjectStream<POSSample> samples,
TrainingParameters trainParams,
POSTaggerFactory posFactory) |
protected AbstractModel posModel
protected POSContextGenerator contextGen
protected TagDictionary tagDictionary
protected Dictionary ngramDictionary
protected boolean useClosedClassTagsFilter
public static final int DEFAULT_BEAM_SIZE
protected int size
protected BeamSearch<String> beam
public POSTaggerME(POSModel model, int beamSize, int cacheSize, SequenceValidator<String> sequenceValidator)
POSTaggerME(POSModel, int, int)
instead. The model
knows which SequenceValidator
to use.SequenceValidator
from the model.public POSTaggerME(POSModel model, int beamSize, int cacheSize)
model
- beamSize
- public POSTaggerME(POSModel model)
model
- @Deprecated public POSTaggerME(AbstractModel model, TagDictionary tagdict)
model
- The model used for tagging.tagdict
- The tag dictionary used for specifying a set of valid tags.@Deprecated public POSTaggerME(AbstractModel model, Dictionary dict)
model
- The model used for tagging.dict
- The n-gram dictionary used for feature generation.@Deprecated public POSTaggerME(AbstractModel model, Dictionary dict, TagDictionary tagdict)
model
- The model used for tagging.dict
- The n-gram dictionary used for feature generation.tagdict
- The dictionary which specifies the valid set of tags for some words.@Deprecated public POSTaggerME(AbstractModel model, POSContextGenerator cg)
model
- The model used for tagging.cg
- The context generator used for feature creation.@Deprecated public POSTaggerME(AbstractModel model, POSContextGenerator cg, TagDictionary tagdict)
model
- The model used for tagging.cg
- The context generator used for feature creation.tagdict
- The dictionary which specifies the valid set of tags for some words.@Deprecated public POSTaggerME(int beamSize, AbstractModel model, POSContextGenerator cg, TagDictionary tagdict)
beamSize
- The number of alternate tagging considered when tagging.model
- The model used for tagging.cg
- The context generator used for feature creation.tagdict
- The dictionary which specifies the valid set of tags for some words.public int getNumTags()
@Deprecated public List<String> tag(List<String> sentence)
POSTagger
public String[] tag(String[] sentence)
POSTagger
public String[][] tag(int numTaggings, String[] sentence)
numTaggings
- The number of tagging to be returned.sentence
- An array of tokens which make up a sentence.@Deprecated public Sequence[] topKSequences(List<String> sentence)
topKSequences
in interface POSTagger
public Sequence[] topKSequences(String[] sentence)
topKSequences
in interface POSTagger
public Sequence[] topKSequences(String[] sentence, Object[] additionaContext)
topKSequences
in interface POSTagger
public void probs(double[] probs)
probs
- An array to put the probabilities into.public double[] probs()
@Deprecated public String tag(String sentence)
POSTagger
public String[] getOrderedTags(List<String> words, List<String> tags, int index, double[] tprobs)
public static POSModel train(String languageCode, ObjectStream<POSSample> samples, TrainingParameters trainParams, POSTaggerFactory posFactory) throws IOException
IOException
public static POSModel train(String languageCode, ObjectStream<POSSample> samples, TrainingParameters trainParams, POSDictionary tagDictionary, Dictionary ngramDictionary) throws IOException
train(String, ObjectStream, TrainingParameters, POSTaggerFactory)
instead and pass in a POSTaggerFactory
.IOException
@Deprecated public static POSModel train(String languageCode, ObjectStream<POSSample> samples, ModelType modelType, POSDictionary tagDictionary, Dictionary ngramDictionary, int cutoff, int iterations) throws IOException
train(String, ObjectStream, TrainingParameters, POSTaggerFactory)
instead and pass in a POSTaggerFactory
and a
TrainingParameters
.IOException
public static Dictionary buildNGramDictionary(ObjectStream<POSSample> samples, int cutoff) throws IOException
IOException
public static void populatePOSDictionary(ObjectStream<POSSample> samples, MutableTagDictionary dict, int cutoff) throws IOException
IOException
Copyright © 2015 The Apache Software Foundation. All rights reserved.