Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sentence_end_markers = set( '.!?' )
- sentences = ["That is, don't just write Java code in Python syntax"]
- current_sentence = ''
- 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. "
- for line in f:
- s = line.strip().lower()
- if len(s) > 0:
- current_sentence += s + "n"
- if len(s) == 0 or s[-1] in sentence_end_markers:
- current_sentence = current_sentence.strip()
- if len(current_sentence) > 10:
- sentences.append(str(current_sentence))
- current_sentence = ''
- print('sentence', sentences)
- 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.']
- print('[%s]' % ', '.join(map(repr, L)))
- print(*L)
Add Comment
Please, Sign In to add comment