26 lines
604 B
Python
26 lines
604 B
Python
#!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# import re
|
|
# m = re.findall(r"")
|
|
|
|
def splitParagraphIntoSentences(paragraph):
|
|
''' break a paragraph into sentences
|
|
and return a list '''
|
|
import re
|
|
# to split by multile characters
|
|
|
|
# regular expressions are easiest (and fastest)
|
|
sentenceEnders = re.compile('[.!?]')
|
|
# sentenceList = sentenceEnders.split(paragraph)
|
|
return sentenceList
|
|
|
|
with open("how_2_use_drill.txt", "r" ) as source:
|
|
for line in source:
|
|
sentences = splitParagraphIntoSentences(line)
|
|
for s in sentences:
|
|
print s.strip()
|
|
|
|
# print(line)
|
|
|