Corrected errors in calculate_frequencies_whole_corpus