Created
April 24, 2019 16:09
-
-
Save alinazhanguwo/5da08b1a0ebe1a7c63e89127ca5572b0 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
# Dictionary of all words from train corpus with their counts. | |
words_counts = {} | |
from collections import Counter | |
words_counts = Counter([word for line in X_train for word in line.split(' ')]) | |
# Sorting | |
most_common_words = sorted(words_counts.items(), key=lambda x: x[1], reverse=True)[:10] | |
# Top 10 | |
most_common_words[:10] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment