fork(2) download
  1. import re
  2. paragraph = "Mr. Smith bought cheapsite.com for 1.5 million dollars, i.e. he "\
  3. "paid a lot for it. Did he mind? Adams Jones Jr. thinks he "\
  4. "didn't. In any case, this isn't true... Well, with a "\
  5. "probability of .9 it isn't."
  6.  
  7. sentenceEnd = re.compile('(?<=(?<!Mr)(?<!Mrs)(?<!Ms)(?<!Dr)(?<!Jr)[.!?])\s{1,2}(?=[A-Z])')
  8. sentenceList = sentenceEnd.split(paragraph)
  9.  
  10. for sentence in sentenceList:
  11. print(sentence)
Success #stdin #stdout 0.1s 10088KB
stdin
Standard input is empty
stdout
Mr. Smith bought cheapsite.com for 1.5 million dollars, i.e. he paid a lot for it.
Did he mind?
Adams Jones Jr. thinks he didn't.
In any case, this isn't true...
Well, with a probability of .9 it isn't.