{# bokeh #} {% for f in bokehres.js_files -%} {%- endfor %} {% for f in bokehres.css_files -%} {%- endfor %}

لوحة مفاتيح عربية

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

Windows
Download driver and follow instructions in INSTALL.txt
Android
Install AnySoftKeyboard and Arabic for AnySoftKeyboard
Linux
Run: xmodmap ar-lulua.xmodmap

Learn more

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

The Arabic alphabet

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

{% for c in corpus|sort(attribute='source.name.en') %} {% set count = c.get ('count') %} {% if count %} {# use new style formatting, for some reason %7,d does not work #} {% else %} {% endif %} {% set stats = c.get ('stats') %} {% for k in ('words', 'characters') %} {% set i = stats[k]|approx('ar') %} {% endfor %} {% endfor %} {% for k in ('words', 'characters') %} {% set i = corpustotal[k]|approx('ar') %} {% endfor %}
مصدركلامحروف
{{ c.source.name.ar }}{{ '{:7,d}'.format(count.num)|arabnum }} {{ count.kind.ar }}{{ '%5.1f'|format(i[0])|arabnum }} {{ i[1] }}
مجموع{{ '%5.1f'|format(i[0])|arabnum }} {{ i[1] }}
{% for c in corpus|sort(attribute='source.name.en') %} {% set count = c.get ('count') %} {% if count %} {# use new style formatting, for some reason %7,d does not work #} {% else %} {% endif %} {% set stats = c.get ('stats') %} {% for k in ('words', 'characters') %} {% set i = stats[k]|approx %} {% endfor %} {% endfor %} {% for k in ('words', 'characters') %} {% set i = corpustotal[k]|approx %} {% endfor %}
SourceWordsCharacters
{{ c.source.name.en }}{{ '{:7,d}'.format(count.num)|numspace }} {{ count.kind.en }}{{ '%5.1f'|format(i[0])|numspace }} {{ i[1] }}
Total{{ '%5.1f'|format(i[0])|numspace }} {{ i[1] }}

The chosen Quran representation does not include all quranic diacritization symbols, like other datasets. This makes comparison fairer, since most keyboards presented below do not include any of them.

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

Throughout this evaluation color coding is used to identify fingers:

red
little finger
blue
ring finger
magenta
middle finger
violet
index finger
cyan
thumb

Asymmetry is defined as the difference between left and right hand button usage \(b_{left/right}\) and includes the thumb:

$$a = \frac{b_{left}}{b_{total}} - \frac{b_{right}}{b_{total}}$$

The layout proposed uses four layers and assumes a 102/105 key ISO keyboard common in Europe to accomodate the shift keys necessary. These are in order: Shift on the left and right, caps lock on the left and the rightmost key in the middle row, the key right of the left shift key and the key labeled Alt Gr to the right of the spacebar. Symbols are assigned to the four layers by their function: characters, punctuation, diacritics, other.

The first layer was optimized using an extended reimplementation of carpalx. From several runs with 100.000 iterations each the layout which had good scores and looked reasonable to the human eye was picked. Afterwards the third layer was optimized using the same process, but only using data from the Hindawi corpus, because it is the only one with at least some fully diacriticised texts. Finally the different brackets were arranged by hand and the remaining symbols algorithmically distributed on the second layer using the raw Wikitext from the Arabic Wikipedia dataset.

The most frequent letters have all been assigned to the home row, which makes them easily accessible. ا and ل are typed with different hands, balancing the load on hands almost evenly. The index and middle finger of both hands share the majority of the typing load, but naturally the left middle finger is used more frequently due to its assignment to the letter alif.

{% macro fingerhandstats(stats) %} {% set hands = stats.hands %} {% set fingers = stats.fingers %}
{% for hand in Direction %} {% set handpct = hands[hand]/stats.buttonPresses*100 %}
{{ '%.2f'|format(handpct) }}%
{% for finger in fingerOrder[hand] %} {% set fingerpct = fingers[(hand, finger)]/stats.buttonPresses*100 %} {# finger width is relative to parent (i.e. hand) #} {% set fingerwidth = fingers[(hand, finger)]/hands[hand]*100 %}
{{ '%.2f'|format(fingerpct) }}
{% endfor %}
{% if loop.first %}
Asymmetry: {{ '%.3f'|format(stats.asymmetry) }}
{% endif %} {% endfor %}

Examples:

{% endmacro %}
{{ fingerhandstats(layoutstats['ar-lulua']) }}

Acknowledgements

This work would not have been possible without Martin Krzywinski’s work on carpalx. Neo Layout’s kbdneo2 Windows driver proved to be an invaluable source for understanding the undocumented nature of Windows keyboard driver development.