Guest User

Untitled

a guest
May 27th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. sentence_end_markers = set( '.!?' )
  2. sentences = ["That is, don't just write Java code in Python syntax"]
  3. current_sentence = ''
  4. f = "Python has enough in common with Java and C++ that adding a notch on your belt for Python as another of the N programming languages you know is pretty easy. Paradigm differences aren't a huge barrier to trying Python. "
  5.  
  6. for line in f:
  7.  
  8. s = line.strip().lower()
  9.  
  10. if len(s) > 0:
  11. current_sentence += s + "n"
  12. if len(s) == 0 or s[-1] in sentence_end_markers:
  13. current_sentence = current_sentence.strip()
  14. if len(current_sentence) > 10:
  15. sentences.append(str(current_sentence))
  16. current_sentence = ''
  17.  
  18. print('sentence', sentences)
  19.  
  20. sentence ["That is, don't just write Java code in Python syntax", 'pnyntnhnonn', 'hnansennnonungnh', 'inncnonmnmnonn', 'wnintnhjnanvna', 'annndcn+n+tnhnant', 'andndninnng', 'annontncnhonn', 'ynonunrbnenlnt', 'fnonrpnyntnhnonn', 'ansannnontnhnenr', 'onftnhnenpnrnongnrnanmnmninnng', 'lnannngnunangnens', 'ynonuknnnonw', 'inspnrnentntny', 'enansnyn.pnanrnandningnm', 'dninfnfnenrnennncnens', "anrnennn'nt", 'ahnungnebnanrnrninenr', 'tnotnrnyninnng', 'pnyntnhnonnn.']
  21.  
  22. print('[%s]' % ', '.join(map(repr, L)))
  23.  
  24. print(*L)
Add Comment
Please, Sign In to add comment