1b963ec

Pinchord · pinchord.git · Tickets · Changelog

Branches > build-process > 1b963ec > files / README.md

Move bank key definitions out of generate.clj and into chords.edn

Grahp, 2026-09-05

Commit: 1b963eca6fa0c8eb655f1d10c2c24335d876f5e3
Parent: 717fc20

2 changed files:

chords.edn modified (view file)

@@ -1,10 +1,11 @@ {:version "v30.0"- :banks {:prefixes "#+"-         :initials "TSPWHR&"-         :vowels "AOIU^"-         :finals "LRPKFST*"-         :suffixes "es"}- :keys "#+TSPWHR&AOIU^LRPKFST*es"+ :chords/banks [:prefixes :initials :vowels :finals :suffixes]+ :chords/bank-keys {:prefixes "#+"+                    :initials "TSPWHR&"+                    :vowels "AOIU^"+                    :finals "LRPKFST*"+                    :suffixes "es"}+ ;:keys "#+TSPWHR&AOIU^LRPKFST*es"  :initials {"T" "t"             "TSP&" "sk"             "TP" "f"

src/org/pinchord/generate.clj modified (view file)

@@ -1,13 +1,8 @@ (ns org.pinchord.generate-  (:require [clj-yaml.core :as yaml]-            [clojure.string :as str]-            [clojure.edn :as edn]))--(def banks [:prefixes :initials :vowels :finals :suffixes])--(def bank->priority-  "Map of banks to priorities used for javelin orthospelling."-  (zipmap banks (rest (range))))+  (:require+   [clj-yaml.core :as yaml]+   [clojure.edn :as edn]+   [clojure.string :as str]))  (defn finalize [m]   (update-keys m (partial str "-")))@@ -43,33 +38,38 @@   (update-vals s abbreviate))  (defn with-gaps-filled [bank chords]-  (let [s (remove (bank chords) (all-chords (bank (:banks chords))))]+  (let [s (remove (bank chords) (all-chords (bank (:chords/bank-keys chords))))]     (merge (bank chords) (abbreviate-long-chords (zipmap s s))))) +; TODO make this a function of bank-keys (defn fill-gaps-in-banks [chords]   (assoc chords          :initials (with-gaps-filled :initials chords)          :vowels   (with-gaps-filled :vowels chords)          :finals   (with-gaps-filled :finals chords))) -(defn build-javelin-dictionary [chords]-  {:name (str "Pinchord Base " (:version chords))-   :maximumOutlineLength 1-   :starters [{:stroke "#+" :definition "{^}{-|}" :mask "#+"}-              {:stroke "" :definition "{}" :mask ""}]-   :letters (->> (reduce (fn [acc [bank entries]]-                           (if-let [bank-keys ((:banks chords) bank)]-                             (into acc (mapv (fn [[stroke translation]]-                                               {:stroke stroke :data translation :order (bank->priority bank)-                                                :avoidMask (str (when (= bank :finals)-                                                                  "-")-                                                                (mask stroke bank-keys))})-                                             entries))-                             (into acc (mapv (fn [[stroke translation]]-                                               {:stroke stroke :data translation :order (bank->priority bank)})-                                             entries))))-                         #{} (select-keys chords banks))-                 (sort-by (comp - count :stroke)))})+; TODO switch to JVM and use keys! with the latest alpha+(defn build-javelin-dictionary [{:chords/keys [banks bank-keys]+                                 :keys [version]+                                 :as chords}]+  (let [bank->priority (zipmap banks (map inc (range)))]+    {:name (str "Pinchord Base " version)+     :maximumOutlineLength 1+     :starters [{:stroke "#+" :definition "{^}{-|}" :mask "#+"}+                {:stroke "" :definition "{}" :mask ""}]+     :letters (->> (reduce (fn [acc [bank entries]]+                             (if-let [bank-keys (bank-keys bank)]+                               (into acc (mapv (fn [[stroke translation]]+                                                 {:stroke stroke :data translation :order (bank->priority bank)+                                                  :avoidMask (str (when (= bank :finals)+                                                                    "-")+                                                                  (mask stroke bank-keys))})+                                               entries))+                               (into acc (mapv (fn [[stroke translation]]+                                                 {:stroke stroke :data translation :order (bank->priority bank)})+                                               entries))))+                           #{} (select-keys chords banks))+                   (sort-by (comp - count :stroke)))}))  (defn -main [& _args]   (let [chords (-> (edn/read-string (slurp "chords.edn"))