forked from GitHub/gf-rgl
implement DetDAP and AdjDAP
This commit is contained in:
@@ -54,7 +54,7 @@ concrete CatBul of Cat = CommonX - [IAdv,CAdv,AdV,SC] ** open ResBul, Prelude, P
|
|||||||
CN = {s : NForm => Str; g : AGender} ;
|
CN = {s : NForm => Str; g : AGender} ;
|
||||||
NP = {s : Role => Str; a : Agr; p : Polarity} ;
|
NP = {s : Role => Str; a : Agr; p : Polarity} ;
|
||||||
Pron = {s : Role => Str; clit : Case => Str; gen : AForm => Str; a : Agr} ;
|
Pron = {s : Role => Str; clit : Case => Str; gen : AForm => Str; a : Agr} ;
|
||||||
Det = {s : Bool => AGender => Role => Str; nn : NNumber; spec : Species; p : Polarity} ;
|
Det,DAP = {s : Bool => AGender => Role => Str; nn : NNumber; spec : Species; p : Polarity} ;
|
||||||
Predet = {s : GenNum => Str} ;
|
Predet = {s : GenNum => Str} ;
|
||||||
Ord = {s : AForm => Str} ;
|
Ord = {s : AForm => Str} ;
|
||||||
Num = {s : CardForm => Str; nn : NNumber; nonEmpty : Bool} ;
|
Num = {s : CardForm => Str; nn : NNumber; nonEmpty : Bool} ;
|
||||||
|
|||||||
@@ -1,222 +1,243 @@
|
|||||||
--# -coding=cp1251
|
--# -coding=cp1251
|
||||||
concrete NounBul of Noun = CatBul ** open ResBul, Prelude in {
|
concrete NounBul of Noun = CatBul ** open ResBul, Prelude in {
|
||||||
flags optimize=all_subs ; coding=cp1251 ;
|
flags optimize=all_subs ; coding=cp1251 ;
|
||||||
|
|
||||||
lin
|
lin
|
||||||
DetCN det cn =
|
DetCN det cn =
|
||||||
{ s = \\role => let nf = case <det.nn,det.spec> of {
|
{ s = \\role => let nf = case <det.nn,det.spec> of {
|
||||||
<NNum Sg,Def> => case role of {
|
<NNum Sg,Def> => case role of {
|
||||||
RSubj => NFSgDefNom ;
|
RSubj => NFSgDefNom ;
|
||||||
RVoc => NFVocative ;
|
RVoc => NFVocative ;
|
||||||
_ => NF Sg Def
|
_ => NF Sg Def
|
||||||
} ;
|
} ;
|
||||||
<NNum Sg,Indef> => case role of {
|
<NNum Sg,Indef> => case role of {
|
||||||
RVoc => NFVocative ;
|
RVoc => NFVocative ;
|
||||||
_ => NF Sg Indef
|
_ => NF Sg Indef
|
||||||
} ;
|
} ;
|
||||||
<NNum Pl,Def> => NF Pl Def ;
|
<NNum Pl,Def> => NF Pl Def ;
|
||||||
<NNum Pl,Indef> => NF Pl Indef;
|
<NNum Pl,Indef> => NF Pl Indef;
|
||||||
<NCountable,Def> => NF Pl det.spec ;
|
<NCountable,Def> => NF Pl det.spec ;
|
||||||
<NCountable,Indef> => case cn.g of {
|
<NCountable,Indef> => case cn.g of {
|
||||||
AMasc Human => NF Pl Indef;
|
AMasc Human => NF Pl Indef;
|
||||||
_ => NFPlCount
|
_ => NFPlCount
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
s = det.s ! True ! cn.g ! role ++ cn.s ! nf
|
s = det.s ! True ! cn.g ! role ++ cn.s ! nf
|
||||||
in case role of {
|
in case role of {
|
||||||
RObj Dat => "íà" ++ s;
|
RObj Dat => "íà" ++ s;
|
||||||
RObj WithPrep => case det.p of {
|
RObj WithPrep => case det.p of {
|
||||||
Pos => with_Word ++ s ;
|
Pos => with_Word ++ s ;
|
||||||
Neg => "áåç" ++ s
|
Neg => "áåç" ++ s
|
||||||
} ;
|
} ;
|
||||||
_ => s
|
_ => s
|
||||||
} ;
|
} ;
|
||||||
a = {gn = gennum cn.g (numnnum det.nn); p = P3} ;
|
a = {gn = gennum cn.g (numnnum det.nn); p = P3} ;
|
||||||
p = det.p
|
p = det.p
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
DetNP det =
|
DetNP det =
|
||||||
{ s = \\role => let s = det.s ! False ! ANeut ! role
|
{ s = \\role => let s = det.s ! False ! ANeut ! role
|
||||||
in case role of {
|
in case role of {
|
||||||
RObj Dat => "íà" ++ s;
|
RObj Dat => "íà" ++ s;
|
||||||
_ => s
|
_ => s
|
||||||
} ;
|
} ;
|
||||||
a = {gn = gennum ANeut (numnnum det.nn); p = P3} ;
|
a = {gn = gennum ANeut (numnnum det.nn); p = P3} ;
|
||||||
p = Pos
|
p = Pos
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
UsePN pn = { s = table {
|
UsePN pn = { s = table {
|
||||||
RObj Dat => "íà" ++ pn.s;
|
RObj Dat => "íà" ++ pn.s;
|
||||||
RObj WithPron => with_Word ++ pn.s;
|
RObj WithPron => with_Word ++ pn.s;
|
||||||
_ => pn.s
|
_ => pn.s
|
||||||
} ;
|
} ;
|
||||||
a = {gn = GSg pn.g; p = P3} ;
|
a = {gn = GSg pn.g; p = P3} ;
|
||||||
p = Pos
|
p = Pos
|
||||||
} ;
|
} ;
|
||||||
UsePron p = {s = p.s; a=p.a; p=Pos} ;
|
UsePron p = {s = p.s; a=p.a; p=Pos} ;
|
||||||
|
|
||||||
PredetNP pred np = {
|
PredetNP pred np = {
|
||||||
s = \\c => case c of {
|
s = \\c => case c of {
|
||||||
RObj Dat => "íà";
|
RObj Dat => "íà";
|
||||||
RObj WithPrep => with_Word;
|
RObj WithPrep => with_Word;
|
||||||
_ => ""
|
_ => ""
|
||||||
} ++
|
} ++
|
||||||
pred.s ! np.a.gn ++ np.s ! RObj Acc ;
|
pred.s ! np.a.gn ++ np.s ! RObj Acc ;
|
||||||
a = np.a ;
|
a = np.a ;
|
||||||
p = np.p
|
p = np.p
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
PPartNP np v2 = {
|
PPartNP np v2 = {
|
||||||
s = \\c => np.s ! c ++ v2.s ! Perf ! VPassive (aform np.a.gn Indef c) ;
|
s = \\c => np.s ! c ++ v2.s ! Perf ! VPassive (aform np.a.gn Indef c) ;
|
||||||
a = np.a ;
|
a = np.a ;
|
||||||
p = np.p
|
p = np.p
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
AdvNP np adv = {
|
AdvNP np adv = {
|
||||||
s = \\c => np.s ! c ++ adv.s ;
|
s = \\c => np.s ! c ++ adv.s ;
|
||||||
a = np.a ;
|
a = np.a ;
|
||||||
p = np.p
|
p = np.p
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
ExtAdvNP np adv = {
|
ExtAdvNP np adv = {
|
||||||
s = \\c => np.s ! c ++ comma ++ adv.s ;
|
s = \\c => np.s ! c ++ comma ++ adv.s ;
|
||||||
a = np.a ;
|
a = np.a ;
|
||||||
p = np.p
|
p = np.p
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
DetQuant quant num = {
|
DetQuant quant num = {
|
||||||
s = \\sp,g,c => let sp' = case num.nonEmpty of { True => True ;
|
s = \\sp,g,c => let sp' = case num.nonEmpty of { True => True ;
|
||||||
False => sp }
|
False => sp }
|
||||||
in quant.s ! sp' ! aform (gennum g (numnnum num.nn)) (case c of {RVoc=>Indef; _=>Def}) c ++
|
in quant.s ! sp' ! aform (gennum g (numnnum num.nn)) (case c of {RVoc=>Indef; _=>Def}) c ++
|
||||||
num.s ! dgenderSpecies g quant.spec c ;
|
num.s ! dgenderSpecies g quant.spec c ;
|
||||||
nn = num.nn ;
|
nn = num.nn ;
|
||||||
spec = case num.nonEmpty of {True=>Indef; _=>quant.spec} ;
|
spec = case num.nonEmpty of {True=>Indef; _=>quant.spec} ;
|
||||||
p = quant.p
|
p = quant.p
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
DetQuantOrd = \quant, num, ord -> {
|
DetQuantOrd = \quant, num, ord -> {
|
||||||
s = \\_,g,c => quant.s ! True ! aform (gennum g (numnnum num.nn)) (case c of {RVoc=>Indef; _=>Def}) c ++
|
s = \\_,g,c => quant.s ! True ! aform (gennum g (numnnum num.nn)) (case c of {RVoc=>Indef; _=>Def}) c ++
|
||||||
num.s ! dgenderSpecies g quant.spec c ++
|
num.s ! dgenderSpecies g quant.spec c ++
|
||||||
ord.s ! aform (gennum g (numnnum num.nn)) (case num.nonEmpty of {True=>Indef; _=>quant.spec}) c ;
|
ord.s ! aform (gennum g (numnnum num.nn)) (case num.nonEmpty of {True=>Indef; _=>quant.spec}) c ;
|
||||||
nn = num.nn ;
|
nn = num.nn ;
|
||||||
spec=Indef ;
|
spec=Indef ;
|
||||||
p = quant.p
|
p = quant.p
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
PossPron p = {
|
PossPron p = {
|
||||||
s = \\_ => p.gen ;
|
s = \\_ => p.gen ;
|
||||||
nonEmpty = True ;
|
nonEmpty = True ;
|
||||||
spec = ResBul.Indef ;
|
spec = ResBul.Indef ;
|
||||||
p = Pos
|
p = Pos
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
NumSg = {s = \\_ => []; nn = NNum Sg; nonEmpty = False} ;
|
NumSg = {s = \\_ => []; nn = NNum Sg; nonEmpty = False} ;
|
||||||
NumPl = {s = \\_ => []; nn = NNum Pl; nonEmpty = False} ;
|
NumPl = {s = \\_ => []; nn = NNum Pl; nonEmpty = False} ;
|
||||||
|
|
||||||
NumCard n = {s=n.s; nn=case n.n of {Sg => NNum Sg; Pl => NCountable}; nonEmpty = True} ;
|
NumCard n = {s=n.s; nn=case n.n of {Sg => NNum Sg; Pl => NCountable}; nonEmpty = True} ;
|
||||||
|
|
||||||
NumDigits n = {s = \\gspec => n.s ! NCard gspec; n = n.n} ;
|
NumDigits n = {s = \\gspec => n.s ! NCard gspec; n = n.n} ;
|
||||||
OrdDigits n = {s = \\aform => n.s ! NOrd aform} ;
|
OrdDigits n = {s = \\aform => n.s ! NOrd aform} ;
|
||||||
|
|
||||||
NumNumeral numeral = {s = \\gspec => numeral.s ! NCard gspec; n = numeral.n; nonEmpty = True} ;
|
NumNumeral numeral = {s = \\gspec => numeral.s ! NCard gspec; n = numeral.n; nonEmpty = True} ;
|
||||||
OrdNumeral numeral = {s = \\aform => numeral.s ! NOrd aform} ;
|
OrdNumeral numeral = {s = \\aform => numeral.s ! NOrd aform} ;
|
||||||
|
|
||||||
AdNum adn num = {s = \\gspec => adn.s ++ num.s ! gspec; n = num.n; nonEmpty = num.nonEmpty} ;
|
AdNum adn num = {s = \\gspec => adn.s ++ num.s ! gspec; n = num.n; nonEmpty = num.nonEmpty} ;
|
||||||
|
|
||||||
OrdSuperl a = {s = \\aform => "íàé" ++ hyphen ++ a.s ! aform} ;
|
OrdSuperl a = {s = \\aform => "íàé" ++ hyphen ++ a.s ! aform} ;
|
||||||
|
|
||||||
DefArt = {
|
DefArt = {
|
||||||
s = table {
|
s = table {
|
||||||
True => \\_ => [] ;
|
True => \\_ => [] ;
|
||||||
False => table {
|
False => table {
|
||||||
ASg Masc _ => "òîé" ;
|
ASg Masc _ => "òîé" ;
|
||||||
ASgMascDefNom => "òîé" ;
|
ASgMascDefNom => "òîé" ;
|
||||||
ASg Fem _ => "òÿ" ;
|
ASg Fem _ => "òÿ" ;
|
||||||
ASg Neut _ => "òî" ;
|
ASg Neut _ => "òî" ;
|
||||||
APl _ => "òå"
|
APl _ => "òå"
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
nonEmpty = False ;
|
nonEmpty = False ;
|
||||||
spec = ResBul.Def ;
|
spec = ResBul.Def ;
|
||||||
p = Pos
|
p = Pos
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
IndefArt = {
|
IndefArt = {
|
||||||
s = table {
|
s = table {
|
||||||
True => \\_ => [] ;
|
True => \\_ => [] ;
|
||||||
False => table {
|
False => table {
|
||||||
ASg Masc _ => "åäèí" ;
|
ASg Masc _ => "åäèí" ;
|
||||||
ASgMascDefNom => "åäèí" ;
|
ASgMascDefNom => "åäèí" ;
|
||||||
ASg Fem _ => "åäíà" ;
|
ASg Fem _ => "åäíà" ;
|
||||||
ASg Neut _ => "åäíî" ;
|
ASg Neut _ => "åäíî" ;
|
||||||
APl _ => "åäíè"
|
APl _ => "åäíè"
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
nonEmpty = False ;
|
nonEmpty = False ;
|
||||||
spec = ResBul.Indef ;
|
spec = ResBul.Indef ;
|
||||||
p = Pos
|
p = Pos
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
MassNP cn = {
|
MassNP cn = {
|
||||||
s = table {
|
s = table {
|
||||||
RVoc => cn.s ! NFVocative ;
|
RVoc => cn.s ! NFVocative ;
|
||||||
RObj Dat => "íà" ++ cn.s ! (NF Sg Indef) ;
|
RObj Dat => "íà" ++ cn.s ! (NF Sg Indef) ;
|
||||||
RObj WithPrep => with_Word ++ cn.s ! (NF Sg Indef);
|
RObj WithPrep => with_Word ++ cn.s ! (NF Sg Indef);
|
||||||
_ => cn.s ! (NF Sg Indef)
|
_ => cn.s ! (NF Sg Indef)
|
||||||
} ;
|
} ;
|
||||||
a = {gn = gennum cn.g Sg; p = P3} ;
|
a = {gn = gennum cn.g Sg; p = P3} ;
|
||||||
p = Pos
|
p = Pos
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
UseN noun = noun ;
|
UseN noun = noun ;
|
||||||
UseN2 noun = noun ;
|
UseN2 noun = noun ;
|
||||||
|
|
||||||
ComplN2 f x = {s = \\nf => f.s ! nf ++ f.c2.s ++ x.s ! RObj f.c2.c; g=f.g} ;
|
ComplN2 f x = {s = \\nf => f.s ! nf ++ f.c2.s ++ x.s ! RObj f.c2.c; g=f.g} ;
|
||||||
ComplN3 f x = {s = \\nf => f.s ! nf ++ f.c2.s ++ x.s ! RObj f.c2.c; rel = \\af => f.rel ! af ++ f.c2.s ++ x.s ! RObj f.c2.c; relPost = True; c2 = f.c3; g=f.g} ;
|
ComplN3 f x = {s = \\nf => f.s ! nf ++ f.c2.s ++ x.s ! RObj f.c2.c; rel = \\af => f.rel ! af ++ f.c2.s ++ x.s ! RObj f.c2.c; relPost = True; c2 = f.c3; g=f.g} ;
|
||||||
|
|
||||||
Use2N3 f = {s = f.s ; rel = f.rel ; relPost = f.relPost ; g=f.g ; c2 = f.c2} ;
|
Use2N3 f = {s = f.s ; rel = f.rel ; relPost = f.relPost ; g=f.g ; c2 = f.c2} ;
|
||||||
Use3N3 f = {s = f.s ; rel = f.rel ; relPost = f.relPost ; g=f.g ; c2 = f.c3} ;
|
Use3N3 f = {s = f.s ; rel = f.rel ; relPost = f.relPost ; g=f.g ; c2 = f.c3} ;
|
||||||
|
|
||||||
|
|
||||||
AdjCN ap cn = {
|
AdjCN ap cn = {
|
||||||
s = \\nf => case ap.isPre of {
|
s = \\nf => case ap.isPre of {
|
||||||
True => (ap.s ! nform2aform nf cn.g ! P3) ++ (cn.s ! (indefNForm nf)) ;
|
True => (ap.s ! nform2aform nf cn.g ! P3) ++ (cn.s ! (indefNForm nf)) ;
|
||||||
False => (cn.s ! nf) ++ (ap.s ! nform2aform (indefNForm nf) cn.g ! P3)
|
False => (cn.s ! nf) ++ (ap.s ! nform2aform (indefNForm nf) cn.g ! P3)
|
||||||
} ;
|
} ;
|
||||||
g = cn.g
|
g = cn.g
|
||||||
} ;
|
} ;
|
||||||
RelCN cn rs = {
|
RelCN cn rs = {
|
||||||
s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (gennum cn.g (numNForm nf)) ;
|
s = \\nf => cn.s ! nf ++ rs.s ! agrP3 (gennum cn.g (numNForm nf)) ;
|
||||||
g = cn.g
|
g = cn.g
|
||||||
} ;
|
} ;
|
||||||
AdvCN cn ad = {
|
AdvCN cn ad = {
|
||||||
s = \\nf => cn.s ! nf ++ ad.s ;
|
s = \\nf => cn.s ! nf ++ ad.s ;
|
||||||
g = cn.g
|
g = cn.g
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
SentCN cn sc = {s = \\nf => cn.s ! nf ++ sc.s ! agrP3 (gennum cn.g (numNForm nf)); g=cn.g} ;
|
SentCN cn sc = {s = \\nf => cn.s ! nf ++ sc.s ! agrP3 (gennum cn.g (numNForm nf)); g=cn.g} ;
|
||||||
|
|
||||||
ApposCN cn np = {s = \\nf => cn.s ! nf ++ np.s ! RSubj; g=cn.g} ;
|
ApposCN cn np = {s = \\nf => cn.s ! nf ++ np.s ! RSubj; g=cn.g} ;
|
||||||
|
|
||||||
PossNP cn np = {s = \\nf => cn.s ! nf ++ "íà" ++ np.s ! (RObj Acc); g = cn.g} ;
|
PossNP cn np = {s = \\nf => cn.s ! nf ++ "íà" ++ np.s ! (RObj Acc); g = cn.g} ;
|
||||||
|
|
||||||
PartNP cn np = {s = \\nf => cn.s ! nf ++ "îò" ++ np.s ! (RObj Acc); g = cn.g} ;
|
PartNP cn np = {s = \\nf => cn.s ! nf ++ "îò" ++ np.s ! (RObj Acc); g = cn.g} ;
|
||||||
|
|
||||||
CountNP det np = {
|
CountNP det np = {
|
||||||
s = \\role => let g = case np.a.gn of { -- this is lossy
|
s = \\role => let g = case np.a.gn of { -- this is lossy
|
||||||
GSg Masc => AMasc NonHuman ;
|
GSg Masc => AMasc NonHuman ;
|
||||||
GSg Neut => ANeut ;
|
GSg Neut => ANeut ;
|
||||||
GSg Fem => AFem ;
|
GSg Fem => AFem ;
|
||||||
GPl => ANeut
|
GPl => ANeut
|
||||||
}
|
}
|
||||||
in det.s ! False ! g ! role ++ np.s ! (RObj Acc) ;
|
in det.s ! False ! g ! role ++ np.s ! (RObj Acc) ;
|
||||||
a = {gn = gennum ANeut (numnnum det.nn); p = P3} ;
|
a = {gn = gennum ANeut (numnnum det.nn); p = P3} ;
|
||||||
p = Pos
|
p = Pos
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
RelNP np rs = {
|
RelNP np rs = {
|
||||||
s = \\r => np.s ! r ++ rs.s ! np.a ;
|
s = \\r => np.s ! r ++ rs.s ! np.a ;
|
||||||
a = np.a ;
|
a = np.a ;
|
||||||
p = np.p
|
p = np.p
|
||||||
} ;
|
} ;
|
||||||
}
|
|
||||||
|
AdjDAP dap ap = {s = \\sp,g,role => let g' = case g of {
|
||||||
|
AMasc _ => Masc ;
|
||||||
|
AFem => Fem ;
|
||||||
|
ANeut => Neut
|
||||||
|
} ;
|
||||||
|
aform = case <numnnum dap.nn,dap.spec,role> of {
|
||||||
|
<Sg,Def,RSubj> => ASgMascDefNom ;
|
||||||
|
<Sg,_ ,_ > => ASg g' dap.spec ;
|
||||||
|
<Pl,_ ,_ > => APl dap.spec
|
||||||
|
} ;
|
||||||
|
in dap.s ! True ! g ! role ++ ap.s ! aform ! P3 ;
|
||||||
|
nn = dap.nn;
|
||||||
|
spec = dap.spec;
|
||||||
|
p = dap.p
|
||||||
|
} ;
|
||||||
|
DetDAP det = {s = \\sp,g,role => det.s ! sp ! g ! role;
|
||||||
|
nn = det.nn;
|
||||||
|
spec = det.spec;
|
||||||
|
p = det.p
|
||||||
|
} ;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user