a29c18b
Pinchord · pinchord.git · Tickets · Changelog
Branches > v30.2 > a29c18b > files
Split chords into chords.edn and update dictionary generation script
Commit: a29c18ba0bf99b2a0131ba75cdadef8c5e5e79ac
Parent: 9056192
4 changed files:
README.md view file
@@ -9,3 +9,11 @@ Everything is versioned with a suffix number. Thanks to Kate (https://codeberg.org/StrawberryTurtle, https://github.com/StrawberryTurtle) and Harri (https://github.com/StenoHarri) for help and influence :)++# Dictionary++Chords can be found in "chords.edn".++To generate the dictionary into a javelin dict, run `./generate-dict.clj` (requires babashka - https://babashka.org).++Or you can just edit the generated dictionary directly of coursechords.edn view file
@@ -0,0 +1,237 @@+{:version 13+ :initials {"T" "t",+ "TSP*" "sk"+ "TSPHR" "sv",+ "TP" "f",+ "TSWR" "kr",+ "THR" "thr",+ "TPR" "fr",+ "PWR" "br",+ "SH*" "sch",+ "TSPR" "scr",+ "TSWH" "kn",+ "TWH" "thw",+ "PWHR" "bl",+ "SPWHR" "cl",+ "TS" "st",+ "SPR" "spr",+ "SWHR" "shr",+ "HR" "l",+ "WH" "wh",+ "TW" "tw",+ "S" "s",+ "SR" "v",+ "TPWR" "dr",+ "H" "h",+ "PR" "pr",+ "TSPWR" "gr",+ "SHR" "sl",+ "SW" "sw",+ "SWR" "y",+ "TSPWH" "gh",+ "R" "r",+ "TSPR*" "squ",+ "TWR" "vr",+ "TSR" "str",+ "TWHR" "j",+ "SH" "sh",+ "PH" "m",+ "TSP" "sc",+ "TR" "tr",+ "P" "p",+ "WHR" "qu",+ "WHR*" "q",+ "TPHR" "fl",+ "TH" "th",+ "WR" "wr",+ "SPWR" "cr",+ "SPH" "sm",+ "TSW" "k",+ "SPHR" "spl",+ "TSPWHR" "gl",+ "TSWHR" "kl",+ "SPW" "c",+ "SWH" "z",+ "PHR" "pl",+ "SPWH" "ch",+ "TSPW" "g",+ "W" "w",+ "SP" "sp",+ "TSPH" "sn",+ "TPH" "n",+ "TPW" "d",+ "PW" "b"}++ :vowels {"OU" "ou",+ "AU" "au",+ "AOI" "ee",+ "AO^" "oa",+ "AU^" "ua",+ "AI^" "ia",+ "IU^" "ui",+ "IU" "e",+ "AIU" "ea",+ "OI^" "io",+ "AIU^" "ae",+ "AOU" "ei",+ "U^" "ue",+ "U" "u",+ "O" "o",+ "AO" "oo",+ "A" "a",+ "I" "i",+ "I^" "y",+ "AOIU" "",+ "OIU" "oe",+ "AOU^" "ie",+ "OI" "oi",+ "OIU^" "eo",+ "AI" "ai"}++ :finals {"FS" "v"+ "FS*" "vv"+ "LFS" "lv"+ "LRFS" "nv"+ "RFS" "rv"+ "KFS" "sh"+ "LKFS" "lsh"+ "LRKFS" "nsh"+ "RKFS" "rsh"generate-dictionary.clj view file
@@ -0,0 +1,43 @@+#!/usr/bin/env bb+;; Dictionay generation script+(def priority+ "Priorities used for javelin orthospelling."+ (zipmap [::pre-prefixes ::prefixes ::initials ::vowels ::finals ::suffixes]+ (rest (range))))++(comment+ (def yaml-dict (yaml/parse-string (slurp "pinchord-javelin-dictionary.yaml")))++ (->> (:letters yaml-dict)+ (filter #(= (:order %) 2))+ (map (fn [m] [(:stroke m) (:data m)]))+ (into {})))++(defn finalize+ "Puts dashes before all the keys of m"+ [m]+ (update-keys m (partial str \-)))++(defn generate-dict! []+ (let [chords (edn/read-string (slurp "chords.edn"))+ {:keys [version pre-prefixes prefixes initials vowels finals suffixes]} chords+ layout {::pre-prefixes pre-prefixes+ ::prefixes prefixes+ ::initials initials+ ::vowels vowels+ ::finals (finalize finals)+ ::suffixes (finalize suffixes)}+ dict {:name "Pinchord"+ :maximumOutlineLength 1+ :starters [{:stroke "" :definition "" :mask ""}]+ :letters (->> (reduce (fn [acc [layout entries]]+ (into acc (mapv (fn [[stroke translation]] {:stroke stroke :data translation :order (priority layout)})+ entries)))+ #{} layout)+ (sort-by (comp - count :stroke)))}]++ (->> (yaml/generate-string dict)+ (spit (str "pinchord-javelin-dictionary-" version ".yaml")))))++(generate-dict!)+pinchord-dict.clj view file
@@ -1,291 +0,0 @@-;; Dictionay generation script-(def priority- "Priorities used for javelin orthospelling."- (zipmap [::pre-prefixes ::prefixes ::initials ::vowels ::finals ::suffixes]- (rest (range))))--(def version 13)--(comment- (def yaml-dict (yaml/parse-string (slurp "pinchord-javelin-dictionary.yaml")))-- (->> (:letters yaml-dict)- (filter #(= (:order %) 2))- (map (fn [m] [(:stroke m) (:data m)]))- (into {})))--(def initials {"T" "t",- "TSP*" "sk"- "TSPHR" "sv",- "TP" "f",- "TSWR" "kr",- "THR" "thr",- "TPR" "fr",- "PWR" "br",- "SH*" "sch",- "TSPR" "scr",- "TSWH" "kn",- "TWH" "thw",- "PWHR" "bl",- "SPWHR" "cl",- "TS" "st",- "SPR" "spr",- "SWHR" "shr",- "HR" "l",- "WH" "wh",- "TW" "tw",- "S" "s",- "SR" "v",- "TPWR" "dr",- "H" "h",- "PR" "pr",- "TSPWR" "gr",- "SHR" "sl",- "SW" "sw",- "SWR" "y",- "TSPWH" "gh",- "R" "r",- "TSPR*" "squ",- "TWR" "vr",- "TSR" "str",- "TWHR" "j",- "SH" "sh",- "PH" "m",- "TSP" "sc",- "TR" "tr",- "P" "p",- "WHR" "qu",- "WHR*" "q",- "TPHR" "fl",- "TH" "th",- "WR" "wr",- "SPWR" "cr",- "SPH" "sm",- "TSW" "k",- "SPHR" "spl",- "TSPWHR" "gl",- "TSWHR" "kl",- "SPW" "c",- "SWH" "z",- "PHR" "pl",- "SPWH" "ch",- "TSPW" "g",- "W" "w",- "SP" "sp",- "TSPH" "sn",- "TPH" "n",- "TPW" "d",- "PW" "b"})--(def vowels {"OU" "ou",- "AU" "au",- "AOI" "ee",- "AO^" "oa",- "AU^" "ua",- "AI^" "ia",- "IU^" "ui",- "IU" "e",- "AIU" "ea",- "OI^" "io",- "AIU^" "ae",- "AOU" "ei",- "U^" "ue",- "U" "u",- "O" "o",- "AO" "oo",- "A" "a",- "I" "i",- "I^" "y",- "AOIU" "",