From e4a195a777afe516fb0a6c8f4a41eaacc3a3e874 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 29 Jun 2022 14:35:23 +0200 Subject: [PATCH] (Est) more API-friendly overloads for mkPrep --- src/estonian/ConstructionEst.gf | 2 +- src/estonian/ParadigmsEst.gf | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/estonian/ConstructionEst.gf b/src/estonian/ConstructionEst.gf index 74840743..d313eaab 100644 --- a/src/estonian/ConstructionEst.gf +++ b/src/estonian/ConstructionEst.gf @@ -32,7 +32,7 @@ lin n_units_AP card cn a = mkAP (lin AdA (mkUtt (lin NP (mkNP (lin CN cn))))) (lin A a) ; {- - glass_of_CN np = mkCN (lin N2 (mkN2 (mkN "klaas") (mkPrep partitive))) (lin NP np) | mkCN (lin N2 (mkN2 (mkN "klaasitäis") (mkPrep partitive))) (lin NP np) ; + glass_of_CN np = mkCN (lin N2 (mkN2 (mkN "klaas") (casePrep partitive))) (lin NP np) | mkCN (lin N2 (mkN2 (mkN "klaasitäis") (casePrep partitive))) (lin NP np) ; where_go_QCl np = mkQCl (lin IAdv (ss "kuhu")) (mkCl np (mkVP L.go_V)) ; diff --git a/src/estonian/ParadigmsEst.gf b/src/estonian/ParadigmsEst.gf index 45bffe7d..a2ebf907 100644 --- a/src/estonian/ParadigmsEst.gf +++ b/src/estonian/ParadigmsEst.gf @@ -83,6 +83,12 @@ oper postGenPrep : Str -> Prep ; -- genitive postposition, e.g. "taga" casePrep : Case -> Prep ; -- just case, e.g. adessive + mkPrep : overload { + mkPrep : Str -> Prep ; -- API-friendly version of postGenPrep—many applications assume there is a `mkX : Str -> X' available for any X + mkPrep : Case -> Prep ; -- API-friendly version of casePrep + mkPrep : Case -> Str -> Prep ; -- API-friendly version of postPrep + } ; + --2 Conjunctions, adverbs @@ -311,19 +317,25 @@ oper infDa = InfDa ; infMa = InfMa ; infMast = InfMast ; infDes = InfDes ; infMas = InfMas ; infMaks = InfMaks ; infMata = InfMata ; infMine = InfMine ; - mkPrep : (isPre : Bool) -> Case -> Str -> Prep = \isPre,c,p -> lin Prep { + mkAdposition : (isPre : Bool) -> Case -> Str -> Prep = \isPre,c,p -> lin Prep { c = casep2npformp c ; s = p ; isPre = isPre } ; - prePrep : Case -> Str -> Prep = mkPrep True ; - postPrep : Case -> Str -> Prep = mkPrep False ; + prePrep : Case -> Str -> Prep = mkAdposition True ; + postPrep : Case -> Str -> Prep = mkAdposition False ; postGenPrep : Str -> Prep = postPrep genitive ; + mkPrep = overload { + mkPrep : Str -> Prep = postGenPrep ; + mkPrep : Case -> Prep = casePrep ; + mkPrep : Case -> Str -> Prep = postPrep ; + mkPrep : (isPre : Bool) -> Case -> Str -> Prep = mkAdposition + } ; -- The Prep's isPre field is used in a special (hacky) way in mkN3 and mkN2. -- Used to be able to match whether the Prep's case is Gen, but now several -- Preps use the genitive stem, so we need to check if it's actually genitive. - casePrep : Case -> Prep = \c -> mkPrep (isActuallyGenitive c) c [] ; + casePrep : Case -> Prep = \c -> mkAdposition (isActuallyGenitive c) c [] ; -- NPAcc is different, it's not formed from a Case(Plus) accPrep : Prep = lin Prep {