Why is the termination condition of the `generate` function `next = 1` (BOS) instead of `next = 2` (EOS)?