python -c "from collections import defaultdict as d;import sys,random;w=sys.stdin.read().split(' ');x=list(zip(w[:-2],w[1:-1],w[2:]));y=d(list);[y[j,l].append(k) for j,k,l in x];print(' '.join(w[:2]+[random.choice(y[a,c])for a,b,c in x[1:]]))" <pg2489.txt
replaces words in stdin at random with other words occurring in the same 1-word context window—sort of a minimalist word vector similarity replacement
@er1n In this case it looks to me like @aparrish means something like, if the text has phrases like "a fine plan" and "a strange plan", then any use of "a […] plan" could have the middle word replaced by either "fine" or "strange" at random. So it's the context a word appears in, where context is determined by looking one word before and one word after.
@aparrish Beautiful! I don't want to share *all* of my explication and ruin the fun, but in case it piques other people's interest, here's some of it:
from collections import defaultdict
words = sys.stdin.read().split(' ')
word_triples = list(zip(words[:-2], words[1:-1], words[2:]))
context_dict = defaultdict(list)
for (j, k, l) in word_triples:
@aparrish My favorite part of the code is the w[:2] to ensure the output begins with "**The Project"
Hometown is adapted from Mastodon, a decentralized social network with no ads, no corporate surveillance, and ethical design.