如何在Python中用句子分解段落

Dav*_*542 9 python regex text-segmentation

我需要解析Python中段落的句子.是否有现成的包,或者我应该尝试在这里使用正则表达式?

str*_*cat 31

nltk.tokenize模块专为此设计并处理边缘情况.例如:

>>> from nltk import tokenize
>>> p = "Good morning Dr. Adams. The patient is waiting for you in room number 3."
>>> tokenize.sent_tokenize(p)
['Good morning Dr. Adams.', 'The patient is waiting for you in room number 3.']
Run Code Online (Sandbox Code Playgroud)