From a8a5080693b6ffd1fb4d78369a0f88b043776592 Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 8 Dec 2005 09:56:15 +0000 Subject: [PATCH] Swedish relatives --- lib/resource-1.0/scandinavian/CatScand.gf | 2 +- lib/resource-1.0/scandinavian/DiffScand.gf | 8 ++ lib/resource-1.0/scandinavian/NounScand.gf | 17 +++-- lib/resource-1.0/scandinavian/ParamScand.gf | 2 +- .../scandinavian/RelativeScand.gf | 76 +++++++++++-------- lib/resource-1.0/swedish/DiffSwe.gf | 10 +++ lib/resource-1.0/swedish/RelativeSwe.gf | 2 + lib/resource-1.0/swedish/TestSwe.gf | 2 +- 8 files changed, 78 insertions(+), 41 deletions(-) create mode 100644 lib/resource-1.0/swedish/RelativeSwe.gf diff --git a/lib/resource-1.0/scandinavian/CatScand.gf b/lib/resource-1.0/scandinavian/CatScand.gf index 3716c29a1..e2edb6515 100644 --- a/lib/resource-1.0/scandinavian/CatScand.gf +++ b/lib/resource-1.0/scandinavian/CatScand.gf @@ -64,7 +64,7 @@ incomplete concrete CatScand of Cat = IDet = {s : Gender => Str ; n : Number ; det : DetSpecies} ; IAdv = {s : Str} ; - RP = {s : RCase => Str ; a : RAgr} ; + RP = {s : GenNum => RCase => Str ; a : RAgr} ; Numeral = {s : CardOrd => Str ; n : Number} ; diff --git a/lib/resource-1.0/scandinavian/DiffScand.gf b/lib/resource-1.0/scandinavian/DiffScand.gf index 960024865..ec3c96ef1 100644 --- a/lib/resource-1.0/scandinavian/DiffScand.gf +++ b/lib/resource-1.0/scandinavian/DiffScand.gf @@ -36,6 +36,14 @@ interface DiffScand = open ResScand, Prelude in { genderForms : (x1,x2 : Str) -> Gender => Str ; +-- The forms of a relative pronoun ("som", "vars", "i vilken"). + + relPron : GenNum => RCase => Str ; + +-- Pronoun "sÃ¥dan" used in $Relative.RelCl$. + + pronSuch : GenNum => Str ; + ----------------------------------------------------------------------- -- -- The functions and parameters below are here because they depend on diff --git a/lib/resource-1.0/scandinavian/NounScand.gf b/lib/resource-1.0/scandinavian/NounScand.gf index 93a2026f5..c6b31a08b 100644 --- a/lib/resource-1.0/scandinavian/NounScand.gf +++ b/lib/resource-1.0/scandinavian/NounScand.gf @@ -68,12 +68,19 @@ incomplete concrete NounScand of Noun = g = g } ; -{- - RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ; + RelCN cn rs = let g = cn.g in { + s = \\n,d,c => cn.s ! n ! d ! c ++ rs.s ! agrP3 g n ; + g = g + } ; + SentCN cn s = let g = cn.g in { + s = \\n,d,c => cn.s ! n ! d ! c ++ conjThat ++ s.s ! Sub ; + g = g + } ; + QuestCN cn qs = let g = cn.g in { + s = \\n,d,c => cn.s ! n ! d ! c ++ qs.s ! QIndir ; + g = g + } ; - SentCN cn s = {s = \\n,c => cn.s ! n ! c ++ conjThat ++ s.s} ; - QuestCN cn qs = {s = \\n,c => cn.s ! n ! c ++ qs.s ! QIndir} ; --} UseN noun = { s = \\n,d => noun.s ! n ! specDet d ; g = noun.g diff --git a/lib/resource-1.0/scandinavian/ParamScand.gf b/lib/resource-1.0/scandinavian/ParamScand.gf index c1eef796c..62a41fea3 100644 --- a/lib/resource-1.0/scandinavian/ParamScand.gf +++ b/lib/resource-1.0/scandinavian/ParamScand.gf @@ -46,7 +46,7 @@ param --- AdjPronForm = APron GenNum Case ; --- AuxVerbForm = AuxInf | AuxPres | AuxPret | AuxSup ; - RCase = RNom | RAcc | RGen | RPrep ; + RCase = RNom | RGen | RPrep ; RAgr = RNoAg | RAg {gn : GenNum ; p : Person} ; diff --git a/lib/resource-1.0/scandinavian/RelativeScand.gf b/lib/resource-1.0/scandinavian/RelativeScand.gf index 6c191f494..cefc682fe 100644 --- a/lib/resource-1.0/scandinavian/RelativeScand.gf +++ b/lib/resource-1.0/scandinavian/RelativeScand.gf @@ -1,34 +1,44 @@ ---concrete RelativeScand of Relative = CatScand ** open ResScand in { +incomplete concrete RelativeScand of Relative = + CatScand ** open DiffScand, ResScand in { + + flags optimize=all_subs ; + + lin + + RelCl cl = { + s = \\t,a,p,ag => pronSuch ! ag.gn ++ conjThat ++ cl.s ! t ! a ! p ! Sub + } ; + + RelVP rp vp = { + s = \\t,ant,b,ag => + let + agr = case rp.a of { + RNoAg => ag ; + RAg a => a + } ; + cl = mkClause (rp.s ! ag.gn ! RNom) agr vp + in + cl.s ! t ! ant ! b ! Sub + } ; + +--- We make this easy by using "som" and preposition stranding. It would be +--- a proble to determine whether $slash$ takes a direct object, since +--- $slash.c2$ is defined to be just a string. -- --- flags optimize=all_subs ; --- --- lin --- --- RelCl cl = { --- s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! ODir --- } ; --- --- RelVP rp vp = { --- s = \\t,ant,b,ag => --- let --- agr = case rp.a of { --- RNoAg => ag ; --- RAg a => a --- } ; --- cl = mkS (rp.s ! Nom) agr vp.s vp.s2 --- in --- cl.s ! t ! ant ! b ! ODir --- } ; --- --- RelSlash rp slash = { --- s = \\t,a,p,_ => slash.c2 ++ rp.s ! Acc ++ slash.s ! t ! a ! p ! ODir --- } ; --- --- FunRP p np rp = { --- s = \\c => np.s ! c ++ p.s ++ rp.s ! Acc ; --- a = RAg np.a --- } ; --- --- IdRP = mkIP "which" "which" "whose" Sg ** {a = RNoAg} ; --- ---} +-- The empty relative is left to $ExtScand$. + + RelSlash rp slash = { + s = \\t,a,p,ag => + rp.s ! ag.gn ! RNom ++ slash.s ! t ! a ! p ! Sub ++ slash.c2 + } ; + +--- The case here could be genitive. + + FunRP p np rp = { + s = \\gn,c => np.s ! nominative ++ p.s ++ rp.s ! gn ! RPrep ; + a = RAg np.a + } ; + + IdRP = {s = relPron ; a = RNoAg} ; + +} diff --git a/lib/resource-1.0/swedish/DiffSwe.gf b/lib/resource-1.0/swedish/DiffSwe.gf index 42a6191f3..e1a77d462 100644 --- a/lib/resource-1.0/swedish/DiffSwe.gf +++ b/lib/resource-1.0/swedish/DiffSwe.gf @@ -50,4 +50,14 @@ instance DiffSwe of DiffScand = open ResScand, Prelude in { Neutr => allt } ; + relPron : GenNum => RCase => Str = \\gn,c => case c of { + RNom => "som" ; + RGen => "vars" ; + RPrep => gennumForms "vilken" "vilket" "vilka" ! gn + } ; + + pronSuch = gennumForms "sådan" "sådant" "sådana" ; + + + } diff --git a/lib/resource-1.0/swedish/RelativeSwe.gf b/lib/resource-1.0/swedish/RelativeSwe.gf new file mode 100644 index 000000000..2ffc183e5 --- /dev/null +++ b/lib/resource-1.0/swedish/RelativeSwe.gf @@ -0,0 +1,2 @@ +concrete RelativeSwe of Relative = CatSwe ** RelativeScand with + (DiffScand = DiffSwe) ; diff --git a/lib/resource-1.0/swedish/TestSwe.gf b/lib/resource-1.0/swedish/TestSwe.gf index 83a7f30a0..34ec55bab 100644 --- a/lib/resource-1.0/swedish/TestSwe.gf +++ b/lib/resource-1.0/swedish/TestSwe.gf @@ -8,7 +8,7 @@ concrete TestSwe of Test = -- -- NumeralSwe, SentenceSwe, QuestionSwe, --- RelativeSwe, + RelativeSwe, ConjunctionSwe, PhraseSwe, UntensedSwe,