您可以检查documentPreprocessor类。以下是一个简短的摘要。我认为可能还有其他方式可以做您想要的事情。
String paragraph = "My 1st sentence. “Does it work for questions?” My third sentence.";Reader reader = new StringReader(paragraph);documentPreprocessor dp = new documentPreprocessor(reader);List<String> sentenceList = new ArrayList<String>();for (List<HasWord> sentence : dp) { // SentenceUtils not Sentence String sentenceString = SentenceUtils.listToString(sentence); sentenceList.add(sentenceString);}for (String sentence : sentenceList) { System.out.println(sentence);}


