1
0
forked from GitHub/gf-rgl

refactoring to make it easier to add new conjuncts

This commit is contained in:
Krasimir Angelov
2018-09-09 14:10:16 +02:00
parent 790d4bc04a
commit 285bca2ef5
8 changed files with 60 additions and 62 deletions

View File

@@ -68,7 +68,7 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV,SC] ** open ResBul, Prelude, Predef
-- Structural -- Structural
Conj = {s : Str; distr : Bool; conj : Ints 4; n : Number} ; Conj = {s : Str; sep : Ints 3; n : Number} ;
Subj = {s : Str} ; Subj = {s : Str} ;
Prep = {s : Str; c : Case} ; Prep = {s : Str; c : Case} ;
@@ -126,11 +126,7 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV,SC] ** open ResBul, Prelude, Predef
} }
in linrefVP vp; in linrefVP vp;
Conj = \conj -> let s = linCoord ! conj.conj Conj = \conj -> conj.s ;
in case conj.distr of {
True => s ++ s;
False => s
} ;
V, VS, VQ, VA = \v -> linrefVP (predV v); V, VS, VQ, VA = \v -> linrefVP (predV v);
V2 = \v -> linrefVP (predV v) ++ linPrep v.c2 ; V2 = \v -> linrefVP (predV v) ++ linPrep v.c2 ;

View File

