Carpalx optimizes keyboard layouts to create ones that require less effort and significantly reduced carpal strain!
Have ideas? Tell me.
the best layout
Partially optimized QWKRFY and fully optimized QGMLWY layouts are the last word in easier typing.
the worst layout
A fully anti-optimized TNWMLC layout is a joke and a nightmare to type. It's also the only keyboard layout that has its own fashion line.
download and explore
Download keyboard layouts, or run the code yourself to explore new layouts. Carpalx is licensed under CC BY-NC-SA 4.0.
layouts
Download and install the layouts.
25 Oct 21 — Added vertical and horizontal alphabetic layouts to the layouts analysis.
19 Mar 21 — Added BEAKL 15, Hieamtsr, Colemak Mod-DH and Mtgap 2.0 layouts to the layouts analysis.
15 Mar 21 — Added the Engram layout by Arno Klein to the layouts analysis.
6 Aug 20 — The search for the world’s best keyboard layout by Paul Guerin
4 May 20 — An interview with Bloomberg's Arianne Cohen Splurge on a Better Keyboard, It's Worth It.
25 May 18 — The BBC article Why we can't give up this off way of typing by Tim McDonald discusses the history and persistence of QWERTY and my Carpalx work.
16 Aug 16 — Ergonomic Keyboard Layout Designed for the Filipino Language at AHFE2016 derives layout for Filipino language using Carpalx
18 Apr 16 — Carpalx layouts soon to appear in freedesktop (package xkeyboard-config) and kbd. Thanks to Perry Thompson.
Typing Effort Model
Developing a Model of Typing Effort
The result of any keyboard layout search is dependent on (a) the training text, (b) determination of layout suitability and (c) the search algorithm. The choice of algorithm should not change the ideal layout, but only the likelihood of finding it. In practise, a poorly devised search strategy may seriously impact the likelihood of discovering a better layout. The choice of the training text will impact the generalizability of the layout - if the text is representative of the typist's daily tasks (representative in terms of key stroke combinations), then an optimized layout will be helpful in typing future texts of similar nature.
The fact is, the choice of training text and search algorithm is less subjective than the model for typing effort. For example, unless you are concerned with typing body copy specific to a field with domain-specific terms (e.g. medical texts), a year's worth of New York Times would arguably be a good corpus. If your search algorithm is appropriate, you will find a global minimum and you will have a layout on which typing a year's worth of NYT involves minimum effort - but only as far as quantified by your typing effort model.
Characteristics of a successful model
If you explore keyboard layout projects, such as Capewell or Arensito, you'll find that each approach is different and uses a combination of heuristic and algorithmic contributions to determining the goodness of a layout. There are certain properties of a good layout, however, that are widely agreed upon
- limited use of weak fingers, like pinky and ring finger
- limited use of bottom row
- increased use of home row
- limited finger travel distance
- limited same-finger typing (e.g. uhm)
- balanced hand-use vs right-hand priority (see below)
- alternating hand-use vs rolling (see below)
The question of balanced hand use is debated. Alternate-hand typing may not be as efficient as "rolling finger" typing, in which two successive strokes are typed by the same hand. Most typists find it faster and more comfortable to type "iu" than "it". The former stroke combination uses a rolling finger movement in which your wrist lightly rolls from the outside in. Generally, outward rolling (e.g. "ui", or even worse "io" or "op") is undesirable.
Some also argue for adjusting the layout to favour the right hand. The argument for this is that most individuals are right-handed and therefore their right hand is "stronger". My own experience does not reflect this, though. Being right handed and having typed for 20 years, I find my left and right hands ambidexterous when it comes to typing (but not much else).
Carpalx typing model
Carpalx uses a typing effort model which describes the perceived effort of typing. Given a training text, each layout has an associated typing effort and during layout optimization, this layout is adjusted until a global minimum in effort is reached. I've attempted to make the model flexible to avoid heuristic penalties. The model is highly parametrized, however, and you decide what is important to your layout and these parameters make the model highly subjective. The parameters can be adjusted to try to increase positive layout characteristics (see list above) and minimize aspects which make typing difficult. The task of solving the keyboard layout problem (if the problem is universally solvable - which I doubt, due to its subjective nature) can be reduced to the task of finding the ideal effort model for you.
The carpalx typing effort model is based on triads, which are three character substrings formed from the training text. A triad starts at each letter position. Thus, triads overlap, though this is configurable. The effort model takes into account contributions of the following characteristics
- finger travel distance
- hand, finger and row penalties
- stroke path
The effort associated with typing has two components: effort to hit a key (independently of preceeding and successive strokes) and effort to hit a group of keys. Independent effort is based on finger distance and includes hand/finger/row penalties associated with that key. The penalties provide a means to tune the parameters to reflect your typing abilities and preferences. The effort of hitting a group of keys is measured based on stroke path which assigns desirability to certain patterns of finger movement. More about stroke path below.
Triads: 3-key Effort
Introduced above, the input document is divided into triads, which are three-character substrings. The triad overlap is an adjustable parameter but generally is set to 2 to avoid starting position bias. Space characters are removed from the text up-front and do not impact the formation of triads, since the space bar is not considered relocatable and enjoys dedicated service by the thumbs. I chose to model effort using triads to help evaluate single-key and multi-key effort contributions.
For example, consider the text "typing is hard". If triad overlap is set to 2 (default), after the removal of spaces, the triads are
TEXT: typingishard TRIADS: typ ypi .... har ard
The typing effort for the text is the normalized total of triad typing efforts $$E = \frac{1}{N} \sum_{i} n_i e_i$$
where `N = \sum_i n_i` is the total number of triads and `e_i` is the effort of typing triad `i`. The number of unique triads is limited by the variety of characters in the input text and it is efficient to index all unique triads, each having `n_i` instances. The validity of the model is based on the assumption that the desirability of a keyboard layout can be determined by considering the effort of individual triads. The use of triads limits the interaction effect of near-neighbouring keys on the final layout. By choosing to work with three-key combinations, I am limiting the degree to which long-range effects affect the final layout.
The effort `e_i` of typing a triad is given by $$ e_i = k_b b_i + k_p p_i + k_s s_i $$
where `b_i`, `p_i` and `s_i` are the base, penalty and stroke path effort components of triad `i`. In turn, the base and penalty components are given by $$b_i = k_1 b_{i1} (1 + k_2 b_{i2} ( 1+ k_3 b_{i3}))$$ $$p_i = k_1 p_{i1} (1 + k_2 p_{i2} ( 1+ k_3 p_{i3}))$$
Notice that the baseline and penalty efforts are defined symmetrically, with `b_{ij}` and `p_ij` being the base and penalty factors of key `j` in triad `i`. The stroke path term `s_i` is discussed further below.
The role of the `k_b`, `k_p` and `k_s` factors is to weight the indidividual effort components. For example, by setting `k_s=0`, the triad effort is no longer influenced by the stroke path.
Within each triad, the efforts of each key are combined using the `k_1`, `k_2` and `k_3` parameters. For example, if `k_2 = k_3 = 0`, then the effort of each triad is solely based on the effort of the first key in the triad. With this setting, the typing model contains no interaction terms between keys. However, as soon as `k_2 > 0` and/or `k_3 > 0`, efforts of the second and/or third keys in the triad add to the total triad effort in proportion to the effort of the previous key(s). Now, the triad effort is compounded geometrically over the first two or three keys of the triad. The effect of this is that triads such as "zza" have a larger effort than the individual effort of their single-character components (the purpose of this is to model tiredness associated with typing successivel high-effort keys).
All weight factors ki should be non-negative, since negative typing effort has no interpretation within the model.
No negative effort?
Although hitting any key is associated with a finite amount of typing effort (some keys may be effortless for certain parameter combinations), the concept of negative effort is an interesting one. For example, the notion of recuperation could be considered by extending the correlation length of effort beyond the length of the triad. For example, after a long run of easy-to-type triads, one might consider that a certain amount of "finger rest" has been accumulated, which goes to offset the effort of subsequent, harder-to-type triads.
base effort is finger travel distance
The base effort for a key is defined solely by the finger travel distance for that key. This distance corresponds to the physical distance between keys, as measured on my BenQ x120 keyboard. This value is shown on each key in the figure below.
The role of the base effort is to measure the total distance traveled by fingers during typing. Layouts that keep this value low are those that place frequently used keys on home row.
Instead of using a subjective measure of key effort, I decided to objectively define the effort by a combination of the physical keyboard distance and finger/row penalties (see below). This combination naturally results in a higher effort for z than q, because the bottom row carries a larger penalty than the top row (for both keys the base effort given by the finger travel distance is the same, as is the finger penalty)..
penalty component is hand, row and finger cost
The penalty component for a key is associated with the hand, row and finger for that key. Each hand, row and finger have unique penalties that reflect the degree to which using them is difficult. The penalty for key `j` of triad `i` is $$p_{ij} = w_0 + w_\text{hand} P_{\text{hand}_j} + w_\text{row} P_{\text{row}_j} + w_\text{finger} P_{\text{finger}_j}$$
where the `w` terms are weights and the `P` terms are the penalties associated with the hand, row and finger for key `j`. Typically, `w_0 = 0` (no default penalty), and `P_\text{hand}=0` (neither left nor right hands are penalized).
The role of the penalty is to model increased effort of the use of weak fingers (e.g. pinky) or hard-to-reach rows (e.g. bottom row). The penalty term can also differentially penalize one of the hands (e.g. associate a penalty with the left hand to favour the use of the right hand).
Layouts that have a low penalty are those that limit the use of the pinky, ring finger and the bottom row (note that this statement applies to a model parameter set that associates penalties with the use of these fingers and row).
personalized penalties
You can personalize the key stroke effort by adjusting hand, row and finger penalties to model use of any injured fingers or hands.
effortless keys and triads
Now a note about keys with zero-effort. Since a key's sum of base and penalty components, `b_ij` and `p_ij`, may be zero (such as the key "f"), if the key is the first in the triad, the triad has zero effort (excluding stroke path). If this is undesirable, set the baseline penalty, `w_0`, to a positive value as described above.
For example, in the word coffee, which has triads cof/off/ffe/fee, the triads which start with f, a key with zero effort, will not count total effort of typing coffee if no stroke path contribution exists (`k_4 = 0`). However, all triads count towards the total number of triads which is used to normalize the total effort sum. In the model, such effortless triads are like little typing breaks. This behaviour can be counteracted by ensuring that all `e_i > 0` by setting `b_{ij} > 0` or `w_0 > 0`.
Evaluating the Stroke Path
Not all triads, even those with equivalent baseline effort, are as easy to type. Consider "fjo" and "jfy". The former uses the ring finger which is penalized and the latter requires that the strong index finger reach for the y, a distant key. Depending on the model parameters, these triads may have the same effort. However, fjo is easier to type then jfy, which uses the same finger twice. Therefore, it's appropriate to add to the effort model a cost function which augments the typing cost with additional weighting of uncomfortable key combinations.
The effort associated with the stroke path is parameterized by the following indexes
- hand-alternation, `p_\text{h}`
- row-alternation, `p_\text{r}`
- finger-alternation, `p_\text{f}`
Each of these indexes `(p_\text{h}, p_\text{r}, p_\text{f})` may take the following values
value | hand, `p_\text{h}` | row, `p_\text{r}` | finger, `p_\text{f}` |
---|---|---|---|
0 | both used, not alternating eem ope |
same ert als |
all different, monotonic progression asd pua |
1 | alternating aja sot |
downward progression, with repetition ern kam |
some different, key repeat, monotonic progression app err |
2 | same ase mon |
upward progression, with repetition ade nal |
rolling bih fad |
3 | - | some different, not monotonic, max row change 1 jab oar |
all different, not monotonic yak nep |
4 | - | downward progression eln pax |
some different, not monotonic progression kri maj |
5 | - | some different, not monotonic, max row change downward >1 hen kib |
same, key repeat cee loo |
6 | - | upward progression zaw nap |
some different, no key repeat, monotonic progression abr bde |
7 | - | some different, not monotonic, max row change upward >1 abe axe |
same, no key repeat tfb dec |
Any given triad has a unique stroke path index triplet `(p_\text{h}, p_\text{r}, p_\text{f})`. This triplet is used to calculate the path effort for the triad. Note that some triplet values do not describe a valid path (e.g. `0*4` = alternating hand, same finger). The path effort for each triad is calculated as a weighted sum of the index values. This linear composition of triplet elements is appropriate because more difficult typing scenarios are parametrized by larger index values (e.g. `p_\text{f} = 0` is more desirable than `p_\text{f} = 7`). $$s_i = \sum_{j \,=\, \text{hand, row, finger}} f_j p_j$$
The parameters `f_\text{h,r,f}` assign a weight to each triplet element value. For example, consider the triad "abz". This triad is associated with the path triplet `(p_\text{h}, p_\text{r}, p_\text{f}) = (2,1,4)`. Consider a stroke model that uses the following stroke path weights, `(f_\text{h}, f_\text{r}, f_\text{f} )=(1,2,3)`. $$s(2,1,4) = 2 f_\text{h} + 1 f_\text{r} + 4 f_\text{f} = 2 \times 1 + 1 \times 2 + 4 \times 3 = 16$$
In this example, the contributions of effort towards the stroke path from hand, row and finger terms is unbalanced: the finger term contributes `+12` whereas the hand and row contribute `+2` each. Using the English corpus, the weights `(f_\text{h}, f_\text{r}, f_\text{f} )=(1,0.3,0.3)` yield approximately a `1:1:1` ratio of hand, row and finger contributions to the stroke path over the entire corpus.
Below are the path efforts for weights `(1,0.3,0.3)`.
|
|
|
As it is, these stroke efforts are very subjective. There are certain triads that I find particularly difficult to type. For example, I don't like upward row progressions (`p_\text{r} = 6`) when the same hand and finger is used (`p_\text{h} = 2, p_\text{f} = 7`) . Triads such as "bfr", "cde" and "nhu" are examples and have high stroke effort of 5.9.
Families of Typing Models
I applied different parameter sets to the layout optimization problem to examine the effect of model complexity. Values of baseline key stroke efforts based on finger travel distance, `d_i`, are described in the figure above and do not vary between model families. A list of parameter sets is found in the Carpalx — Model Parameters section.
Training Texts
For optimizing English text, I use a corpus composed of the following
- Alice in Wonderland, by Lewis Carroll
- Dracula, by Bram Stoker
- Great Expectations, by Charles Dickens
- Huckleberry Finn, by Mark Twain
- Moby Dick, by Herman Melville
- Picture of Dorian Grey, by Oscar Wilde
- Pride and Prejudice, by Jane Austen
- Sense and Sensibility, by Jane Austen
- The Adventures of Tom Sawyer, by Mark Twain
- The Adventures of Sherlock Holmes, by Sir Arthur Conan Doyle
- The Count of Monte Cristo, by Alexandre Dumas
- Ulysses, by James Joyce
- Walden, by Henry Thoreau
These books are freely available from Project Gutenberg.
Another source of corpora is the Natural Language Toolkit Project.