pinchord-dict.clj
Pinchord · pinchord.git · Tickets · Changelog
Branches > serial-mods > 9056192 > files / pinchord-dict.clj
;; 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" "",
"OIU" "oe",
"AOU^" "ie",
"OI" "oi",
"OIU^" "eo",
"AI" "ai"})
(def finals {"FS" "v"
"FS*" "vv"
"LFS" "lv"
"LRFS" "nv"
"RFS" "rv"
"KFS" "sh"
"LKFS" "lsh"
"LRKFS" "nsh"
"RKFS" "rsh"
"KFS*" "w"
"LKFS*" "wl"
"LRKFS*" "wn"
"RKFS*" "rw"
"L" "l"
"LR" "rl"
"R" "r"
"P" "p"
"LP" "lp"
"LRP" "mp"
"RP" "rp"
"PK" "b"
"LPK" "lb"
"LRPK" "mb"
"RPK" "rb"
"PF" "n"
"LPF" "ln"
"LRPF" "nn"
"RPF" "rn"
"PKFS" "g"
"LPKFS" "lg"
"LRPKFS" "ng"
"RPKFS" "rg"
"RPKFS*" "gh"
"RPKFST*" "ght"
"F" "f"
"F*" "ff"
"LF" "lf"
"LRF" "nf"
"LRF*" "fn" ;; :garfsmie:
"RF" "rf"
"PFT" "y"
"PFT*" "yy"
"LPFT" "ly"
"LPFT*" "nly"
"RPFT" "ry"
"RPFT*" "rly"
"LRPFT" "ny"
"PKST" "j"
"LPKST" "lj"
"LRPKST" "nj"
"RPKST" "rj"
"PKF" "d"
"LPKF" "ld"
"LRPKF" "nd"
"RPKF" "rd"
"RPKF*" "dg"
"KS" "x"
"RKS" "rx"
"LKS" "lx"
"LRKS" "nx"
"KST" "xt"
"RKST" "rxt"
"LKST" "lxt"
"LRKST" "nxt"
"KF" "ch"
"LKF" "lch"
"LRKF" "nch"
"RKF" "rch"
"K" "k"
"K*" "ck"
"LK" "lk"
"LRK" "nk"
"RK" "rk"
"S" "s"
"LS" "ls"
"LRS" "ns"
"RS" "rs"
"PS" "m"
"LPS" "lm"
"LRPS" "mn"
"RPS" "rm"
;"P" * "S h"
;"PKF" * "S gh"
;"PKF" * "TS ght"
"PFS" "z"
"LPFS" "lz"
"LRPFS" "nz"
"RPFS" "rz"
"T" "t"
"LT" "lt"
"LRT" "nt"
"RT" "rt"
"ST" "st"
"LST" "lst"
"LRST" "nst"
"RST" "rst"
"PT" "pt"
"KT" "kt"
"FT" "ft"
"PKFT" "ky"
"RPKFT" "cky"
"L*" "ll"
"R*" "rr"
"P*" "pp"
"PK*" "w"
"LPK*" "bl"
"LRPK*" "bbl"
"PKFS*" "gg"
"LRPFT*" "nny"
"PKF*" "dd"
"LPKF*" "ddl"
"LRPKF*" "rld"
"KS*" "sk"
"RKS*" "rsk"
"LKS*" "lsk"
"LRKS*" "nsk"
"KST*" "sc"
"RKST*" "rsc"
"LKST*" "lsc"
"LRKST*" "nsc"
"KF*" "tch"
"PKS" "c"
"LPKS" "lc"
"LRPKS" "nc"
"RPKS" "rc"
"PKS*" "h"
"S*" "ss"
"PS*" "sp"
;"P*S*" "tion"
;"PKF*S*" "ction"
;"PKF*TS*" "nction"
"PFS*" "zz"
"T*" "tt"
"LT*" "ttl"
"ST*" "th"
"LST*" "lth"
"LRST*" "nth"
"RST*" "rth"
"KT*" "ct"
"PKFT*" "cy"})
(defn finalize
"Puts dashes before all the keys of m"
[m]
(update-keys m (partial str \-)))
;; Does not include empty entries since javelin doesn't...
(def layout
{::pre-prefixes {"+" "{^}"
"_" "{^}_"
"_+" "{^}_"}
::prefixes {"#" "{-|}"}
::initials initials
::vowels vowels
::finals (finalize finals)
::suffixes (finalize {"E" "e"})})
(defn javelin-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)))})
#_(defn javelin-dict []
{:name "Pinchord"
:maximumOutlineLength 1
:starters [{:stroke "" :definition "" :mask ""}]
:letters (sort-by (comp - count :stroke)
(for [[layout-key entries] layout
[stroke translation] entries]
{:stroke stroke
:data translation
:priority (priority layout-key)}))})
(defn generate-javelin-dict! [dict]
(->> (yaml/generate-string dict)
(spit (str "pinchord-javelin-dictionary-" version ".yaml"))))
(comment
(generate-javelin-dict! (javelin-dict)))