NaNoGenMo / 2019

National Novel Generation Month, 2019 edition.
97 stars 5 forks source link

Minimalist synonym replacement #97

Open aparrish opened 4 years ago

aparrish commented 4 years ago

I made a quick #NNNGM (Nano-NaNoGenMo) entry—a <256 character Python program that replaces every word in stdin at random with another word that occurred in the same 1-word window context (i.e., the word before and the word after). This is effectively a (very) minimalist version of replacing words with their nearest-neighbor word vector "synonym."

It's pretty easy to trawl through this to find weird poetic bits:

Folding back the bar--wait, I was over the bed. Though none of the most massive, it yet stood the scrutiny tolerably well. What then glanced round the bench, and besides the bedstead and centre table, could discover no other furniture belonging to the head; but a rude shelf, the four walls, and a papered fireboard representing a man maintained a god. Such things not properly belonging to the counterpane, there was a hammock lashed up, and call upon the transom, in one had a large seaman's bag, containing the harpooneer's wardrobe, no doubt in each of the land trunk. But there was a parcel of outlandish bone fish hooks suspending the air over the doxology for a corroded harpoon standing on the Rights to the fabric?

nickmontfort commented 4 years ago

Everything about this is great, including the introductory PG text:

This work is nothing new under construction, email me board ye can help.

It is mostly from Michael Hart's salary at Carnegie-Mellon University, and harpooneers of sporadic gifts; this breaching is wonderfully solved in a few more years, so we are looking for heaven's sake to open it, as we don't want Project Gutenberg to pass, so sweet on one person.

And beyond:

A tramping of sea he was still from the wharf with the voyage. I was flung open, and in countersinking for a particular set of mariners enough.

Plus I like the [w:2]+ in the code which is just there to ensure the output starts with "***The Project."

nickmontfort commented 4 years ago

Also, I found that 2 words of context before a word and 0 words after seems to be interesting. 2 words before and 1 word after seemed to change very little except a few closed-class words.