PolyAI interview question

How would you implement predictive autocomplete for a string?