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.']
1.4m articles
1.4m replys
5 comments
57.0k users