Ergonomic Arabic Keyboard Layout

لؤلؤة

This is work in progress and contributions are welcome. Head over to GitHub to see where you can help.

Goals

  • Ergonomic typing of unvocalized and vocalized text with 10 fingers
  • Modern Standard Arabic and Quranic Arabic
  • Localized numbers (European/Arabic-Indic)
  • Usable as primary or secondary keyboard
  • Compose-based
  • Support for Markdown, RST, Wikitext and similar markup

Other languages using the Arabic alphabet (regional dialects, Urdu, Persian) are explicitly not supported.

Usage

Linux
Run: xmodmap ar-lulua.xmodmap
Android
Install AnySoftKeyboard and Arabic for AnySoftKeyboard

Learn more

الأبجدية العربية

The Arabic Alphabet

There are 28 letters in the Arabic alphabet, plus quite a few extra symbols required for proper text input, like the hamza in its different shapes أ إ آ ء ئ ؤ, ta marbutah ة, alif maqsurah ى and various diacritics for vowelized texts. Since the usability of a keyboard layout depends on the text entered it is necessary to study letter and letter combination frequencies first. The corpus used for the following analysis consists of

SourceWordsCharacters
Al-Jazeera 547,110 articles 187.6 million 1.2 billion
Arabic Wikipedia 857,386 articles 110.3 million 700.6 million
BBC Arabic 149,901 articles 36.3 million 232.1 million
hindawi.org 1,709 books 68.0 million 498.2 million
OpenStreetMap Arabic Labels 376,148 labels 909.9 thousand 5.5 million
ORPUS OpenSubtitles 2018 94,093 movies 361.4 million 2.1 billion
tanzil.net Quran 72.0 thousand 703.8 thousand
United Nations Parallel Corpus v1.0 116,754 documents 423.1 million 2.9 billion
Total 1.2 billion 7.6 billion

The plot below shows ا ل ي م و ن can be considered the most frequently used letters in the Arabic language. Together they account for more than 55% of all letters in the corpus.

Arabic letter frequency distribution

Layout properties

Below are statistics for the proposed layout.

51.54%
6.51
6.13
16.29
13.83
8.78
48.46%
7.85
18.12
10.58
6.07
5.84

Related work

48.15%
7.22
3.03
8.70
18.61
10.59
51.85%
5.29
23.69
7.42
6.06
9.40

Trying to unify existing layouts, the Arab Standardization and Meterology Organization (ASMO), now part of AIDMO, published an Arabic keyboard layout in 1987 as standard 663. This, however, turned out to be a failure, due to lack of adoption by the typewriter industry.

46.10%
8.59
2.98
6.21
17.45
10.89
53.90%
4.94
21.39
10.53
6.89
10.15

Instead we’re currently using this layout (on Linux), which is similar, but not quite the same. Most notably this layout arranges letters by their visual similarity. Thus it allocates suboptimal or even awkward positions to frequently used letters like ا ل and ذ.

49.55%
7.07
2.31
4.97
26.47
8.73
50.45%
7.53
9.56
13.57
5.56
14.24

The work by Malas et al. (2008), Toward Optimal Arabic Keyboard Layout Using Genetic Algorithm, presents an alternative layout generated by a genetic algorithm. They used a snapshot of the Arabic Wikipedia probably from around 2008 and optimized for typing speed only, claiming 35% faster typing compared to the currently used layouts. However the decision to put ي in the top row seems odd. Assigning the same left index finger to ا ي و, which are three of the most frequent letters, heavily strains this particular finger.

46.06%
6.33
1.77
6.77
20.37
10.82
53.94%
5.58
23.53
7.97
7.06
9.80

In 2015 patent 9,041,657 B2 was filed in the US, presenting yet another computer-generated layout. Its genetic algorithm was seeded with just 54 Arabic e-books consisting of 7 million characters in total. Overall it claims to be 9% faster than default layouts. This layout rips off most of the standard layout’s second layer, but amusingly fails to include a question mark, while it does provide three single-quote marks ’ and two Arabic semicolon ؛. Additionally it places ي in an even worse position than Malas’ layout.

48.05%
5.87
9.54
9.76
13.39
9.48
51.95%
8.07
18.96
7.98
7.53
9.41

In the paper A new optimal Arabic keyboard layout using genetic algorithm Khorshid et al. present yet another layout. They claim a 36% improvement over the standard keyboard based on their criteria for ergonomic layouts. However in their layout from figure 8 the letters ل ب ر are in suboptimal positions. Also it seems their algorithm favors the bottom row instead of the easier to use top row.

62.46%
22.50
8.26
5.34
11.63
14.73
37.54%
0.02
18.65
3.10
9.63
6.14

The Arabic Phonetic Keyboard simply maps the QWERTY layout to Arabic letters, based on their sound. Thus Q becomes ق, Y becomes ي and so on. It claims to be optimized for writing vowelized texts, especially Quranic Arabic, and thus includes quite a few combining characters and special symbols. Although it claims to make frequently used letters easily available – based on the work of Intellaren – it makes no effort to arrange letters according to their usage frequency.

While technically speaking not a layout but alternative input method, Intellark by Intellaren is worth mentioning. It is based on repeatedly pressing the same button to modifiy the current character. For example pressing A on the QWERTY keyboard cycles through the alternatives ا أ إ آ and ء. Obviously this is slow, error-prone and violates Dvorak’s guidelines for keyboard layout designs.