poemecanic~20171217-105932.py 481 B

12345678910111213141516171819
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. def splitParagraphIntoSentences(paragraph):
  4. ''' break a paragraph into sentences
  5. and return a list '''
  6. import re
  7. # to split by multile characters
  8. sentenceEnders = re.compile('[.!?]')
  9. sentenceList = split(paragraph)
  10. return sentenceList
  11. with open("how_2_use_drill.txt", "r" ) as source:
  12. for line in source:
  13. sentences = splitParagraphIntoSentences(line)
  14. for s in sentences:
  15. print s.strip()