Minor renaming
This commit is contained in:
@@ -33,15 +33,12 @@ def frequencies(word_list, func):
|
|||||||
wf[w] += 1
|
wf[w] += 1
|
||||||
else:
|
else:
|
||||||
wf[w] = 1
|
wf[w] = 1
|
||||||
func(wf, format)
|
func(wf, format_text)
|
||||||
|
|
||||||
def sort(wf, func):
|
def sort(wf, func):
|
||||||
func(sorted(wf.iteritems(), key=operator.itemgetter(1), reverse=True), print_all)
|
func(sorted(wf.iteritems(), key=operator.itemgetter(1), reverse=True), print_all)
|
||||||
|
|
||||||
def no_op(func):
|
def format_text(word_freqs, func):
|
||||||
return
|
|
||||||
|
|
||||||
def format(word_freqs, func):
|
|
||||||
text = ""
|
text = ""
|
||||||
for (w, c) in word_freqs[0:25]:
|
for (w, c) in word_freqs[0:25]:
|
||||||
text = text + w + ' - ' + str(c) + '\n'
|
text = text + w + ' - ' + str(c) + '\n'
|
||||||
@@ -51,7 +48,10 @@ def print_all(text, func):
|
|||||||
print text
|
print text
|
||||||
func(None)
|
func(None)
|
||||||
|
|
||||||
|
def no_op(func):
|
||||||
|
return
|
||||||
|
|
||||||
#
|
#
|
||||||
# The main function
|
# The main function
|
||||||
#
|
#
|
||||||
read_file(sys.argv[1], filter_chars)
|
read_file(sys.argv[1], filter_chars)
|
||||||
|
|||||||
Reference in New Issue
Block a user