Skip to content

The Markov chain implementation from Kernighan and Pike's "The Practice of Programming"

Notifications You must be signed in to change notification settings

matt-dumler/markov-chain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Markov Chain

The Markov Chain algorithm is used to generate random output text from a given input text. This particular implementation is largely derived from the Kernighan and Pike implementation detailed in "The Practice of Programming." There is both a C and a C++ implementation, which intends to show the impact language choice has on the implementation of a program.

The input text, divots.txt, used for testing is the first chapter of a novel "Divots" which I arbitrarily chose from the "Golf stories" subject on Project Gutenberg. Below is a sample of the output generated by the program:

It was a revelation, and for several minutes sat staring moodily down into the club-house. It has been putting like a man of subtle and sinister mind. “I have a feeling that his peculiar manner was due entirely to the hotel never soared above a certain amount of decent humility, which keeps a man of subtle and sinister mind. “I have a hundred rotten rounds would undo him. I understand his bankruptcy may be that in the afternoon by Jimmy Fothergill, and it was that when, after waggling in a sickly manner and tottered off to his liking. “All square...

About

The Markov chain implementation from Kernighan and Pike's "The Practice of Programming"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published