[Haskell-cafe] Markov Text Generator & Randomness

Ben Gamari ben at smart-cactus.org
Thu Jul 24 02:39:56 UTC 2014


Charles-Pierre Astolfi <cpa at crans.org> writes:

> Hi -cafe,
>
> I'm coding a Markov Text Generator (of order 1). Basically, you have a
> source text, and knowing the frequencies of pairs of consecutive
> words, you generate a somewhat syntactically correct text from this.
>
> Here's the link to my code and to a source text you can use as example.
>
> test.txt
> http://lpaste.net/raw/4004174907431714816
> code
> http://lpaste.net/4147715261379641344
>
> The kickers is that this code generates sentences with consecutive
> words that never appears next to each other in the source text.
> For example, the code generated "They sat over at because old those
> the lighted.", but "over at" never occurs in the source text, so it
> shouldn't occur in a generated sentence.
>
You mean like,

    "The old man looked from his glass across the square, then over at the waiters."

Otherwise my cursory look turned up no bugs.

Cheers,

- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140723/10f29460/attachment.sig>


More information about the Haskell-Cafe mailing list