主页:https://nlp.stanford.edu/software/tagger.html
下载:
basic English Stanford Tagger version 只包括训练好的英文模型,而 full Stanford Tagger version 包括多种语言模型,其中有英文,中文,德语等模型。
一个简单的Demo:
import java.io.IOException;
import edu.stanford.nlp.tagger.maxent.MaxentTagger;
public class POS2WORD {
public static void main(String[] args) throws IOException,ClassNotFoundException
{
// Initialize the tagger 载入已经训练好的模型
MaxentTagger tagger = new MaxentTagger("models/english-left3words-distsim.tagger");
// The sample string
String sample = "text love my us like my you";
// The tagged string
String tagged = tagger.tagString(sample);
// Output the result
System.out.println(tagged);
}
}
结果: