3e90fb2

Pinchord · pinchord.git · Tickets · Changelog

Branches > serial-mods > 3e90fb2 > files / generate-dictionary.clj

Add pinchord mods dict

Grahp, 2026-06-08

Commit: 3e90fb2ab9b66b5843b54069ce1abdac03ffaac8
Parent: b0c4e1a

7 changed files:

generate-mods.clj modified (view file)

@@ -1,45 +1,353 @@-(def numbers {:chord "LRPKFST*"-              :left-numpad {"" ""-                            "R" "1"}})+; Map of symbols to names+#_(def symbol-names+  {"." "period"}) -(def symbols {"P" "."-              "RP" "/"})+(def symbol-names+  {"á" "aacute"+   "â" "acircumflex"+   "´" "acute"+   "ä" "adiaeresis"+   "æ" "ae"+   "à" "agrave"+   "&" "ampersand"+   "'" "apostrophe"+   "å" "aring"+   "^" "asciicircum"+   "~" "asciitilde"+   "*" "asterisk"+   "@" "at"+   "ã" "atilde"+   "\\" "backslash"+   "|" "bar"+   "{" "braceleft"+   "}" "braceright"+   "[" "bracketleft"+   "]" "bracketright"+   "¦" "brokenbar"+   "ç" "ccedilla"+   "¸" "cedilla"+   "¢" "cent"+   ":" "colon"+   " " "space"+   "," "comma"+   "©" "copyright"+   "¤" "currency"+   "°" "degree"+   "¨" "diaeresis"+   "÷" "division"+   "$" "dollar"+   "é" "eacute"+   "ê" "ecircumflex"+   "ë" "ediaeresis"+   "è" "egrave"+   "=" "equal"+   "ð" "eth"+   "!" "exclam"+   "¡" "exclamdown"+   "`" "grave"+   ">" "greater"+   "«" "guillemotleft"+   "»" "guillemotright"+   "­" "hyphen"+   "í" "iacute"+   "î" "icircumflex"+   "ï" "idiaeresis"+   "ì" "igrave"+   "<" "less"+   "¯" "macron"+   "º" "masculine"+   "-" "minus"+   "µ" "mu"+   "×" "multiply"+   "¬" "notsign"+   "ñ" "ntilde"+   "#" "numbersign"+   "ó" "oacute"+   "ô" "ocircumflex"+   "ö" "odiaeresis"+   "ò" "ograve"+   "½" "onehalf"+   "¼" "onequarter"+   "¹" "onesuperior"+   "Ø" "ooblique"+   "ª" "ordfeminine"+   "ø" "oslash"+   "õ" "otilde"+   "¶" "paragraph"+   "(" "parenleft"+   ")" "parenright"+   "%" "percent"+   "." "period"+   "·" "periodcentered"+   "+" "plus"+   "±" "plusminus"+   "?" "question"+   "¿" "questiondown"+   "\"" "quotedbl"+   "®" "registered"+   "\r" "return"+   "§" "section"+   ";" "semicolon"+   "/" "slash"+   "ß" "ssharp"+   "£" "sterling"+   "\t" "tab"+   "þ" "thorn"+   "¾" "threequarters"+   "³" "threesuperior"+   "²" "twosuperior"+   "ú" "uacute"+   "û" "ucircumflex"+   "ü" "udiaeresis"+   "ù" "ugrave"+   "_" "underscore"+   "ý" "yacute"+   "ÿ" "ydiaeresis"+   "¥" "yen"}) -{:chord "P"- :translation "."}+(defn symbol-name [x]+  (or (symbol-names x) (throw (ex-info (str "No such symbol! " x) {:symbol x})))) -(def mods {"-" ""-           "A" "ctrl"-           "E" "shift"-           "I" "super"-           "U" "alt"})+(def symbols+  {:starter "TSHR"+   :chords {"P" "."+            "RP" "/"+            "RPS" "^"+            "LRPKS" "&"+            "LRPKFS" "@"+            "K" ","+            "PS" "\\"+            "FS" ":" "^FS" ";"+            "RPKF" "$"+            "LRFS" "#"+            "L" "'" "^L" "`"+            "PK" "|"+            "LR" "!"+            "F" "*"+            "LPKF" "¥"+            "LP" "\""+            "PKFS" "="+            "LPK" "?"+            "RPKS" "+"+            ; Unfortunately, Plover does not see the vision+            ;"LRPKF" "€" "^LRPKF" "£"+            "PF" "-"+            "KS" "_"+            "LRPK" "%"+            "LPKS" "~"+            "LRK" "("+            "LK" "<"+            "LRP" "[" "^LRP" "{"+            "" " "+            "RPK" ")"+            "KF" ">"+            "PFS" "]"+            "^PFS" "}"+            }+   :shortcuts {"LS" "tab"+               "RK" "backspace" "^RK" "delete"+               "RF" "enter"+               "LPF" "escape"}}) -(def mods {"A" "ctrl"-           "E" "shift"-           "I" "super"-           "U" "alt"})+(def vowel-chords+  {"A"    ["control"]+   "O"    ["shift"]+   "I"    ["super"]+   "U"    ["alt"]+   "AO"   ["control" "shift"]+   "AI"   ["control" "super"]+   "AU"   ["control" "alt"]+   "OI"   ["shift" "super"]+   "OU"   ["shift" "alt"]+   "IU"   ["super" "alt"]+   "AOI"  ["control" "shift" "super"]+   "AOU"  ["control" "shift" "alt"]+   "AIU"  ["control" "super" "alt"]+   "OIU"  ["shift" "super" "alt"]+   "AOIU" ["control" "shift" "super" "alt"]}) -(defn power-set [coll]-  (let [rest (power-set (rest coll))]-    (concat rest-            (map #(cons (first coll) %) rest))))--(defn power-set [coll]-  (reduce (fn [acc x]-            (into acc (map #(conj % x) acc)))-          #{#{}} coll))--(power-set mods)--(defn apply-mods [x combo]-  (reduce (fn [acc [_ mod]]+; combos: vector of combos+(defn apply-mods [x combos]+  (str "{#"+       (reduce (fn [acc mod]             (str mod "(" acc ")"))-          x combo))+          x combos)+       "}")) -(defn generate-all-mods [starter {:keys [chord translation]}]-  (for [mods (power-set mods)]-    (apply-mods translation mods)))+(defn ->map [xs]+  (update-keys (apply hash-map (flatten xs))+               (fn [x]+                 (str/replace x #"-\^" "^")))) -(generate-all-mods "ST" {:chord "SP" :translation "/"})+(defn rep [n s]+  (apply str (repeat n s))) -(comment)+(def symbols-dict+  (->map+    (let [{:keys [starter chords shortcuts]} symbols]+      [(for [[mod symbol] chords+             [chord combo] vowel-chords]+         [(str starter chord mod) (str "{^}" (apply-mods (symbol-name symbol) combo))])+       (for [[mod shortcut] shortcuts+             [chord combo] (assoc vowel-chords "-" [])]+         [(str starter chord mod) (apply-mods shortcut combo)])+       (for [[mod symbol] chords]+         [+          ; the 4 combos of T* with and without e+          (str starter "-" mod) (str "{}" symbol)+          (str "+" starter "-" mod) (str "{^}" symbol)+          (str starter "-" mod "e") (str "{}" symbol "=")+          (str "+" starter "-" mod "e") (str "{^}" symbol "=")++          (str starter "-" mod "*") (str "{}" (rep 2 symbol))+          (str "+" starter "-" mod "*") (str "{^}" (rep 2 symbol))+          (str starter "-" mod "*e") (str "{}" (rep 2 symbol) "=")+          (str "+" starter "-" mod "*e") (str "{^}" (rep 2 symbol) "=")++          (str starter "-" mod "T") (str "{}" (rep 3 symbol))+          (str "+" starter "-" mod "T") (str "{^}" (rep 3 symbol))+          (str starter "-" mod "Te") (str "{}" (rep 3 symbol) "=")+          (str "+" starter "-" mod "Te") (str "{^}" (rep 3 symbol) "=")++          (str starter "-" mod "T*") (str "{}" (rep 4 symbol))+          (str "+" starter "-" mod "T*") (str "{^}" (rep 4 symbol))+          (str starter "-" mod "T*e") (str "{}" (rep 4 symbol) "=")+          (str "+" starter "-" mod "T*e") (str "{^}" (rep 4 symbol) "=")])])))++(def numbers+  {:starter "TPWHR"+   :left {"R" "1"+          "RK" "2"+          "K" "3"+          "LR" "4"+          "LRPK" "5"+          "PK" "6"+          "L" "7"+          "LP" "8"+          "P" "9"+          "LRK" "0"+          "LRP" "0"+          "RPK" "0"+          "LPK" "0"}+   :right {"S" "1"+           "S*" "2"+           "*" "3"+           "FS" "4"+           "FST*" "5"+           "T*" "6"+           "F" "7"+           "FT" "8"+           "T" "9"+           "FST" "0"+           "FS*" "0"+           "ST*" "0"+           "FT*" "0"}+   :F-starter "TPWHR&"+   :F-keys {"R"    "F1"  "S"    "F1"+            "RK"   "F2"  "S*"   "F2"+            "K"    "F3"  "*"    "F3"+            "LR"   "F4"  "FS"   "F4"+            "LRPK" "F5"  "FST*" "F5"+            "PK"   "F6"  "T*"   "F6"+            "L"    "F7"  "F"    "F7"+            "LP"   "F8"  "FT"   "F8"+            "P"    "F9"  "T" "F9"+            "RFST" "F10"+            "RFS*" "F10"+            "RST*" "F10"+            "RFT*" "F10"+            "RS"   "F11"+            "RS*"  "F12"+            }})++(def numbers-dict+  (->map+    (let [{:keys [starter left right F-starter F-keys]} numbers]+      [(for [[number-chord number] (merge left right) ; maps are merged into one+             [mod-chord combo] vowel-chords]+         [+          (str starter mod-chord number-chord) (str "{^}" (apply-mods number combo))+          ;(str starter chord left-chord) (apply-mods (symbol-name left-number) combo)+          ;(str "+" starter chord left-chord) (str "{^}" (apply-mods (symbol-name left-number) combo))+          ])+       (for [[f-chord f-key] F-keys+             [mod-chord combo] (assoc vowel-chords "-" [])]+         [(str F-starter mod-chord f-chord) (apply-mods f-key combo)])+       (for [[left-chord left-number] left+             [right-chord right-number] right]+         [(str starter left-chord right-chord) (str "{}" left-number right-number)+          (str "+" starter left-chord right-chord) (str "{^}" left-number right-number)++          (str starter "^" left-chord right-chord) (str "{}" left-number right-number "0")+          (str "+" starter "^" left-chord right-chord) (str "{^}" left-number right-number "0")++          (str starter left-chord right-chord "e") (str "{}" left-number right-number "00")+          (str "+" starter left-chord right-chord "e") (str "{^}" left-number right-number "00")++          (str starter "^" left-chord right-chord "e") (str "{}" left-number right-number "000")+          (str "+" starter "^" left-chord right-chord "e") (str "{^}" left-number right-number "000")+          ])])))+++(def movement-starter "PWH")+(def movement-chords+  {"R" "left"+   "P" "up"+   "K" "down"+   "S" "right"+   "LPF" "page_up"+   "RKS" "page_down"+   "LR" "home"+   "FS" "end"})++(def movement-dict+  (->map+    [(for [[mod-chord combo] (assoc vowel-chords "-" [])+           [chord movement] movement-chords]+       [(str movement-starter mod-chord chord) (apply-mods movement combo)]+       )]))++(def fingerspelling-starter "TWR")+(def letters+  {"LRPK" "a"+   "PK" "b"+   "PKS" "c"+   "PKF" "d"+   "LRPKS" "e"+   "F" "f"+   "PKFS" "g"+   "KT" "h"+   "KT*" "h" ; Porque no+   "LR" "i"+   "KST*" "j"+   "KST" "j" ; Here as a misstroke because why not+   "K" "k"+   "L" "l"+   "PS" "m"+   "PF" "n"+   "LRPKFS" "o"+   "P" "p"+   "KF*" "q"+   "KF" "q" ; Again, why not+   "R" "r"+   "S" "s"+   "T" "t"+   "LRKFS" "u"+   "FS" "v"+   "PF*" "w"+   "KS" "x"+   "PFT" "y"+   "PFS" "z"})++(def fingerspelling-dict+  (->map+    [(for [[mod-chord combo] vowel-chords+           [chord letter] letters]+       [(str fingerspelling-starter mod-chord chord) (apply-mods letter combo)])+     (for [[chord letter] letters]+       [(str fingerspelling-starter "-" chord) (str "{^}" letter)+        (str "#" fingerspelling-starter "-" chord) (str "{^}{-|}" letter)])]))++(def mods-dict (merge symbols-dict fingerspelling-dict numbers-dict movement-dict))++(spit "pinchord-mods.json" (json/generate-string mods-dict))

