make keys accessible by rows/cols
[evolve-layout.git] / configs / config3_never_handswitch_after_unbalancing.py
blobf5c075eb805fea3d7c45b5ca4e27e5709c9ae74f
1 #!/usr/bin/env python3
3 """Configuration of check_neo, mainly the weights of the cost functions. Intended to be easily modified.
5 Result with -800 (very bad, 3000 step + tail):
6 aüävt e,gbri´
7 zuowh dclmjn
8 ypöqs x.fkß
10 result with -40, 3000 steps with tail (far better):
12 yucüe lfgmzp´
13 niroa sdht,b
14 qöxä. vwkßj
16 """
18 #: The mutated letters - only these get changed.
19 abc = "abcdefghijklmnopqrstuvwxyzäöüß,."
21 WEIGHT_POSITION = 4 #: reference cost - gets multiplied with the COST_PER_KEY.
23 WEIGHT_FINGER_REPEATS = 128 #: Cost of a finger repeat. Gets additional +1 from the row change on the same finger.
25 WEIGHT_FINGER_REPEATS_TOP_BOTTOM = 2048 #: Additional cost of a finger repetition from the top to the bottom line. Gets added to the cost of the normal finger repetition. Additionally this gets costs as row repetition on the same hand (+4).
27 WEIGHT_BIGRAM_ROW_CHANGE_PER_ROW = 0.2 #: When I have to switch the row in a bigram while on the same hand, that takes time => Penalty per (row to cross ² / horizontal distance)² if we’re on the same hand.
29 WEIGHT_COUNT_ROW_CHANGES_BETWEEN_HANDS = False #: Should we count a row change with a handswitch as row change?
31 WEIGHT_FINGER_DISBALANCE = 40 #: multiplied with the standard deviation of the finger usage - value guessed and only valid for the 1gramme.txt corpus.
33 WEIGHT_TOO_LITTLE_HANDSWITCHING = 50 #: how high should it be counted, if the hands aren’t switched in a triple?
35 WEIGHT_NO_HANDSWITCH_AFTER_DIRECTION_CHANGE = 1 #: how much stronger should the triple without handswitch be counted, if there also is a direction change? Also affects the “unweighted” result from total_cost!
36 WEIGHT_NO_HANDSWITCH_WITHOUT_DIRECTION_CHANGE = 0 #: how much stronger should the triple without handswitch be counted, if there also is a direction change? Also affects the “unweighted” result from total_cost!
39 WEIGHT_INTENDED_FINGER_LOAD_LEFT_PINKY_TO_RIGHT_PINKY = [
43 2.6, # is 1/3 faster
46 2.6,
49 1] #: The intended load per finger. Inversed and then used as multiplier for the finger load before calculating the finger disbalance penalty. Any load distribution which strays from this optimum gives a penalty.
51 WEIGHT_XCVZ_ON_BAD_POSITION = 0.2 #: the penalty *per letter* in the text if xvcz are on bad positions (cumulative; if all 4 are on bad positions (not in the first 5 keys, counted from the left side horizontally) we get 4 times the penalty).
53 WEIGHT_FINGER_SWITCH = 2 #: how much worse is it to switch from middle to indexfinger compared with middle to pinky (~30ms according to Rohmert).
55 #: The cost for moving from one finger to another one with middle-to-index as 1 (30ms). Currently only uses the neighbors. Can also be used to favor a certain direction. Adapted the Rohmert times as per my own experiences: http://lists.neo-layout.org/pipermail/diskussion/2010-May/017171.html and http://lists.neo-layout.org/pipermail/diskussion/2010-May/017321.html
56 FINGER_SWITCH_COST = {
57 "Klein_L": {
58 "Ring_L": 2, # 100ms
59 "Mittel_L": 4,
60 "Zeige_L": 1
61 },
62 "Ring_L": {
63 "Klein_L": 3,
64 "Mittel_L": 4, # 140ms
65 "Zeige_L": 1
66 },
67 "Mittel_L": {
68 "Klein_L": 1,
69 "Ring_L": 4,
70 "Zeige_L": 1 # Nach Rohmert 230ms statt 200ms ⇒ 30ms
71 },
72 "Zeige_L": {
73 "Klein_L": 1,
74 "Ring_L": 3,
75 "Mittel_L": 4 # 120ms
76 },
77 "Daumen_L": {
79 "Daumen_R": {
81 "Zeige_R": {
82 "Mittel_R": 4,
83 "Ring_R": 3,
84 "Klein_R": 1
86 "Mittel_R": {
87 "Zeige_R": 1,
88 "Ring_R": 4,
89 "Klein_R": 1
91 "Ring_R": {
92 "Zeige_R": 2,
93 "Mittel_R": 4,
94 "Klein_R": 3
95 },
96 "Klein_R": {
97 "Zeige_R": 1,
98 "Mittel_R": 4,
99 "Ring_R": 2
103 WEIGHT_NO_HANDSWITCH_AFTER_UNBALANCING_KEY = -40 #: How much penalty we want if there’s no handswitching after an unbalancing key. Heavy unbalancing (wkßz, M3 right, return and the shifts) counts double (see UNBALANCING_POSITIONS). This also gives a penalty for handswitching after an uppercase letter.
105 #: Positions which pull the hand from the base row, position and cost (the strength of the pulling from base row).
106 UNBALANCING_POSITIONS = {
107 (1, 0, 0): 2, # Tab
108 (1, 1, 0): 1,# x
109 (1, 5, 0): 2, # w
110 (1, 6, 0): 2, # k
111 (1, 10, 0): 1, # q
112 (1, 11, 0): 2, # ß
113 (2, 0, 0): 2, # L_M3
114 (2, 5, 0): 1, # o
115 (2, 6, 0): 1, # s
116 (2, 11, 0): 1, # y
117 (2, 12, 0): 2, # R_M3
118 (2, 13, 0): 2, # Return
119 (3, 0, 0): 2, # L_Shift
120 (3, 12, 0): 2, # R_Shift
121 (3, 6, 0): 2 # z
124 # Structured key weighting (but still mostly from experience and deducing from the work of others).
125 # The speed of the fingers is taken out (see INTENDED_FINGER_LOAD_LEFT_PINKY_TO_RIGHT_PINKY).
126 # So this shows the reachability of the keys, ignoring the different speed of the fingers.
127 # “How much does the hand hurt when reaching for the key” :)
128 # rationale: reaching for the Neo 2 x hurts thrice as much as just hitting the Neo2 u → 10 vs. 3.
129 # the upper keys on the right hand can be reached a bit better, since movement is aligned with the hand
130 # (except for q, since the pinky is too short for that).
131 # theoretical minimum (assigning the lowest cost to the most frequent char, counting only the chars on layer 1):
132 # 1123111113 = 3.3490913205386508 mean key position cost
133 # Ringfinger on lower row takes 1.5 times the time of index on the upper row[1].
134 # [1]: http://forschung.goebel-consult.de/de-ergo/rohmert/Rohmert.html - only one person!
135 COST_PER_KEY = [
136 # The 0 values aren’t filled in at the moment.
137 # Don’t put mutated keys there!
138 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,22, 0, 0], # Zahlenreihe (0)
139 [0, 10, 6, 5, 6, 9, 10, 5, 4, 5, 8,12,18, 0], # Reihe 1
140 [0, 3, 3, 3, 3, 5, 5, 3, 3, 3, 3, 5,10,18], # Reihe 2
141 [15,10,12,12,10, 10, 15, 7, 6,11,11,10, 15], # Reihe 3
142 [0,0,0, 3 , 0, 0, 0, 0] # Reihe 4 mit Leertaste
145 # for reference the neo layout
146 NEO = [
147 [("^"),("1"),("2"),("3"),("4"),("5"),("6"),("7"),("8"),("9"),("0"),("-"),("`"),("←")], # Zahlenreihe (0)
148 [("⇥"),("x"),("v"),("l"),("c"),("w"),("k"),("h"),("g"),("f"),("q"),("ß"),("´"),()], # Reihe 1
149 [("⇩"),("u"),("i"),("a"),("e"),("o"),("s"),("n"),("r"),("t"),("d"),("y"),("⇘"),("\n")], # Reihe 2
150 [("⇧"),(),("ü"),("ö"),("ä"),("p"),("z"),("b"),("m"),(","),("."),("j"),("⇗")], # Reihe 3
151 [(), (), (), (" "), (), (), (), ()] # Reihe 4 mit Leertaste
155 #: The positions which are by default accessed by the given finger.
156 FINGER_POSITIONS = {
157 "Klein_L": [(1, 1, 0), (2, 0, 0), (2, 1, 0), (3, 0, 0), (3, 1, 0), (3, 2, 0)], # Klein_L
158 "Ring_L": [(1, 2, 0), (2, 2, 0), (3, 3, 0)], # Ring_L
159 "Mittel_L": [(1, 3, 0), (2, 3, 0), (3, 4, 0)], # Mittel_L
160 "Zeige_L": [(1, 4, 0), (2, 4, 0), (3, 5, 0), (1, 5, 0), (2, 5, 0), (3, 6, 0)], # Zeige_L
161 "Daumen_L": [(4, 3, 0)], # Daumen_L
162 "Daumen_R": [(4, 3, 0)], # Daumen_R
163 "Zeige_R": [(1, 6, 0), (2, 6, 0), (3, 7, 0), (1, 7, 0), (2, 7, 0), (3, 8, 0)], # Zeige_R
164 "Mittel_R": [(1, 8, 0), (2, 8, 0), (3, 9, 0)], # Mittel_R
165 "Ring_R": [(1, 9, 0), (2, 9, 0), (3, 10, 0)], # Ring_R
166 "Klein_R": [(1, 10, 0), (2, 10, 0), (3, 11, 0), (1, 11, 0), (2, 11, 0), (1, 12, 0), (2, 12, 0), (2, 13, 0), (3, 12, 0)] # Klein_R