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.
@er1n@aparrish yeah, that's my reading of that Python anyway. although it's not precisely "swapping" since each instance of a context can be replaced with any other instance, including itself; in very unlikely circumstances all instances could be replaced by the same word every time.