How can I split a text into sentences using the Stanford parser?

后端 未结 12 1914
终归单人心
终归单人心 2020-11-27 14:52

How can I split a text or paragraph into sentences using Stanford parser?

Is there any method that can extract sentences, such as getSentencesFromString()

12条回答
  •  旧巷少年郎
    2020-11-27 15:39

    A variation in the @Kevin answer which will solve the question is as follows:

    for(CoreMap sentence: sentences) {
          String sentenceText = sentence.get(TextAnnotation.class)
    }
    

    which gets you the sentence information without bothering with the other annotators.

提交回复
热议问题