I need to parse sentences from a paragraph in Python. Is there an existing package to do this, or should I be trying to use regex here?
The nltk.tokenize module is designed for this and handles edge cases. For example:
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.']
2.1m questions
2.1m answers
60 comments
57.0k users