From 3705c9229dbb2777ff8c75317a1400bf00b8d00c Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 22 Apr 2020 19:55:11 +0200 Subject: [PATCH] (Hun) Restructure adpositions --- src/hungarian/AdjectiveHun.gf | 5 +++-- src/hungarian/AdverbHun.gf | 2 +- src/hungarian/ParadigmsHun.gf | 8 ++++---- src/hungarian/ResHun.gf | 28 +++++++++++++++++++++++++--- src/hungarian/StructuralHun.gf | 16 ++++++++-------- 5 files changed, 41 insertions(+), 18 deletions(-) diff --git a/src/hungarian/AdjectiveHun.gf b/src/hungarian/AdjectiveHun.gf index a718d87a..1a4c8449 100644 --- a/src/hungarian/AdjectiveHun.gf +++ b/src/hungarian/AdjectiveHun.gf @@ -12,13 +12,14 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in { -- : A -> NP -> AP ; ComparA a np = emptyAP ** { s = a.s ! Compar ; - compar = np.s ! Ade ; + compar = applyAdp (caseAdp "nál" "nél") np ; -- Adessive + -- compar = applyAdp (prepos Nom "mint") np ; } ; -- : A2 -> NP -> AP ; -- married to her ComplA2 a2 np = emptyAP ** { s = a2.s ! Posit ; - compar = np.s ! a2.c2.c ++ a2.c2.s + compar = applyAdp a2.c2 np ; } ; -- : A2 -> AP ; -- married to itself diff --git a/src/hungarian/AdverbHun.gf b/src/hungarian/AdverbHun.gf index ed7b7473..c7cbde60 100644 --- a/src/hungarian/AdverbHun.gf +++ b/src/hungarian/AdverbHun.gf @@ -12,7 +12,7 @@ lin -- : Prep -> NP -> Adv ; PrepNP prep np = { - s = prep.pr ++ np.s ! prep.c ++ prep.s ; + s = applyAdp prep np } ; -- Adverbs can be modified by 'adadjectives', just like adjectives. diff --git a/src/hungarian/ParadigmsHun.gf b/src/hungarian/ParadigmsHun.gf index fafbc4a5..6a6ccd16 100644 --- a/src/hungarian/ParadigmsHun.gf +++ b/src/hungarian/ParadigmsHun.gf @@ -90,7 +90,7 @@ oper } ; prePrep : Str -> Case -> Prep -- Preposition - = \s,c -> lin Prep {pr=s ; s=[] ; c=c} ; + = \s,c -> lin Prep (ResHun.prepos c s) ; casePrep : Case -> Prep ; -- No postposition, only case @@ -190,13 +190,13 @@ oper mkPrep = overload { mkPrep : (e : Str) -> Prep - = \str -> lin Prep (ResHun.mkPrep str) ; + = \str -> lin Prep (ResHun.nomAdp str) ; mkPrep : Str -> Case -> Prep - = \str,c -> lin Prep (ResHun.mkPrep str ** {c = c}) ; + = \str,c -> lin Prep (ResHun.caseAdp c str) ; } ; casePrep : Case -> Prep - = \c -> lin Prep (ResHun.mkPrep [] ** {c = c}) ; + = \c -> lin Prep (ResHun.caseAdp c) ; -------------------------------------------------------------------------------- } diff --git a/src/hungarian/ResHun.gf b/src/hungarian/ResHun.gf index 7f122f10..a26fd5a7 100644 --- a/src/hungarian/ResHun.gf +++ b/src/hungarian/ResHun.gf @@ -120,13 +120,35 @@ oper -- TODO: personal suffixes, e.g. felettem, általam, not *felett/által én Adposition : Type = { pr : Str ; -- Preposition - s : Str ; -- Postposition + s : HarmForms ; -- Postposition c : Case ; } ; - mkPrep : Str -> Adposition = \str -> {s=str ; c=Nom ; pr=[]} ; + nomAdp : Str -> Adposition = \s -> postpos Nom (harm1 s) ; - emptyAdp : Adposition = mkPrep [] ; + caseAdp = overload { + caseAdp : Case -> Adposition = \c -> postpos c (harm1 []) ; + caseAdp : Case -> Str -> Adposition = \c,s -> postpos c (harm1 s) ; + caseAdp : Str -> Adposition = \ért -> + postpos OblStem (harm1 ért) ; + caseAdp : (x,y : Str) -> Adposition = \nál,nél -> + postpos OblStem (harm nál nél) ; + caseAdp : (x,y,z : Str) -> Adposition = \hoz,hez,höz -> + postpos OblStem (harm3 hoz hez höz) + } ; + postpos : Case -> HarmForms -> Adposition = \c,h-> {s=h ; c=c ; pr=[]} ; + prepos : Case -> Str -> Adposition = \c,s -> {s=harm1 [] ; c=c ; pr=s} ; + + emptyAdp : Adposition = nomAdp [] ; + + applyAdp : Adposition -> NounPhrase -> Str = \adp,np -> + adp.pr ++ glueIf adp.c (np.s ! adp.c) (adp.s ! np.h) ; + + glueIf : Case -> (_,_ : Str) -> Str = \cas,a,b -> + case cas of { + OblStem => glue a b ; + _ => a ++ b + } ; ------------------ -- Conj diff --git a/src/hungarian/StructuralHun.gf b/src/hungarian/StructuralHun.gf index 20d11a6e..7b5af2da 100644 --- a/src/hungarian/StructuralHun.gf +++ b/src/hungarian/StructuralHun.gf @@ -94,25 +94,25 @@ lin something_NP = defNP "valami" Sg ; -- List of postpositions requiring case: -- https://en.wiktionary.org/wiki/Appendix:Hungarian_postpositions#Postpositions_Requiring_Case -lin above_Prep = mkPrep "fölött" ; +lin above_Prep = nomAdp "fölött" ; -- lin after_Prep = mkPrep "" -- lin before_Prep = mkPrep "" ; -- lin behind_Prep = mkPrep "" ; -- lin between_Prep = = mkPrep "" ; -lin by8agent_Prep = mkPrep "által" ; -lin by8means_Prep = casePrep Ins ; +lin by8agent_Prep = nomAdp "által" ; +lin by8means_Prep = caseAdp Ins ; -- lin during_Prep = mkPrep ; -- lin except_Prep = mkPrep ; -lin for_Prep = casePrep Dat ; +lin for_Prep = caseAdp Dat ; -- lin from_Prep = mkPrep "" ; -- lin in8front_Prep = mkPrep "" ; -lin in_Prep = casePrep Ine ; -lin on_Prep = casePrep Sup ; +lin in_Prep = caseAdp "ban" "ben" ; +lin on_Prep = caseAdp Sup ; -- lin part_Prep = casePrep ; -- lin possess_Prep = -- Suffix attaches to possessee, not possessor -- lin through_Prep = mkPrep ; -lin to_Prep = casePrep All ; -lin under_Prep = mkPrep "alatt" ; +lin to_Prep = caseAdp "hoz" "hez" "höz" ; +lin under_Prep = nomAdp "alatt" ; -- lin with_Prep = mkPrep "" ; -- lin without_Prep = mkPrep "" ;