Created
December 14, 2019 22:17
-
-
Save gibizer/a3a021365bdbbeaf0da02517bd199095 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
import re | |
with open('sherlock.txt') as f: | |
words = re.findall(r'\w+', f.read().lower()) | |
counter = collections.Counter(words) | |
for w, c in counter.most_common(20): | |
print(w, c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment