Working (but VERY slow) n-gram flow, running on small inputs.