この質問に続いて、スタンフォードのcorenlpで見出し語化を試みています 。私の環境は: -
- Java 1.7
- エクリプス 3.4.0
- StandfordCoreNLP バージョン 3.4.1 (ここからダウンロード)。
私のコードスニペットは次のとおりです:-
//...........lemmatization starts........................
Properties props = new Properties();
props.put("annotators", "tokenize, ssplit, pos, lemma");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props, false);
String text = "painting";
Annotation document = pipeline.process(text);
List<edu.stanford.nlp.util.CoreMap> sentences = document.get(SentencesAnnotation.class);
for(edu.stanford.nlp.util.CoreMap sentence: sentences)
{
for(CoreLabel token: sentence.get(TokensAnnotation.class))
{
String word = token.get(TextAnnotation.class);
String lemma = token.get(LemmaAnnotation.class);
System.out.println("lemmatized version :" + lemma);
}
}
//...........lemmatization ends.........................
私が得る出力は次のとおりです:-
lemmatized version :painting
私が期待する場所
lemmatized version :paint
教えてください。