An uneducated attempt at using Markov chains to generate sentences.
####Files ######1-markov.cpp Source code for first-order markov chain construction and sentence generation.
######LICENSE License file
######Readme.md This file
######makefile Generic makefile
######out.svg
The graph generated by first-order Markov chain construction from meat
.
Rendered with GraphViz.
####Compiling Tested and working with g++ 4.8.2 or clang++ 3.2-11 and Boost 1.53. Does not work with g++ 4.7.2.
To compile 1-markov.cpp simply run make
.
To add edge output in GraphViz format, append -DGRAPHVIZ
to the CXX_FLAGS
line in makefile
.
####Running
./1-markov.out <sentences=1>
The program takes the number of sentences to be generated as the only argument.
Input is captured and used in Markov chain construction until EOF.
An example of generating 5 sentences using meat
as a corpus would be ./1-markov.out 5 < meat