From 6de0fe95ec484729edf3932bb3151c912459e737 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 17 Apr 2020 18:23:21 +0200 Subject: [PATCH] (Hun) Add relative clauses --- src/hungarian/CatHun.gf | 6 ++-- src/hungarian/NounHun.gf | 5 ++-- src/hungarian/ParamHun.gf | 5 ++++ src/hungarian/RelativeHun.gf | 19 ++++++++---- src/hungarian/ResHun.gf | 56 +++++++++++++++++++++++++++++------- src/hungarian/SentenceHun.gf | 4 +-- 6 files changed, 73 insertions(+), 22 deletions(-) diff --git a/src/hungarian/CatHun.gf b/src/hungarian/CatHun.gf index 8449d206c..159b97ad7 100644 --- a/src/hungarian/CatHun.gf +++ b/src/hungarian/CatHun.gf @@ -9,7 +9,7 @@ concrete CatHun of Cat = CommonX ** open ResHun, Prelude in { S = ResHun.Sentence ; QS = SS ; - RS = SS ; + RS = ResHun.RP ; -- relative sentence. Tense and polarity fixed, -- but agreement may depend on the CN/NP it modifies. @@ -30,8 +30,8 @@ concrete CatHun of Cat = CommonX ** open ResHun, Prelude in { --2 Subord clauses and pronouns - --RCl = ResHun.RClause ; - --RP = SS ; + RCl = ResHun.RClause ; + RP = ResHun.RP ; --2 Verb phrases diff --git a/src/hungarian/NounHun.gf b/src/hungarian/NounHun.gf index 98e351ec4..b5651fa89 100644 --- a/src/hungarian/NounHun.gf +++ b/src/hungarian/NounHun.gf @@ -167,8 +167,9 @@ concrete NounHun of Noun = CatHun ** open ResHun, Prelude in { } ; -- : CN -> RS -> CN ; - -- RelCN cn rs = cn ** { - -- } ; + RelCN cn rs = cn ** { + s = \\n,c => cn.s ! n ! c ++ rs.s ! n ! c + } ; {- -- : CN -> Adv -> CN ; diff --git a/src/hungarian/ParamHun.gf b/src/hungarian/ParamHun.gf index 2157c654f..35d4e5ad8 100644 --- a/src/hungarian/ParamHun.gf +++ b/src/hungarian/ParamHun.gf @@ -46,6 +46,11 @@ oper Ins => ins ; Tra => tra } ; + sc2case : SubjCase -> Case = \sc -> + case sc of { + SCNom => Nom ; + SCDat => Dat + } ; -------------------------------------------------------------------------------- -- Numerals diff --git a/src/hungarian/RelativeHun.gf b/src/hungarian/RelativeHun.gf index 6f14093bc..84b873a19 100644 --- a/src/hungarian/RelativeHun.gf +++ b/src/hungarian/RelativeHun.gf @@ -1,22 +1,31 @@ concrete RelativeHun of Relative = CatHun ** open ResHun, Prelude, (NS=NounHun), (SS=StructuralHun) in { -{- lin -- : Cl -> RCl ; -- such that John loves her -- RelCl cl = ; -- : RP -> VP -> RCl ; - RelVP rp vp = + RelVP = relVP ; -- : RP -> ClSlash -> RCl ; -- whom John loves - RelSlash rp cls = + RelSlash = relSlash ; -- : RP ; - IdRP = {s = ""} ; + IdRP = {s = + table {Sg => caseTable "ami" "amit" "aminek" -- nom, acc, dat + "amibe" "amiben" "amiből" -- ill, ine, ela + "amihez" "aminél" "amitől" -- all, ade, abl + "amire" "amin" "amiről" -- sub, sup, del + "amiért" "amivel" "amivé" ; -- cau, ins, tra + Pl => caseTable "amik" "amiket" "amiknek" -- nom, acc, dat + "amikbe" "amikben" "amikből" -- ill, ine, ela + "amikhez" "amiknél" "amiktől" -- all, ade, abl + "amikre" "amiken" "amikről" -- sub, sup, del + "amikért" "amikkel" "amikké"}; -- cau, ins, tra + } ; -- : Prep -> NP -> RP -> RP ; -- the mother of whom --FunRP prep np rp = {} ; --} } diff --git a/src/hungarian/ResHun.gf b/src/hungarian/ResHun.gf index f92d0e0b3..ef5cf5411 100644 --- a/src/hungarian/ResHun.gf +++ b/src/hungarian/ResHun.gf @@ -301,25 +301,61 @@ oper {- After PredVP, we might still want to add more adverbs (QuestIAdv), but we're done with verb inflection. -} - ClSlash : Type = Clause ; + ClSlash : Type = Clause ** { + sc : SubjCase ; -- For RelSlash + } ; QClause : Type = Clause ; - -- RClause : Type = {s : NForm => Tense => Anteriority => Polarity => Str} ; Sentence : Type = {s : Str} ; + -- predVP : NounPhrase -> VerbPhrase -> ClSlash = \np,vp -> vp ** { + -- s = \\t,a,p => let subjcase : Case = case vp.sc of { + -- SCNom => Nom ; + -- SCDat => Dat } + -- in np.s ! subjcase + -- ++ np.empty -- standard trick for prodrop + -- ++ vp.s ! agr2vf np.agr + -- ++ vp.obj + -- ++ vp.adv + -- } ; + predVP : NounPhrase -> VerbPhrase -> ClSlash = \np,vp -> vp ** { - s = \\t,a,p => let subjcase : Case = case vp.sc of { - SCNom => Nom ; - SCDat => Dat } - in np.s ! subjcase - ++ np.empty -- standard trick for prodrop - ++ vp.s ! agr2vf np.agr - ++ vp.obj - ++ vp.adv + s = let rel : RClause = relVP' (np2rp np) vp ; + in \\t,a,p => rel.s ! t ! a ! p ! np.agr.p2 ! sc2case vp.sc + ++ np.empty ; -- standard trick for prodrop+metavariable problem } ; + + -- Relative + + RP : Type = {s : Number => Case => Str} ; + RClause : Type = {s : Tense => Anteriority => Polarity => Number => Case => Str} ; + + np2rp : NounPhrase -> RP ** {agr : Person*Number} = \np -> np ** { + s = \\n => np.s ; + } ; + + relVP : RP -> VerbPhrase -> RClause = \rp -> relVP' (rp ** {agr=}) ; + + relVP' : RP ** {agr : Person*Number} -> VerbPhrase -> RClause = \rp,vp -> { + s = \\t,a,p,n,c => let subjcase : Case = case vp.sc of { + SCNom => c ; + SCDat => Dat } + in rp.s ! n ! subjcase + ++ vp.s ! VFin rp.agr.p1 n -- variable by number + ++ vp.obj + ++ vp.adv + } ; + + relSlash : RP -> ClSlash -> RClause = \rp,cls -> { + s = \\t,a,p,n,c => let subjcase : Case = case cls.sc of { + SCNom => c ; + SCDat => Dat } + in rp.s ! n ! subjcase + ++ cls.s ! t ! a ! p + } ; -------------------------------------------------------------------------------- -- linrefs diff --git a/src/hungarian/SentenceHun.gf b/src/hungarian/SentenceHun.gf index 8c498bd4c..7cbafa7c4 100644 --- a/src/hungarian/SentenceHun.gf +++ b/src/hungarian/SentenceHun.gf @@ -15,7 +15,7 @@ lin --2 Clauses missing object noun phrases -- : NP -> VPSlash -> ClSlash ; - -- SlashVP = predVP ; + SlashVP np vps = predVP np (vps ** {s = vps.s ! Def ; obj = []}) ; {- -- : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today AdvSlash cls adv = cls ** insertAdv adv cls ; @@ -56,7 +56,7 @@ lin UseQCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p} ; -- : Temp -> Pol -> RCl -> RS ; - -- UseRCl t p cl = {s = } ; + UseRCl t p cl = {s = \\n,c => t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! n ! c} ; -- AdvS : Adv -> S -> S ; -- then I will go home AdvS = advS "" ;