pinchord-chords-v28.1.json renamed from pinchord-chords-v28.0.json (view file)

File renamed without changes.

pinchord-javelin-dictionary-v28.1.yaml renamed from pinchord-javelin-dictionary-v28.0.yaml (view file)

File renamed without changes.

pinchord-javelin-system-v28.1.yaml renamed from pinchord-javelin-system-v28.0.yaml (view file)

File renamed without changes.

pinchord-starboard-layout-v28.1.javelin-layout renamed from pinchord-starboard-layout-v28.0.javelin-layout (view file)

File renamed without changes.

plover_pinchord/dictionaries/pinchord-mods-v28.0.3.json added (view file)

@@ -0,0 +1 @@

Show all 3 lines

plover_pinchord/system.py modified (view file)

@@ -17,7 +17,7 @@ UNDO_STROKE_STENO = "-LR"  DICTIONARIES_ROOT = "asset:plover_pinchord:dictionaries"-DEFAULT_DICTIONARIES = ("user.json", "pinchord-v28.0.3.json", "pinchord-v28.0.3.py")+DEFAULT_DICTIONARIES = ("user.json", "pinchord-v28.0.3.json", "pinchord-mods-v28.0.3.json", "pinchord-v28.0.3.py")  KEYMAPS = {   "Keyboard": {