smile.nlp.pos
Class HMMPOSTagger
- java.lang.Object
-
- smile.nlp.pos.HMMPOSTagger
-
- All Implemented Interfaces:
- java.io.Serializable, POSTagger
public class HMMPOSTagger extends java.lang.Object implements POSTagger, java.io.Serializable
Part-of-speech tagging with hidden Markov model.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description HMMPOSTagger()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static HMMPOSTaggergetDefault()Returns the default English POS tagger.static HMMPOSTaggerlearn(java.lang.String[][] sentences, PennTreebankPOS[][] labels)Learns an HMM POS tagger by maximum likelihood estimation.static voidload(java.lang.String dir, java.util.List<java.lang.String[]> sentences, java.util.List<PennTreebankPOS[]> labels)Load training data from a corpora.static voidmain(java.lang.String[] argvs)Train the default model on WSJ and BROWN datasets.PennTreebankPOS[]tag(java.lang.String[] sentence)Tags the sentence in the form of a sequence of wordsstatic voidwalkin(java.io.File dir, java.util.List<java.io.File> files)Recursive function to descend into the directory tree and find all the files that end with ".POS"
-
-
-
Constructor Detail
-
HMMPOSTagger
public HMMPOSTagger()
Constructor. Creates an empty model. For Serialization only.
-
-
Method Detail
-
getDefault
public static HMMPOSTagger getDefault()
Returns the default English POS tagger.- Returns:
- the default English POS tagger
-
tag
public PennTreebankPOS[] tag(java.lang.String[] sentence)
Description copied from interface:POSTaggerTags the sentence in the form of a sequence of words
-
learn
public static HMMPOSTagger learn(java.lang.String[][] sentences, PennTreebankPOS[][] labels)
Learns an HMM POS tagger by maximum likelihood estimation.
-
load
public static void load(java.lang.String dir, java.util.List<java.lang.String[]> sentences, java.util.List<PennTreebankPOS[]> labels)Load training data from a corpora.- Parameters:
dir- a file object defining the top directory
-
walkin
public static void walkin(java.io.File dir, java.util.List<java.io.File> files)Recursive function to descend into the directory tree and find all the files that end with ".POS"- Parameters:
dir- a file object defining the top directory
-
main
public static void main(java.lang.String[] argvs)
Train the default model on WSJ and BROWN datasets.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG