From be6aa2b07fd4c476e338e53c7ffea2d04b910a16 Mon Sep 17 00:00:00 2001 From: aarne Date: Sun, 27 Apr 2008 19:19:40 +0000 Subject: [PATCH] new abstract implemented for exper/french --- lib/resource/exper/french/NounFre.gf | 2 + lib/resource/exper/french/StructuralFre.gf | 10 +- lib/resource/exper/french/VerbFre.gf | 2 + lib/resource/exper/romance/CatRomance.gf | 11 ++- lib/resource/exper/romance/CommonRomance.gf | 2 +- .../exper/romance/ConjunctionRomance.gf | 15 +++ lib/resource/exper/romance/NounRomance.gf | 81 +++++++++++++++- lib/resource/exper/romance/PhraseRomance.gf | 2 +- lib/resource/exper/romance/QuestionRomance.gf | 41 ++++++++- lib/resource/exper/romance/RelativeRomance.gf | 2 +- lib/resource/exper/romance/ResRomance.gf | 4 +- lib/resource/exper/romance/SentenceRomance.gf | 37 ++++---- lib/resource/exper/romance/VerbRomance.gf | 92 +++++++++++++++---- 13 files changed, 247 insertions(+), 54 deletions(-) diff --git a/lib/resource/exper/french/NounFre.gf b/lib/resource/exper/french/NounFre.gf index ef8c9cffc..e79ca7477 100644 --- a/lib/resource/exper/french/NounFre.gf +++ b/lib/resource/exper/french/NounFre.gf @@ -1,2 +1,4 @@ +--# -path=.:romance:abstract:../common:prelude + concrete NounFre of Noun = CatFre ** NounRomance with (ResRomance = ResFre) ; diff --git a/lib/resource/exper/french/StructuralFre.gf b/lib/resource/exper/french/StructuralFre.gf index 12a7dc3fa..c2cf66531 100644 --- a/lib/resource/exper/french/StructuralFre.gf +++ b/lib/resource/exper/french/StructuralFre.gf @@ -16,7 +16,7 @@ lin almost_AdA, almost_AdN = ss "presque" ; always_AdV = ss "toujours" ; although_Subj = ss ("bien" ++ elisQue) ** {m = Conjunct} ; - and_Conj = ss "et" ** {n = Pl} ; + and_Conj = {s1 = [] ; s2 = "et" ; n = Pl} ; because_Subj = ss ("parce" ++ elisQue) ** {m = Indic} ; before_Prep = mkPreposition "avant" ; behind_Prep = mkPreposition "derrière" ; @@ -63,11 +63,12 @@ lin most_Predet = {s = \\_,c => prepCase c ++ ["la plupart"] ; c = CPrep P_de} ; much_Det = {s = \\_,c => prepCase c ++ "beaucoup" ++ elisDe ; n = Pl} ; must_VV = mkVV (devoir_V2 ** {lock_V = <>}) ; - no_Phr = ss "non" ; +---b no_Phr = ss "non" ; + no_Utt = ss "non" ; on_Prep = mkPreposition "sur" ; --- DEPREC one_Quant = {s = \\g,c => prepCase c ++ genForms "un" "une" ! g} ; only_Predet = {s = \\_,c => prepCase c ++ "seulement" ; c = Nom} ; --- seul(e)(s) - or_Conj = {s = "ou" ; n = Sg} ; + or_Conj = {s1 = [] ; s2 = "ou" ; n = Sg} ; otherwise_PConj = ss "autrement" ; part_Prep = complGen ; please_Voc = ss ["s'il vous plaît"] ; @@ -138,7 +139,8 @@ lin why_IAdv = ss "pourquoi" ; without_Prep = mkPreposition "sans" ; with_Prep = mkPreposition "avec" ; - yes_Phr = ss "oui" ; --- si + yes_Utt = ss "oui" ; --- si +---b yes_Phr = ss "oui" ; --- si youSg_Pron = mkPronoun "tu" (elision "t") (elision "t") "toi" "ton" (elisPoss "t") "tes" Masc Sg P2 ; diff --git a/lib/resource/exper/french/VerbFre.gf b/lib/resource/exper/french/VerbFre.gf index 492604e7b..9630ec92d 100644 --- a/lib/resource/exper/french/VerbFre.gf +++ b/lib/resource/exper/french/VerbFre.gf @@ -1,2 +1,4 @@ +--# -path=.:romance:abstract:../common:prelude + concrete VerbFre of Verb = CatFre ** VerbRomance with (ResRomance = ResFre) ; diff --git a/lib/resource/exper/romance/CatRomance.gf b/lib/resource/exper/romance/CatRomance.gf index 6d277cd1b..a3829d811 100644 --- a/lib/resource/exper/romance/CatRomance.gf +++ b/lib/resource/exper/romance/CatRomance.gf @@ -21,7 +21,7 @@ incomplete concrete CatRomance of Cat = Cl = {s : Direct => RTense => Anteriority => Polarity => Mood => Str} ; ClSlash = { - s : Direct => AAgr => RTense => Anteriority => Polarity => Mood => Str ; + s : AAgr => Direct => RTense => Anteriority => Polarity => Mood => Str ; c2 : Compl } ; Imp = {s : Polarity => ImpForm => Gender => Str} ; @@ -73,10 +73,11 @@ incomplete concrete CatRomance of Cat = -- Structural - Conj = {s : Str ; n : Number} ; - DConj = {s1,s2 : Str ; n : Number} ; - Subj = {s : Str ; m : Mood} ; - Prep = {s : Str ; c : Case ; isDir : Bool} ; +---b Conj = {s : Str ; n : Number} ; +---b DConj = {s1,s2 : Str ; n : Number} ; + Conj = {s1,s2 : Str ; n : Number} ; + Subj = {s : Str ; m : Mood} ; + Prep = {s : Str ; c : Case ; isDir : Bool} ; -- Open lexical classes, e.g. Lexicon diff --git a/lib/resource/exper/romance/CommonRomance.gf b/lib/resource/exper/romance/CommonRomance.gf index 9224e1204..fec810bed 100644 --- a/lib/resource/exper/romance/CommonRomance.gf +++ b/lib/resource/exper/romance/CommonRomance.gf @@ -60,7 +60,7 @@ oper conjGender : Gender -> Gender -> Gender = \m,n -> case of { => Fem ; - _ => Fem + _ => Masc } ; conjAgr : Agr -> Agr -> Agr = \a,b -> { diff --git a/lib/resource/exper/romance/ConjunctionRomance.gf b/lib/resource/exper/romance/ConjunctionRomance.gf index cdfbb97a2..894fccefa 100644 --- a/lib/resource/exper/romance/ConjunctionRomance.gf +++ b/lib/resource/exper/romance/ConjunctionRomance.gf @@ -5,6 +5,7 @@ incomplete concrete ConjunctionRomance of Conjunction = lin +{---b ConjS conj ss = conjunctTable Mood conj ss ; DConjS conj ss = conjunctDistrTable Mood conj ss ; @@ -26,6 +27,20 @@ incomplete concrete ConjunctionRomance of Conjunction = DConjAP conj ss = conjunctDistrTable AForm conj ss ** { isPre = ss.isPre } ; +---} + + ConjS conj ss = conjunctDistrTable Mood conj ss ; + + ConjAdv conj ss = conjunctDistrSS conj ss ; + + ConjNP conj ss = conjunctDistrTable NPForm conj ss ** { + a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p} ; + hasClit = False + } ; + ConjAP conj ss = conjunctDistrTable AForm conj ss ** { + isPre = ss.isPre + } ; + -- These fun's are generated from the list cat's. diff --git a/lib/resource/exper/romance/NounRomance.gf b/lib/resource/exper/romance/NounRomance.gf index 1b70b6cc3..9b17766b1 100644 --- a/lib/resource/exper/romance/NounRomance.gf +++ b/lib/resource/exper/romance/NounRomance.gf @@ -32,12 +32,29 @@ incomplete concrete NounRomance of Noun = hasClit = False } ; + RelNP np rs = { + s = \\c => np.s ! c ++ rs.s ! Indic ! np.a ; + a = np.a ; + hasClit = False + } ; + AdvNP np adv = { s = \\c => np.s ! c ++ adv.s ; a = np.a ; hasClit = False } ; + DetQuantOrd quant num ord = { + s = \\g,c => quant.s ! num.n ! g ! c ++ num.s ! g ++ + ord.s ! aagr g num.n ; + n = num.n + } ; + + DetQuant quant num = { + s = \\g,c => quant.s ! num.n ! g ! c ++ num.s ! g ; + n = num.n + } ; + {---b DetSg quant ord = { s = \\g,c => quant.s ! False ! Sg ! g ! c ++ ord.s ! aagr g Sg ; @@ -50,6 +67,17 @@ incomplete concrete NounRomance of Noun = } ; -} + DetNP det = + let + g = Masc ; ---- Fem in Extra + n = det.n + in { + s = \\c => let cs = npform2case c in + det.s ! g ! cs ; + a = agrP3 g n ; + hasClit = False + } ; + PossPron p = { s = \\n,g,c => possCase g n c ++ p.s ! Poss (aagr g n) ---- il mio! } ; @@ -62,16 +90,51 @@ incomplete concrete NounRomance of Noun = ---b NumInt n = {s = \\_ => n.s ; isNum = True ; n = Pl} ; ---b OrdInt n = {s = \\_ => n.s ++ "."} ; --- - NumDigits nu = {s = \\g => nu.s ! NCard g ; isNum = True ; n = nu.n} ; + NumCard n = n ** {isNum = True} ; + + NumDigits nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdDigits nu = {s = \\a => nu.s ! NOrd a.g a.n} ; - NumNumeral nu = {s = \\g => nu.s ! NCard g ; isNum = True ; n = nu.n} ; + NumNumeral nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdNumeral nu = {s = \\a => nu.s ! NOrd a.g a.n} ; AdNum adn num = {s = \\a => adn.s ++ num.s ! a ; isNum = num.isNum ; n = num.n} ; OrdSuperl adj = {s = \\a => adj.s ! Superl ! AF a.g a.n} ; + DetArtOrd quant num ord = { + s = \\g,c => quant.s ! num.isNum ! num.n ! g ! c ++ num.s ! g ++ + ord.s ! aagr g num.n ; + n = num.n + } ; + + DetArtCard quant num = { + s = \\g,c => quant.s ! True ! num.n ! g ! c ++ num.s ! g ; + n = num.n + } ; + + DetArtSg det cn = + let + g = cn.g ; + n = Sg + in { + s = \\c => let cs = npform2case c in + det.s ! False ! n ! g ! cs ++ cn.s ! n ; + a = agrP3 g n ; + hasClit = False + } ; + + DetArtPl det cn = + let + g = cn.g ; + n = Pl + in { + s = \\c => let cs = npform2case c in + det.s ! False ! n ! g ! cs ++ cn.s ! n ; + a = agrP3 g n ; + hasClit = False + } ; + DefArt = { s = \\_,n,g,c => artDef g n c } ; @@ -80,6 +143,15 @@ incomplete concrete NounRomance of Noun = s = \\b,n,g,c => if_then_Str b [] (artIndef g n c) ; } ; + MassNP cn = let + g = cn.g ; + n = Sg + in { + s = \\c => partitive g (npform2case c) ++ cn.s ! n ; + a = agrP3 g n ; + hasClit = False + } ; + {---b MassDet = { s = \\b,n,g,c => case of { @@ -94,10 +166,15 @@ incomplete concrete NounRomance of Noun = UseN, UseN2 = \noun -> noun ; ---b UseN3 = \noun -> noun ; + Use2N3 f = f ; + + Use3N3 f = f ** {c2 = f.c3} ; + ComplN2 f x = { s = \\n => f.s ! n ++ appCompl f.c2 x.s ; g = f.g ; } ; + ComplN3 f x = { s = \\n => f.s ! n ++ appCompl f.c2 x.s ; g = f.g ; diff --git a/lib/resource/exper/romance/PhraseRomance.gf b/lib/resource/exper/romance/PhraseRomance.gf index e45f1beff..4de6b28e5 100644 --- a/lib/resource/exper/romance/PhraseRomance.gf +++ b/lib/resource/exper/romance/PhraseRomance.gf @@ -19,7 +19,7 @@ incomplete concrete PhraseRomance of Phrase = UttAdv adv = adv ; NoPConj = {s = []} ; - PConjConj conj = conj ; + PConjConj conj = {s = conj.s2} ; NoVoc = {s = []} ; VocNP np = {s = "," ++ np.s ! Ton Nom} ; diff --git a/lib/resource/exper/romance/QuestionRomance.gf b/lib/resource/exper/romance/QuestionRomance.gf index 3e14a6644..e4959c0fe 100644 --- a/lib/resource/exper/romance/QuestionRomance.gf +++ b/lib/resource/exper/romance/QuestionRomance.gf @@ -26,7 +26,7 @@ incomplete concrete QuestionRomance of Question = s = \\t,a,p => let cls : Direct -> Str = - \d -> slash.s ! d ! ip.a ! t ! a ! p ! Indic ; + \d -> slash.s ! ip.a ! d ! t ! a ! p ! Indic ; who = slash.c2.s ++ ip.s ! slash.c2.c in table { QDir => who ++ cls DInv ; @@ -60,6 +60,42 @@ incomplete concrete QuestionRomance of Question = s = \\c => ip.s ! c ++ adv.s ; a = ip.a } ; + + IdetCN idet cn = + let + g = cn.g ; + n = idet.n ; + a = aagr g n + in { + s = \\c => idet.s ! g ! c ++ cn.s ! n ; + a = a + } ; + + IdetIP idet = + let + g = Masc ; ---- Fem in Extra + n = idet.n ; + a = aagr g n + in { + s = \\c => idet.s ! g ! c ; + a = a + } ; + + IdetQuant idet num = + let + n = num.n ; + in { + s = \\g,c => idet.s ! n ! g ! c ++ num.s ! g ; + n = n + } ; + + + CompIAdv a = {s = \\_ => a.s} ; + + CompIP p = {s = \\_ => p.s ! Nom} ; + +} + {- ---b IDetCN idet num ord cn = let @@ -71,6 +107,3 @@ incomplete concrete QuestionRomance of Question = a = a } ; -} - CompIAdv a = {s = \\_ => a.s} ; - -} diff --git a/lib/resource/exper/romance/RelativeRomance.gf b/lib/resource/exper/romance/RelativeRomance.gf index 2051c283d..40b83c1b3 100644 --- a/lib/resource/exper/romance/RelativeRomance.gf +++ b/lib/resource/exper/romance/RelativeRomance.gf @@ -32,7 +32,7 @@ incomplete concrete RelativeRomance of Relative = in slash.c2.s ++ rp.s ! False ! aag ! slash.c2.c ++ - slash.s ! DDir ! aag ! t ! a ! p ! m ; --- ragr + slash.s ! aag ! DDir ! t ! a ! p ! m ; --- ragr c = Acc } ; diff --git a/lib/resource/exper/romance/ResRomance.gf b/lib/resource/exper/romance/ResRomance.gf index fc29c0af5..9191b5f5f 100644 --- a/lib/resource/exper/romance/ResRomance.gf +++ b/lib/resource/exper/romance/ResRomance.gf @@ -122,7 +122,7 @@ oper clDat = cc.p2 ; clit2 = vp.clit2 ; neg = vp.neg ; - comp = \\a => vp.comp ! a ++ cc.p3 ; + comp = \\a => cc.p3 ++ vp.comp ! a ; ext = vp.ext ; } ; @@ -195,6 +195,8 @@ oper ext = \\p => vp.ext ! p ++ co ! p ; } ; + mkVPSlash : Compl -> VP -> VP ** {c2 : Compl} = \c,vp -> vp ** {c2 = c} ; + mkClause : Str -> Bool -> Agr -> VP -> {s : Direct => RTense => Anteriority => Polarity => Mood => Str} = \subj,hasClit,agr,vp -> { diff --git a/lib/resource/exper/romance/SentenceRomance.gf b/lib/resource/exper/romance/SentenceRomance.gf index ecfe25a86..feadd991c 100644 --- a/lib/resource/exper/romance/SentenceRomance.gf +++ b/lib/resource/exper/romance/SentenceRomance.gf @@ -14,18 +14,18 @@ incomplete concrete SentenceRomance of Sentence = } } ; -{---- OK but inefficient SlashVP np v2 = - {s = \\d,ag =>case of { - => - (mkClause (np.s ! Aton Nom) np.hasClit np.a - (insertAgr ag v2)).s ! d ; - _ => (mkClause (np.s ! Aton Nom) np.hasClit np.a v2).s ! d - } ; + -- agreement decided afterwards: la fille qu'il a trouvée + {s = \\ag => + let vp = case of { + => insertAgr ag v2 ; + _ => v2 + } + in (mkClause (np.s ! Aton Nom) np.hasClit np.a vp).s ; c2 = v2.c2 } ; ----b +{---b SlashV2 np v2 = {s = \\d,ag =>case of { => @@ -46,26 +46,25 @@ incomplete concrete SentenceRomance of Sentence = } ; -} AdvSlash slash adv = { - s = \\d,ag,t,a,b,m => slash.s ! d! ag ! t ! a ! b ! m ++ adv.s ; + s = \\ag,d,t,a,b,m => slash.s ! ag ! d ! t ! a ! b ! m ++ adv.s ; c2 = slash.c2 } ; SlashPrep cl prep = { - s = \\d,_ => cl.s ! d ; + s = \\_ => cl.s ; c2 = {s = prep.s ; c = prep.c ; isDir = False} } ; -{---- OK but inefficient SlashVS np vs slash = - {s = \\d,ag => + {s = \\ag => (mkClause (np.s ! Aton Nom) np.hasClit np.a - (insertExtrapos (\\b => conjThat ++ slash.s ! ag ! (vs.m ! b)) --- ag? + (insertExtrapos (\\b => conjThat ++ slash.s ! ag ! (vs.m ! b)) (predV vs)) - ).s ! d ; + ).s ; c2 = slash.c2 } ; --} + EmbedS s = {s = conjThat ++ s.s ! Indic} ; --- mood EmbedQS qs = {s = qs.s ! QIndir} ; EmbedVP vp = {s = infVP vp (agrP3 Masc Sg)} ; --- agr ---- compl @@ -81,11 +80,15 @@ incomplete concrete SentenceRomance of Sentence = c = cl.c } ; UseSlash t a p cl = { - s = \\agr,mo => - t.s ++ a.s ++ p.s ++ cl.s ! DDir ! agr ! t.t ! a.a ! p.p ! mo ; + s = \\ag,mo => + t.s ++ a.s ++ p.s ++ cl.s ! ag ! DDir ! t.t ! a.a ! p.p ! mo ; c2 = cl.c2 } ; AdvS a s = {s = \\o => a.s ++ "," ++ s.s ! o} ; + RelS s r = { + s = \\o => s.s ! o ++ "," ++ partQIndir ++ r.s ! Indic ! agrP3 Masc Sg + } ; + } diff --git a/lib/resource/exper/romance/VerbRomance.gf b/lib/resource/exper/romance/VerbRomance.gf index 4cccd21b1..b6c96f06b 100644 --- a/lib/resource/exper/romance/VerbRomance.gf +++ b/lib/resource/exper/romance/VerbRomance.gf @@ -6,11 +6,6 @@ incomplete concrete VerbRomance of Verb = lin UseV = predV ; -{---b - ComplV2 v np1 = insertObject v.c2 np1 (predV v) ; - - ComplV3 v np1 np2 = insertObject v.c3 np2 (insertObject v.c2 np1 (predV v)) ; - ComplVV v vp = insertComplement (\\a => prepCase v.c2.c ++ infVP vp a) (predV v) ; ComplVS v s = insertExtrapos (\\b => conjThat ++ s.s ! (v.m ! b)) (predV v) ; @@ -18,6 +13,79 @@ incomplete concrete VerbRomance of Verb = ComplVA v ap = insertComplement (\\a => ap.s ! AF a.g a.n) (predV v) ; + SlashV2a v = mkVPSlash v.c2 (predV v) ; + + Slash2V3 v np = mkVPSlash v.c3 (insertObject v.c2 np (predV v)) ; + Slash3V3 v np = mkVPSlash v.c2 (insertObject v.c3 np (predV v)) ; + + SlashV2V v vp = + mkVPSlash v.c2 + (insertComplement + (\\a => prepCase v.c2.c ++ infVP vp a) + (predV v)) ; + + SlashV2S v s = + mkVPSlash v.c2 + (insertExtrapos + (\\b => s.s ! Indic) ---- mood + (predV v)) ; + + SlashV2Q v q = + mkVPSlash v.c2 + (insertExtrapos + (\\_ => q.s ! QIndir) + (predV v)) ; + + SlashV2A v ap = + + let af = AF Masc Sg + {- ---- lincat should be fixed + let af = case v.c3.isDir of { + True => AF np.a.g np.a.n ; -- ... bleues + _ => AF Masc Sg -- il les peint en bleu + } + -} + in + mkVPSlash v.c2 + (insertComplement + (\\_ => v.c3.s ++ prepCase v.c3.c ++ ap.s ! af) + (predV v)) ; + + ComplSlash vp np = insertObject vp.c2 np vp ; + + ReflVP v = case v.c2.isDir of { + True => v ** {vtyp = vRefl} ; + False => insertComplement + (\\a => v.c2.s ++ reflPron a.n a.p v.c2.c) v + } ; + + SlashVV v vp = + mkVPSlash vp.c2 + (insertComplement (\\a => prepCase v.c2.c ++ infVP vp a) (predV v)) ; + + SlashV2VNP v np vp = + mkVPSlash vp.c2 + (insertComplement + (\\a => prepCase v.c2.c ++ infVP vp a) + (insertObject v.c2 np (predV v))) ; + + UseComp comp = insertComplement comp.s (predV copula) ; + + CompAP ap = {s = \\ag => ap.s ! AF ag.g ag.n} ; + CompNP np = {s = \\_ => np.s ! Ton Acc} ; + CompAdv a = {s = \\_ => a.s} ; + + AdvVP vp adv = insertAdv adv.s vp ; + AdVVP adv vp = insertAdV adv.s vp ; + + PassV2 v = insertComplement (\\a => v.s ! VPart a.g a.n) (predV auxPassive) ; + +} + +{---b + ComplV2 v np1 = insertObject v.c2 np1 (predV v) ; + ComplV3 v np1 np2 = insertObject v.c3 np2 (insertObject v.c2 np1 (predV v)) ; + ComplV2V v np vp = insertComplement (\\a => prepCase v.c2.c ++ infVP vp a) (insertObject v.c2 np (predV v)) ; @@ -44,18 +112,6 @@ incomplete concrete VerbRomance of Verb = (\\a => v.c2.s ++ reflPron a.n a.p v.c2.c) (predV v) } ; + UseVS, UseVQ = \vv -> {s = vv.s ; c2 = complAcc ; vtyp = vv.vtyp} ; -} - UseComp comp = insertComplement comp.s (predV copula) ; - CompAP ap = {s = \\ag => ap.s ! AF ag.g ag.n} ; - CompNP np = {s = \\_ => np.s ! Ton Acc} ; - CompAdv a = {s = \\_ => a.s} ; - - AdvVP vp adv = insertAdv adv.s vp ; - AdVVP adv vp = insertAdV adv.s vp ; - - PassV2 v = insertComplement (\\a => v.s ! VPart a.g a.n) (predV auxPassive) ; - ----b UseVS, UseVQ = \vv -> {s = vv.s ; c2 = complAcc ; vtyp = vv.vtyp} ; - -}