From 095f11abb7126ac218d26b106e36a703e2f2be66 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 18 Aug 2020 21:36:04 +0200 Subject: [PATCH] (May) WIP relative clauses --- src/malay/CatMay.gf | 6 +++--- src/malay/NounMay.gf | 10 ++++++---- src/malay/RelativeMay.gf | 15 ++++++++++----- src/malay/ResMay.gf | 9 +++++++++ src/malay/SentenceMay.gf | 21 +++++++++++---------- 5 files changed, 39 insertions(+), 22 deletions(-) diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index fbcd6ad01..9b61bebb1 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -9,12 +9,12 @@ concrete CatMay of Cat = CommonX ** open ResMay, Prelude in { S = ResMay.Sentence ; QS = SS ; - RS = SS ; + RS = ResMay.RClause ; -- relative sentence. Tense and polarity fixed, -- but agreement may depend on the CN/NP it modifies. Cl = ResMay.Clause ; - ClSlash = ResMay.Clause ; + ClSlash = ResMay.ClSlash ; SSlash = ResMay.Sentence ; -- sentence missing NP; e.g. "she has looked at" Imp = {s : Number => Polarity => Str} ; -- imperative e.g. "look at this" @@ -30,7 +30,7 @@ concrete CatMay of Cat = CommonX ** open ResMay, Prelude in { --2 Subord clauses and pronouns - RCl = ResMay.Clause ; + RCl = ResMay.RClause ; RP = SS ; --2 Verb phrases diff --git a/src/malay/NounMay.gf b/src/malay/NounMay.gf index f83379915..6445bd78d 100644 --- a/src/malay/NounMay.gf +++ b/src/malay/NounMay.gf @@ -38,8 +38,9 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { --AdvNP,ExtAdvNP = \np,adv -> np ** {} ; -- : NP -> RS -> NP ; -- Paris, which is here - -- RelNP np rs = np ** { - -- } ; + RelNP np rs = np ** { + s = np.s ++ rs.subj ++ rs.pred ! np.p + } ; -- Determiners can form noun phrases directly. @@ -144,8 +145,9 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { -- } ; -- : CN -> RS -> CN ; - -- RelCN cn rs = cn ** { - -- } ; + RelCN cn rs = cn ** { + s = \\nf => cn.s ! nf ++ rs.subj ++ rs.pred ! P3 + } ; {- -- : CN -> Adv -> CN ; diff --git a/src/malay/RelativeMay.gf b/src/malay/RelativeMay.gf index 3587c422e..80aff1b2c 100644 --- a/src/malay/RelativeMay.gf +++ b/src/malay/RelativeMay.gf @@ -1,5 +1,5 @@ concrete RelativeMay of Relative = CatMay ** open - ResMay, Prelude, (NS=NounMay), (SS=StructuralMay) in { + ResMay, Prelude in { lin @@ -9,11 +9,17 @@ lin -- : RP -> VP -> RCl ; RelVP rp vp = { subj = rp.s ; - pred = vp.s ! Root ; -- TODO + pred = \\_ => vp.s ! Root ; -- TODO } ; - -- : RP -> ClSlash -> RCl ; -- whom John loves - -- RelSlash rp cls = + -- : RP -> ClSlash -> RCl ; -- who I went with + RelSlash rp cls = { + subj = rp.s -- yang + ++ cls.subj ; -- saya + pred = + \\p => cls.pred -- ikut sama + ++ cls.c2.obj ! p -- dengan+nya (depends on the head, not known yet) + } ; -- : RP ; IdRP = {s = "yang"} ; @@ -23,5 +29,4 @@ lin -- : Prep -> NP -> RP -> RP ; -- the mother of whom -- FunRP prep np rp = {} ; - } diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 610981b5c..0b9e0fb16 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -156,6 +156,12 @@ oper Clause : Type = {subj, pred : Str} ; + RClause : Type = { + subj : Str ; + pred : Person => Str} ; + + ClSlash : Type = Clause ** {c2 : Preposition} ; + Sentence : Type = {s : Str} ; predVP : NounPhrase -> VerbPhrase -> Clause = \np,vp -> { @@ -163,6 +169,9 @@ oper pred = vp.s ! Active ; -- TODO } ; + predVPSlash : NounPhrase -> VPSlash -> ClSlash = \np,vps -> + predVP np ** {c2 = vps.c2} ; + -------------------------------------------------------------------------------- -- linrefs diff --git a/src/malay/SentenceMay.gf b/src/malay/SentenceMay.gf index b5cabb198..fc736da29 100644 --- a/src/malay/SentenceMay.gf +++ b/src/malay/SentenceMay.gf @@ -15,20 +15,21 @@ lin --2 Clauses missing object noun phrases -- : NP -> VPSlash -> ClSlash ; - SlashVP = predVP ; -{- + SlashVP = predVPSlash ; + -- : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today - AdvSlash cls adv = cls ** insertAdv adv cls ; + -- AdvSlash cls adv = cls ** insertAdv adv cls ; --- SlashPrep : Cl -> Prep -> ClSlash ; -- (with whom) he walks + -- : Cl -> Prep -> ClSlash ; -- (with whom) he walks + SlashPrep cl prep = cl ** {c2 = prep} ; + {- -- : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves --- SlashVS np vs ss = {} ; + SlashVS np vs ss = {} ; - -- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen - UseSlash t p cls = { - } ; + -- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen + UseSlash t p cls = {} ; --2 Imperatives -- : VP -> Imp ; @@ -58,8 +59,8 @@ lin } ; -- : Temp -> Pol -> RCl -> RS ; - UseRCl t p cl = { - s = cl.subj ++ t.s ++ p.s ++ cl.pred ; + UseRCl t p cl = cl ** { + pred = \\per => t.s ++ p.s ++ cl.pred ! per ; } ; -- AdvS : Adv -> S -> S ; -- then I will go home