Start hacking on a C(++) implementation of the optimizer
[evolve-layout.git] / grep-cascade.sh
blob6d25062e1f77bc41bc5b0feb6ecefb443590db7a
1 #!/bin/sh
3 # a cascade of greps to find all layouts which have values in a given range.
4 # take the median of each value as fixpoint (the value of a typical layout).
5 # TODO: recalculate all values for a reference sentence. Then work with these.
6 # -> results/2010-08-17-all-recalculated-for-the-reference-text.txt
8 ### data
10 ## layout
12 # #### 21 ####
13 # xuc.ü vdsljq´
14 # miaeo btrnhk
15 # y,zäö fgßwp
16 # ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬──────┐
17 # │ ^ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ ` │ ← │
18 # ├───┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬─────┤
19 # │ ⇥ │ x │ u │ c │ . │ ü │ v │ d │ s │ l │ j │ q │ ´ │ Ret │
20 # ├────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─┐ │
21 # │ ⇩ │ m │ i │ a │ e │ o │ b │ t │ r │ n │ h │ k │ ⇘ │ │
22 # ├────┬┴──┬┴──┬┴──┬┴──┬┴──┬┴──┬┴──┬┴──┬┴──┬┴──┬┴──┬┴────┴───┤
23 # │ ⇧ │ M4│ y │ , │ z │ ä │ ö │ f │ g │ ß │ w │ p │ ⇗ │
24 # ├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬───┤
25 # │Str │ Fe │ Al │ Leerzeichen │ M4 │ Fe │ Me │Str│
26 # └────┴────┴────┴────────────────────────┴────┴────┴────┴───┘
27 # 19.825044696 billion total penalty compared to notime-noeffort
28 # 5.19590183127 mean key position cost in file 1gramme.txt ( 14.95921721 )
29 # 1.54621348386 % finger repeats in file 2gramme.txt ( 0.66178688 )
30 # 3.42663847398 million keystrokes disbalance of the fingers ( 0.856659618 )
31 # 0.036349195039 % finger repeats top to bottom or vice versa ( 0.248922112 )
32 # 1.51856790633 % of trigrams have no handswitching (after direction change counted x 1 ) ( 0.88434855 )
33 # 3.02438136579 billion (rows²/dist)² to cross ( 0.604876273157 )
34 # 0.0263628392305 hand disbalance. Left: 0.47363716077 %, Right: 0.52636283923 %
35 # 0.0575808308 badly positioned shortcut keys (weighted).
36 # 1.204443 no handswitching after unbalancing key (weighted).
37 # 3.47210222 movement pattern cost (weighted).
39 ## layout value summary
41 # $ ./csv-ftw.sh
42 # $ R
43 # > a = read.csv("layouts.csv", sep=";")
44 # > summary(a)
45 # total.penalty key.position.cost finger.repeats disbalance.of.fingers
46 # Min. :19.83 Min. :14.77 Min. :0.3489 Min. :0.4052
47 # 1st Qu.:20.48 1st Qu.:15.05 1st Qu.:0.6555 1st Qu.:0.8973
48 # Median :20.84 Median :15.19 Median :0.7570 Median :1.0663
49 # Mean :21.01 Mean :15.23 Mean :0.7976 Mean :1.0761
50 # 3rd Qu.:21.47 3rd Qu.:15.38 3rd Qu.:0.9091 3rd Qu.:1.2407
51 # Max. :23.48 Max. :16.58 Max. :1.6705 Max. :1.8463
52 # top.to.bottom.or.vice.versa handswitching.in.trigram X.rows..dist..
53 # Min. :0.08527 Min. :0.5506 Min. :0.4390
54 # 1st Qu.:0.19885 1st Qu.:0.9338 1st Qu.:0.6151
55 # Median :0.24342 Median :1.1292 Median :0.7269
56 # Mean :0.25161 Mean :1.2533 Mean :0.7525
57 # 3rd Qu.:0.29633 3rd Qu.:1.4689 3rd Qu.:0.8267
58 # Max. :0.61345 Max. :2.7018 Max. :1.5323
59 # shortcut.keys handswitching.after.unbalancing movement.pattern
60 # Min. :0.00000 Min. :0.9096 Min. :3.198
61 # 1st Qu.:0.05758 1st Qu.:1.1441 1st Qu.:3.281
62 # Median :0.11516 Median :1.2089 Median :3.402
63 # Mean :0.09858 Mean :1.2138 Mean :3.383
64 # 3rd Qu.:0.11516 3rd Qu.:1.2797 3rd Qu.:3.477
65 # Max. :0.23032 Max. :1.5518 Max. :3.524
67 # alle Werte unten sind getestet, dass sie min 10 Layouts geben.
69 alias grep="grep -h"
71 # lines_before lines_after
72 tot="20\\..*compared.* -B 16 -A 11" # ignored
73 pos="position.*15\\.[0123] -B 17 -A 10"
74 rep="2gramme.*0\\.[78] -B 18 -A 9"
75 dis="fingers.*[01]\\.[0129] -B 19 -A 8"
76 bot="bottom.*0\\.2 -B 20 -A 7"
77 swi="trigram.*1\\.[012] -B 21 -A 6"
78 row="rows.*0\\.[678] -B 22 -A 5"
79 sho="0\\.1.*shortcut -B 23 -A 4" # ignored: no effect on typing.
80 unb="1\\.2.*unbalancing -B 24 -A 3"
81 pat="3\\.4.*pattern -B 25 -A 2" # ignored: useless optimization
83 echo --- reference layouts ---
84 grep $pos results/2010-* | grep $rep | grep $dis | grep $bot | grep $swi | grep $row | grep $unb
86 # partial
87 echo " "
88 echo " "
89 echo " " --- finger-repeats ---
90 echo " "
91 grep $pos results/2010-* | grep $dis | grep $bot | grep $swi | grep $row | grep $unb
92 echo " "
93 echo " "
94 echo " " --- finger-disbalance ---
95 echo " "
96 grep $pos results/2010-* | grep $rep | grep $bot | grep $swi | grep $row | grep $unb
97 echo " "
98 echo " "
99 echo " " --- top-bottom ---
100 echo " "
101 grep $pos results/2010-* | grep $rep | grep $dis | grep $swi | grep $row | grep $unb
102 echo " "
103 echo " "
104 echo " " --- handswitching ---
105 echo " "
106 grep $pos results/2010-* | grep $rep | grep $dis | grep $bot | grep $row | grep $unb
107 echo " "
108 echo " "
109 echo " " --- rows ---
110 echo " "
111 grep $pos results/2010-* | grep $rep | grep $dis | grep $bot | grep $swi | grep $unb
112 echo " "
113 echo " "
114 echo " " --- switch-after-unbalancing ---
115 echo " "
116 grep $pos results/2010-* | grep $rep | grep $dis | grep $bot | grep $swi | grep $row