Question: Java Markov Chain Text Generater Prefix/Suffix class Map of prefixes to suffix probabilities. This map will be filled based on the sequence given to the

Java Markov Chain Text Generater Prefix/Suffix class

Map of prefixes to suffix probabilities. This map will be filled based on the sequence given to the addItems method. Remember, addItems may be called more than once.

Create private nested classes for the prefixes and suffix probability objects. It is up to you whether they should be static or non-static classes:

Prefix key class A simple implementation would wrap a list of Strings. Since this going to be used as a Map key, youll need to override the equals and hashCode methods, at least.

Suffix probabilities class A simple implementation might just wrap a list of Strings, with more common values appearing more often in the list. This does have the disadvantage of taking up more space than a fancier implementation.

A more complicated implementation might wrap a map of unique suffix strings to frequency or probability values. This implementation would save space, but would be trickier to implement correctly.

However you choose to implement this, you should have a way of taking a random number generator and selecting a suffix, with more common frequencies being more likely.

Write the classes:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!