Introduction

Maven of NLP4J Stanford NLP for English NLP

<!-- https://mvnrepository.com/artifact/org.nlp4j/nlp4j-stanford -->
<dependency>
    <groupId>org.nlp4j</groupId>
    <artifactId>nlp4j-stanford</artifactId>
    <version>1.3.5.0</version>
</dependency>

Code

Document doc = new DefaultDocument();
{
	doc.putAttribute("text", "I eat sushi with chopsticks.");
}
StanfordPosAnnotator ann = new StanfordPosAnnotator();
{
	ann.setProperty("target", "text");
}
ann.annotate(doc); // do annotation
for (Keyword kwd : doc.getKeywords()) {
	System.err.println(kwd);
}

Result

[begin=0,end=1,facet=word.PRP,lex=I,str=I]
[begin=2,end=5,facet=word.VBP,lex=eat,str=eat]
[begin=6,end=11,facet=word.NN,lex=sushi,str=sushi]
[begin=12,end=16,facet=word.IN,lex=with,str=with]
[begin=17,end=27,facet=word.NNS,lex=chopstick,str=chopsticks]
[begin=27,end=28,facet=word..,lex=.,str=.]