Live data from Hacker News

A kinda okay text generator

blog.ftql.pw

21–30 of 33 posts

Re: A kinda okay text generator

#21

You’re going to want to look at https://en.wikipedia.org/wiki/Kneser–Ney_smoothing for further improvements on an ngram based approach.

Or even just Stupid Backoff[1]: If you can't find anything of length N, try N-1 but lower the probability by a fixed ratio (0.4).

[1] Page 2, equation 5 of https://www.aclweb.org/anthology/D07-1090.pdf#page=2

Re: A kinda okay text generator

#22
POS tagging is a nice touch, but I've long wondered if there's a way to combine Markov sentence generation with actual grammatical rules -- that if there's an opening parenthesis there has to be a closing one, dependent clauses, etc. It would need to both gramatically parse the inputs as well as produce grammar trees for the outputs that would then be filled in by Markov chains that fit the trees...

Heck, even do it at a level larger than sentences too, so questions are followed by answers, a line of dialog is followed by a response, paragraphs follow a realistic distribution of lengths...

Re: A kinda okay text generator

#23

POS tagging is a nice touch, but I've long wondered if there's a way to combine Markov sentence generation with actual grammatical rules -- that if there's an opening parenthesis there has to be a closing one, dependent clauses, etc. It would need to both gramatically parse the inputs as well as produce grammar trees for the outputs that would then be filled in by Markov chains that fit the trees... Heck, even do it…

Hmm. A Markov chain where you actually do some kind of search? You build up a chain then backtrack and retry as necessary until you get something meeting the requirements.

Re: A kinda okay text generator

#24
post #20

Children's poetry makes for fun source texts for these projects. In this case dumping a bunch of old poems generated mostly gibberish but I found the following examples amusing. While here on my deathbed I try to relate My many misfortunes and miseries great. Poor thoughtless young thing! If I recollect right, I began life in March, on a clear frosty night; And before I could see or was half a week old, I nearly had…

Lewis Carrol is actually really fun in just a pure markov chain; usually the diction is sufficient to put someone in the mood for Carrol, which means nobody really expects it to make sense anyways.

Re: A kinda okay text generator

#25
post #11
post #8

What does "cweep" mean?

If it helps, here's the full paragraph: “We’ll send the infantwy down by the swamps,” Denísov continued. “They’ll cweep up to the garden; you’ll wide up fwom there with the Cossacks”—he pointed to a spot in the forest beyond the village—“and I with my hussars fwom here. And at the signal shot...”

What are "sramps"?

Re: A kinda okay text generator

#26

POS tagging is a nice touch, but I've long wondered if there's a way to combine Markov sentence generation with actual grammatical rules -- that if there's an opening parenthesis there has to be a closing one, dependent clauses, etc. It would need to both gramatically parse the inputs as well as produce grammar trees for the outputs that would then be filled in by Markov chains that fit the trees... Heck, even do it…

Hmm. A Markov chain where you actually do some kind of search? You build up a chain then backtrack and retry as necessary until you get something meeting the requirements.

Sounds like getting some sort of context free grammar out of it. There is a LR grammar algorithm that is very fast, you could use a Markov chain to generate and then a CFG to verify

Re: A kinda okay text generator

#27
post #20

Children's poetry makes for fun source texts for these projects. In this case dumping a bunch of old poems generated mostly gibberish but I found the following examples amusing. While here on my deathbed I try to relate My many misfortunes and miseries great. Poor thoughtless young thing! If I recollect right, I began life in March, on a clear frosty night; And before I could see or was half a week old, I nearly had…

Very nice! Especially "till loop and button failing both at last it flew away"

Feels like it's missing a sentence at the end that rhymes with tailor (eg "and equally assaults us the great big sleep, from skilled oarsmen to new sailors)

Re: A kinda okay text generator

#28

POS tagging is a nice touch, but I've long wondered if there's a way to combine Markov sentence generation with actual grammatical rules -- that if there's an opening parenthesis there has to be a closing one, dependent clauses, etc. It would need to both gramatically parse the inputs as well as produce grammar trees for the outputs that would then be filled in by Markov chains that fit the trees... Heck, even do it…

Hmm. A Markov chain where you actually do some kind of search? You build up a chain then backtrack and retry as necessary until you get something meeting the requirements.

See [0] for a method combining branch and prune with Markovian probabilities. I did a hacky version of my interpretation of this work at [1].

[0] https://link.springer.com/article/10.1007/s10601-010-9101-4

[1] https://github.com/kastnerkyle/pachet_experiments

Re: A kinda okay text generator

#29
post #24
post #20

Children's poetry makes for fun source texts for these projects. In this case dumping a bunch of old poems generated mostly gibberish but I found the following examples amusing. While here on my deathbed I try to relate My many misfortunes and miseries great. Poor thoughtless young thing! If I recollect right, I began life in March, on a clear frosty night; And before I could see or was half a week old, I nearly had…

Lewis Carrol is actually really fun in just a pure markov chain; usually the diction is sufficient to put someone in the mood for Carrol, which means nobody really expects it to make sense anyways.

One of my favorite parts of Gödel, Escher, Bach was the description of translating Lewis Carroll's Jabberwocky into various languages -- particularly troublesome since the original poem contains few English words to begin with.

Re: A kinda okay text generator

#30
post #26

Earlier quoted context omitted.

Hmm. A Markov chain where you actually do some kind of search? You build up a chain then backtrack and retry as necessary until you get something meeting the requirements.

Sounds like getting some sort of context free grammar out of it. There is a LR grammar algorithm that is very fast, you could use a Markov chain to generate and then a CFG to verify

Or a CFG to generate at a high level and a Markov chain to fill in the details
Post reply on HN