Skip to content

Instantly share code, notes, and snippets.

@Mistobaan
Created February 19, 2013 01:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mistobaan/4982459 to your computer and use it in GitHub Desktop.
Save Mistobaan/4982459 to your computer and use it in GitHub Desktop.
def histogram(filename):
with open(filename) as fd:
return Counter(w.strip().lower() for w in fd.read().split()
if not (w in nltk.corpus.stopwords.words('english') )).most_common()
print '\n'.join("{}:{}".format(x,y) for x,y in histogram('/Users/fabrizio/Desktop/input.txt'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment