My computer re-writes “A Christmas Carol”

(I feel this has a certain Joyce-like quality. It is generated from a statistical model built by analysing the original)

merry? you’re poor bob cratchit, when everybody had been a little crutch, and called good old gentlemen, lolling at it had happened on the high-road, by the genii; there sprung a clear, cold, rigid, dreadful eath, set himself in; double-locked himself of death, not shut up; and seeing that everything within himself, and became as observing his mind to him.

“one of standing there: perfectly tumultuous, for this was overcome by other fiddler plunged a touch his mouldy old sinner! hard and skirts, and peter a vague uncertain horror, looking through the three quarters in a hut, and so hurried out plain. i’m quite enough now, but never had pinched, and putting off the recollection of night, said the spirit’s robe, or two children; wretched, abject, frightful, hideous, miserable. they went on the year, when it to greet them. here, as more dances, and put to the lord mayor, in the dish), they didn’t live in scraping the power to come?” said bob, “the colour hurts my boys!” said mrs. fezziwig, clapping his christian name; and a bull, or perish.

“would it for on the merchants; who would dance, cried one murmur of which the back again quite satisfied. “walk-er!” exclaimed another. to have touched her silken rustlings, and was the pavement stones were not turn came tiny tim! and looked at scrooge’s niece’s sisters, for such weather sat in a rush immediately connected with himself, he had set on, outpouring, with quaint dutch merchant long ago, you doubt his cold within two to say,” said scrooge, “a poor abode! were sharp look-out in their way he told you bear you point,” said the solution of things, if i ask me no doubt!” “to whom we be repeated.

i tell it seemed as before—though at last time of the struggle, if there was nothing at the main street, at him that is; strictly in the more and gave a bad repute. the knocker caught the gentleman, who perhaps the party, but of my life. as the ground; which effort, not afraid i don’t you could only time in your understanding, and desks. at it. it’s the ghost, they came, one when he could no peace. incessant labour in the party, which the ghost, “if these boys had little bob, the naked laths were not forgetting in the poem, they sought to greet them. here, old marley’s funeral brings me no more alarming than to go, if the shutters up,” cried scrooge, while the strife and turned up and left the black enough, and down below; as likely to do, and it must be a peculiar flavour in his hungry brothers in his way i would have run there was. a splendid joke: a low roof quite happy.

“if they come back again, and looked upon a rusty keys, padlocks, ledgers, deeds, and wished to him. “god bless it!” you say, ‘uncle scrooge!’ ” “i seek!” exclaimed in letting scrooge’s niece’s sister—the plump sister was. the notion of his cravat; put them did), on a round with perhaps it better than there were so liberal and like so like sticks of their dinners and see the dance; advance and then indeed he could have the time there was not to bed, before him for that was perhaps two apprentices, who suffers by the door. it was. the hour. the bleak, dark brown air. the door, and his usual character, he was closely followed to say, topper?”

“my little mirrors had been two persons meeting. scrooge regarded it is upon its distinctness: being water-proof; their capacity for its rapid little cell beyond, a wonderful party, but you were in that the heart upon. “it’s hanging up in reference to sit close to save that place; fezziwig took tiny tim! she often the door. not the yellow tail, with it.” the first a smile, “i don’t you think?” the wall, and had had a simple green a special desire to see me. i know what is all bounds to such a fine one guiding principle to himself.

stop! there on at my opinion of delight (surveying one of shutting up to happiness!” which his arm off. he is particularly dead against you? if there he (not proud, although the satisfaction of gravy (ready beforehand in words choked up as you trouble me?” the chimes of this time we could he used to bob trembled, and lemons, and back again quite used to avoid me; and i think otherwise if i know a hole in a truth it is dead.” “am i?” she answered, gently. “all in an infernal atmosphere of its own kind, forgiving, charitable, pleasant as in with a children’s faces, hushed and peter cratchit he had as a thing like a bear. at this man that christmas present; and winking their fragrance, ancient walks among the wise men see.”

“why, bless me!” scrooge pressed it here, my clerk observed with a most extravagant contortions: scrooge’s niece, by the door of the heart alive, to say about to him. he were a child, and i took his stockings. “i hope not.” martha didn’t know where to hear it! “scrooge and clasped about the malady in a man, just as if he had fallen up and at blindman’s-buff.
“no, indeed,” said mrs. dilber, laughing.
“because it cried, tight by a monstrous masses of the house like it were
perfectly convinced he looked just assigned; and by houses; overrun by this
was very night.”
“mr. marley entered! there’s more worthless and fresh that
his reappearance, he had acted like race-horses. “am i told them with a
very dark, so hurried to eat. “it’s christmas time. i know.”

—-

the code, for those who like such things – just a simplistic Markov Chain

var text = $(‘input’).innerHTML;
var text_array = text.split(/\s/);

var chain = {};

for(var i = 0; i < text_array.length – 1; i++)
{
var word = text_array[i].toLowerCase();
var next_word = text_array[i + 1].toLowerCase();
if(chain[word]) {
chain[word].push(next_word);
}
else {
chain[word] = [next_word];
}
}

function generate(genlength) {
var next_choices = $H(chain).keys();
for(var i = 0; i < genlength; i++) {
var choice = next_choices[Math.floor(Math.random() * next_choices.length)];
$(‘output’).innerHTML += choice + ‘ ‘;
next_choices = chain[choice];
}
}

generate(1000);

// debug function
function viewChain() {
$H(chain).each(function(item) {
$(‘output’).innerHTML += ‘‘ + item[0] + ‘: ‘;
for(var i = 0; i < item[1].length; i++)
{
$(‘output’).innerHTML += item[1][i] + ‘, ‘;
}
$(‘output’).innerHTML += ”;
});
}

  1. No trackbacks yet.

Leave a comment