- Common bug: getting random text very similar to but not quite the same as the random text from the correct output.
Common cause: Copying a previous version of
.getRandomText()and forgetting to modify the call toRandom.nextInt()for the order of markov model. Think about what you need to account for when you randomly generateindexto make the first key. - Common bug: getting the wrong size for the largest value in the
HashMapinEfficientMarkovWord.
Common causes:
- Using the old
.getFollows()method to build theHashMap. You should not call.getFollows()to build the map or add to the map in.getFollows(). You should first build the map and then use the completedHashMapin.getFollows(). - Make sure you are using the correct conditions to stop the loop over the training text to build the
HashMap(make sure you are not stopping too early and missing some of the text).
- Using the old
- Why is my
EfficientMarkovWordtaking longer than myMarkovWord?
Make sure you are only passing over the training text once to build the map. Don’t call your old
.getFollows()method in.buildMap(), or add to yourHashMapin.getFollows(). You should first build theHashMap, and use the completedHashMapin.getFollows()rather than searching the training text again.
