Package opennlp.tools.postag
Klasse POSTaggerME
java.lang.Object
opennlp.tools.postag.POSTaggerME
- Alle implementierten Schnittstellen:
POSTagger
A
part-of-speech tagger
that uses maximum entropy.
Tries to predict whether words are nouns, verbs, or any of 70 other POS tags depending on their surrounding context.
-
Feldübersicht
Felder -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungPOSTaggerME
(String language) Initializes aPOSTaggerME
by downloading a default model for a givenlanguage
.POSTaggerME
(String language, POSTagFormat format) Initializes aPOSTaggerME
by downloading a default model for a givenlanguage
.POSTaggerME
(POSModel model) Initializes aPOSTaggerME
with the providedmodel
.POSTaggerME
(POSModel model, POSTagFormat format) Initializes aPOSTaggerME
with the providedmodel
. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic Dictionary
buildNGramDictionary
(ObjectStream<POSSample> samples, int cutoff) Constructs anGram dictionary
from anObjectStream
of samples.String[]
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) Populates aPOSDictionary
from anObjectStream
of samples.double[]
probs()
void
probs
(double[] probs) Populates the specified array with the probabilities for each tag of the last tagged sentence.String[][]
Returns at most the specifiednumTaggings
for the specifiedsentence
.String[]
Assigns the sentence of tokens pos tags.String[]
Assigns the sentence of tokens pos tags.Sequence[]
topKSequences
(String[] sentence) Assigns the sentence the top-ksequences
.Sequence[]
topKSequences
(String[] sentence, Object[] additionalContext) Assigns the sentence the top-ksequences
.static POSModel
train
(String languageCode, ObjectStream<POSSample> samples, TrainingParameters trainParams, POSTaggerFactory posFactory)
-
Felddetails
-
DEFAULT_BEAM_SIZE
public static final int DEFAULT_BEAM_SIZE- Siehe auch:
-
-
Konstruktordetails
-
POSTaggerME
Initializes aPOSTaggerME
by downloading a default model for a givenlanguage
.- Parameter:
language
- An ISO conform language code.- Löst aus:
IOException
- Thrown if the model could not be downloaded or saved.
-
POSTaggerME
Initializes aPOSTaggerME
by downloading a default model for a givenlanguage
.- Parameter:
language
- An ISO conform language code.format
- A validPOSTagFormat
.- Löst aus:
IOException
- Thrown if the model could not be downloaded or saved.
-
POSTaggerME
Initializes aPOSTaggerME
with the providedmodel
.- Parameter:
model
- A validPOSModel
.
-
POSTaggerME
Initializes aPOSTaggerME
with the providedmodel
.- Parameter:
model
- A validPOSModel
.format
- A validPOSTagFormat
.
-
-
Methodendetails
-
getAllPosTags
- Gibt zurück:
- Retrieves an array of all possible part-of-speech tags from the tagger.
-
tag
Beschreibung aus Schnittstelle kopiert:POSTagger
Assigns the sentence of tokens pos tags. -
tag
Beschreibung aus Schnittstelle kopiert:POSTagger
Assigns the sentence of tokens pos tags. -
tag
Returns at most the specifiednumTaggings
for the specifiedsentence
.- Parameter:
numTaggings
- The number of tagging to be returned.sentence
- An array of tokens which make up a sentence.- Gibt zurück:
- At most the specified number of taggings for the specified
sentence
.
-
topKSequences
Beschreibung aus Schnittstelle kopiert:POSTagger
Assigns the sentence the top-ksequences
.- Angegeben von:
topKSequences
in SchnittstellePOSTagger
- Parameter:
sentence
- The sentence of tokens to be tagged.- Gibt zurück:
- An array of
sequences
for each token provided insentence
.
-
topKSequences
Beschreibung aus Schnittstelle kopiert:POSTagger
Assigns the sentence the top-ksequences
.- Angegeben von:
topKSequences
in SchnittstellePOSTagger
- Parameter:
sentence
- The sentence of tokens to be tagged.additionalContext
- The context to provide additional information with.- Gibt zurück:
- An array of
sequences
for each token provided insentence
.
-
probs
public void probs(double[] probs) Populates the specified array with the probabilities for each tag of the last tagged sentence.- Parameter:
probs
- An array to put the probabilities into.
-
probs
public double[] probs()- Gibt zurück:
- An array with the probabilities for each tag of the last tagged sentence.
-
getOrderedTags
-
getOrderedTags
-
train
public static POSModel train(String languageCode, ObjectStream<POSSample> samples, TrainingParameters trainParams, POSTaggerFactory posFactory) throws IOException - Löst aus:
IOException
-
buildNGramDictionary
public static Dictionary buildNGramDictionary(ObjectStream<POSSample> samples, int cutoff) throws IOException Constructs anGram dictionary
from anObjectStream
of samples.- Parameter:
samples
- TheObjectStream
to process.cutoff
- A non-negative cut-off value.- Gibt zurück:
- A valid
Dictionary
instance holding nGrams. - Löst aus:
IOException
- Thrown if IO errors occurred during dictionary construction.
-
populatePOSDictionary
public static void populatePOSDictionary(ObjectStream<POSSample> samples, MutableTagDictionary dict, int cutoff) throws IOException Populates aPOSDictionary
from anObjectStream
of samples.- Parameter:
samples
- TheObjectStream
to process.dict
- TheMutableTagDictionary
to use during population.cutoff
- A non-negative cut-off value.- Löst aus:
IOException
- Thrown if IO errors occurred during dictionary construction.
-