from cppy.cp_util import * def readfile(path_to_file, func): data = read_file(path_to_file) func(data, frequencies) def extractwords(str_data,func): func(extract_str_words(str_data), sort) def frequencies(word_list, func): wf = get_frequencies(word_list) func(wf, printall) def sort(wf, func): func(sort_dict(wf), None) def printall(word_freqs, func): print_word_freqs(word_freqs) if __name__ == "__main__": readfile(testfilepath, extractwords)