Gesture Typing ¶

Typing quickly and accurately on a smartphone screen is hard! One invention to make it easier is gesture typing, in which your finger can trace a path consisting of letter-to-letter segments. When you lift your finger the path (and the word) is complete. Below we see the path for the word "hello." Note that the path is imprecise; it didn't quite hit the "L", but the word was recognized anyways, because "Hello" is a known word, whereas "Hekko", "Hwerklo", etc., are not.

Questions About Gesture Typing¶

My colleague Nicolas Schank examined (and answered) the question of what word has the longest path length. I mentioned this to Shumin Zhai, the pioneer of gesture typing, and between the three of us we expanded the list of questions:

What words have the longest path length? What words have the highest ratio of path length to word length? What is the average segment length, over a typical typing work load? Is there a better keyboard layout to minimize the average segment length over a work load? How often are two words confused because they have similar paths? Is there a better keyboard layout to minimize confusion? Is there a better keyboard layout to maximize overall user satisfaction?

Let's look at each of these questions, but first, let's get a rough idea for of the concepts we will need to model.

We will need to talk about the following concepts:

Keyboard : We'll need to know the location of each letter on the keyboard (we consider only letters, not the other symbols).

: We'll need to know the of each letter on the keyboard (we consider only letters, not the other symbols). Location : A location is a point in two-dimensional space (we assume keyboards are flat).

: A location is a in two-dimensional space (we assume keyboards are flat). Path : A path connects the letters in a word. In the picture above the path is curved, but a shortest path is formed by connecting straight line segments , so maybe we need only deal with straight lines.

: A path connects the letters in a word. In the picture above the path is curved, but a shortest path is formed by connecting straight line , so maybe we need only deal with straight lines. Segment : A line segment is a straight line between two points.

: A line segment is a straight line between two points. Words : We will need a list of allowable words (in order to find the one with the longest path).

: We will need a list of allowable words (in order to find the one with the longest path). Work Load : If we want to find the average path length over a typical work load, we'll have to represent a work load: not just a list of words, but a measure of how frequent each word is.

: If we want to find the average path length over a typical work load, we'll have to represent a work load: not just a list of words, but a measure of how frequent each word is. Confusion : We need some measure of whether (or perhaps to what degree) the paths for two words can be confused with each other.

: We need some measure of whether (or perhaps to what degree) the paths for two words can be confused with each other. Satisfaction: This is a very difficult concept to define. A user will be more satisfied with a keyboard if it allows for fast, accurate typing, and if it gives the user a feeling of mastery, not frustration.

Note: Before we get started writing any real code, I've taken all the imports I will need throughout this notebook and gathered them together here: