1
0
forked from GitHub/gf-core

reduce the number of variants in Interlingua

This commit is contained in:
krasimir
2009-06-16 07:53:01 +00:00
parent b2b4a7064b
commit b442cde3bd
9 changed files with 79 additions and 60 deletions

View File

@@ -27,7 +27,7 @@ concrete CatIna of Cat = CommonX ** open ResIna, Prelude in {
-- Relative -- 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 RP = {s : Case => Str; a : Agr} ; -- number for "tal que / tales que"; person for reflexives
-- Verb -- Verb

View File

@@ -9,26 +9,26 @@ concrete IdiomIna of Idiom = CatIna ** open Prelude, ResIna in {
CleftNP np rs = mkClause "lo" Sp3 CleftNP np rs = mkClause "lo" Sp3
(insertObj [] Acc (mkInvarNP (rs.s ! Sp3)) (insertObj [] Acc (mkInvarNP (rs.s ! Sp3))
(insertObj [] Acc np (insertObj [] Acc np
(predV esserV))); (predV_ esserV)));
-- ??? number/case agreement -- ??? number/case agreement
CleftAdv ad s = mkClause "lo" Sp3 CleftAdv ad s = mkClause "lo" Sp3
(insertObj [] Acc (mkInvarNP ("que" ++ s.s)) (insertObj [] Acc (mkInvarNP ("que" ++ s.s))
(insertObj [] Acc (mkInvarNP (ad.s)) (predV esserV))) ; (insertObj [] Acc (mkInvarNP (ad.s)) (predV_ esserV))) ;
ExistNP np = 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) -- 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 -- Never seen the above, but we can deduce it exists, since it's
-- merely an interrogative form of ExistNP. -- merely an interrogative form of ExistNP.
ProgrVP vp = vp; -- progressive tense is the same as present in Interlingua. ProgrVP vp = vp; -- progressive tense is the same as present in Interlingua.
-- (parag. 80+ of Grammatica de 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};
} }

View File

@@ -1,4 +1,4 @@
--# -path=.:../abstract:../common:prelude --# -path=.:../abstract:../common:../prelude
concrete LangIna of Lang = concrete LangIna of Lang =
GrammarIna, GrammarIna,

View File

