From 5a1ce37e1ca31b04a45edc580fb51c12a1382483 Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 29 Nov 2005 09:43:20 +0000 Subject: [PATCH] relatives --- lib/resource-1.0/gf/Cat.gf | 4 ++++ lib/resource-1.0/gf/CatEng.gf | 7 +++++- lib/resource-1.0/gf/Lex.gf | 10 ++++++--- lib/resource-1.0/gf/LexEng.gf | 11 ++++++++++ lib/resource-1.0/gf/Noun.gf | 15 +++++++++---- lib/resource-1.0/gf/NounEng.gf | 11 +++++----- lib/resource-1.0/gf/Question.gf | 3 +-- lib/resource-1.0/gf/QuestionEng.gf | 6 ++---- lib/resource-1.0/gf/Relative.gf | 13 ++++++++++++ lib/resource-1.0/gf/RelativeEng.gf | 34 ++++++++++++++++++++++++++++++ lib/resource-1.0/gf/ResEng.gf | 5 +++++ lib/resource-1.0/gf/Sentence.gf | 2 ++ lib/resource-1.0/gf/SentenceEng.gf | 3 +++ lib/resource-1.0/gf/Test.gf | 3 ++- lib/resource-1.0/gf/TestEng.gf | 3 ++- lib/resource-1.0/gf/Untensed.gf | 1 + lib/resource-1.0/gf/UntensedEng.gf | 3 +++ 17 files changed, 113 insertions(+), 21 deletions(-) create mode 100644 lib/resource-1.0/gf/Relative.gf create mode 100644 lib/resource-1.0/gf/RelativeEng.gf diff --git a/lib/resource-1.0/gf/Cat.gf b/lib/resource-1.0/gf/Cat.gf index 018cdeddd..83400c013 100644 --- a/lib/resource-1.0/gf/Cat.gf +++ b/lib/resource-1.0/gf/Cat.gf @@ -2,9 +2,12 @@ abstract Cat = { cat S ; QS ; + RS ; Cl ; QCl ; + RCl ; + Slash ; VP ; @@ -39,6 +42,7 @@ abstract Cat = { Predet ; Quant ; Num ; + Ord ; Prep ; diff --git a/lib/resource-1.0/gf/CatEng.gf b/lib/resource-1.0/gf/CatEng.gf index ee34f7a09..367f0018b 100644 --- a/lib/resource-1.0/gf/CatEng.gf +++ b/lib/resource-1.0/gf/CatEng.gf @@ -3,11 +3,13 @@ concrete CatEng of Cat = open ResEng, Prelude in { lincat S = {s : Str} ; QS = {s : QForm => Str} ; + RS = {s : Agr => Str} ; Cl = {s : Tense => Anteriority => Polarity => Ord => Str} ; Slash = {s : Tense => Anteriority => Polarity => Ord => Str} ** {c2 : Str} ; QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ; + RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ; VP = { s : Tense => Anteriority => Polarity => Ord => Agr => {fin, inf : Str} ; @@ -25,9 +27,10 @@ concrete CatEng of Cat = open ResEng, Prelude in { A2 = {s : AForm => Str ; c2 : Str} ; Adv, AdV, AdA, AdS = {s : Str} ; + Prep = {s : Str} ; Det, Quant = {s : Str ; n : Number} ; - Predet, Num = {s : Str} ; + Predet, Num, Ord = {s : Str} ; CN,N = {s : Number => Case => Str} ; PN = {s : Case => Str} ; @@ -39,6 +42,8 @@ concrete CatEng of Cat = open ResEng, Prelude in { IDet = {s : Str ; n : Number} ; IAdv = {s : Str} ; + RP = {s : Case => Str ; a : RAgr} ; + Numeral = {s : CardOrd => Str ; n : Number} ; } diff --git a/lib/resource-1.0/gf/Lex.gf b/lib/resource-1.0/gf/Lex.gf index 0e9185718..1293fd83e 100644 --- a/lib/resource-1.0/gf/Lex.gf +++ b/lib/resource-1.0/gf/Lex.gf @@ -18,14 +18,14 @@ abstract Lex = Cat ** { -- structural - only_Predet : Predet ; + only_Predet, all_Predet : Predet ; - this_Quant : Quant ; + this_Quant, these_Quant : Quant ; i_Pron, he_Pron, we_Pron : Pron ; - whoSg_IP, whoPl_IP, whatSg_IP, whatPl_IP : IP ; + whoSg_IP, whoPl_IP : IP ; when_IAdv, where_IAdv, why_IAdv : IAdv ; @@ -34,4 +34,8 @@ abstract Lex = Cat ** { here_Adv : Adv ; very_AdA : AdA ; + + one_Numeral, forty_Numeral : Numeral ; + + in_Prep, of_Prep : Prep ; } diff --git a/lib/resource-1.0/gf/LexEng.gf b/lib/resource-1.0/gf/LexEng.gf index 7fe74aaa3..d48e12077 100644 --- a/lib/resource-1.0/gf/LexEng.gf +++ b/lib/resource-1.0/gf/LexEng.gf @@ -19,7 +19,9 @@ concrete LexEng of Lex = CatEng ** open ResEng, Prelude in { very_AdA = {s = "very"} ; only_Predet = {s = "only"} ; + all_Predet = {s = "only"} ; this_Quant = {s = "this" ; n = Sg} ; + these_Quant = {s = "these" ; n = Pl} ; i_Pron = mkNP "I" "me" "my" Sg P1 ; he_Pron = mkNP "he" "him" "his" Sg P3 ; @@ -29,7 +31,16 @@ concrete LexEng of Lex = CatEng ** open ResEng, Prelude in { whoPl_IP = mkIP "who" "whom" "whose" Pl ; when_IAdv = {s = "when"} ; + where_IAdv = {s = "where"} ; + why_IAdv = {s = "why"} ; whichSg_IDet = {s = "which" ; n = Sg} ; + whichPl_IDet = {s = "which" ; n = Pl} ; + + one_Numeral = {s = table {NCard => "one" ; NOrd => "first"} ; n = Sg} ; + forty_Numeral = {s = table {NCard => "forty" ; NOrd => "fortieth"} ; n = Pl} ; + + in_Prep = {s = "in"} ; + of_Prep = {s = "of"} ; } diff --git a/lib/resource-1.0/gf/Noun.gf b/lib/resource-1.0/gf/Noun.gf index 5a7d6454c..1de879190 100644 --- a/lib/resource-1.0/gf/Noun.gf +++ b/lib/resource-1.0/gf/Noun.gf @@ -7,17 +7,22 @@ abstract Noun = Cat ** { UsePN : PN -> NP ; UsePron : Pron -> NP ; - MkDet : Predet -> Quant -> Num -> Det ; +-- Determiner structure à la CLE; we further divide $Num$ into cardinal +-- and ordinal/superlative. So we get e.g. "my first forty books". + + MkDet : Predet -> Quant -> Num -> Ord -> Det ; PossPronSg, PossPronPl : Pron -> Quant ; --- PossNP not in romance NoNum : Num ; NumInt : Int -> Num ; - CardNumeral : Numeral -> Num ; - OrdNumeral : Numeral -> Num ; + NumNumeral : Numeral -> Num ; + + OrdNumeral : Numeral -> Ord ; - NumSuperl : A -> Num ; + NoOrd : Ord ; + OrdSuperl : A -> Ord ; NoPredet : Predet ; @@ -28,6 +33,8 @@ abstract Noun = Cat ** { ComplN3 : N3 -> NP -> N2 ; AdjCN : AP -> CN -> CN ; + RelCN : CN -> RS -> CN ; + SentCN : CN -> S -> CN ; QuestCN : CN -> QS -> CN ; diff --git a/lib/resource-1.0/gf/NounEng.gf b/lib/resource-1.0/gf/NounEng.gf index 57a48bb45..3149a245c 100644 --- a/lib/resource-1.0/gf/NounEng.gf +++ b/lib/resource-1.0/gf/NounEng.gf @@ -7,21 +7,21 @@ concrete NounEng of Noun = CatEng ** open ResEng, Prelude in { UsePN pn = pn ** agrP3 Sg ; UsePron p = p ; - MkDet pred quant num = { - s = pred.s ++ quant.s ++ num.s ; + MkDet pred quant num ord = { + s = pred.s ++ quant.s ++ num.s ++ ord.s ; n = quant.n } ; PossPronSg p = {s = p.s ! Gen ; n = Sg} ; PossPronPl p = {s = p.s ! Gen ; n = Pl} ; - NoNum, NoPredet = {s = []} ; + NoPredet, NoNum, NoOrd = {s = []} ; NumInt n = n ; - CardNumeral numeral = {s = numeral.s ! NCard} ; + NumNumeral numeral = {s = numeral.s ! NCard} ; OrdNumeral numeral = {s = numeral.s ! NOrd} ; - NumSuperl a = {s = a.s ! AAdj Superl} ; + OrdSuperl a = {s = a.s ! AAdj Superl} ; DefSg = {s = "the" ; n = Sg} ; DefPl = {s = "the" ; n = Pl} ; @@ -33,6 +33,7 @@ concrete NounEng of Noun = CatEng ** open ResEng, Prelude in { ComplN3 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; c2 = f.c3} ; AdjCN ap cn = {s = \\n,c => preOrPost ap.isPre ap.s (cn.s ! n ! c)} ; + RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ; 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} ; diff --git a/lib/resource-1.0/gf/Question.gf b/lib/resource-1.0/gf/Question.gf index 0a1571c39..3d08a7acd 100644 --- a/lib/resource-1.0/gf/Question.gf +++ b/lib/resource-1.0/gf/Question.gf @@ -8,10 +8,9 @@ abstract Question = Cat, Sentence ** { QuestIAdv : IAdv -> Cl -> QCl ; PrepIP : Prep -> IP -> IAdv ; - FunIP : N2 -> IP -> IP ; AdvIP : IP -> Adv -> IP ; - IDetCN : IDet -> Num -> CN -> IP ; + IDetCN : IDet -> Num -> Ord -> CN -> IP ; } diff --git a/lib/resource-1.0/gf/QuestionEng.gf b/lib/resource-1.0/gf/QuestionEng.gf index 47cd33aa8..8ce4e0c4a 100644 --- a/lib/resource-1.0/gf/QuestionEng.gf +++ b/lib/resource-1.0/gf/QuestionEng.gf @@ -46,16 +46,14 @@ concrete QuestionEng of Question = CatEng, SentenceEng ** open ResEng in { PrepIP p ip = {s = p.s ++ ip.s ! Nom} ; ----- FunIP : N2 -> IP -> IP ; AdvIP ip adv = { s = \\c => ip.s ! c ++ adv.s ; n = ip.n } ; - IDetCN idet num cn = { - s = \\c => idet.s ++ num.s ++ cn.s ! idet.n ! c ; + IDetCN idet num ord cn = { + s = \\c => idet.s ++ num.s ++ ord.s ++ cn.s ! idet.n ! c ; n = idet.n } ; } - diff --git a/lib/resource-1.0/gf/Relative.gf b/lib/resource-1.0/gf/Relative.gf new file mode 100644 index 000000000..22c22fae9 --- /dev/null +++ b/lib/resource-1.0/gf/Relative.gf @@ -0,0 +1,13 @@ +abstract Relative = Cat, Sentence ** { + + fun + + RelCl : Cl -> RCl ; + RelVP : RP -> VP -> RCl ; + RelSlash : RP -> Slash -> RCl ; + + FunRP : Prep -> NP -> RP -> RP ; + IdRP : RP ; + +} + diff --git a/lib/resource-1.0/gf/RelativeEng.gf b/lib/resource-1.0/gf/RelativeEng.gf new file mode 100644 index 000000000..17ee61b85 --- /dev/null +++ b/lib/resource-1.0/gf/RelativeEng.gf @@ -0,0 +1,34 @@ +concrete RelativeEng of Relative = CatEng, SentenceEng ** open ResEng in { + + 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 + } ; + verb = vp.s ! t ! ant ! b ! ODir ! agr ; + subj = rp.s ! Nom ; + compl = vp.s2 ! agr + in + subj ++ verb.fin ++ verb.inf ++ compl + } ; + + 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} ; + +} diff --git a/lib/resource-1.0/gf/ResEng.gf b/lib/resource-1.0/gf/ResEng.gf index 2784a67c0..e474e6e90 100644 --- a/lib/resource-1.0/gf/ResEng.gf +++ b/lib/resource-1.0/gf/ResEng.gf @@ -176,6 +176,11 @@ oper } } ; +-- For $Relative$. + +param + RAgr = RNoAg | RAg {n : Number ; p : Person} ; + -- For $Numeral$. param diff --git a/lib/resource-1.0/gf/Sentence.gf b/lib/resource-1.0/gf/Sentence.gf index 5a5ba0498..337e27c4d 100644 --- a/lib/resource-1.0/gf/Sentence.gf +++ b/lib/resource-1.0/gf/Sentence.gf @@ -7,5 +7,7 @@ abstract Sentence = Cat ** { SlashV2 : NP -> V2 -> Slash ; AdvSlash : Slash -> Adv -> Slash ; + + SlashPrep : Cl -> Prep -> Slash ; } diff --git a/lib/resource-1.0/gf/SentenceEng.gf b/lib/resource-1.0/gf/SentenceEng.gf index 05daa8113..787e21254 100644 --- a/lib/resource-1.0/gf/SentenceEng.gf +++ b/lib/resource-1.0/gf/SentenceEng.gf @@ -36,4 +36,7 @@ concrete SentenceEng of Sentence = CatEng ** open ResEng in { s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ; c2 = slash.c2 } ; + + SlashPrep cl prep = cl ** {c2 = prep.s} ; + } diff --git a/lib/resource-1.0/gf/Test.gf b/lib/resource-1.0/gf/Test.gf index 0aafc7b79..bbb8b05d7 100644 --- a/lib/resource-1.0/gf/Test.gf +++ b/lib/resource-1.0/gf/Test.gf @@ -2,9 +2,10 @@ abstract Test = Noun, Verb, Adjective, - Numeral, + -- Numeral, Sentence, Question, + Relative, Untensed, -- Tensed, Lex diff --git a/lib/resource-1.0/gf/TestEng.gf b/lib/resource-1.0/gf/TestEng.gf index 1938a7f1a..02d906fc9 100644 --- a/lib/resource-1.0/gf/TestEng.gf +++ b/lib/resource-1.0/gf/TestEng.gf @@ -4,9 +4,10 @@ concrete TestEng of Test = NounEng, VerbEng, AdjectiveEng, - NumeralEng, + -- NumeralEng, SentenceEng, QuestionEng, + RelativeEng, UntensedEng, -- TensedEng, LexEng diff --git a/lib/resource-1.0/gf/Untensed.gf b/lib/resource-1.0/gf/Untensed.gf index d3e6c08a0..0ff11c9fd 100644 --- a/lib/resource-1.0/gf/Untensed.gf +++ b/lib/resource-1.0/gf/Untensed.gf @@ -3,5 +3,6 @@ abstract Untensed = Cat ** { fun PosCl, NegCl : Cl -> S ; PosQCl, NegQCl : QCl -> QS ; + PosRCl, NegRCl : RCl -> RS ; } diff --git a/lib/resource-1.0/gf/UntensedEng.gf b/lib/resource-1.0/gf/UntensedEng.gf index 041cf6dfa..baba90eba 100644 --- a/lib/resource-1.0/gf/UntensedEng.gf +++ b/lib/resource-1.0/gf/UntensedEng.gf @@ -9,4 +9,7 @@ concrete UntensedEng of Untensed = CatEng ** open ResEng in { PosQCl cl = {s = cl.s ! Pres ! Simul ! Pos} ; NegQCl cl = {s = cl.s ! Pres ! Simul ! Neg} ; + PosRCl cl = {s = cl.s ! Pres ! Simul ! Pos} ; + NegRCl cl = {s = cl.s ! Pres ! Simul ! Neg} ; + }