Demo entry 6643398

p2-1-a

   

Submitted by anonymous on Sep 27, 2017 at 19:52
Language: Python 3. Code size: 197 Bytes.

import nltk
tfile = open('sample.txt', encoding='utf-8')
rawtext = tfile.read()
tokens = nltk.word_tokenize(rawtext)
print(tokens)
words = [word.lower() for word in tokens ]
print(len(words))

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).