How the phone suggests the correct words as you type: predictive text

If we type on a phone with an operating system Android and Gboard keyboard, the word “Today” and then we complete the sentence by clicking only on the suggested words in the bar above the keyboard we get something like: “Today I can’t come to my house and have some time to do the shopping and do shopping and shopping and doing…”, but if we do it on an iPhone (iOS) with default keyboard we get something like: “Today people are so tired of this job that they can’t deal with the situation in a simpler way…”. This happens thanks to a function of ours smartphones called “predictive text” or “predictive text/tip” which consists in predicting the most probable word within a sentence starting from the first letters typed. This function can improve writing efficiency anticipating what the user intends to type. It is based on algorithms machine learning which predict the most likely words based on the language you are speaking in and how users write.

What is predictive keyboard text and how does it work

The predictive text it is a function that makes writing easier on a device (smartphone or tablet) suggesting words that the user might want to insert into a text. The user simply needs to tap the suggested wordinstead of typing it.

There are two main types of forecasts:

  • Automatic completion: When the phone suggests completing a word as you start typing it. For example, if I start typing “gr” it will suggest “thank you”.
  • Next word prediction: When it suggests the next word based on the context of what you’ve already typed. For example, if I have already written “I’m staying at tonight” it will probably suggest “home”.

Predictive text uses algorithms Of machine learning, that is, artificial intelligence, different from a operating system to another and from one keyboard to another. So, if we have a Samsung or an iPhone, which use different operating systems, even if the keyboard used will be the same, the mechanisms with which the words will be suggested will vary slightly.

If we use the keyboard Gboard of Google on Android, for example, will tend to create more loops (such as “going shopping” in the initial example) compared to what happens on iOS. However, what they all have in common is that analyze linguistic patterns of whoever is writing, the words used more frequently and the context to make predictions about the next word or phrase the user might want to type. The predictions of the most probable words, in fact, are based both on the most used phrases in the language in which you are writing and on how the user expresses himself.

Each user will have different predictions because a personalized dictionary is created

Every predictive text system creates a “personal dictionary” composed of words and phrases frequently used by the single user. As we write, the system learns which words are used most often, assigning a score to words based on their likelihood of use. For example, if you use Often the word “damn”, this will come suggested more often than other words.

This local dictionary updates based on our writing habits, and trains and personalizes the predictive system to be increasingly precise. We can also add our most used words by going to the keyboard settings, and then choosing General > Keyboard > Text Replacement if we are using an iPhone, or Dictionary > Personal dictionary, selecting the language and adding the word if we are using Android.

One might therefore ask whether the manufacturing companies know everything we write: not exactly. There are several techniques to customize the predictive system of users, the one used by Google (and therefore by Gboard) to train and update its model is called Federated Learning and allows you to train the predictive model without exporting sensitive user data to servers. In this way, it manages to maintain its privacy: the data remains only on users’ devicesbut the keyboard continues to learn and improve to be more precise in its suggestions.

If the context is too generic, the same words are repeated over and over again

Predictive systems they use contextthat is, the words written before, to predict the next expression or word. So, if the sentence we are writing is unclear or the words are too generic, the algorithm will tend to propose extremely common words, thus easily entering a repetitions infinite successions of generic words, such as “and go shopping” in the initial example.

predictive keyboard repeats

This often happens when you start a new sentence or when you accept too many suggestions from the central predictor button, as happened in our case. If we generate the sentences using only the most probable suggestions, i.e. those proposed in the central position, the context is shortened and the algorithm always proposes the same same loop of probable words. When this happens, just type something manually to break the loop.