It doesn't quite work at the level of words, and it's not deterministic that way, it picks from a weighted set of possible next words, not just the most likely, and you're describing GPT-3 not ChatGPT