tags:

views:

343

answers:

2

This is my first time working with Markov chains.

I want to combine two sources of text and get a readable Markov Chain. The implementation I'm using is here - the sources of text are stripped of markup, etc.

I was first exposed to Markov Chains with the Ruby Rbot IRC bot. Their Markov plugin source is here.

I'm finding my use of the PHP markov algorithm's output is messy. One thing I am able to see is that the rbot implementation chains two words together to start. Is there a clear way to make this happen with the PHP implementation I've linked? If not, is there a PHP implementation that can do this?

+3  A: 

Do you want to do word chaining or letter chaining? The PHP implementation you have above does letter chaning, which will tend towards gibberish, not just words seemingly out of place, at low order values. It looks like the rbot does word chaining, which implicitly generates more 'readable' text.

Markov chaining is pretty simple to implement. I don't think it would be too hard to adapt the PHP source to split and chain by word instead of letter. I've been thinking of making a pure sql stored procedure which can take a table and generate a string.

Justin
I would like letter chaining. Can you point me to some examples so I can figure out how to do that with the PHP source?
andyh_ky
A: 

Interesting...I never knew Markov chains until now. How is can that be applied to the web?

shrimpwagon
http://www.codinghorror.com/blog/2008/06/markov-and-you.html
mixdev