Painting Blue Code
Simple, self-explanatory code snippets.
2015-07-13
PYTHON - Break a paragraph into a sentences list
import re
text = 'This is. A paragraph with. Three sentences.'
sentences = re.split(r'(?<!\w\.\w.)(?<![A-Z][a-z]\.)(?<=\.|\?)\s', text)
for item in sentences:
print(item)
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment