You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
869 B
25 lines
869 B
from cppy.cp_util import *
|
|
|
|
|
|
def extractWords(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!"
|
|
return extract_file_words(path_to_file)
|
|
|
|
def frequencies(word_list):
|
|
assert(type(word_list) is list), "I need a list! I quit!"
|
|
assert(word_list != []), "I need a non-empty list! I quit!"
|
|
return get_frequencies(word_list)
|
|
|
|
def sort(word_freqs):
|
|
assert(type(word_freqs) is dict), "I need a dictionary! I quit!"
|
|
assert(word_freqs != {}), "I need a non-empty dictionary! I quit!"
|
|
return sort_dict(word_freqs)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
try:
|
|
word_freqs = sort(frequencies(extractWords( testfilepath )))
|
|
print_word_freqs(word_freqs)
|
|
except Exception as e:
|
|
print(" Something wrong: {0}".format(e) ) |