From f46cbfe51e66a98a5314307baea4add3a43b425d Mon Sep 17 00:00:00 2001 From: Herbert Lange Date: Tue, 12 Nov 2019 14:47:21 +0100 Subject: [PATCH] work on relative clauses --- src/latin/CatLat.gf | 5 +++-- src/latin/ConjunctionLat.gf | 18 ++++++++++++--- src/latin/LangLat.gf | 3 ++- src/latin/RelativeLat.gf | 44 ++++++++++++++++++++++++++++--------- src/latin/SentenceLat.gf | 9 ++++---- 5 files changed, 59 insertions(+), 20 deletions(-) diff --git a/src/latin/CatLat.gf b/src/latin/CatLat.gf index 26537bda6..0b704307e 100644 --- a/src/latin/CatLat.gf +++ b/src/latin/CatLat.gf @@ -8,6 +8,7 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in { -- S = Sentence ; QS = {s : QForm => Str} ; + RS = { s : Gender => Number => Str } ; -- Sentence ; -- RS = {s : Agr => Str ; c : Case} ; -- c for it clefts -- SSlash = {s : Str ; c2 : Str} ; -- @@ -28,11 +29,11 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in { -- ---- Relative -- --- RCl = { + RCl = Gender => Number => Clause ; -- s : ResLat.Tense => Anteriority => CPolarity => Agr => Str ; -- c : Case -- } ; --- RP = {s : RCase => Str ; a : RAgr} ; + RP = {s : Agr => Str } ; -- ---- Verb -- diff --git a/src/latin/ConjunctionLat.gf b/src/latin/ConjunctionLat.gf index 77911d720..0fc23f3df 100644 --- a/src/latin/ConjunctionLat.gf +++ b/src/latin/ConjunctionLat.gf @@ -62,8 +62,12 @@ concrete ConjunctionLat of Conjunction = -- isPre = ss.isPre -- } ; ---} --- ----- These fun's are generated from the list cat's. + -- + + -- ConjRS : Conj -> ListRS -> RS + ConjRS conj rss = { s = \\g,n => conj.s1 ++ (rss.s ! conj.c).init ! g ! n ++ conj.s2 ++ (rss.s ! conj.c).last ! g ! n++ conj.s3 }; + + ---- These fun's are generated from the list cat's. -- -- BaseS : S -> S -> ListS @@ -131,13 +135,21 @@ concrete ConjunctionLat of Conjunction = -- -- ConsAP : AP -> ListAP -> ListAP -- ConsAP x xs = -- { l = \\_ => consrTable Agr and_Conj.s2 x (xs.l ! Comma ) } ; + + -- BaseRS : RS -> RS -> ListRS ; + BaseRS rs1 rs2 = { s = \\co => { init = rs1.s ; last = rs2.s }} ; + + -- ConsRS : RS -> List RS -> ListRS ; + ConsRS rs rss = { s = \\co => { init = rs.s ; last = \\g,n => coord co { init = (rss.s ! co).init ! g ! n ; last = (rss.s ! co).last ! g ! n } } } ; + + -- lincat [S] = { s : Coordinator => {init,last : SAdvPos => AdvPos => ComplPos => Order => Str} ; p : Pol ; t : Tense } ; -- TO FIX [Adv] = { s: Coordinator => {init,last : Str}} ; [NP] = { s : Coordinator => {init,last : PronDropForm => Case => Str} ; g : Gender ; n : Number ; p : Person ; adv : Str ; preap : AP ; postap : AP ; isBase : Bool ; det : Det } ; [AP] = {s : Coordinator => {init,last : Agr => Str } } ; - + [RS] = { s : Coordinator => { init, last : Gender => Number => Str }} ; oper -- Generates a new number value given two number values. -- Pl if any of the two is Pl diff --git a/src/latin/LangLat.gf b/src/latin/LangLat.gf index 09e9d919d..da0c70d2c 100644 --- a/src/latin/LangLat.gf +++ b/src/latin/LangLat.gf @@ -3,7 +3,8 @@ concrete LangLat of Lang = GrammarLat, ParadigmsLat, - LexiconLat + LexiconLat, + RelativeLat -- ConstructionLat ** { diff --git a/src/latin/RelativeLat.gf b/src/latin/RelativeLat.gf index c3b3fa045..7e1a36eac 100644 --- a/src/latin/RelativeLat.gf +++ b/src/latin/RelativeLat.gf @@ -2,14 +2,14 @@ concrete RelativeLat of Relative = CatLat ** open ResLat in { -- -- flags optimize=all_subs ; -- --- lin + lin -- -- RelCl cl = { -- s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! ODir ; -- c = Nom -- } ; -- --- RelVP rp vp = { + RelVP rp vp = \\g,n => mkClause (emptyNP ** { s = \\_,c => rp.s ! (Ag g n c) ; g = g ; n = n } ) vp ; -- s = \\t,ant,b,ag => -- let -- agr = case rp.a of { @@ -25,19 +25,43 @@ concrete RelativeLat of Relative = CatLat ** open ResLat in { ---- Pied piping: "at which we are looking". Stranding and empty ---- relative are defined in $ExtraLat.gf$ ("that we are looking at", ---- "we are looking at"). --- --- RelSlash rp slash = { + -- + -- RelSlash : RP -> ClSlash -> RCl ; + RelSlash rp slash = \\g,n => slash ** { adv = rp.s ! Ag g n Gen } ; -- abuse adverbs again -- s = \\t,a,p,agr => -- slash.c2 ++ rp.s ! RPrep (fromAgr agr).g ++ slash.s ! t ! a ! p ! ODir ; -- c = Acc --- } ; -- --- FunRP p np rp = { --- s = \\c => (combineNounPhrase np) ! PronNonDrop ! Acc ++ p.s ++ rp.s ! RPrep (fromAgr np.a).g ; --- a = RAg np.a --- } ; + FunRP p np rp = { + s = \\a => case a of { Ag g n c => rp.s ! a ++ p.s ++ (combineNounPhrase np) ! PronNonDrop ! APostN ! DPreN ! Acc }; + -- s = \\c => (combineNounPhrase np) ! PronNonDrop ! Acc ++ p.s ++ rp.s ! RPrep (fromAgr np.a).g ; + -- a = RAg np.a + } ; -- --- IdRP = + IdRP = { + s = table { + Ag Masc Sg (Nom | Voc) => "qui" ; + Ag Fem Sg (Nom | Voc) => "quae" ; + Ag Neutr Sg (Nom | Voc) => "quod" ; + Ag _ Sg Gen => "cuius" ; + Ag _ Sg Dat => "cui" ; + Ag Masc Sg Acc => "quem" ; + Ag Fem Sg Acc => "quam" ; + Ag Neutr Sg Acc => "quod" ; + Ag (Masc | Neutr) Sg Abl => "quo" ; + Ag Fem Sg Abl => "qua" ; + Ag Masc Pl (Nom | Voc) => "qui" ; + Ag (Fem | Neutr) Pl (Nom | Voc) => "quae" ; + Ag (Masc | Neutr) Pl Gen => "quorum" ; + Ag Fem Pl Gen => "quarum" ; + Ag _ Pl Dat => "quibus" ; + Ag Masc Pl Acc => "quos" ; + Ag Fem Pl Acc => "quas" ; + Ag Neutr Pl Acc => "quae" ; + Ag _ Pl Abl => "cui" + } + } + ; -- let varr : Str -> Str = \x -> variants {x ; "that"} --- for bwc -- in { -- s = table { diff --git a/src/latin/SentenceLat.gf b/src/latin/SentenceLat.gf index 8c27956bd..ec91b0c42 100644 --- a/src/latin/SentenceLat.gf +++ b/src/latin/SentenceLat.gf @@ -56,11 +56,12 @@ concrete SentenceLat of Sentence = CatLat ** open Prelude, ResLat in { QIndir => cl.q ++ combineSentence qs ! SPreS ! PreV ! CPostV ! SOV -- t.s ++ p.s ++ cl.q ++ cl.s ! PreV ++ cl.o ! PreV ++ cl.v ! t.t ! t.a ! VQTrue ! PreV ! CPostV } } ; - --- UseRCl t p cl = { + -- UseRCl : Temp -> Pol -> RCl -> RS ; + UseRCl t p cl = { + s = \\g,n => defaultSentence (combineClause (cl ! g ! n) (lin Tense t) t.a (lin Pol p) VQFalse) ! SOV ; -- s = \\r => t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! r ; -- c = cl.c --- } ; + } ; -- UseSlash t p cl = { -- s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! ctr p.p ! ODir ; -- c2 = cl.c2 @@ -75,7 +76,7 @@ concrete SentenceLat of Sentence = CatLat ** open Prelude, ResLat in { -- TO FIX -- SSubjS s1 subj s2 = { s = \\_ => subj.s ++ s2.s ! PreS ++ s1.s ! PreS ; sadv = lin Adv (mkAdverb []) } ; --- RelS s r = {s = s.s ++ "," ++ r.s ! agrP3 Sg} ; +-- RelS s r = {s = s.s ! APreV ++ "," ++ r.s } ; -- -- oper -- ctr = contrNeg True ; -- contracted negations