Skip to content

Commit

Permalink
+(defn convert-stems)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoontz committed Jun 6, 2024
1 parent da9a677 commit b7e1418
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/menard/español.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,17 @@
:agr {:person :3rd :number :sing}
:surface (u/get-in exceptions [:preterito :3sing])}])))

(defn convert-stems [exceptions]
(merge
(when (u/get-in exceptions [:boot-stem])
{:stems {:boot (u/get-in exceptions [:boot-stem])}})
(when (u/get-in exceptions [:preterito-stem])
{:stems {:boot (u/get-in exceptions [:preterito-stem])}})))

(defn convert []
(->> (-> "resources/español/lexicon.edn"
slurp
read-string)
read-string)
(map (fn [[k v]]
[k (if (vector? v)
v [v])]))
Expand All @@ -87,9 +94,18 @@
{:agr (u/get-in v [:synsem :agr])}
{}))
(merge (if (u/get-in v [:espanol])
{:exceptions (vec (convert-exceptions (u/get-in v [:espanol])))}
{})))))
(let [converted-exceptions (convert-exceptions (u/get-in v [:espanol]))]
(if (not (empty? converted-exceptions))
{:exceptions (vec converted-exceptions)}
{}))))
(merge (if (u/get-in v [:espanol])
(let [stems (convert-stems (u/get-in v [:espanol]))]
(if stems
stems
{})))))))

vec)]))
(into {})))



0 comments on commit b7e1418

Please sign in to comment.