N-Grams: Predictive Text

Ace your homework & exams now with Quizwiz!

In the Tester class, run the program testGetFollowsWithFile with the string "o" and the file confucius.txt. What is the size of the ArrayList of characters that follow "o"?

10453

In the EfficientMarkovModel class, comment out the print statements in the printHashMapInfo method that prints out the map. Make sure printHashMapInfo is called right after the HashMap is built. Then in the MarkovRunnerWithInterface class call the runModel method on an EfficientMarkovModel of order 5 with seed 531 on the file confucius.txt. What was the size of the largest ArrayList in the HashMap?

1549

In the Tester class, run the program testGetFollowsWithFile with the string "he" and the file confucius.txt. What is the size of the ArrayList of characters that follow "he"?

3715

In the EfficientMarkovModel class, comment out the print statements in the printHashMapInfo method that prints out the map. Make sure printHashMapInfo is called right after the HashMap is built. Then in the MarkovRunnerWithInterface class call the runModel method on an EfficientMarkovModel of order 6 with seed 792 on the file confucius.txt. How many keys are in the HashMap?

70162

Here is the code for runMarkovZero. 1 public void runMarkovZero() { 2 FileResource fr = new FileResource(); 3 String st = fr.asString(); 4 st = st.replace('\n', ' '); 5 MarkovZero markov = new MarkovZero(); 6 markov.setTraining(st); 7 for(int k=0; k < 3; k++) { 8 String text = markov.getRandomText(500); 9 printOut(text); 10 } 11 } Suppose the line markov.setRandom(18); is put between lines 7 and 8, as the first line in the body of the for loop. Which one of the following options best describes how this line affects the program?

Each of three randomly generated texts will all be identical.

For the class EfficientMarkovModel, which one of the following is the best place to call the buildMap method?

In the setTraining method.

After the completion of the MarkovModel class to generate random text by finding all the characters that follow N characters, set the random seed in the runMarkovModel method in the MarkovRunner class to 953 and pass in N as 7. Then run runMarkovModel on the file romeo.txt. What is the first line of text generated?

e uncle Capulet's orchard. Enter an officer, and light- more

In the MarkovRunner class in the runMarkovZero method, set the random seed to 1024 and run this method on the file confucius.txt. What is the first line of text output when this program runs?

eeuefmespwhsfoyu, s giowhersa eell; bma s.7shni:.at.ttdr.w aknf

After the completion of the MarkovFour class to generate random text by finding all the characters that follow four characters, set the random seed in the runMarkovFour method in the MarkovRunner class to 715. Then run runMarkovFour on the file romeo.txt. What is the first line of text generated?

man in a green, for that haste, for a foot in her from Tybalt!

After the completion of the MarkovOne class to generate random text by finding all the characters that follow one character, set the random seed in the runMarkovOne method in the MarkovRunner class to 365. Then run runMarkovOne on the file romeo.txt. What is the first line generated?

y O wirs bloay Ger. fo. tifthy The, A My; st- ie d, s. bluolate,


Related study sets

Information Systems Management WGU

View Set

leadership and management quiz 1

View Set

History: The Declaration Of Independence

View Set

Skills for Healthy Relationships Assignment

View Set