import cppy.cp_util as util


def extract_words(path_to_file:str) -> list:    
    return util.extract_file_words(path_to_file)

def frequencies( word_list:list ) -> dict :
    return util.get_frequencies(word_list)

def sort(word_freq:dict) -> list : 
    return util.sort_dict(word_freq)


if __name__ == "__main__":
    word_freqs = sort( frequencies(extract_words( util.testfilepath )) )
    util.print_word_freqs(word_freqs)