And this one too
This commit is contained in:
11
19-plugins/plugins-src/frequencies1.py
Normal file
11
19-plugins/plugins-src/frequencies1.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import operator
|
||||
|
||||
def top25(word_list):
|
||||
word_freqs = {}
|
||||
for w in word_list:
|
||||
if w in word_freqs:
|
||||
word_freqs[w] += 1
|
||||
else:
|
||||
word_freqs[w] = 1
|
||||
return sorted(word_freqs.iteritems(), key=operator.itemgetter(1), reverse=True)[:25]
|
||||
|
||||
Reference in New Issue
Block a user