Clean up
This commit is contained in:
@@ -4,10 +4,6 @@ import sys, re, operator, string
|
||||
#
|
||||
# The functions
|
||||
#
|
||||
def get_input(arg):
|
||||
assert(len(sys.argv) > 1), "You idiot! I need an input file! I quit!"
|
||||
return sys.argv[1]
|
||||
|
||||
def extract_words(path_to_file):
|
||||
assert(type(path_to_file) is str), "I need a string! I quit!"
|
||||
assert(path_to_file), "I need a non-empty string! I quit!"
|
||||
@@ -59,7 +55,7 @@ def top25_freqs(word_freqs):
|
||||
#
|
||||
try:
|
||||
assert(len(sys.argv) > 1), "You idiot! I need an input file! I quit!"
|
||||
word_freqs = sort(frequencies(extract_words(sys.argv[1])))
|
||||
word_freqs = sort(frequencies(remove_stop_words(extract_words(sys.argv[1]))))
|
||||
|
||||
assert(len(word_freqs) > 25), "OMG! Less than 25 words! I QUIT!"
|
||||
for tf in word_freqs[0:25]:
|
||||
|
||||
Reference in New Issue
Block a user