Skip to content

Instantly share code, notes, and snippets.

@luisfredgs
Last active April 18, 2020 20:25
Show Gist options
  • Save luisfredgs/f0e2f6bb8c89a7c0d81623cff3a16789 to your computer and use it in GitHub Desktop.
Save luisfredgs/f0e2f6bb8c89a7c0d81623cff3a16789 to your computer and use it in GitHub Desktop.
val=sorted(word_frequency.values())
higher_word_frequencies = [word for word,freq in word_frequency.items() if freq in val[-3:]]
print("\nWords with higher frequencies: ", higher_word_frequencies)
# gets relative frequencies of words
higher_frequency = val[-1]
for word in word_frequency.keys():
word_frequency[word] = (word_frequency[word]/higher_frequency)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment