Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having trouble with a problem in my Java programming class. Its on Map Collection/Random Writer. The goal is to write a program to

I am having trouble with a problem in my Java programming class. Its on Map Collection/Random Writer. The goal is to write a program to generate random text based on the style of another writers work. Below is the outline for the assignment.

Problem:

There is a classic problem by the same name, "Random Writer", that was proposed by computer scientist Joseph Zachary. He found that there is a relation between the style of a writers work and the probability of a word showing up next in that persons writing. The accuracy of randomized text to the style of the writer could be increased by using chains of words and tracking the word to come next.

For instance the word sequence "I like" could be followed by many words. If we have the text body:

'

I was walking home one day and thought to myself: "I like ice cream." So I changed my destination. Once I got to the store I was unable to make up my mind on the type of ice cream to buy.

'

'I was' is followed by two possible words in the sample text so in my random text generator, if this was my input text, I should equally randomly choose between walking and unable.

Your task is to create a solution to this problem. Read in a text file and read an integer from the user. The text file will be a long text file of a writers work found on the internet. This will be the source of the statistics for the predictions of the next word in your random writer. The integer from the keyboard should be the length of the chain of words to track for the statistics on word occurrence probability. A solid way to tackle this problem is to read in enough words to act as the key and then the next word would be added into a list which would be value of that key.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What were the issues and solutions proposed by each team?

Answered: 1 week ago

Question

Were all members comfortable brainstorming in front of each other?

Answered: 1 week ago

Question

5. What information would the team members need?

Answered: 1 week ago