HTMLify
word_frequency.py
Views: 510 | Author: abh
1 2 3 4 5 6 7 | def word_frequency(text: str) -> dict: words = text.split() word_f = {} for word in words: w = word.strip(".,!?").lower() word_f[w] = word_f.get(w,0)+1 return word_f |