From 9ba7a9e4205dadd08b2f10b27e743fecbda24896 Mon Sep 17 00:00:00 2001 From: krasimir Date: Tue, 16 Jun 2009 07:53:01 +0000 Subject: [PATCH] reduce the number of variants in Interlingua --- next-lib/src/interlingua/CatIna.gf | 2 +- next-lib/src/interlingua/IdiomIna.gf | 10 +-- next-lib/src/interlingua/LangIna.gf | 2 +- next-lib/src/interlingua/QuestionIna.gf | 8 +- next-lib/src/interlingua/RelativeIna.gf | 8 +- next-lib/src/interlingua/ResIna.gf | 91 ++++++++++++++--------- next-lib/src/interlingua/SentenceIna.gf | 12 +-- next-lib/src/interlingua/StructuralIna.gf | 2 +- next-lib/src/interlingua/VerbIna.gf | 4 +- 9 files changed, 79 insertions(+), 60 deletions(-) diff --git a/next-lib/src/interlingua/CatIna.gf b/next-lib/src/interlingua/CatIna.gf index adfa365ea..2a463890d 100644 --- a/next-lib/src/interlingua/CatIna.gf +++ b/next-lib/src/interlingua/CatIna.gf @@ -27,7 +27,7 @@ concrete CatIna of Cat = CommonX ** open ResIna, Prelude in { -- Relative - RCl = {s : ResIna.Tense => Anteriority => Polarity => Agr => Str ; c : Case} ; + RCl = {s : Bool => ResIna.Tense => Anteriority => Polarity => Agr => Str ; c : Case} ; RP = {s : Case => Str; a : Agr} ; -- number for "tal que / tales que"; person for reflexives -- Verb diff --git a/next-lib/src/interlingua/IdiomIna.gf b/next-lib/src/interlingua/IdiomIna.gf index 6aac72fc5..62b9d4152 100644 --- a/next-lib/src/interlingua/IdiomIna.gf +++ b/next-lib/src/interlingua/IdiomIna.gf @@ -9,26 +9,26 @@ concrete IdiomIna of Idiom = CatIna ** open Prelude, ResIna in { CleftNP np rs = mkClause "lo" Sp3 (insertObj [] Acc (mkInvarNP (rs.s ! Sp3)) (insertObj [] Acc np - (predV esserV))); + (predV_ esserV))); -- ??? number/case agreement CleftAdv ad s = mkClause "lo" Sp3 (insertObj [] Acc (mkInvarNP ("que" ++ s.s)) - (insertObj [] Acc (mkInvarNP (ad.s)) (predV esserV))) ; + (insertObj [] Acc (mkInvarNP (ad.s)) (predV_ esserV))) ; ExistNP np = - mkClause "il" Sp3 ((insertObj "" Acc np) (predV haberV)) ; + mkClause "il" Sp3 ((insertObj "" Acc np) (predV_ haberV)) ; -- Il ha colonias que non pote reclamar mesmo un tal origine. (sample text 3) - ExistIP ip = mkQuestion {s=ip.s ! Acc} (mkClause "il" Sp3 (predV haberV)) ; + ExistIP ip = mkQuestion {s=ip.s ! Acc} (mkClause "il" Sp3 (predV_ haberV)) ; -- Never seen the above, but we can deduce it exists, since it's -- merely an interrogative form of ExistNP. ProgrVP vp = vp; -- progressive tense is the same as present in Interlingua. -- (parag. 80+ of Grammatica de Interlingua) - ImpPl1 vp = {s = "que" ++ (mkClause "nos" {n = Pl ; p = P1} vp).s ! Pres ! Simul ! Pos ! ODir}; + ImpPl1 vp = {s = "que" ++ (mkClause "nos" {n = Pl ; p = P1} vp).s ! variants {True;False} ! Pres ! Simul ! Pos ! ODir}; } diff --git a/next-lib/src/interlingua/LangIna.gf b/next-lib/src/interlingua/LangIna.gf index 9c4460100..58fe6e92c 100644 --- a/next-lib/src/interlingua/LangIna.gf +++ b/next-lib/src/interlingua/LangIna.gf @@ -1,4 +1,4 @@ ---# -path=.:../abstract:../common:prelude +--# -path=.:../abstract:../common:../prelude concrete LangIna of Lang = GrammarIna, diff --git a/next-lib/src/interlingua/QuestionIna.gf b/next-lib/src/interlingua/QuestionIna.gf index aadbaa090..59d578ee3 100644 --- a/next-lib/src/interlingua/QuestionIna.gf +++ b/next-lib/src/interlingua/QuestionIna.gf @@ -4,8 +4,8 @@ concrete QuestionIna of Question = CatIna ** open ResIna, Prelude in { lin QuestCl cl = { - s = \\t,a,p => - let cls = cl.s ! t ! a ! p + s = \\use_irreg,t,a,p => + let cls = cl.s ! use_irreg ! t ! a ! p in table { OQuest => cls ! OQuest ; ODir => "an" ++ cls ! ODir @@ -14,7 +14,7 @@ concrete QuestionIna of Question = CatIna ** open ResIna, Prelude in { QuestVP qp vp = let cl = mkClause (qp.s ! Nom) Sp3 vp - in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ; + in {s = \\use_irreg,t,a,b,_ => cl.s ! use_irreg ! t ! a ! b ! ODir} ; QuestSlash ip slash = mkQuestion (ss (slash.p2 ++ ip.s ! slash.c2)) slash ; @@ -22,7 +22,7 @@ concrete QuestionIna of Question = CatIna ** open ResIna, Prelude in { QuestIAdv iadv cl = mkQuestion iadv cl ; QuestIComp icomp np = - mkQuestion icomp (mkClause (np.s ! Nom) np.a (predV esserV)) ; + mkQuestion icomp (mkClause (np.s ! Nom) np.a (predV_ esserV)) ; PrepIP p ip = {s = p.s ++ ip.s ! Nom} ; diff --git a/next-lib/src/interlingua/RelativeIna.gf b/next-lib/src/interlingua/RelativeIna.gf index ebdebcd13..be3be3150 100644 --- a/next-lib/src/interlingua/RelativeIna.gf +++ b/next-lib/src/interlingua/RelativeIna.gf @@ -5,14 +5,14 @@ concrete RelativeIna of Relative = CatIna ** open ResIna in { lin RelCl cl = { - s = \\t,a,p,agr => + s = \\use_irreg,t,a,p,agr => (case agr.n of {Sg => "tal"; Pl => "tales"}) ++ - "que" ++ cl.s ! t ! a ! p ! ODir ; + "que" ++ cl.s ! use_irreg ! t ! a ! p ! ODir ; c = Nom } ; RelVP rp vp = { - s = \\t,a,p,agr => (mkClause (rp.s!Nom) agr vp).s ! t ! a ! p ! ODir; + s = \\use_irreg,t,a,p,agr => (mkClause (rp.s!Nom) agr vp).s ! use_irreg ! t ! a ! p ! ODir; c = Nom } ; -- !!! person agreement is probably bad here; see below. @@ -20,7 +20,7 @@ concrete RelativeIna of Relative = CatIna ** open ResIna in { ---- Pied piping: "a que tu invia flores" RelSlash rp slash = { - s = \\t,a,p,agr => slash.p2 ++ rp.s ! slash.c2 ++ slash.s ! t ! a ! p ! ODir ; + s = \\use_irreg,t,a,p,agr => slash.p2 ++ rp.s ! slash.c2 ++ slash.s ! use_irreg ! t ! a ! p ! ODir ; c = slash.c2; } ; -- !!! In the above The agreement feature of the RP does not match diff --git a/next-lib/src/interlingua/ResIna.gf b/next-lib/src/interlingua/ResIna.gf index c81324f0d..9eb64bce4 100644 --- a/next-lib/src/interlingua/ResIna.gf +++ b/next-lib/src/interlingua/ResIna.gf @@ -1,4 +1,4 @@ ---# -path=.:../abstract:../common:../../prelude +--# -path=.:../abstract:../common:../prelude --1 Interlingua auxiliary operations. @@ -128,29 +128,45 @@ resource ResIna = ParamX ** open Prelude in { }}}; -- + The 3 (optionally) irregular verbs. (we only need haberV in this module) - esserV : Verb = + esserV : Bool => Verb = \\use_irreg => let reg = mkVerb "esser" in {isRefl = False; - s = \\form=> case form of { - VPres => variants {"es"; "esse"}; - VFut => variants {"sera"; "essera"}; - VCond => variants {"serea"; "esserea"}; - VPast => variants {"era"; "esseva"}; - _ => reg.s!form}}; + s = case use_irreg of { + True => table { + VPres => "es"; + VFut => "sera"; + VCond => "serea"; + VPast => "era"; + form => reg.s!form + }; + False => reg.s + } + }; - haberV : Verb = + haberV : Bool => Verb = \\use_irreg => let reg = mkVerb "haber" in {isRefl = False; - s = \\form=> case form of { - VPres => variants {"ha"; "habe"}; - _ => reg.s!form}}; + s = case use_irreg of { + True => table { + VPres => "ha"; + form => reg.s!form + }; + False => reg.s + } + }; - vaderV : Verb = + vaderV : Bool => Verb = \\use_irreg => let reg = mkVerb "vader" in {isRefl = False; - s = \\form=> case form of { - VPres => variants {"va"; "vade"}; - _ => reg.s!form}}; + s = case use_irreg of { + True => table { + VPres => "va"; + form => reg.s!form + }; + + False => reg.s + } + }; mkIP : Str -> Number -> {s : Case => Str ; n : Number} = \qui,n -> {s = \\c=>casePrep [] c ++ qui; n = n}; @@ -196,7 +212,7 @@ resource ResIna = ParamX ** open Prelude in { -- Dependency on Agr is there only because of reflexive pronouns! VP : Type = { - s : Anteriority => Tense => {fin, inf : Str} ; + s : Anteriority => Tense => Bool => {fin, inf : Str} ; rest : Agr => Str; -- comes after the infinite part clitics : Agr => Str; -- can be placed just before the finite or right after the infinite prp : Str ; -- present participle (unused at the moment ???) @@ -213,17 +229,19 @@ resource ResIna = ParamX ** open Prelude in { s : Agr => Case => Str; }; - predV : Verb -> VP = \verb -> { + predV_ : (Bool => Verb) -> VP = \verb -> { clitics = \\_ => []; rest = \\_ => []; s = table - {Simul => \\t=> {fin = verb.s ! (tenseToVFrom!t); inf = []}; - Anter => \\t=> {fin = haberV.s ! (tenseToVFrom!t); inf = verb.s!VPPart} + {Simul => \\t,use_irreg => {fin = (verb!use_irreg).s ! (tenseToVFrom!t); inf = []}; + Anter => \\t,use_irreg => {fin = (haberV!use_irreg).s ! (tenseToVFrom!t); inf = (verb!use_irreg).s!VPPart} }; - prp = verb.s ! VPresPart; - inf = verb.s ! VInf; + prp = (verb!False).s ! VPresPart; + inf = (verb!False).s ! VInf; }; - + + predV : Verb -> VP = \verb -> predV_ (\\_ => verb) ; + tenseToVFrom = table { Pres => VPres ;Past => VPast; --# notpresent @@ -277,28 +295,29 @@ resource ResIna = ParamX ** open Prelude in { ---- For $Sentence$. -- - Clause = {s : Tense => Anteriority => Polarity => Order => Str} ; + Clause = {s : Bool => Tense => Anteriority => Polarity => Order => Str} ; mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> { - s = \\t,anter,b =>let v = vp.s!anter!t - in table { - ODir => variants { - subj ++ posneg b ++ v.fin ++ v.inf ++ vp.clitics!agr ++ vp.rest!agr; - subj ++ posneg b ++ vp.clitics!agr ++ v.fin ++ v.inf ++ vp.rest!agr - }; - OQuest => variants { - posneg b ++ v.fin ++ subj ++ v.inf ++ vp.clitics!agr ++ vp.rest!agr; - posneg b ++ vp.clitics!agr ++ v.fin ++ subj ++ v.inf ++ vp.rest!agr; - } - } + s = \\use_irreg,t,anter,b => + let v = vp.s!anter!t!use_irreg + in case use_irreg of { + True => table { + ODir => subj ++ posneg b ++ v.fin ++ v.inf ++ vp.clitics!agr ++ vp.rest!agr; + OQuest => posneg b ++ v.fin ++ subj ++ v.inf ++ vp.clitics!agr ++ vp.rest!agr + } ; + False => table { + ODir => subj ++ posneg b ++ vp.clitics!agr ++ v.fin ++ v.inf ++ vp.rest!agr; + OQuest => posneg b ++ vp.clitics!agr ++ v.fin ++ subj ++ v.inf ++ vp.rest!agr + } + } }; mkQuestion : {s : Str} -> Clause -> Clause = \qu,cl -> - {s=\\t,a,p,o => qu.s ++ cl.s ! t ! a ! p ! o}; + {s=\\use_irreg,t,a,p,o => qu.s ++ cl.s ! use_irreg ! t ! a ! p ! o}; diff --git a/next-lib/src/interlingua/SentenceIna.gf b/next-lib/src/interlingua/SentenceIna.gf index 9fc97023d..cc0640811 100644 --- a/next-lib/src/interlingua/SentenceIna.gf +++ b/next-lib/src/interlingua/SentenceIna.gf @@ -8,7 +8,7 @@ lin PredSCVP sc vp = mkClause sc.s Sp3 vp ; - ImpVP vp = {s = \\pol,n=> (mkClause [] {n = n; p = P2} vp).s!Pres!Simul!pol!ODir}; + ImpVP vp = {s = \\pol,n=> (mkClause [] {n = n; p = P2} vp).s!variants {True;False}!Pres!Simul!pol!ODir}; SlashVP np vp = mkClause (np.s ! Nom) np.a vp ** {c2 = vp.c2; p2 = vp.p2} ; @@ -18,7 +18,7 @@ lin {c2 = slash.c2; p2 = slash.p2} ; AdvSlash slash adv = { - s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ; + s = \\use_irreg,t,a,b,o => slash.s ! use_irreg ! t ! a ! b ! o ++ adv.s ; c2 = slash.c2; p2 = slash.p2 } ; @@ -31,10 +31,10 @@ lin EmbedQS qs = {s = qs.s ! ODir} ; EmbedVP vp = {s = infVP vp} ; - UseCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! ODir} ; - UseQCl t p cl = {s = \\o => t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! o} ; - UseRCl t p cl = {s = \\agr => t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! agr}; - UseSlash t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! ODir; + UseCl t p cl = {s = t.s ++ p.s ++ cl.s ! variants {True;False} ! t.t ! t.a ! p.p ! ODir} ; + UseQCl t p cl = {s = \\o => t.s ++ p.s ++ cl.s ! variants {True;False} ! t.t ! t.a ! p.p ! o} ; + UseRCl t p cl = {s = \\agr => t.s ++ p.s ++ cl.s ! variants {True;False} ! t.t ! t.a ! p.p ! agr}; + UseSlash t p cl = {s = t.s ++ p.s ++ cl.s ! variants {True;False} ! t.t ! t.a ! p.p ! ODir; c2 = cl.c2; p2 = cl.p2} ; diff --git a/next-lib/src/interlingua/StructuralIna.gf b/next-lib/src/interlingua/StructuralIna.gf index 2db1f5a63..69acc0658 100644 --- a/next-lib/src/interlingua/StructuralIna.gf +++ b/next-lib/src/interlingua/StructuralIna.gf @@ -104,7 +104,7 @@ concrete StructuralIna of Structural = CatIna ** youPl_Pron = mkPron "vos" "vos" "vostre" Pp2; youPol_Pron = mkPron "vos" "vos" "vostre" Pp2; - have_V2 = dirV2 (R.haberV ** {lock_V = <>}); + -- have_V2 = dirV2 (R.haberV ** {lock_V = <>}); oper mkQuant : Str -> Str -> {s : Number => Case => Str} = \x,y -> { diff --git a/next-lib/src/interlingua/VerbIna.gf b/next-lib/src/interlingua/VerbIna.gf index c41b1f55b..bfbac787f 100644 --- a/next-lib/src/interlingua/VerbIna.gf +++ b/next-lib/src/interlingua/VerbIna.gf @@ -39,7 +39,7 @@ concrete VerbIna of Verb = CatIna ** open ResIna, Prelude in { ComplSlash vp np = insertObj vp.p2 vp.c2 np vp ; - UseComp comp = insertInvarObj (comp.s ! Sp3) (predV esserV) ; + UseComp comp = insertInvarObj (comp.s ! Sp3) (predV_ esserV) ; -- !!! as above SlashVV v vp = @@ -57,7 +57,7 @@ concrete VerbIna of Verb = CatIna ** open ResIna, Prelude in { ReflVP vp = insertReflObj vp.p2 vp.c2 {isPronoun = True; s = \\agr,c => reflPron!agr} vp ; - PassV2 v = insertInvarObj (v.s ! VPPart) (predV esserV); + PassV2 v = insertInvarObj (v.s ! VPPart) (predV_ esserV); CompAP ap = ap ; CompNP np = {s = \\_ => np.s ! Acc} ;