Package smile.nlp.pos
Class HMMPOSTagger
java.lang.Object
smile.nlp.pos.HMMPOSTagger
- All Implemented Interfaces:
Serializable
,POSTagger
Part-of-speech tagging with hidden Markov model.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic HMMPOSTagger
fit
(String[][] sentences, PennTreebankPOS[][] labels) Fits an HMM POS tagger by maximum likelihood estimation.static HMMPOSTagger
Returns the default English POS tagger.static void
Train the default model on WSJ and BROWN datasets.static void
Load training data from a corpora.Tags the sentence in the form of a sequence of words.static void
Recursive function to descend into the directory tree and find all the files that end with ".POS"
-
Constructor Details
-
HMMPOSTagger
public HMMPOSTagger()Constructor. Creates an empty model. For Serialization only.
-
-
Method Details
-
getDefault
Returns the default English POS tagger.- Returns:
- the default English POS tagger
-
tag
Description copied from interface:POSTagger
Tags the sentence in the form of a sequence of words. -
fit
Fits an HMM POS tagger by maximum likelihood estimation.- Parameters:
sentences
- the training sentences.labels
- the training labels.- Returns:
- the model.
-
read
Load training data from a corpora.- Parameters:
dir
- the top directory of training data.sentences
- the output list of training sentences.labels
- the output list of training labels.
-
walkin
Recursive function to descend into the directory tree and find all the files that end with ".POS"- Parameters:
dir
- the top directory of training data.files
- the output list of training files.
-
main
Train the default model on WSJ and BROWN datasets.- Parameters:
args
- the command line arguments.
-