forked from GitHub/gf-rgl
(Pes) Support relative pronoun contraction
This commit is contained in:
@@ -7,7 +7,7 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in {
|
||||
|
||||
S = {s : VVForm => Str} ; -- as a complement to Subj
|
||||
QS = {s : Str} ;
|
||||
RS = {s : Agr => Str } ;
|
||||
RS = {s : Agr => Str ; rp : RelPron => Str} ;
|
||||
SSlash = {s : VVForm => Str ; c2 : ResPes.Compl} ;
|
||||
|
||||
---- Sentence
|
||||
@@ -32,10 +32,10 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in {
|
||||
---- Relative
|
||||
|
||||
RCl = {
|
||||
s : ResPes.TAnt => Polarity => Order => Agr => Str ;
|
||||
-- c : Case
|
||||
s : ResPes.TAnt => Polarity => Agr => Str ;
|
||||
rp : RelPron => Str
|
||||
} ;
|
||||
RP = {s: Str ; a:RAgr};
|
||||
RP = {s : RelPron => Str ; a : RAgr};
|
||||
|
||||
---- Verb
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ concrete ConjunctionPes of Conjunction =
|
||||
} ;
|
||||
|
||||
ConjAP conj ss = ss ** conjunctDistrTable Mod conj ss ; -- Adv isn't changed
|
||||
ConjRS conj rs = conjunctDistrTable Agr conj rs ** { c = rs.c};
|
||||
ConjRS conj rs = rs ** conjunctDistrTable Agr conj rs ;
|
||||
|
||||
---- These fun's are generated from the list cat's.
|
||||
|
||||
@@ -29,17 +29,17 @@ concrete ConjunctionPes of Conjunction =
|
||||
ConsAdv = consrSS comma ;
|
||||
|
||||
BaseNP x y = y ** twoTable Mod x y ** {a = conjAgr x.a y.a ; animacy = y.animacy } ; -- check animacy
|
||||
BaseRS x y = twoTable Agr x y ** {c = x.c};
|
||||
BaseRS x y = x ** twoTable Agr x y ;
|
||||
ConsNP xs x = xs ** consrTable Mod comma xs x ** {a = conjAgr xs.a x.a ; animacy = xs.animacy } ; -- InaandB xs.animacy x.animacy} ;
|
||||
ConsRS xs x = consrTable Agr comma xs x ** { c = xs.c};
|
||||
ConsRS xs x = xs ** consrTable Agr comma xs x ;
|
||||
BaseAP x y = y ** twoTable Mod x y ;
|
||||
ConsAP xs x = xs ** consrTable Mod comma xs x ; -- Table3 Number Gender Case comma xs x ;-- ** {isPre = andB xs.isPre x.isPre} ;
|
||||
|
||||
lincat
|
||||
[S] = {s1,s2 : VVForm => Str} ;
|
||||
[Adv] = {s1,s2 : Str} ;
|
||||
[NP] = {s1,s2 : Mod => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool} ;
|
||||
[AP] = {s1,s2 : Mod => Str ; adv : Str ; isPre : Bool} ;
|
||||
[RS] = {s1,s2 : Agr => Str };
|
||||
[NP] = {s1,s2 : Mod => Str} ** BaseNP ;
|
||||
[AP] = {s1,s2 : Mod => Str ; adv : Str ; isPre : Bool} ;
|
||||
[RS] = {s1,s2 : Agr => Str ; rp : RelPron => Str} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ lin
|
||||
CleftNP np rs =
|
||||
let cl = mkSClause (np2str np) (np.a) (predV beVerb);
|
||||
in
|
||||
{s = \\t,p,o => cl.s ! t ! p ! o ++ rs.s ! np.a };
|
||||
{s = \\t,p,o => cl.s ! t ! p ! o ++ rs2str Ke np.a rs};
|
||||
|
||||
CleftAdv ad ss = { s = \\t,b,o => ad.s ++ ss.s ! Indic};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
DetCN det cn = cn ** {
|
||||
DetCN det cn = emptyNP ** cn ** {
|
||||
s = \\m =>
|
||||
let num : Number = case det.isNum of {
|
||||
True => Sg ; -- noun modified by a number is invariably singular
|
||||
@@ -32,7 +32,9 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
|
||||
} ;
|
||||
|
||||
RelNP np rs = np ** {
|
||||
s = \\m => np.s ! Clitic ++ rs.s ! np.a
|
||||
s = \\m => case np.relpron of {
|
||||
Ance => np.empty ++ rs2str np.relpron np.a rs ;
|
||||
Ke => np.s ! Clitic ++ rs2str np.relpron np.a rs }
|
||||
} ;
|
||||
|
||||
AdvNP np adv = np ** {
|
||||
@@ -55,11 +57,12 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
|
||||
n = num.n
|
||||
} ;
|
||||
|
||||
DetNP det = {
|
||||
DetNP det = emptyNP ** {
|
||||
s = \\_ => det.sp ;
|
||||
a = agrP3 det.n ;
|
||||
hasAdj = False ;
|
||||
animacy = Inanimate ;
|
||||
relpron = Ance -- TODO check if this works for all Dets
|
||||
} ;
|
||||
|
||||
PossPron p = {
|
||||
@@ -87,7 +90,7 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
|
||||
DefArt = {s = \\_,_ => [] ; mod = Bare} ;
|
||||
IndefArt = {s = table {Sg => \\_ => IndefArticle ; Pl => \\_ => []} ; mod = Bare} ;
|
||||
|
||||
MassNP cn = cn ** {
|
||||
MassNP cn = emptyNP ** cn ** {
|
||||
s = \\m => cn.s ! Sg ! m ++ cn.compl ! Sg ;
|
||||
a = agrP3 Sg ;
|
||||
} ;
|
||||
@@ -126,7 +129,7 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
|
||||
|
||||
RelCN cn rs = cn ** {
|
||||
s = \\n,ez => cn.s ! n ! Clitic ;
|
||||
compl = \\n => cn.compl ! n ++ rs.s ! agrP3 n ;
|
||||
compl = \\n => cn.compl ! n ++ rs2str Ke (agrP3 n) rs ;
|
||||
} ;
|
||||
|
||||
AdvCN cn ad = cn ** {
|
||||
|
||||
@@ -6,43 +6,32 @@ concrete RelativePes of Relative = CatPes ** open ResPes in {
|
||||
lin
|
||||
|
||||
RelCl cl = {
|
||||
s = \\t,p,o,agr => "که" ++ cl.s ! t ! p ! o ;
|
||||
};
|
||||
-- RelVP and RelSlash slows the linking process a lot this is why it is commented for test purposes
|
||||
s = \\t,p,agr => cl.s ! t ! p ! ODir ;
|
||||
rp = IdRP.s
|
||||
} ;
|
||||
|
||||
RelVP rp vp = {
|
||||
s = \\t,p,o,ag =>
|
||||
let
|
||||
agr = case rp.a of {
|
||||
RNoAg => ag ;
|
||||
RAg a => a
|
||||
} ;
|
||||
cl = mkSClause (rp.s) agr vp;
|
||||
|
||||
-- cl = case t of {
|
||||
-- VPImpPast => mkSClause (rp.s ! (giveNumber agr) ! Obl) agr vp;
|
||||
-- _ => mkSClause (rp.s ! (giveNumber agr) ! Dir) agr vp
|
||||
-- };
|
||||
in
|
||||
cl.s ! t ! p ! ODir ;
|
||||
-- c = Dir
|
||||
s = \\t,p,ag =>
|
||||
let agr = case rp.a of {
|
||||
RNoAg => ag ;
|
||||
RAg a => a} ;
|
||||
cl = mkSClause [] agr vp;
|
||||
in cl.s ! t ! p ! ODir ;
|
||||
rp = rp.s
|
||||
} ;
|
||||
--
|
||||
|
||||
RelSlash rp slash = {
|
||||
s = \\t,p,o,agr => rp.s ++ slash.c2.s ++ slash.subj ++ slash.vp ! t ! p ! o ;--case t of { ---- AR 18/8/2017 is this the right place of subj?
|
||||
-- VPImpPast => rp.s ! (giveNumber agr) Obl ++ slash.c2.s ++ slash.s ! t ! p ! o ;
|
||||
-- _ => rp.s ! (giveNumber agr) Dir ++ slash.c2.s ++ slash.s ! t ! p ! o
|
||||
-- };
|
||||
-- c = Dir
|
||||
s = \\t,p,agr => slash.c2.s ++ slash.subj ++ slash.vp ! t ! p ! ODir ;--case t of { ---- AR 18/8/2017 is this the right place of subj?
|
||||
rp = rp.s
|
||||
} ;
|
||||
|
||||
FunRP p np rp = {
|
||||
s = np.s ! Clitic ++ rp.s ++ p.s ++ getPron np.animacy (fromAgr np.a).n ; -- need to make a special form of relative np by addY
|
||||
s = \\ke => np.s ! Clitic ++ rp.s ! ke ++ p.s ++ getPron np.animacy (fromAgr np.a).n ;
|
||||
a = RAg np.a
|
||||
} ;
|
||||
|
||||
IdRP = {
|
||||
s = "که" ;
|
||||
s = table {Ke => "که" ; Ance => "آنچه"} ;
|
||||
a = RNoAg
|
||||
} ;
|
||||
|
||||
|
||||
@@ -12,10 +12,9 @@ resource ResPes = MorphoPes ** open Prelude,Predef in {
|
||||
|
||||
param
|
||||
Order = ODir | OQuest ;
|
||||
PMood = Del | Imper | PCond ;
|
||||
|
||||
CardOrd = NCard | NOrd ;
|
||||
RAgr = RNoAg | RAg Agr ;
|
||||
RelPron = Ance | Ke ; -- https://en.wiktionary.org/wiki/%D8%A2%D9%86%DA%86%D9%87
|
||||
|
||||
oper
|
||||
CN : Type = Noun ** {
|
||||
@@ -24,11 +23,16 @@ resource ResPes = MorphoPes ** open Prelude,Predef in {
|
||||
-- dep. on Number because of RelCN
|
||||
} ;
|
||||
|
||||
NP : Type = {
|
||||
NP : Type = BaseNP ** {
|
||||
s : Mod => Str ; -- NP can appear with a clitic, need to keep Mod open
|
||||
} ;
|
||||
|
||||
BaseNP : Type = {
|
||||
a : Agr ;
|
||||
hasAdj : Bool ; -- to get the right form when NP is a predicate
|
||||
animacy : Animacy -- to get the right relative pronoun
|
||||
animacy : Animacy ; -- to get the right pronoun in FunRP
|
||||
relpron : RelPron ; -- contraction for "that which"
|
||||
empty : Str -- to prevent metavariables in case of rel.pron. contraction
|
||||
} ;
|
||||
|
||||
oper
|
||||
@@ -37,7 +41,10 @@ resource ResPes = MorphoPes ** open Prelude,Predef in {
|
||||
a = defaultAgr ;
|
||||
hasAdj = False ;
|
||||
animacy = Inanimate ;
|
||||
relpron = Ke ;
|
||||
empty = []
|
||||
} ;
|
||||
|
||||
indeclNP : Str -> NP = \s ->
|
||||
emptyNP ** {s = \\m => s} ;
|
||||
|
||||
@@ -52,6 +59,9 @@ resource ResPes = MorphoPes ** open Prelude,Predef in {
|
||||
cn2str : CN -> Str = \cn ->
|
||||
cn.s ! Sg ! Bare ++ cn.compl ! Sg ;
|
||||
|
||||
rs2str : RelPron -> Agr -> {s : Agr => Str ; rp : RelPron => Str} -> Str =
|
||||
\ke,agr,rs -> rs.rp ! ke ++ rs.s ! agr ;
|
||||
|
||||
-----------------------
|
||||
--- Verb Phrase
|
||||
-----------------------
|
||||
|
||||
@@ -52,7 +52,7 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in {
|
||||
} ;
|
||||
|
||||
UseRCl temp p rcl = let vt = TA temp.t temp.a in rcl ** {
|
||||
s = \\q => temp.s ++ p.s ++ rcl.s ! vt ! p.p ! ODir ! q
|
||||
s = \\a => temp.s ++ p.s ++ rcl.s ! vt ! p.p ! a
|
||||
} ;
|
||||
|
||||
UseSlash temp p cls = cls ** {
|
||||
@@ -63,7 +63,7 @@ concrete SentencePes of Sentence = CatPes ** open Prelude, ResPes,Predef in {
|
||||
|
||||
AdvS a s = {s = \\vvf => a.s ++ s.s ! vvf} ;
|
||||
|
||||
RelS s r = {s = \\vvf => s.s ! vvf ++ r.s ! agrP3 Sg} ;
|
||||
RelS s r = {s = \\vvf => s.s ! vvf ++ rs2str Ke (agrP3 Sg) r} ;
|
||||
SSubjS s1 sj s2 = {s = \\vvf => s1.s ! vvf ++ sj.s ++ s2.s ! sj.compl};
|
||||
|
||||
}
|
||||
|
||||
@@ -10,15 +10,15 @@ concrete SymbolPes of Symbol = CatPes ** open Prelude, ResPes in {
|
||||
IntPN i = {s = i.s ; animacy = Inanimate} ;
|
||||
FloatPN i = {s = i.s ; animacy = Inanimate} ;
|
||||
NumPN i = {s = i.s ; animacy = Inanimate} ;
|
||||
CNIntNP cn i = cn ** {
|
||||
CNIntNP cn i = emptyNP ** cn ** {
|
||||
s = \\ez => cn.s ! Sg ! Ezafe ++ i.s ++ cn.compl ! Sg ;
|
||||
a = agrP3 Sg
|
||||
} ;
|
||||
CNSymbNP det cn xs = cn ** {
|
||||
CNSymbNP det cn xs = emptyNP ** cn ** {
|
||||
s = \\ez => det.s ++ cn.s ! det.n ! Ezafe ++ xs.s ++ cn.compl ! det.n ;
|
||||
a = agrP3 det.n
|
||||
} ;
|
||||
CNNumNP cn i = cn ** {
|
||||
CNNumNP cn i = emptyNP ** cn ** {
|
||||
s = \\ez => cn.s ! Sg ! Ezafe ++ i.s ++ cn.compl ! Sg ;
|
||||
a = agrP3 Sg ;
|
||||
} ;
|
||||
|
||||
Reference in New Issue
Block a user