Question: IN JAVA CODE: Within the DataFileReader class, write a method createDictLetterFrequencies(String fileName, int n). This method should read the specified file and return a dictionary
IN JAVA CODE:
Within the DataFileReader class, write a method createDictLetterFrequencies(String fileName, int n). This method should read the specified file and return a dictionary of dictionaries. The outer dictionary associates the previous n letters of a word with an inner dictionary, which indicates the frequency at which the next letter appears based on those previous n letters. A single entry in the outer dictionary (n = 3) might look something like this:
This means that the three letters ing are followed by a 20% of the time, c 10% of the time, l 50% of the time, and y 20% of the time. (Note: I completely made up those percentages, so dont assume theyre accurate based on the file ) As you mightve guessed, this dictionary will be used to pick the next letter of each word based on its previous letters.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