@@ -8,92 +8,92 @@ concrete ConjunctionBul of Conjunction =
lin lin
ConjS conj ss = { ConjS conj ss = {
s = conj.s ++ (linCoordSep [])!conj.distr!conj.conj++ss.s!conj.distr!conj.conj; s = linCoord []!conj.sep ++ ss.s!conj.sep ++ conj.s ++ ss.s!4;
} ; } ;
ConjAdv conj ss = { ConjAdv conj ss = {
s = conj.s ++ (linCoordSep [])!conj.distr!conj.conj++ss.s!conj.distr!conj.conj; s = linCoord []!conj.sep ++ ss.s!conj.sep ++ conj.s ++ ss.s!4;
} ; } ;
ConjAdV conj ss = { ConjAdV conj ss = {
s = conj.s ++ (linCoordSep [])!conj.distr!conj.conj++ss.s!conj.distr!conj.conj; s = linCoord []!conj.sep ++ ss.s!conj.sep ++ conj.s ++ ss.s!4;
p = Pos p = Pos
} ; } ;
ConjIAdv conj ss = { ConjIAdv conj ss = {
s = \\qform => conj.s ++ (linCoordSep [])!conj.distr!conj.conj++ss.s!conj.distr!conj.conj!qform; s = \\qform => linCoord []!conj.sep ++ ss.s!qform!conj.sep ++ conj.s ++ ss.s!qform!4;
} ; } ;
ConjNP conj ss = { ConjNP conj ss = {
s = \\role => conj.s ++ (linCoordSep [])!conj.distr!conj.conj++ss.s!conj.distr!conj.conj!role; s = \\role => linCoord []!conj.sep ++ ss.s!role!conj.sep ++ conj.s ++ ss.s!role!4;
gn = conjGenNum (gennum (AMasc NonHuman) conj.n) ss.gn; gn = conjGenNum (gennum (AMasc NonHuman) conj.n) ss.gn;
p = ss.p p = ss.p
} ; } ;
ConjAP conj ss = { ConjAP conj ss = {
s = \\aform,p => conj.s ++ (linCoordSep [])!conj.distr!conj.conj++ss.s!conj.distr!conj.conj!aform!p; s = \\aform,p => linCoord []!conj.sep ++ ss.s!aform!p!conj.sep ++ conj.s ++ ss.s!aform!p!4;
adv = conj.s ++ (linCoordSep [])!conj.distr!conj.conj++ss.adv!conj.distr!conj.conj; adv = ss.adv!conj.conj ++ conj.s ++ ss.adv!4;
isPre = ss.isPre isPre = ss.isPre
} ; } ;
ConjRS conj ss = { ConjRS conj ss = {
s = \\role => conj.s ++ (linCoordSep [])!conj.distr!conj.conj++ss.s!conj.distr!conj.conj!role s = \\role => linCoord []!conj.sep ++ ss.s!role!conj.sep ++ conj.s ++ ss.s!role!4;
} ; } ;
ConjCN conj ss = { ConjCN conj ss = {
s = \\nform => conj.s ++ (linCoordSep [])!conj.distr!conj.conj++ss.s!conj.distr!conj.conj!nform; s = \\nform => linCoord []!conj.sep ++ ss.s!nform!conj.sep ++ conj.s ++ ss.s!nform!4;
g = ss.g g = ss.g
} ; } ;
-- These fun's are generated from the list cat's. -- These fun's are generated from the list cat's.
BaseS x y = {s = \\d,t=>x.s++linCoord!t++ y.s} ; BaseS x y = {s = table {4 => y.s; _ => x.s}} ;
ConsS x xs = {s = \\d,t=>x.s++(linCoordSep comma)!d!t++xs.s!d!t} ; ConsS x xs = {s = table {4 => xs.s!4; t => x.s++linCoord bindComma!t++xs.s!t}} ;
BaseAdv x y = {s = \\d,t=>x.s++linCoord!t++ y.s} ; BaseAdv x y = {s = table {4 => y.s; _ => x.s}} ;
ConsAdv x xs = {s = \\d,t=>x.s++(linCoordSep comma)!d!t++xs.s!d!t} ; ConsAdv x xs = {s = table {4 => xs.s!4; t => x.s++linCoord bindComma!t++xs.s!t}} ;
BaseAdV x y = {s = \\d,t=>x.s++linCoord!t++ y.s} ; BaseAdV x y = {s = table {4 => y.s; _ => x.s}} ;
ConsAdV x xs = {s = \\d,t=>x.s++(linCoordSep comma)!d!t++xs.s!d!t} ; ConsAdV x xs = {s = table {4 => xs.s!4; t => x.s++linCoord bindComma!t++xs.s!t}} ;
BaseIAdv x y = {s = \\d,t,qform=>x.s!qform++linCoord!t++ y.s!qform} ; BaseIAdv x y = {s = \\qform=>table {4 => y.s!qform; _ => x.s!qform}} ;
ConsIAdv x xs = {s = \\d,t,qform=>x.s!qform++(linCoordSep comma)!d!t++xs.s!d!t!qform} ; ConsIAdv x xs = {s = \\qform=>table {4 => xs.s!qform!4; t => x.s!qform++linCoord bindComma!t++xs.s!qform!t}} ;
BaseNP x y = BaseNP x y =
{s = \\d,t,role=>x.s!role++linCoord!t++y.s!role; {s = \\role=>table {4 => y.s!role; _ => x.s!role};
gn = conjGenNum x.gn y.gn; gn = conjGenNum x.gn y.gn;
p = x.p} ; p = x.p} ;
ConsNP x xs = ConsNP x xs =
{s = \\d,t,role=>x.s!role++(linCoordSep comma)!d!t++xs.s!d!t!role; {s = \\role=>table {4 => xs.s!role!4; t => x.s!role++linCoord bindComma!t++xs.s!role!t};
gn = conjGenNum xs.gn x.gn; gn = conjGenNum xs.gn x.gn;
p = x.p} ; p = x.p} ;
BaseAP x y = BaseAP x y =
{s = \\d,t,aform,p => x.s!aform!p++linCoord!t++y.s!aform!p; {s = \\aform,p => table {4 => y.s!aform!p; _ => x.s!aform!p} ;
isPre = andB x.isPre y.isPre} ; isPre = andB x.isPre y.isPre} ;
ConsAP x xs = ConsAP x xs =
{s = \\d,t,aform,p =>x.s!aform!p++(linCoordSep comma)!d!t++xs.s!d!t!aform!p; {s = \\aform,p=>table {4 => xs.s!aform!p!4; t => x.s!aform!p++linCoord bindComma!t++xs.s!aform!p!t};
isPre = andB x.isPre xs.isPre} ; isPre = andB x.isPre xs.isPre} ;
BaseRS x y = BaseRS x y =
{s = \\d,t,role=>x.s!role++linCoord!t++y.s!role} ; {s = \\role=>table {4 => y.s!role; _ => x.s!role}} ;
ConsRS x xs = ConsRS x xs =
{s = \\d,t,role=>x.s!role++(linCoordSep comma)!d!t++xs.s!d!t!role} ; {s = \\role=>table {4 => xs.s!role!4; t => x.s!role++linCoord bindComma!t++xs.s!role!t}} ;
BaseCN x y = BaseCN x y =
{s = \\d,t,nform=>x.s!nform++linCoord!t++y.s!nform; {s = \\nform=>table {4 => y.s!nform; _ => x.s!nform};
g = x.g} ; g = x.g} ;
ConsCN x xs = ConsCN x xs =
{s = \\d,t,nform=>x.s!nform++(linCoordSep comma)!d!t++xs.s!d!t!nform; {s = \\nform=>table {4 => xs.s!nform!4; t => x.s!nform++linCoord bindComma!t++xs.s!nform!t};
g = x.g} ; g = x.g} ;
lincat lincat
[S] = {s : Bool => Ints 4 => Str} ; [S] = {s : Ints 4 => Str} ;
[Adv] = {s : Bool => Ints 4 => Str} ; [Adv] = {s : Ints 4 => Str} ;
[AdV] = {s : Bool => Ints 4 => Str} ; [AdV] = {s : Ints 4 => Str} ;
[IAdv] = {s : Bool => Ints 4 => QForm => Str} ; [IAdv] = {s : QForm => Ints 4 => Str} ;
[NP] = {s : Bool => Ints 4 => Role => Str; gn : GenNum; p : PronPerson} ; [NP] = {s : Role => Ints 4 => Str; gn : GenNum; p : PronPerson} ;
[AP] = {s : Bool => Ints 4 => AForm => Person => Str; isPre : Bool} ; [AP] = {s : AForm => Person => Ints 4 => Str; isPre : Bool} ;
[RS] = {s : Bool => Ints 4 => Agr => Str} ; [RS] = {s : Agr => Ints 4 => Str} ;
[CN] = {s : Bool => Ints 4 => NForm => Str; g : AGender} ; [CN] = {s : NForm => Ints 4 => Str; g : AGender} ;
} }

