We wanted to improve upon the status quo (QWERTY) layout. Alternatives like the DVORAK layout do exist, but we wanted to create our own in an attempt to apply our genetic algorithm to a generalized problem.

What it does

BetterKey will return an iterative keyboard layout with 31 keys (26 letters, semicolon, period, comma, slash and apostrophe. First, we ran the genetic algorithm for 5 situations - 1) two-handed typing on a computer, 2) only right-hand typing on a computer, 3) only left-hand typing on a computer, 4) two-thumb typing on mobile phone and 5) one-thumb typing on mobile phone. Secondly, we redefined the genetic algorithm for Typo Avoidance on a mobile phone.

What is a Genetic Algorithm?

A Genetic Algorithm is an algorithm that works off evolutionary techniques. It starts off with a group of solutions (or organisms) and over time these organisms mutate and mate to create offspring that may be better or worse adapted for the our defined fitness in the given environment. Over many generations of evolution, Genetic Algorithms are very useful in searching over a very broad solution space and finding close global maximums in the fitness surface.

How we built it

As our test data, we fed in a text file of the book "Heart of Darkness". Next, we defined the parameter we were attempting to optimize as the "fitness" by creating a customized set of weights based on the relative effort it took to type a key (see images). The third step was to create 10 randomized organisms (potential keyboard layouts). Finally, we ran the organisms through the Genetic Algorithm, with the goal of improving fitness (minimizing effort). All code was written by us from scratch.

The second main part of BetterKey is creating a Typo Avoidance mechanism for mobile phones. Autocorrect is very successful in many ways. However, one way it fails is in differentiating between two words that only differ by one letter (vast majority of autocorrect errors). These words are called orthographic neighbors (eg: cart and cars). First, we determined through a dictionary, all common orthographic neighbors in the English language. We redefined fitness by the number of collisions a keyboard layout has. A collision is when the differing letter in orthographic neighbors are located close to each other on a specific keyboard layout. Running these parameters through the Genetic Algorithm, we got a new keyboard layout that theoretically minimizes typos on a mobile keyboard. This makes the actual autocorrect's job in mobile easier and much more reliable.

Challenges we ran into

Our biggest challenge was defining the "effort" necessary in typing a key. We developed a heuristic to weight how much effort certain finger movements took based on our past experience.

Accomplishments that we're proud of

Our genetic algorithm actually returned actionable data, which can be used to create customized keyboards that trump the efficiency of the QWERTY layout, as well as reduce typos due to orthographical neighbors relative to the QWERTY layout by over 50%!

What we learned

We started out with a myriad of ideas, some much more feasibly than others. Over the course of TAMUHack, we learnt how to iterate through ideas in order to find the perfect balance between practicality and technical challenge. Additionally, we got to work with fascinating ideas in the field of machine learning.

What's next for BetterKey

Ideally, we would like to implement a neuroevolution mechanism in some form, perhaps to improve keyboard layout mapping. Another cool thing to test out would be to run actual tests (on physical keyboards) to evaluate the true efficiency of BetterKey versus DVORAK.

Built With

Share this project: