Automated Help in Composing Text Messages

Robert B.
June 12, 2017

Data Science Capstone Project - Coursera

Intro

Composing text messages got easier because of help of n-grams which provide the ability to predict the next set of possible words as a text message is typed.

This application is comprised of multiple n-grams, there is a set of 2-gram, 3-gram, 4-gram and 5-grams, each n-gram has been sorted by frequency and has probability assigned to each element of the n-gram.

The n-grams are created based on english data files downloaded from the Swiftkey site.

Application Overview

The application takes any word or phrase as input and provides a list of possible next words based on the n-gram match and the frequency from highest to lowest. An input slider provides the ability to set the maximum number of words possible to predict.

The prediction algorithn can start predicting the next word, right after the first word is typed and when the user stops typing the prediction algorithm automatically will suggest the next word(s). The send button simulates the action of sending a text message after is typed.

A data table on the right will display a list of the sent messages. The table will display up to 5 mesage per page. The data table allows to search or filter messages based on specific provided pattern. See application screenshot on last slide.

Prediction Model Algorithm

On initial startup of the application multiple n-gram files are uploaded in memory. The prediction algorightm is also loaded along with any other depending function that is invoked by the prediction algorithm.

The prediction algorithm is invoked when the user types the text message, based on the length of the message the prediction algorithm will do a lookup search on the matching ngram, if there is no matching ngram the algorithm will use the back off method to do a search on the next shorter n-gram and so forth.

If the initial text message contains more than 4 words, the algorithm will use only the last four words and will try to predict the next word based on the 5-gram.

Application User Interface

The following screenshot depicts the versatility of this application.

alt text

Link to Compose Text Messages App

Note: Depending on your machine the application could take 20 to 30 secs to load.

Thank You.