I believe you are talking about how to automatically complete a text? For example, you are writing a sentence and you have a system that gives you suggestion to complete your sentence. Then the best thing you can use is language modeling. A statistical language model is a probability distribution over sequences of words. To know about it briefly, i would recommend you to go through this tutorial from Stanford. This tutorial talks about N-gram language modeling and also Markov assumption.
If you are interested to know about advanced techniques, specially using deep learning techniques, you can search for recent research works related to this. Deep learning techniques are proved effective in many NLP applications.
For example:
You can find many other closely related NLP applications that now-a-days being address by using deep learning techniques. You can consider them as advanced techniques based on language modeling.