@@ -4,8 +4,8 @@ concrete QuestionIna of Question = CatIna ** open ResIna, Prelude in {
lin lin
QuestCl cl = { QuestCl cl = {
s = \\t,a,p => s = \\use_irreg,t,a,p =>
let cls = cl.s ! t ! a ! p let cls = cl.s ! use_irreg ! t ! a ! p
in table { in table {
OQuest => cls ! OQuest ; OQuest => cls ! OQuest ;
ODir => "an" ++ cls ! ODir ODir => "an" ++ cls ! ODir
@@ -14,7 +14,7 @@ concrete QuestionIna of Question = CatIna ** open ResIna, Prelude in {
QuestVP qp vp = QuestVP qp vp =
let cl = mkClause (qp.s ! Nom) Sp3 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 = QuestSlash ip slash =
mkQuestion (ss (slash.p2 ++ ip.s ! slash.c2)) 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 ; QuestIAdv iadv cl = mkQuestion iadv cl ;
QuestIComp icomp np = 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} ; PrepIP p ip = {s = p.s ++ ip.s ! Nom} ;

View File

@@ -5,14 +5,14 @@ concrete RelativeIna of Relative = CatIna ** open ResIna in {
lin lin
RelCl cl = { RelCl cl = {
s = \\t,a,p,agr => s = \\use_irreg,t,a,p,agr =>
(case agr.n of {Sg => "tal"; Pl => "tales"}) ++ (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 c = Nom
} ; } ;
RelVP rp vp = { 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 c = Nom
} ; } ;
-- !!! person agreement is probably bad here; see below. -- !!! 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" ---- Pied piping: "a que tu invia flores"
RelSlash rp slash = { 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; c = slash.c2;
} ; } ;
-- !!! In the above The agreement feature of the RP does not match -- !!! In the above The agreement feature of the RP does not match

View File

@@ -1,4 +1,4 @@
--# -path=.:../abstract:../common:../../prelude --# -path=.:../abstract:../common:../prelude
--1 Interlingua auxiliary operations. --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) -- + The 3 (optionally) irregular verbs. (we only need haberV in this module)
esserV : Verb = esserV : Bool => Verb = \\use_irreg =>
let reg = mkVerb "esser" let reg = mkVerb "esser"
in {isRefl = False; in {isRefl = False;
s = \\form=> case form of { s = case use_irreg of {
VPres => variants {"es"; "esse"}; True => table {
VFut => variants {"sera"; "essera"}; VPres => "es";
VCond => variants {"serea"; "esserea"}; VFut => "sera";
VPast => variants {"era"; "esseva"}; VCond => "serea";
_ => reg.s!form}}; VPast => "era";
form => reg.s!form
};
False => reg.s
}
};
haberV : Verb = haberV : Bool => Verb = \\use_irreg =>
let reg = mkVerb "haber" let reg = mkVerb "haber"
in {isRefl = False; in {isRefl = False;
s = \\form=> case form of { s = case use_irreg of {
VPres => variants {"ha"; "habe"}; True => table {
_ => reg.s!form}}; VPres => "ha";
form => reg.s!form
};
False => reg.s
}
};
vaderV : Verb = vaderV : Bool => Verb = \\use_irreg =>
let reg = mkVerb "vader" let reg = mkVerb "vader"
in {isRefl = False; in {isRefl = False;
s = \\form=> case form of { s = case use_irreg of {
VPres => variants {"va"; "vade"}; True => table {
_ => reg.s!form}}; 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}; 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! -- Dependency on Agr is there only because of reflexive pronouns!
VP : Type = { VP : Type = {
s : Anteriority => Tense => {fin, inf : Str} ; s : Anteriority => Tense => Bool => {fin, inf : Str} ;
rest : Agr => Str; -- comes after the infinite part rest : Agr => Str; -- comes after the infinite part
clitics : Agr => Str; -- can be placed just before the finite or right after the infinite clitics : Agr => Str; -- can be placed just before the finite or right after the infinite
prp : Str ; -- present participle (unused at the moment ???) prp : Str ; -- present participle (unused at the moment ???)
@@ -213,17 +229,19 @@ resource ResIna = ParamX ** open Prelude in {
s : Agr => Case => Str; s : Agr => Case => Str;
}; };
predV : Verb -> VP = \verb -> { predV_ : (Bool => Verb) -> VP = \verb -> {
clitics = \\_ => []; clitics = \\_ => [];
rest = \\_ => []; rest = \\_ => [];
s = table s = table
{Simul => \\t=> {fin = verb.s ! (tenseToVFrom!t); inf = []}; {Simul => \\t,use_irreg => {fin = (verb!use_irreg).s ! (tenseToVFrom!t); inf = []};
Anter => \\t=> {fin = haberV.s ! (tenseToVFrom!t); inf = verb.s!VPPart} Anter => \\t,use_irreg => {fin = (haberV!use_irreg).s ! (tenseToVFrom!t); inf = (verb!use_irreg).s!VPPart}
}; };
prp = verb.s ! VPresPart; prp = (verb!False).s ! VPresPart;
inf = verb.s ! VInf; inf = (verb!False).s ! VInf;
}; };
predV : Verb -> VP = \verb -> predV_ (\\_ => verb) ;
tenseToVFrom = table { tenseToVFrom = table {
Pres => VPres Pres => VPres
;Past => VPast; --# notpresent ;Past => VPast; --# notpresent
@@ -277,28 +295,29 @@ resource ResIna = ParamX ** open Prelude in {
---- For $Sentence$. ---- For $Sentence$.
-- --
Clause = {s : Tense => Anteriority => Polarity => Order => Str} ; Clause = {s : Bool => Tense => Anteriority => Polarity => Order => Str} ;
mkClause : Str -> Agr -> VP -> Clause = mkClause : Str -> Agr -> VP -> Clause =
\subj,agr,vp -> \subj,agr,vp ->
{ {
s = \\t,anter,b =>let v = vp.s!anter!t s = \\use_irreg,t,anter,b =>
in table { let v = vp.s!anter!t!use_irreg
ODir => variants { in case use_irreg of {
subj ++ posneg b ++ v.fin ++ v.inf ++ vp.clitics!agr ++ vp.rest!agr; True => table {
subj ++ posneg b ++ vp.clitics!agr ++ v.fin ++ v.inf ++ vp.rest!agr 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
OQuest => variants { } ;
posneg b ++ v.fin ++ subj ++ v.inf ++ vp.clitics!agr ++ vp.rest!agr; False => table {
posneg b ++ vp.clitics!agr ++ v.fin ++ subj ++ v.inf ++ vp.rest!agr; 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 : mkQuestion :
{s : Str} -> Clause -> Clause = \qu,cl -> {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};

View File

@@ -8,7 +8,7 @@ lin
PredSCVP sc vp = mkClause sc.s Sp3 vp ; 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} ; 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} ; {c2 = slash.c2; p2 = slash.p2} ;
AdvSlash slash adv = { 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; c2 = slash.c2;
p2 = slash.p2 p2 = slash.p2
} ; } ;
@@ -31,10 +31,10 @@ lin
EmbedQS qs = {s = qs.s ! ODir} ; EmbedQS qs = {s = qs.s ! ODir} ;
EmbedVP vp = {s = infVP vp} ; EmbedVP vp = {s = infVP vp} ;
UseCl 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 ! t.t ! t.a ! p.p ! o} ; 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 ! t.t ! t.a ! p.p ! agr}; 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 ! t.t ! t.a ! p.p ! ODir; UseSlash t p cl = {s = t.s ++ p.s ++ cl.s ! variants {True;False} ! t.t ! t.a ! p.p ! ODir;
c2 = cl.c2; c2 = cl.c2;
p2 = cl.p2} ; p2 = cl.p2} ;

View File

@@ -104,7 +104,7 @@ concrete StructuralIna of Structural = CatIna **
youPl_Pron = mkPron "vos" "vos" "vostre" Pp2; youPl_Pron = mkPron "vos" "vos" "vostre" Pp2;
youPol_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 oper
mkQuant : Str -> Str -> {s : Number => Case => Str} = \x,y -> { mkQuant : Str -> Str -> {s : Number => Case => Str} = \x,y -> {

View File

@@ -39,7 +39,7 @@ concrete VerbIna of Verb = CatIna ** open ResIna, Prelude in {
ComplSlash vp np = insertObj vp.p2 vp.c2 np vp ; 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 -- !!! as above
SlashVV v vp = SlashVV v vp =
@@ -57,7 +57,7 @@ concrete VerbIna of Verb = CatIna ** open ResIna, Prelude in {
ReflVP vp = insertReflObj vp.p2 vp.c2 ReflVP vp = insertReflObj vp.p2 vp.c2
{isPronoun = True; s = \\agr,c => reflPron!agr} vp ; {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 ; CompAP ap = ap ;
CompNP np = {s = \\_ => np.s ! Acc} ; CompNP np = {s = \\_ => np.s ! Acc} ;