NaNoGenMo / 2016

National Novel Generation Month, 2016 edition.
https://nanogenmo.github.io
162 stars 7 forks source link

Another text rearrangement: split on pronoun #135

Open enkiv2 opened 7 years ago

enkiv2 commented 7 years ago

I had been considering some techniques I had seen for constructing text that could be rearranged reasonably, and I noticed that one technique was to always split on the division between subject and predicate. (There was a spoken-word poetry album that did this, such that you could play the album on shuffle and get a meaningfully different story each time.)

I figured, you could do this on an existing full-text corpus in an automated way if you were conservative about where you split. The easiest way seemed to be to split on pronouns, performing splits and random rearrangements on different pronouns separately in order to preserve agreement. So, that's what I did.

Resulting novel (based on Lovecraft): https://raw.githubusercontent.com/enkiv2/misc/master/nanogenmo-2016/lovecraft-split-on-pronouns.md Code: https://github.com/enkiv2/misc/blob/master/nanogenmo-2016/split-on-pronouns.sh

Essentially, all this code does is perform a sequence of splits, shuffles, and merges -- one for each of he/she/it/I -- and then discards singletons/scraps. The result almost makes sense -- a better result than markov & phrasechain, probably. (I was considering combining this with phrasechain, and maybe in the future I will, but for now shuffles seem to be sufficient.)