Markov Generator won't generate anything from a table

ignore my locked post, i accidently created that topic. dumb me.

I’ve been recently trying to figure out using boatbomber’s Markov Chain module by making trying to generate a tutorial title. Instead, it simply chooses a title from the table.

What now? I’ve been trying to figure this out on my own.

local MarkovChain = require(script.Parent.MarkovChain)

local Chain = MarkovChain.new()

local tutorials = {"How to make a game using Unity 3D", "3D Modelling for Dummies", "A Guide to Git", "Building Tutorial", "Scripting: The Ultimate Guide"}

for key, tutorial in pairs(tutorials) do
	Chain:Study(tutorial)
end

print(Chain:Generate())
1 Like

Sorta off topic, but sorry for the regarding my other post. I accidentally created the topic whilst writing, and I had to delete that post and replace it with this one.

Also, this issue is still open…

I got it to work by inputting the entirety of A Christmas Carol as a single call to Chain:Study(). Sample output:

“I have known him walk with Tiny Tim will live in the scanty light afforded by the smart sound its teeth made when we were helping ourselves before we met”

“I have not the one with a softening influence and gave a freer passage to his robe in supplication I am The voice was tremulous when he said Sunday You”

“I have endeavoured to diffuse in vain For the first syllable And being from the numbers of people running to and fro and patted children on the threshold of the”

One issue is that it always starts at the very beginning of the text, because there was only one :Study() call and therefore one single way to go from no words (an empty string) to any word. I’m not sure why it always starts with “I have” though, since there are plenty of other ways it can go after “I” (e.g. “might”, “know”).

Anyway, I think your issue is that you don’t have enough “training data”. Try coming up with a lot more, and make sure they have some words in common?

2 Likes