Another renumbering, so that all concurrent styles are bundled together

This commit is contained in:
Crista Lopes
2013-12-27 15:41:39 -08:00
parent de06b9b09c
commit 750016ac52
39 changed files with 0 additions and 72 deletions

View File

@@ -0,0 +1,18 @@
import operator
def top25(word_list):
"""
Takes a list of words and returns a dictionary associating
words with frequencies of occurrence
"""
if type(word_list) is not list or word_list == []:
return {}
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]