git @ Cat's Eye Technologies NaNoGenLab / 6a77890
Document the quick-and-dirty-markov experiment better. Chris Pressey 10 years ago
1 changed file(s) with 24 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
33 Hypothesis
44 ----------
55
6 I can write a Markov chain processor thing from scratch during my evening
6 I bet I can write a Markov chain processor thing from scratch during my evening
77 commute, having not written one for umpteen years, and having never really
88 studied them formally.
99
1818 ------
1919
2020 * Panic mildly.
21 * Keep a map from every word to a map of words to frequencies.
2122 * For each word in the input, update the element of the map of the last
22 word to this word by increasing its frequency by one
23 * Then pick a random word
24 * Output the word
23 word to this word by increasing its frequency by one.
24 * Then pick a random word.
25 * Output the word.
2526 * Pick a random number between 1 and the total frequencies of its successor
26 words in the map
27 * Change to that word and repeat the last two steps until satisfied
27 words in the map. Pick the successor word associated with that number.
28 * Change to that word and repeat the last two steps until satisfied.
2829
2930 Observations
3031 ------------
3132
32 Sample outputs:
33 I managed to write something which I think of as a "zero-memory" Markov
34 process (which I've tried to describe above) fairly quickly. The gibberish
35 it outputs certainly *looks* like a Markov process traversal:
3336
34 Of version 1, running on "The Rivet in Grandfather's Neck":
37 Running on "The Rivet in Grandfather's Neck":
3538
3639 > croquettes adorned the genealogies of her from here and there was a bantering flirt of clarice pendomer suggested patricia's bedroom he made much better in the honor the alphabet what between these fogies so often do up the remainder of course she did not especially anxious to serve my wife now musgrave could conceivably have been a grim routine perished just because i liked you are like that the immunity musgrave had long since his sister was a buried his saber hacked upon a fashion and praise or do appeared to a person of her had no whit the others are
3740
38 Of version 1, running on a whole bunch of texts::
41 Running on a whole bunch of texts:
3942
40 thrash him in a fiery orator and there grew colder and inheritance the long pine hills hoffmann and all other waggons and that seemed to know all that they cause that the pretence of which had got there are you who had seen him mohammed er-rahmân led by a cry a wave one's eyes across his mouth was open rupture were served in its fastenings what is not know how is about hamilton's expression of being driven off by shard's rakish craft putting forth then they knew as if without being put in my gaze from a chance the priest hortotef
43 > thrash him in a fiery orator and there grew colder and inheritance the long pine hills hoffmann and all other waggons and that seemed to know all that they cause that the pretence of which had got there are you who had seen him mohammed er-rahmân led by a cry a wave one's eyes across his mouth was open rupture were served in its fastenings what is not know how is about hamilton's expression of being driven off by shard's rakish craft putting forth then they knew as if without being put in my gaze from a chance the priest hortotef
4144
42 ### And then I wrote another version ###
45 Encouraged by the apparent success here, and with a good chunk of time
46 remaining on the train, I tried to write a version with memory, which I'm
47 not sure I've ever done before. It keeps a mapping between adjacent
48 pairs of words, to maps of frequencies of following words. It might be
49 possible to extend it to series of 3, 4, etc words, but not designed
50 with that in mind. I did finish it, but I'm not certain it's correct,
51 in the sense of being what Markov had in mind. But it does produce
52 Markov-like gibberish, anyway.
4353
44 Of version 2, running on "The Rivet in Grandfather's Neck":
54 Version 2, running on "The Rivet in Grandfather's Neck":
4555
4656 > splendor such as were really a credit to one's imagination.. for instance but i have to get nothing in particular and tossed her head to one another when we too have gone to alabama and that her picture shows her to be born locked up in a specious manner and perceived a protrusion which bore an undeniable resemblance to the plane of seeming to rudolph musgrave and he found it as for miss stapylton gazed up at the top of the melody was somewhat ruffled she was not a penny of such fripperies i don't see what you are no such things
4757
48 Of version 2, running on a whole bunch of texts:
58 Version 2, running on a whole bunch of texts:
4959
50 > cruelly upon the point of hurling himself upon me for awhile only just recalled his existence imagine that even without visiting the shops to inquire into the mockery of a tramp steamer which had stolen the slipper of the stolen slipper from its streets leaving all present and as he gazed proudly at it there were no more than a yard of us set to music and singing got on a lawn and they had done a rifle cracked to his feet as i was come to you not mention having noticed when he had left the verandah to take me to
60 > cruelly upon the point of hurling himself upon me for awhile only just recalled his existence imagine that even without visiting the shops to inquire into the mockery of a tramp steamer which had stolen the slipper of the stolen slipper from its streets leaving all present and as he gazed proudly at it there were no more than a yard of us set to music and singing got on a lawn and they had done a rifle cracked to his feet as i was come to you not mention having noticed when he had left the verandah to take me to