summaryrefslogtreecommitdiff
path: root/lulua/data/report/index.html
blob: e2108cdefe2095283306a331f70a4ed4dcb53254 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
<!doctype html>
<html lang="ar">
<head>
  <meta charset="utf-8">
  <title>لؤلؤة: لوحة مفاتيح عربية</title>
  <!--<meta name="description" content="">-->
  <meta name="viewport" content="width=device-width, initial-scale=1">
	{# Fonts #}
	<link href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono|IBM+Plex+Sans:100,400&display=swap" rel="stylesheet">

	{# Pure.css #}
	<link rel="stylesheet" href="https://unpkg.com/purecss@2.0.3/build/pure-min.css" integrity="sha384-cg6SkqEOCV1NbJoCu11+bm0NvBRc8IYLRGXkmNrqUBfTjmMYwNKPWBTIKyw9mHNJ" crossorigin="anonymous">
	<link rel="stylesheet" href="https://unpkg.com/purecss@2.0.3/build/grids-responsive-min.css" integrity="sha384-+lKLtMyKzY/ZdqRXlhw2whazop7duDxgP+oWPB+EGry5wK+vJnZwSsgMnAmDS/39" crossorigin="anonymous">

	{# TeX support #}
	<link rel="stylesheet" href="https://unpkg.com/katex@0.13.18/dist/katex.min.css" integrity="sha384-zTROYFVGOfTw7JV7KUu8udsvW2fx4lWOsCEDqhBreBwlHI4ioVRtmIvEThzJHGET" crossorigin="anonymous">
	<script defer src="https://unpkg.com/katex@0.13.18/dist/katex.min.js" integrity="sha384-GxNFqL3r9uRJQhR+47eDxuPoNE7yLftQM8LcxzgS4HT73tp970WS/wV5p8UzCOmb" crossorigin="anonymous"></script>

	<script defer src="https://unpkg.com/katex@0.13.18/dist/contrib/auto-render.min.js" integrity="sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>

	{# bokeh #}
	{# Defer loading bokeh, so it does not block rendering #}
	{% for f in bokehres.js_files -%}
		<script defer crossorigin="anonymous" src="{{ f }}"></script>
	{%- endfor %}
	{% for f in bokehres.css_files -%}
		<link rel="stylesheet" href="{{ f }}">
	{%- endfor %}
	<link rel="stylesheet" href="style.css">
</head>
<body>

<div class="title-card pure-g">
	<div class="pure-u-1 pure-u-lg-1-3">
	<div class="lbox">
		<h1 class="title"><img class="logo" src="lulua-logo.svg" alt="لؤلؤة"></h1>
		<div class="pure-g flexreverse">
			<div class="pure-u-1 pure-u-sm-1-2">
				<h2 class="subtitle">لوحة مفاتيح عربية</h2>
			</div>
			<div class="pure-u-1 pure-u-sm-1-2">
				<h2 class="subtitle" lang="en">Ergonomic Arabic Keyboard Layout</h2>
			</div>
		</div>
	</div>
	</div>
	<div class="pure-u-1 pure-u-lg-2-3">
	<div class="lbox">
		<div class="layout">
			<img src="ar-lulua.svg" alt="لؤلؤة">
		</div>
	</div>
	</div>
</div>

<div class="pure-g flexreverse">
	<div class="pure-u-1 pure-u-xl-1-2">
	</div>
	<div class="pure-u-1 pure-u-xl-1-2" lang="en">
	<div class="lbox">
		<p>This is work in progress and contributions are welcome. Head over to
		<a href="https://github.com/PromyLOPh/lulua">GitHub</a> to see where
		you can help.</p>
	</div>
	</div>
</div>

<div class="pure-g flexreverse">
	<div class="pure-u-1 pure-u-xl-1-2">
	</div>
	<div class="pure-u-1 pure-u-xl-1-2" lang="en">
	<div class="lbox">
		<h2>Goals</h2>
		<ul>
			<li>Ergonomic typing of unvocalized and vocalized text with 10 fingers</li>
			<li>Modern Standard Arabic and Quranic Arabic</li>
			<li>Localized numbers (European/Arabic-Indic)</li>
			<li>Usable as primary or secondary keyboard</li>
			<li>Compose-based</li>
			<li>Support for Markdown, RST, Wikitext and similar markup</li>
		</ul>

		<p>Other languages using the Arabic alphabet (regional dialects, Urdu,
		Persian) are explicitly not supported.</p>
	</div>
	</div>
</div>

<div class="pure-g flexreverse">
	<div class="pure-u-1 pure-u-xl-1-2">
	</div>
	<div class="pure-u-1 pure-u-xl-1-2" lang="en">
	<div class="lbox">
		<h2>Usage</h2>
		<dl>
			<dt>Printout</dt>
			<dd><a href="ar-lulua.pdf">PDF</a></dd>
			<dt>Windows</dt>
			<dd>Download <a href="ar-lulua-w64.zip">driver</a> and follow instructions in <kbd>INSTALL.txt</kbd></dd>
			<dt>Android</dt>
			<dd>Install
			<a href="https://play.google.com/store/apps/details?id=com.menny.android.anysoftkeyboard">AnySoftKeyboard</a>
			and
			<a href="https://play.google.com/store/apps/details?id=com.anysoftkeyboard.languagepack.arabic">Arabic for AnySoftKeyboard</a>
			<dt>Linux</dt>
			<dd>Run: <code>xmodmap <a href="ar-lulua.xmodmap">ar-lulua.xmodmap</a></code></dd>
			<dt><a href="https://klavaro.sourceforge.io/en/index.html">Klavaro</a></dt>
			<dd>A touch typing tutor. Copy the <a href="lulua_ar.kbd">custom
			keyboard</a> to <code>%localappdata%\klavaro</code> (Windows) or
			<code>~/.config/klavaro/</code> (Linux), select Keyboard →
			(Custom), then lulua_ar.</dd>
		</dl>
	</div>
	</div>
</div>

<div class="indepth-card">
<div class="pure-g flexreverse">
	<div class="pure-u-1 pure-u-xl-1-2">
	</div>
	<div class="pure-u-1 pure-u-xl-1-2" lang="en">
	<div class="lbox">
		<h1>Learn more</h1>
	</div>
	</div>
</div>
</div>

<section>
<div class="pure-g flexreverse">
	<div class="pure-u-1 pure-u-xl-1-2">
	<div class="lbox">
		<h2>الأبجدية العربية</h2>
	</div>
	</div>
	<div class="pure-u-1 pure-u-xl-1-2" lang="en">
	<div class="lbox">
		<h2>The Arabic alphabet</h2>
		<p>
		28 letters make up the Arabic alphabet and quite a few extra symbols are
		required for proper text input, like the {{ hamzah }} in its different
		shapes <bdo dir="ltr" lang="ar">أ إ آ ء ئ ؤ</bdo>, {{ tamarbutah
		}}, {{ alifmaqsurah }} 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
		</p>
	</div>
	</div>
</div>

<div class="pure-g flexreverse">
	<div class="pure-u-1 pure-u-xl-1-2">
	<div class="lbox">
		<figure class="table-overflow">
		<table class="pure-table pure-table-horizontal"><thead><tr><th>مصدر</th><th></th><th>كلام</th><th>حروف</th></thead><tbody>
		{% for c in corpus|sort(attribute='source.name.en') %}
			<tr>
			<td><a href="{{ c.source.url }}">{{ c.source.name.ar }}</a></td>
			{% set count = c.get ('count') %}
			{% if count %}
				{# use new style formatting, for some reason %7,d does not work #}
				<td>{{ '{:7,d}'.format(count.num)|arabnum }} {{ count.kind.ar }}</td>
			{% else %}
				<td></td>
			{% endif %}

			{% set stats = c.get ('stats') %}
			{% for k in ('words', 'characters') %}
				{% set i = stats[k]|approx('ar') %}
				<td>{{ '%5.1f'|format(i[0])|arabnum }} {{ i[1] }}</td>
			{% endfor %}
			</tr>
		{% endfor %}
		<tr><td>مجموع</td><td></td>
		{% for k in ('words', 'characters') %}
			{% set i = corpustotal[k]|approx('ar') %}
			<td>{{ '%5.1f'|format(i[0])|arabnum }} {{ i[1] }}</td>
		{% endfor %}
		</tr>
		</tbody></table>
		<figcaption>
		</figcaption>
		</figure>
	</div>
	</div>
	<div class="pure-u-1 pure-u-xl-1-2" lang="en">
	<div class="lbox">
		<figure class="table-overflow">
		<table class="pure-table pure-table-horizontal"><thead><tr><th>Source</th><th></th><th>Words</th><th>Characters</th></thead><tbody>
		{% for c in corpus|sort(attribute='source.name.en') %}
			<tr>
			<td><a href="{{ c.source.url }}">{{ c.source.name.en }}</a></td>
			{% set count = c.get ('count') %}
			{% if count %}
				{# use new style formatting, for some reason %7,d does not work #}
				<td>{{ '{:7,d}'.format(count.num)|numspace }}&#x2008;{{ count.kind.en }}</td>
			{% else %}
				<td></td>
			{% endif %}

			{% set stats = c.get ('stats') %}
			{% for k in ('words', 'characters') %}
				{% set i = stats[k]|approx %}
				<td>{{ '%5.1f'|format(i[0])|numspace }}&#x2008;{{ i[1] }}</td>
			{% endfor %}
			</tr>
		{% endfor %}
		<tr><td>Total</td><td></td>
		{% for k in ('words', 'characters') %}
			{% set i = corpustotal[k]|approx %}
			<td>{{ '%5.1f'|format(i[0])|numspace }}&#x2008;{{ i[1] }}</td>
		{% endfor %}
		</tr>
		</tbody></table>
		</figure>
		<details class="remarks">
		<summary></summary>
		<p>
		The chosen Quran representation does not include all quranic
		diacritization symbols, like <a
		href="https://github.com/khaledhosny/quran-data">other datasets</a>.
		<!-- -->
		This makes comparison fairer, since most keyboards presented below do
		not include any of them.
		</p>
		</details>

		<p>
		The plot below shows {{ alif }}, {{ lam }},  {{ ya }}, {{ mim }}, {{
		waw }} and {{ nun }} 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.
		</p>
	</div>
	</div>
</div>

<figure id="letterfreq">
<div class="lbox" lang="en">
	<div id="letterfreq-div"></div>
</div>
<figcaption class="pure-g flexreverse">
	<div class="pure-u-1 pure-u-xl-1-2">
	</div>
	<div class="pure-u-1 pure-u-xl-1-2" lang="en">
	<div class="lbox">
		<p>Arabic letter frequency distribution</p>
	</div>
	</div>
</figcaption>
</figure>
</section>

<section>
<div class="pure-g flexreverse">
	<div class="pure-u-1 pure-u-xl-1-2">
	</div>
	<div class="pure-u-1 pure-u-xl-1-2" lang="en">
	<div class="lbox">
		<h2>Layout properties</h2>

		<p>Throughout this evaluation color coding is used to identify fingers:</p>
		<dl class="colorcodes">
			<dt class="finger little">red</dt>
			<dd>little finger</dd>
			<dt class="finger ring">blue</dt>
			<dd>ring finger</dd>
			<dt class="finger middle">magenta</dt>
			<dd>middle finger
			<dt class="finger index">violet</dt>
			<dd>index finger</dd>
			<dt class="finger thumb">cyan</dt>
			<dd>thumb</dd>
		</dl>
		<p>Asymmetry is defined as the difference between left and right hand button
		usage \(b_{left/right}\) and includes the thumb:</p>
		$$a = \frac{b_{left}}{b_{total}} - \frac{b_{right}}{b_{total}}$$

		<p>
		The layout proposed uses four shift layers in a way inspired by <a
		href="https://neo-layout.org/">Neo2</a>.
		<!-- -->
		Thus it assumes a <a
		href="https://en.wikipedia.org/wiki/IBM_PC_keyboard#Keyboard_layouts">102/105
		key ISO keyboard</a> common in Europe – but also available in Arab
		countries – to accommodate for the necessary shift keys.
		<!-- -->
		These are in order: <span class="layer second">Shift on the left and
		right</span>, <span class="layer third">caps lock on the left and the
		rightmost key in the middle row</span>, <span class="layer fourth">the
		key right to the left shift key and the key labeled <em>Alt Gr</em> to
		the right of the spacebar</span>.
		<!-- -->
		Symbols are assigned to the four layers by their function: <span
		class="layer first">characters</span>, <span class="layer
		second">punctuation</span>, <span class="layer
		third">diacritics</span>, <span class="layer fourth">other</span>.
		</p>
		<details class="remarks">
		<summary></summary>
		<p>Apple, for instance, provides an <a
		href="https://www.apple.com/shop/product/MLA22AC/A/magic-keyboard-arabic">Arabic
		hardware keyboard</a> with this physical layout. But both variants,
		101/104 key and 102/105 key devices, seem to exist in the Arab
		world.</p>
		</details>

		<p>
		The first layer was optimized using an extended reimplementation of <a
		href="http://mkweb.bcgsc.ca/carpalx/?typing_effort">carpalx</a>.
		<!-- -->
		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.
		</p>
		<details class="remarks">
		<summary></summary>
		<p>This is <a
		href="https://github.com/mw8/white_keyboard_layout/blob/master/README.md#finding-the-optimal-layout">a
		common way</a> of arranging brackets, because most algorithms ignore
		human desire for symmetry.</p>
		</details>

		<p>
		The most frequent letters have all been assigned to the home row, which
		makes them easily accessible.
		<!-- -->
		{{ Alif }} and {{ lam }}
		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 }}.
		</p>

		<p>
		The layout targets Quaranic and Modern Standard Arabic (MSA), also called Fuṣḥa
		(<bdo lang="ar">الفصحى</bdo>), only.
		<!-- -->
		Dialectical Arabic (<bdo lang="ar">العامية</bdo>) is mainly a spoken
		language, although with the rise of social media sites like Twitter and
		Facebook this is changing.
		<!-- -->
		For now however it’s not an optimization target due to the lack of a
		good, representative corpus.
		</p>

		<p>
		Designing the layout to be compose-based has both benefits and
		disadvantages.
		<!-- -->
		Compose-based mainly means the {{ hamzah }} is treated like an optional
		diacritic for {{ alif }}, {{ waw }} and {{ ya }} instead of viewing
		{{ alifhamzah }}, {{ wawhamzah }} and {{ yahamzah }} as precombined,
		atomic units.
		<!-- -->
		Although {{ alifhamzah_ }} and {{ alif_ }} are not the same, the {{
		hamzah_ }} can be dropped if the writer’s intention is unambigiously
		inferable from context.
		<!-- -->
		Thus it makes sense to provide {{ hamzah_ }} as a combining character
		on the keyboard.
		<!-- -->
		Additionally it uses two keys less than precombining it with its stems,
		allowing the entire alphabet plus hamzah diacritic to fit on a single
		keyboard layer.
		<!-- -->
		However, there is a cost to this approach:
		All {{ hamzah_ }} variants account for {{
		'%.1f'|format(layoutstats['ar-osx'].hamzaImpact*100) }}% of button
		combinations.
		<!-- -->
		Splitting {{ hamzah_ }} and from its stem means doubling the total number
		of button combinations and thus button presses, decreasing scores like
		words per minute (WPM) slightly.
		<!-- -->
		Splitting {{ alif }} and {{ alifhamzah }} could also reduce pressure
		on left middle finger and allow for more even distribution, since {{
		layoutstats['ar-osx'].hamzaOnAlef|fraction }}<sup>th</sup> of all {{
		alif }} uses are with {{ hamzah }}.
		</p>
		<details class="remarks">
		<summary></summary>
		<p>See for example section 3.3 of <a
		href="https://doi.org/10.1007/978-1-4020-6046-5_3">Buckwalter’s <em>Issues in Arabic Morphological Analysis</em></a>.
		</p>
		</details>
	</div>
	</div>
</div>

{% macro fingerhandstats(stats) %}
{% set hands = stats.hands %}
{% set fingers = stats.fingers %}
<div class="fingerhandstats" dir="ltr" lang="en">
{% for hand in Direction %}
	{% set handpct = hands[hand]/stats.buttonPresses*100 %}
	<div class="{{ hand.name.lower() }}" style="width: {{ '%.3f'|format(handpct) }}%;">
	<div class="hand">{{ '%.2f'|format(handpct) }}%</div>
	<div class="fingers">
	{% 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 %}
		<div class="{{ finger.name.lower() }}" style="width: {{ '%.3f'|format(fingerwidth) }}%;">{{ '%.2f'|format(fingerpct) }}</div>
	{% endfor %}
	</div>
	</div>
	{% if loop.first %}
		<div class="asymm"><small>Asymmetry: {{ '%.3f'|format(stats.asymmetry) }}</small></div>
	{% endif %}
{% endfor %}
</div>
{% endmacro %}

<figure id="ar-lulua-heat">
<div class="lbox" lang="en">
	<img src="ar-lulua-heat.svg">
	{{ fingerhandstats(layoutstats['ar-lulua']) }}
</div>
</figure>
</section>

<section id="related">
	<div class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<h2><a href="#related">Related work</a></h2>
			<p>This section explores existing keyboard layouts made for the
			Arabic language and analyzes their usability.
			<!-- -->
			Comparing them with the proposed layout above is difficult at best,
			because the layouts presented below cover different character sets.
			<!-- -->
			Some lack numbers, some do not include short vowels and others provide
			no way to type symbols.
			<!-- -->
			Therefore no individual score is assigned to each layout, but an analysis
			of each layout’s features is given.
			</p>
		</div>
		</div>
	</div>

	<figure id="triadeffort">
	<div class="lbox" lang="en">
		<div id="triadeffort-div"></div>
	</div>
	<figcaption class="pure-g flexreverse">
	</figcaption>
	</figure>

	<div class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<p>
				Carpalx tries to minimize the effort of typing in blocks of three
				consecutive keystrokes, triads, and thus a good layout in that sense
				should make typing frequent triads easy.
				<!-- -->
				The figure above plots cumulative triad frequency on the x-axis and
				weighted cumulative effort on the y-axis.
				<!-- -->
				Thus, at an x value of 0.5 the y-axis is the sum of triad frequencies
				multiplied by their effort for all triads responsible for 50% of the
				typing process.
				<!-- -->
				Standard layouts are the layouts from <a href="#ar-asmo663">ASMO</a>,
				<a href="#ar-linux">Linux</a> and <a href="#ar-osx">OSX</a> whereas
				<em>usable</em> lists only those which are actually relevant for typing.
				<!-- -->
				As we can see the layout presented above meets the optimization goal.
				<!-- -->
				Only the top 5% of all triads are “easier” to type with <a
				href="#ar-malas">Malas’ layout</a>, because lulua splits {{ hamzah }}
				from its {{ alif }} stem.
				<!-- -->
				As expected the <a href="#ar-phonetic">phonetic layout</a> is one of the
				worst ones, because QWERTY is not optimized for Arabic letter frequencies.
			</p>
			<p>
				The following sections provide details about these layouts.
			</p>
		</div>
		</div>
	</div>

	<div id="ar-asmo663" class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<h3><a href="#ar-asmo663">ASMO 663</a></h3>
			<p>
			Trying to unify existing layouts, the Arab Standardization and
			Meterology Organization (<abbr>ASMO</abbr>), now part of
			<a href="https://www.aidmo.org/"><abbr>AIDMO</abbr></a>, published an Arabic
			keyboard layout in 1987 as
			<a href="https://www.aidmo.org/smcacc/ar/index.php?option=com_sobi2&Itemid=2&limitstart=2150">standard 663</a>
			titled <em>Arabic terminal keyboard layout</em>.
			<!-- -->
			The layout has several shortcomings:
			Most notably it clusters letters by their visual similarity (<bdo
			dir="ltr" lang="ar">ض ص، س ش، ح ج خ</bdo>) and not frequency.
			<!-- -->
			Also it overuses the right index finger by assigning the four
			high-frequency letters {{ alif }}, {{ ta }}, {{ waw }} and {{ tamarbutah
			}} to it.
			</p>
		</div>
		</div>
	</div>

	<figure>
	<div class="lbox">
		<img src="ar-asmo663-heat.svg">
		{{ fingerhandstats(layoutstats['ar-asmo663']) }}
	</div>
	</figcaption>
	</figure>

	<div id="ar-osx" class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<h3><a href="#ar-osx">Mac OS X</a></h3>
			<p>
			Mac OS X’s Arabic keyboard layout makes a few small changes to ASMO
			663 by moving the {{ tamarbutah }} to a hard to
			reach spot on the right of the top row.
			<!-- -->
			It also moves the short vowels from the first to the top row of the
			second layer and replaces them with symbols.
			<!-- -->
			The bottom row keys are aditionally shifted to the right, beginning
			with {{ ra }}.
			</p>
		</div>
		</div>
	</div>

	<figure>
	<div class="lbox">
		<img src="ar-osx-heat.svg">
		{{ fingerhandstats(layoutstats['ar-osx']) }}
	</div>
	</figure>

	<div id="ar-linux" class="pure-g flexreverse">
	<figcaption class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<h3><a href="#ar-linux">Linux</a></h3>
			<p>
			A more common layout is the one used on Linux, which also exists on
			Windows with minor changes to the first layer.
			<!-- -->
			While its top and center row barely differ from
			ASMO 663 the bottom row now contains a separate key
			for the ligature {{ lamalif }} , likely inherited from <a
			href="https://oztypewriter.blogspot.com/2014/10/the-arabic-typewriter-keyboard-and.html">early
			typewriter layouts</a>.
			<!-- -->
			But at the cost of pushing punctuation characters to the second
			layer, {{ dal }} into the top and {{ dhal }} even further into the number row.
			</p>
		</div>
		</div>
	</div>

	<figure>
	<div class="lbox">
		<img src="ar-linux-heat.svg">
		{{ fingerhandstats(layoutstats['ar-linux']) }}
	</div>
	</figure>

	<div class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<p>In contrast to the layouts presented so far the following
			layouts claim to be optimized for the Arabic language and were, at
			least partially, created algorithmically.</p>
		</div>
		</div>
	</div>

	<div id="ar-alramly" class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<h3><a href="#ar-alramly">Al-Ramly et al</a></h3>
			<p>
			One of the eariest accounts can be found in the article <a
			href="https://doi.org/10.1016/S1474-6670(17)64475-6">Statistical
			Distribution of Arabic Letters Aids to the Design of a New
			Keyboard</a> by Al-Ramly et al published in 1980.
			<!-- -->
			The Arabic half of the proposed bi-lingual layout seems to be
			hand-optimized based on several metrics including character
			frequencies – without mentioning a source for them though – visual
			similarity (“letter groups”) and their position on previous
			layouts.
			<!-- -->
			It tries to balance load between hands, assign more work to index
			and middle fingers and place common letters in the home row.
			<!-- -->
			However the asymmetry given in the article, 0.032, cannot be
			reproduced here.
			<!-- -->
			For the most part the layout lacks combining and pre-combined
			characters, a task that is left to “machine intelligence” making it
			hard to use nowadays.
			</p>
			<p>
			While the layout distributes load between fingers quite well it
			favors the left hand by assigning {{ alif }}
			and {{ lam }} to it.
			<!-- -->
			The decision to place {{ tha }} in a very
			prominent spot seems weird, given it only accounts for 0.5% of all
			symbols, even in their own analysis.
			</p>
		</div></div>
	</div>

	<figure>
	<div class="lbox">
		<img src="ar-alramly-heat.svg">
		{{ fingerhandstats(layoutstats['ar-alramly']) }}
	</div>
	</figure>

	<div id="ar-idlebi" class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<h3><a href="#ar-idlebi">Idlebi et al</a></h3>
			<p>
			Another article from the early days of computers published in 1990
			is <a
			href="https://archive.org/details/computers_and_the_arabic_language_1990/page/n112/mode/2up">Design
			of Arabic Keyboard Layout Based on Statistical Properties of Arabic
			Characters</a> by Idlebi et al.
			<!-- -->
			They present two examples of programmatically optimized layouts and
			account for character and bigram frequencies based on a corpus of
			100.000 characters, finger movement time of unknown origin and finger
			load.
			</p>
			<p>
			Unfortunately the results use 12 keys per row and are not suitable
			for use with current European keyboards, which usually feature only 11 keys
			in the bottom row.
			<!-- -->
			Thus the layout displayed below lacks the Arabic question mark and
			comma in the bottom right.
			<!-- -->
			Probably due to their unusual assumption that middle- and
			ring-finger rest in the top row their results are suboptimal,
			placing both {{ alif }} and {{ ya }} in the top row.
			<!-- -->
			Their analysis notices this and suggests improved positions for
			both characters, but these are not actually implemented.
			<!-- -->
			The big asymmetry is caused by placing {{ alif }}, {{ lam }}, {{ ya }} and
			{{ waw }}, four of the five most frequent letters, on the right hand side.
			</p>
		</div></div>
	</div>

	<figure>
	<div class="lbox">
		<img src="ar-idlebi-heat.svg">
		{{ fingerhandstats(layoutstats['ar-idlebi']) }}
	</div>
	</figure>

	<div id="ar-malas" class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<h3><a href="#ar-malas">Malas et al</a></h3>
			<p>
			About 20 years later (2008) Malas et al. presented an alternative
			layout generated by a genetic algorithm in their article <a
			href="https://pdfs.semanticscholar.org/1bf8/74dcaa7f21c2cc3c6c5e526b61a9ee352bba.pdf">Toward
			Optimal Arabic Keyboard Layout Using Genetic Algorithm</a>.
			<!-- -->
			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 <a href="#ar-linux">currently used layouts</a>.
			<!-- -->
			However the decision to put {{ ya }} in the top
			row seems odd.
			<!-- -->
			Assigning the same left index finger to {{ alif }},
			{{ ya }} and {{ waw }}, which are three of the most frequent letters, heavily
			strains this particular finger.
			</p>
		</div>
		</div>
	</div>

	<figure>
	<div class="lbox">
		<img src="ar-malas-heat.svg">
		{{ fingerhandstats(layoutstats['ar-malas']) }}
	</div>
	</figure>

	<div id="ar-khorshid" class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<h3><a href="#ar-khorshid">Khorshid et al</a></h3>
			<p>
			In figure 8 of the paper
			<a href="https://www.researchgate.net/publication/264837659_A_new_optimal_Arabic_keyboard_layout_using_genetic_algorithm">A new optimal Arabic keyboard layout using genetic algorithm</a>
			published in 2010 Khorshid et al. present yet another layout.
			<!-- -->
			They reject the idea of using contemporary text sources like
			newspapers or books and consequently their only input text is a
			copy of the Quran, whose distribution of mono- and digraphs
			is quite different from modern, non-religious texts.
			<!-- -->
			A 36% improvement over the standard keyboard based on their
			criteria for ergonomic layouts is claimed in their conclusion as
			well.
			<!-- -->
			However their algorithm seems to favor the bottom row instead of the
			easier to use top row since it places the letters {{ ba }}, {{ ta }}
			and {{ ra }} there.
			</p>
		</div>
		</div>
	</div>

	<figure>
	<div class="lbox">
		<img src="ar-khorshid-heat.svg">
		{{ fingerhandstats(layoutstats['ar-khorshid']) }}
	</div>
	</figure>

	<div id="ar-osman" class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<h3><a href="#ar-osman">Osman et al</a></h3>
			<p>
			In 2015 patent
			<a href="https://patents.google.com/patent/US9041657B2/en">9,041,657 B2</a>
			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 <em>three</em> single-quote marks ’ and <em>two</em> Arabic
			semicolon <bdo dir="ltr" lang="ar">؛</bdo>.
			<!-- -->
			Additionally it places {{ ya }} in an even
			worse position than Malas’ layout.
			</p>
		</div>
		</div>
	</div>

	<figure>
	<div class="lbox">
		<img src="ar-osman-heat.svg">
		{{ fingerhandstats(layoutstats['ar-osman']) }}
	</div>
	</figure>

	<div id="ar-qtaish" class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<h3><a href="#ar-qtaish">Qtaish et al</a></h3>
			<p>
			Qtaish et al presented this layout in
			<a href="http://www.sci-int.com/pdf/637456047563529791.pdf">An Improved Arabic Keyboard Layout</a> in 2021.
			<!-- -->
			They use a novel corpus of 5 million words or roughly 66 million letters
			<!-- 65713689 adding up the numbers in their paper --> consisting of
			newspapers, (now defunct) social networks and blogs, as well as six
			dictionaries (see remarks).
			<!-- -->
			Then letters were classified into three categories based on their
			frequency, which apparently were used to populate home, top and bottom
			row (in this order).
			<!-- -->
			Additionally bigrams were somehow used to arrange letters and avoid
			placing them on the same or adjacent fingers, making rolling finger
			movements incentiviced by carpalx impossible.
			<!-- -->
			Ultimately it looks like the layout was designed by hand and not through
			an automated process. <!-- see section 5 of the paper -->
			</p>

			<details class="remarks">
			<summary></summary>
			<em>Alfarahindi</em> and <em>Alein Dictionary</em> are most likely the same 8th century book <a href="https://en.wikipedia.org/wiki/Kitab_al-%27Ayn">Kitab al-'Ayn</a>.
			<!-- -->
			There are also <a href="https://ar.wikipedia.org/wiki/%D8%AA%D8%A7%D8%AC_%D8%A7%D9%84%D8%B9%D8%B1%D9%88%D8%B3_%D9%85%D9%86_%D8%AC%D9%88%D8%A7%D9%87%D8%B1_%D8%A7%D9%84%D9%82%D8%A7%D9%85%D9%88%D8%B3">Taj-Alaroos</a>, <a href="https://www.lesanarab.com/letter/">Lesan Alarab</a>, <a href="https://ar.wikipedia.org/wiki/%D8%A7%D9%84%D9%85%D8%B9%D8%AC%D9%85_%D8%A7%D9%84%D9%88%D8%B3%D9%8A%D8%B7">Almujam Alwaseet</a> and <a href="https://ar.wikipedia.org/wiki/%D8%A7%D9%84%D9%85%D9%86%D8%AC%D8%AF_(%D9%84%D9%88%D9%8A%D8%B3_%D9%85%D8%B9%D9%84%D9%88%D9%81)">Almunjed</a>.
			<!-- -->
			All of them are lexica, not dictionaries.
			</details>

			<p>
			Although the authors do not provide a number row, it has been added for
			fair comparison.
			<!-- -->
			However to be actually usable the layout would need punctuation symbols and diacritics.
			</p>
		</div>
		</div>
	</div>

	<figure id="ar-qtaish">
	<div class="lbox">
		<img src="ar-qtaish-heat.svg">
		{{ fingerhandstats(layoutstats['ar-qtaish']) }}
	</div>
	</figure>

	<div id="ar-ergoarabic" class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<h3><a href="#ar-ergoarabic">Ergoarabic</a></h3>
			<p>
			Being first released in 2021 <a
			href="https://github.com/darkstego/ergoarabic">Ergoarabic</a> is the
			most recent optimized layout for Arabic.
			<!-- -->
			On the first layer it combines the positions of 17 keys from the <a
			href="#ar-linux">standard PC layout</a> with brackets and punctuation
			symbols from QWERTY, aiming to retain compatibility with both.
			<!-- -->
			The remaining keys have been re-arranged or moved to the shift layer by
			hand for improved ergonomics.
			</p>
		</div>
		</div>
	</div>

	<figure id="ar-ergoarabic">
	<div class="lbox">
		<img src="ar-ergoarabic-heat.svg">
		{{ fingerhandstats(layoutstats['ar-ergoarabic']) }}
	</div>
	</figure>

	<div id="ar-phonetic" class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<h3><a href="#ar-phonetic">Phonetic</a></h3>
			<p>
			The <a href="http://arabic.omaralzabir.com/home">Arabic Phonetic Keyboard</a>
			simply maps the QWERTY layout to Arabic letters, based on their sound.
			Thus Q becomes {{ qaf }}, Y becomes {{ ya }} 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.
			</p>
		</div>
		</div>
	</div>

	<figure>
	<div class="lbox">
		<img src="ar-phonetic-heat.svg">
		{{ fingerhandstats(layoutstats['ar-phonetic']) }}
	</div>
	</figure>

	<div id="intellark" class="pure-g flexreverse">
		<div class="pure-u-1 pure-u-xl-1-2">
		</div>
		<div class="pure-u-1 pure-u-xl-1-2" lang="en">
		<div class="lbox">
			<h3><a href="#intellark">Intellark</a></h3>
			<p>
			While technically speaking not a layout but alternative input
			method, <a href="http://www.intellaren.com/intellark">Intellark</a> 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 <bdo dir="ltr" lang="ar">ا أ إ آ</bdo> and <bdo dir="ltr" lang="ar">ء</bdo>.
			<!-- -->
			Obviously this is slow, error-prone and violates Dvorak’s guidelines
			for keyboard layout designs.
			</p>
		</div>
		</div>
	</div>
</section>

<section>
<div class="pure-g flexreverse">
	<div class="pure-u-1 pure-u-xl-1-2">
	</div>
	<div class="pure-u-1 pure-u-xl-1-2" lang="en">
	<div class="lbox">
		<h2>Acknowledgements</h2>

		<p>This work would not have been possible without Martin Krzywinski’s
		work on <a
		href="http://mkweb.bcgsc.ca/carpalx/?typing_effort">carpalx</a>.
		<!-- -->
		Neo Layout’s <a
		href="https://github.com/neo-layout/neo-layout/tree/master/windows/kbdneo2/Quelldateien">kbdneo2</a>
		Windows driver proved to be an invaluable source for understanding the
		undocumented nature of Windows keyboard driver development.
		</p>
	</div>
	</div>
</div>
</section>

<script>
function loadPlots () {
	const plots = ['letterfreq', 'triadeffort'];
	for (const p of plots) {
	    fetch(p + '.json')
	        .then(function(response) { return response.json(); })
	        .then(function(item) { Bokeh.embed.embed_item(item, p + '-div'); });
	}
}
if (document.readyState != "loading") loadPlots ();
else document.addEventListener("DOMContentLoaded", loadPlots);
</script>

</body>
</html>