From 3fccfd4befab04291f168245188560f66860ee46 Mon Sep 17 00:00:00 2001 From: krasimir Date: Wed, 27 Feb 2008 13:29:05 +0000 Subject: [PATCH] Add relative clauses --- lib/resource/bulgarian/CatBul.gf | 6 +++++ lib/resource/bulgarian/GrammarBul.gf | 1 + lib/resource/bulgarian/NounBul.gf | 4 ++++ lib/resource/bulgarian/RelativeBul.gf | 32 +++++++++++++++++++++++++++ lib/resource/bulgarian/ResBul.gf | 17 +++++++++++++- lib/resource/bulgarian/SentenceBul.gf | 4 ++++ 6 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 lib/resource/bulgarian/RelativeBul.gf diff --git a/lib/resource/bulgarian/CatBul.gf b/lib/resource/bulgarian/CatBul.gf index 03643f3a8..4a7332f59 100644 --- a/lib/resource/bulgarian/CatBul.gf +++ b/lib/resource/bulgarian/CatBul.gf @@ -23,6 +23,7 @@ concrete CatBul of Cat = open ResBul, Prelude, (R = ParamX) in { S = {s : Str} ; QS = {s : QForm => Str} ; + RS = {s : GenNum => Str} ; SC = {s : Str} ; -- Sentence @@ -41,6 +42,11 @@ concrete CatBul of Cat = open ResBul, Prelude, (R = ParamX) in { IComp = {s1,s2 : Str} ; IDet = {s : GenNum => Str; n : Number} ; +-- Relative + + RCl = {s : ResBul.Tense => Anteriority => Polarity => GenNum => Str} ; + RP = {s : GenNum => Str} ; + -- Verb VP = { diff --git a/lib/resource/bulgarian/GrammarBul.gf b/lib/resource/bulgarian/GrammarBul.gf index 405d7f13c..ba79da33a 100644 --- a/lib/resource/bulgarian/GrammarBul.gf +++ b/lib/resource/bulgarian/GrammarBul.gf @@ -8,6 +8,7 @@ concrete GrammarBul of Grammar = NumeralBul, SentenceBul, QuestionBul, + RelativeBul, PhraseBul, TextBul, StructuralBul diff --git a/lib/resource/bulgarian/NounBul.gf b/lib/resource/bulgarian/NounBul.gf index c102fa80c..ebc4b1136 100644 --- a/lib/resource/bulgarian/NounBul.gf +++ b/lib/resource/bulgarian/NounBul.gf @@ -109,6 +109,10 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in { s = \\nf => preOrPost ap.isPre (ap.s ! nform2aform nf cn.g) (cn.s ! (indefNForm nf)) ; g = cn.g } ; + RelCN cn rs = { + s = \\nf => cn.s ! nf ++ rs.s ! gennum cn.g (numNForm nf) ; + g = cn.g + } ; AdvCN cn ad = { s = \\nf => cn.s ! nf ++ ad.s ; g = cn.g diff --git a/lib/resource/bulgarian/RelativeBul.gf b/lib/resource/bulgarian/RelativeBul.gf new file mode 100644 index 000000000..a1985ef94 --- /dev/null +++ b/lib/resource/bulgarian/RelativeBul.gf @@ -0,0 +1,32 @@ +concrete RelativeBul of Relative = CatBul ** open ResBul in { + + flags optimize=all_subs ; + + lin + RelCl cl = { + s = \\t,a,p,gn => whichRP ! gn ++ cl.s ! t ! a ! p ! Main ; + role = RSubj + } ; + + RelVP rp vp = { + s = \\t,a,p,gn => + let + cl = mkClause (rp.s ! gn) {gn=gn; p=P3} vp + in + cl.s ! t ! a ! p ! Main ; + role = RSubj + } ; + + RelSlash rp slash = { + s = \\t,a,p,gn => slash.c2.s ++ (rp.s ! gn) ++ slash.s ! t ! a ! p ! Main ; + role = RObj Acc + } ; + + FunRP p np rp = { + s = \\gn => np.s ! RObj Acc ++ p.s ++ rp.s ! gn ; + } ; + + IdRP = { + s = whichRP ; + } ; +} diff --git a/lib/resource/bulgarian/ResBul.gf b/lib/resource/bulgarian/ResBul.gf index 3d4e6a9b0..630b17be6 100644 --- a/lib/resource/bulgarian/ResBul.gf +++ b/lib/resource/bulgarian/ResBul.gf @@ -162,9 +162,16 @@ resource ResBul = ParamX ** open Prelude in { NFVocative => NFVocative } ; + numNForm : NForm -> Number + = \nf -> case nf of { + NF n spec => n ; + NFSgDefNom => Sg ; + NFPlCount => Pl ; + NFVocative => Sg + } ; + oper -- For $Verb$. - Verb : Type = { s : VForm => Str ; vtype : VType @@ -545,4 +552,12 @@ resource ResBul = ParamX ** open Prelude in { QIndir => wh.s2 ++ cls ! Main } } ; + + whichRP : GenNum => Str + = table { + GSg Masc => "който" ; + GSg Fem => "която" ; + GSg Neut => "което" ; + GPl => "които" + } ; } diff --git a/lib/resource/bulgarian/SentenceBul.gf b/lib/resource/bulgarian/SentenceBul.gf index e5ff885fb..96af093ab 100644 --- a/lib/resource/bulgarian/SentenceBul.gf +++ b/lib/resource/bulgarian/SentenceBul.gf @@ -33,6 +33,10 @@ concrete SentenceBul of Sentence = CatBul ** open Prelude, ResBul in { UseQCl t a p cl = { s = \\q => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! q } ; + UseRCl t a p cl = { + s = \\r => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r ; + role = cl.role + } ; UseSlash t a p cl = { s = t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! Main ; c2 = cl.c2