2020
2020 copied to clipboard
"Cheaply the satisfied vampyre was trying the neighbourhood" -- Nano-NaNoGenMo entry
Pretty straightforward: let's use some heuristics to fish a text for verbs, nouns, adjectives and adverbs and then generate random sentences using patterns.
And do it in <=256 characters because #NNNGM and I have not played Perl golf for many years.
$ perl -0pe'$_=lc;y/a-z.,/ /c;$c="[^aeiuo ]";@v=/ (was \S\S+(?<!th)ing)\b/g;@a=/ (?:be|most) ($c\w{4,})/g;@A=/(\S+ly)/g;@n=/ (?:the|a) ($c\S\w+)(?<!s)[.,]/g;@R=(the,a);@P=(RnAvRan,ARanvRn);$\.=(join$",map$$_[rand@$_],$P[$$%2]=~/./g).".\n"while--$$}{' pg14833.txt
Uses Varney the Vampyre but will work with any sufficiently large English text.
An excerpt:
hastily the rural letter was perusing a house. a belfry melancholy was raging a supposed visit. exactly a happy mile was talking the child. the picture certainly was making the deliberate place. accurately a something spot was travelling the gate. a hedge certainly was taking the raised chair. strangely the quite consideration was going a mangled. a populace only was dawning the certainly change. goodly a found place was writing a hall. the breast rightly was going a sufficiently low. acutely the pleased window was willing the whisper. the book likely was getting a sucked wine. lately a possible conversation was waiting a staircase. a clear generally was standing the careful pike. frequently a supposed bed was spreading the smile. the butcher greatly was hurting the released place. wonderfully a disappointed rush was going a room. a least specifically was taking the furiously family. promptly the connected matter was rising the death. the figure nearly was labouring a fairly lawyer.
The length of the generated text is not constant, sometimes it will be shorter than 50k words -- depends on the current state of the OS as it uses PID as a "random big number" and PIDs are not always big enough.
There are also multiple ways to trade characters for quality. I stopped at exactly 256 characters.
If you post a 50k+ version somewhere you can have a completed
label!
Done! https://gist.github.com/kappa/0556b230afe95ecec1f21bd4a6b38046
That was fast