PolyAI Interview Question

How would you implement predictive autocomplete for a string?