Skip to content

Commit

Permalink
compile surface from a map rather than an arbitrary function
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoontz committed Jun 2, 2024
1 parent f57eef0 commit b3739ef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions resources/español/lexicon/rules.edn
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
:boot-stem? true}
:then [{:exceptions [{:infl :present
:agr {:person :1st :number :sing}
:surface #(str (u/get-in % [:stems :boot]) "o")
}
:surface {:prefix [:stems :boot]
:suffix "o"}}
;; TODO: other numbers and persons.
]}]}

Expand Down
15 changes: 9 additions & 6 deletions src/menard/lexiconfn.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@
(merge consequent
{:exceptions (map (fn [exception]
(let [surface (:surface exception)]
(cond (fn? surface)
;; TODO: lock down what can be evaluated
(merge exception
{:surface (surface lexeme)})
:else
exception)))
(cond
(map? surface)
(merge exception
{:surface (str (u/get-in lexeme (:prefix surface))
(:suffix surface))})
(string? surface)
exception
:else
(exception "Cannot find surface form given intermediate surface value: " surface))))
(:exceptions consequent))})]
retval)
consequent))
Expand Down

0 comments on commit b3739ef

Please sign in to comment.