Stanford CoreNLP gives NullPointerException

后端 未结 2 726
一整个雨季
一整个雨季 2021-01-16 14:26

I\'m trying to get my head around the Stanford CoreNLP API. I wish to get a simple sentence to be tokenized using following code:

    Properties props = new          


        
2条回答
  •  伪装坚强ぢ
    2021-01-16 15:05

    This line retrieves sentence annotations.

    List sentences = document.get(SentencesAnnotation.class);
    

    But your pipeline contains only the tokenizer, not the sentence splitter.

    Change the following line:

        props.put("annotators", "tokenize, ssplit"); // add sentence splitter
    

提交回复
热议问题