View File

@@ -112,11 +112,11 @@ lin
lincat lincat
VPS = {s : Agr => Str} ; VPS = {s : Agr => Str} ;
[VPS] = {s : Bool => Ints 4 => Agr => Str} ; [VPS] = {s : Agr => Ints 4 => Str} ;
lin lin
BaseVPS x y = {s = \\d,t,a=>x.s!a++linCoord!t++y.s!a} ; BaseVPS x y = {s = \\a=>table {4 => y.s!a; _ => x.s!a}} ;
ConsVPS x xs = {s = \\d,t,a=>x.s!a++(linCoordSep bindComma)!d!t++xs.s!d!t!a} ; ConsVPS x xs = {s = \\a=>table {4 => xs.s!a!4; t => x.s!a++linCoord bindComma!t++xs.s!a!t}};
PredVPS np vps = {s = np.s ! RSubj ++ vps.s ! personAgr np.gn np.p} ; PredVPS np vps = {s = np.s ! RSubj ++ vps.s ! personAgr np.gn np.p} ;
@@ -128,7 +128,7 @@ lin
} ; } ;
ConjVPS conj vps = { ConjVPS conj vps = {
s = \\a => conj.s++(linCoordSep [])!conj.distr!conj.conj++vps.s!conj.distr!conj.conj!a; s = \\a => linCoord []!conj.sep ++ vps.s!a!conj.sep ++ conj.s ++ vps.s!a!4
} ; } ;
lin lin

View File

