It’s two problems here. One is a dictionary (Search) and other is a training model (AI/ML). Shouldn’t mix up.
How is that a model training problem? It's a prediction / completion problem. The model gives you a that the next token could be 'return' or 'result' or a bunch of other stuff and then you have to filter for tokens starting with 'retu'.
Who's Phil? And what is his MJT?
@Alex-wk1jv