5

Problem: Is there an option to stem the words using stanford-core-nlp? I am not able to find one! I am using the stanford-corenlp-3.5.2.jar.

Code:

public class StanfordNLPTester {

  public static void main (String args[]){

    String paragraph = "A long paragraph here";

    Properties properties = new Properties();
    properties.put("annotators","tokenize,ssplit,pos,lemma,ner,depparse");
    StanfordCoreNLP pipeline = new StanfordCoreNLP(properties);
    Annotation annotation = new Annotation (paragraph);
    pipeline.annotate(annotation);
    pipeline.prettyPrint(annotation,System.out);
  }
}
raikumardipak
  • 1,461
  • 2
  • 29
  • 49

1 Answers1

8

You'll need to get this from GitHub: https://github.com/stanfordnlp/CoreNLP

This class will provide what you want:

https://github.com/stanfordnlp/CoreNLP/blob/master/src/edu/stanford/nlp/process/Stemmer.java

The main() method of that class shows example usage of the stemmer.

You can continue to use the stanford-corenlp-3.5.2.jar and just include that one extra class, since everything that class depends on is in the jar.

StanfordNLPHelp
  • 8,699
  • 1
  • 11
  • 9
  • 17
    why that class is in the repo but not in the jar? – piotrek Jan 06 '16 at 14:28
  • @StanfordNLPHelp Could you please answer this question too: https://stackoverflow.com/questions/50924921/execution-time-of-stanford-corenlp-on-other-languages – SahelSoft Jun 19 '18 at 16:44