@@ -57,26 +57,26 @@ concrete ExtraBul of ExtraBulAbs = CatBul **
lincat lincat
VPI = {s : Agr => Str} ; VPI = {s : Agr => Str} ;
[VPI] = {s : Bool => Ints 4 => Agr => Str} ; [VPI] = {s : Agr => Ints 4 => Str} ;
lin lin
BaseVPI x y = {s = \\d,t,a=>x.s!a++linCoord!t++y.s!a} ; BaseVPI x y = {s = \\a=>table {4 => y.s!a; _ => x.s!a}} ;
ConsVPI x xs = {s = \\d,t,a=>x.s!a++(linCoordSep bindComma)!d!t++xs.s!d!t!a} ; ConsVPI x xs = {s = \\a=>table {4 => xs.s!a!4; t => x.s!a++linCoord bindComma!t++xs.s!a!t}};
MkVPI vp = {s = daComplex Simul Pos vp ! Perf} ; MkVPI vp = {s = daComplex Simul Pos vp ! Perf} ;
ConjVPI conj vpi = { ConjVPI conj vpi = {
s = \\a => conj.s++(linCoordSep [])!conj.distr!conj.conj++vpi.s!conj.distr!conj.conj!a; s = \\a => linCoord []!conj.sep ++ vpi.s!a!conj.sep ++ conj.s ++ vpi.s!a!4
} ; } ;
ComplVPIVV vv vpi = ComplVPIVV vv vpi =
insertObj (\\a => vpi.s ! a) Pos (predV vv) ; insertObj (\\a => vpi.s ! a) Pos (predV vv) ;
lincat lincat
VPS = {s : Agr => Str} ; VPS = {s : Agr => Str} ;
[VPS] = {s : Bool => Ints 4 => Agr => Str} ; [VPS] = {s : Agr => Ints 4 => Str} ;
lin lin
BaseVPS x y = {s = \\d,t,a=>x.s!a++linCoord!t++y.s!a} ; BaseVPS x y = {s = \\a=>table {4 => y.s!a; _ => x.s!a}} ;
ConsVPS x xs = {s = \\d,t,a=>x.s!a++(linCoordSep bindComma)!d!t++xs.s!d!t!a} ; ConsVPS x xs = {s = \\a=>table {4 => xs.s!a!4; t => x.s!a++linCoord bindComma!t++xs.s!a!t}};
PredVPS np vps = {s = np.s ! RSubj ++ vps.s ! personAgr np.gn np.p} ; PredVPS np vps = {s = np.s ! RSubj ++ vps.s ! personAgr np.gn np.p} ;
@@ -88,7 +88,7 @@ concrete ExtraBul of ExtraBulAbs = CatBul **
} ; } ;
ConjVPS conj vps = { ConjVPS conj vps = {
s = \\a => conj.s++(linCoordSep [])!conj.distr!conj.conj++vps.s!conj.distr!conj.conj!a; s = \\a => linCoord []!conj.sep ++ vps.s!a!conj.sep ++ conj.s ++ vps.s!a!4
} ; } ;
PassVPSlash vp = insertObj (\\a => vp.ad.s ++ vp.s ! Perf ! VPassive (aform a.gn Indef (RObj Acc)) ++ PassVPSlash vp = insertObj (\\a => vp.ad.s ++ vp.s ! Perf ! VPassive (aform a.gn Indef (RObj Acc)) ++

View File

@@ -268,6 +268,11 @@ oper
noPrep : Prep = mkPrep [] Acc ; noPrep : Prep = mkPrep [] Acc ;
--2 Conjunctions
mkConj : Str -> Number -> Conj =
\s,n -> {s = s; sep = 3; n = n; lock_Conj = <>} ;
--2 Proper Names --2 Proper Names
-- --
mkPN : Str -> Gender -> PN ; mkPN : Str -> Gender -> PN ;

View File

@@ -23,7 +23,7 @@ concrete PhraseBul of Phrase = CatBul ** open Prelude, ResBul in {
UttInterj i = i ; UttInterj i = i ;
NoPConj = {s = []} ; NoPConj = {s = []} ;
PConjConj conj = {s = conj.s ++ linCoord!conj.conj} ; PConjConj conj = {s = conj.s} ;
NoVoc = {s = []} ; NoVoc = {s = []} ;
VocNP np = {s = bindComma ++ np.s ! RVoc} ; VocNP np = {s = bindComma ++ np.s ! RVoc} ;

View File

@@ -827,11 +827,8 @@ resource ResBul = ParamX ** open Prelude, Predef in {
GPl => "òåçè" GPl => "òåçè"
} ; } ;
linCoord : Ints 4 => Str ; linCoord : Str -> Ints 4 => Str ;
linCoord = table {0 => "è"; 1=>"èëè"; 2=>"íèòî"; 3=>"íî"; 4=>"âìåñòî"} ; linCoord comma = table {0 => "è"; 1=>"èëè"; 2=>"íèòî"; 3=>comma; 4=>[]} ;
linCoordSep : Str -> Bool => Ints 4 => Str ;
linCoordSep s = table {True => linCoord; False=> \\_ => s} ;
hyphen : Str = SOFT_BIND ++ "-" ++ SOFT_BIND ; hyphen : Str = SOFT_BIND ++ "-" ++ SOFT_BIND ;

View File

@@ -14,18 +14,18 @@ concrete StructuralBul of Structural = CatBul **
at_least_AdN, at_most_AdN = ss "ïî÷òè" ; ---- AR at_least_AdN, at_most_AdN = ss "ïî÷òè" ; ---- AR
although_Subj = ss ["âúïðåêè ÷å"] ; although_Subj = ss ["âúïðåêè ÷å"] ;
always_AdV = mkAdV "âèíàãè" ; always_AdV = mkAdV "âèíàãè" ;
and_Conj = {s=[]; conj=0; distr=False; n = Pl} ; and_Conj = mkConj "è" Pl ;
because_Subj = ss "çàùîòî" ; because_Subj = ss "çàùîòî" ;
before_Prep = mkPrep "ïðåäè" ; before_Prep = mkPrep "ïðåäè" ;
behind_Prep = mkPrep "çàä" ; behind_Prep = mkPrep "çàä" ;
between_Prep = mkPrep "ìåæäó" ; between_Prep = mkPrep "ìåæäó" ;
both7and_DConj = {s=[]; conj=0; distr=True; n = Pl} ; both7and_DConj = mkConj "è" Pl ** {sep=0} ;
but_PConj = ss "íî" ; but_PConj = ss "íî" ;
by8agent_Prep = mkPrep "÷ðåç" ; by8agent_Prep = mkPrep "÷ðåç" ;
by8means_Prep = mkPrep "÷ðåç" ; by8means_Prep = mkPrep "÷ðåç" ;
can8know_VV, can_VV = mkVV (stateV (mkV166 "ìîãà")) ; can8know_VV, can_VV = mkVV (stateV (mkV166 "ìîãà")) ;
during_Prep = mkPrep ["ïî âðåìå íà"] ; during_Prep = mkPrep ["ïî âðåìå íà"] ;
either7or_DConj = {s=[]; conj=1; distr=True; n = Sg} ; either7or_DConj = mkConj "èëè" Sg ** {sep=1} ;
everybody_NP = mkNP "âñåêè" (GSg Masc) (NounP3 Pos); everybody_NP = mkNP "âñåêè" (GSg Masc) (NounP3 Pos);
every_Det = mkDeterminerSg "âñåêè" "âñÿêà" "âñÿêî"; every_Det = mkDeterminerSg "âñåêè" "âñÿêà" "âñÿêî";
everything_NP = mkNP "âñè÷êî" (GSg Neut) (NounP3 Pos); everything_NP = mkNP "âñè÷êî" (GSg Neut) (NounP3 Pos);
@@ -75,7 +75,7 @@ concrete StructuralBul of Structural = CatBul **
on_Prep = mkPrep "íà" ; on_Prep = mkPrep "íà" ;
---- one_Quant = mkDeterminer Sg "one" ; -- DEPRECATED ---- one_Quant = mkDeterminer Sg "one" ; -- DEPRECATED
only_Predet = {s = \\_ => "ñàìî"} ; only_Predet = {s = \\_ => "ñàìî"} ;
or_Conj = {s=[]; conj=1; distr=False; n = Sg} ; or_Conj = mkConj "èëè" Sg ;
otherwise_PConj = ss "èíà÷å" ; otherwise_PConj = ss "èíà÷å" ;
part_Prep = mkPrep "îò" ; part_Prep = mkPrep "îò" ;
please_Voc = ss "ìîëÿ" ; please_Voc = ss "ìîëÿ" ;