Skip to content

Commit

Permalink
converting with unifying seems to work now
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoontz committed Jun 6, 2024
1 parent b7e1418 commit d4095e0
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions src/menard/español.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,31 @@
(when (u/get-in exceptions [:preterito-stem])
{:stems {:boot (u/get-in exceptions [:preterito-stem])}})))

(defn convert-unifies [v]
(let [evalled (eval v)]
(if (vector? evalled)
(->> evalled
(map (fn [v]
(apply unify (concat (get v :unify [:top])
[(dissoc v :unify)])))))
evalled)))

(defn convert []
(->> (-> "resources/español/lexicon.edn"
slurp
read-string)
read-string)
(filter (fn [[k v]]
(or true (= k "conducir")
(= k "pararse"))))
(map (fn [[k v]]
[k (convert-unifies v)]))
(map (fn [[k v]]
[k (if (vector? v)
v [v])]))
[k (cond (vector? v)
v
(seq? v)
(vec v)
:else
[v])]))
(map (fn [[k vs]]
[k (->> vs
(map (fn [v]
Expand All @@ -102,10 +120,7 @@
(let [stems (convert-stems (u/get-in v [:espanol]))]
(if stems
stems
{})))))))

vec)]))
{}))))))))]))
(map (fn [[k vs]]
[k (vec vs)]))
(into {})))



0 comments on commit d4095e0

Please sign in to comment.