| 1234567891011121314151617181920212223242526272829303132333435363738394041 | #!/usr/bin/python# -*- coding: utf-8 -*-#ma fonction # def splitParagraphIntoSentences(paragraph):#     ''' break a paragraph into sentences#         and return a list '''#     import re	#     #pour repérer l'expression régulière#     prose = re.compile(r"\wrill[a-z0-9._-]*\s(\w*\s\w*\s\w*\s)")#     #applique retour à la ligne en se repérant le regex#     List = prose.split(paragraph)#     return List#     #appliquer le variable 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()import reprose = re.compile(r"\w+.+rill+.+\s(\w*\s\w*\s\w*\s)\w*")prose2 = re.compile(r"(\w*\s\w*\s\w*)\s\w+.+rill\s\w*")with open("how_2_use_drill.txt", "r" ) as source:	for line in source:			newtext = prose2.findall(line)		print(''.join(newtext))# with open('export.txt', 'w') as f:# 	f.write()
 |