in reality, something much more mechanically mysterious is done inside the weights/embeddings of these networks during the training process, and the inference process (the part that you use in chatgpt) it is trained to auto-complete bundles of text - that's all.