1
0
forked from GitHub/gf-rgl

(Fin) Add CompoundN

This commit is contained in:
Inari Listenmaa
2018-10-05 10:48:48 +02:00
committed by GitHub

View File

@@ -4,6 +4,7 @@ concrete ExtendFin of Extend =
CatFin ** ExtendFunctor - [ CatFin ** ExtendFunctor - [
VPI2,VPS2,MkVPS2,ConjVPS2,ComplVPS2,MkVPI2,ConjVPI2,ComplVPI2,ComplVPIVV VPI2,VPS2,MkVPS2,ConjVPS2,ComplVPS2,MkVPI2,ConjVPI2,ComplVPI2,ComplVPIVV
,ExistCN, ExistMassCN ,ExistCN, ExistMassCN
,CompoundN
] ]
with with
(Grammar = GrammarFin) ** (Grammar = GrammarFin) **
@@ -28,27 +29,27 @@ lin
oper oper
partCN : CN -> GrammarFin.NP ; partCN : CN -> GrammarFin.NP ;
partCN cn = partCN cn =
let let
acn = DetCN (DetQuant IndefArt NumSg) cn acn = DetCN (DetQuant IndefArt NumSg) cn
in acn ** { in acn ** {
s = table { s = table {
NPCase Nom | NPAcc => acn.s ! NPCase ResFin.Part ; NPCase Nom | NPAcc => acn.s ! NPCase ResFin.Part ;
c => acn.s ! c c => acn.s ! c
} }
} ; } ;
lincat lincat
VPS = {s : Agr => Str } ; VPS = {s : Agr => Str } ;
[VPS] = {s1,s2 : Agr => Str } ; [VPS] = {s1,s2 : Agr => Str } ;
VPI = {s : VVType => Agr => Str ; sc : SubjCase } ; -- Agr needed for possessive suffix: VPI = {s : VVType => Agr => Str ; sc : SubjCase } ; -- Agr needed for possessive suffix:
[VPI] = {s1,s2 : VVType => Agr => Str ; sc : SubjCase } ; -- e.g. toivon nukkuva+ni [VPI] = {s1,s2 : VVType => Agr => Str ; sc : SubjCase } ; -- e.g. toivon nukkuva+ni
lin lin
BaseVPS = twoTable Agr ; BaseVPS = twoTable Agr ;
ConsVPS = consrTable Agr comma ; ConsVPS = consrTable Agr comma ;
BaseVPI = twoTable2 VVType Agr ; BaseVPI = twoTable2 VVType Agr ;
ConsVPI = consrTable2 VVType Agr comma ; ConsVPI = consrTable2 VVType Agr comma ;
@@ -56,10 +57,10 @@ oper
ConjVPS c xs = conjunctDistrTable Agr c xs ; ConjVPS c xs = conjunctDistrTable Agr c xs ;
PredVPS np vps = {s = np.s ! npNom ++ vps.s ! np.a} ; PredVPS np vps = {s = np.s ! npNom ++ vps.s ! np.a} ;
MkVPI vp = mkVPI vp ; MkVPI vp = mkVPI vp ;
ConjVPI c xs = conjunctDistrTable2 VVType Agr c xs ; ConjVPI c xs = conjunctDistrTable2 VVType Agr c xs ;
ComplVPIVV vv vpi = ComplVPIVV vv vpi =
S.insertObj (\\_,_,a => vpi.s ! vv.vi ! a) S.insertObj (\\_,_,a => vpi.s ! vv.vi ! a)
(S.predV (vv ** {sc = case vpi.sc of { (S.predV (vv ** {sc = case vpi.sc of {
SCNom => vv.sc ; -- minun täytyy pestä auto SCNom => vv.sc ; -- minun täytyy pestä auto
@@ -71,8 +72,8 @@ oper
lincat lincat
-- Polarity needed to pick the right object case -- Polarity needed to pick the right object case
VPS2 = {s : Agr => Str ; c2 : Compl ; p : Polarity } ; VPS2 = {s : Agr => Str ; c2 : Compl ; p : Polarity } ;
[VPS2] = {s1,s2 : Agr => Str ; c2 : Compl ; p : Polarity } ; [VPS2] = {s1,s2 : Agr => Str ; c2 : Compl ; p : Polarity } ;
-- A version with -- A version with
VPI2 = {s : VVType => Agr => Str ; c2 : Compl ; sc : SubjCase } ; VPI2 = {s : VVType => Agr => Str ; c2 : Compl ; sc : SubjCase } ;
[VPI2] = {s1,s2 : VVType => Agr => Str ; c2 : Compl ; sc : SubjCase } ; [VPI2] = {s1,s2 : VVType => Agr => Str ; c2 : Compl ; sc : SubjCase } ;
@@ -86,7 +87,7 @@ oper
BaseVPS2 x y = twoTable Agr x y ** {c2 = y.c2 ; p = xs.p } ; ---- just remembering the compl. case of the latter verb BaseVPS2 x y = twoTable Agr x y ** {c2 = y.c2 ; p = xs.p } ; ---- just remembering the compl. case of the latter verb
ConsVPS2 x xs = consrTable Agr comma x xs ** {c2 = xs.c2 ; p = xs.p } ; ConsVPS2 x xs = consrTable Agr comma x xs ** {c2 = xs.c2 ; p = xs.p } ;
BaseVPI2 x y = twoTable2 VVType Agr x y ** {c2 = y.c2} ; ---- just remembering the compl. case of the latter verb BaseVPI2 x y = twoTable2 VVType Agr x y ** {c2 = y.c2} ; ---- just remembering the compl. case of the latter verb
ConsVPI2 x xs = consrTable2 VVType Agr comma x xs ** {c2 = xs.c2} ; ConsVPI2 x xs = consrTable2 VVType Agr comma x xs ** {c2 = xs.c2} ;
@@ -95,18 +96,24 @@ oper
ConjVPI2 c xs = conjunctDistrTable2 VVType Agr c xs ** {c2 = xs.c2 ; p = xs.p ; sc = xs.sc } ; ConjVPI2 c xs = conjunctDistrTable2 VVType Agr c xs ** {c2 = xs.c2 ; p = xs.p ; sc = xs.sc } ;
-- appCompl : Bool -> Polarity -> Compl -> ResFin.NP -> Str -- appCompl : Bool -> Polarity -> Compl -> ResFin.NP -> Str
ComplVPS2 v np = { s = \\agr => v.s ! agr ++ appCompl True v.p v.c2 np } ; ComplVPS2 v np = { s = \\agr => v.s ! agr ++ appCompl True v.p v.c2 np } ;
-- TODO: Version with variable polarity? -- TODO: Version with variable polarity?
ComplVPI2 v np = v ** { s = \\vt,a => v.s ! vt ! a ++ appCompl True Pos v.c2 np }; ComplVPI2 v np = v ** { s = \\vt,a => v.s ! vt ! a ++ appCompl True Pos v.c2 np };
oper oper
mkVPS : Temp -> Pol -> VP -> VPS = \tem,pol,vp -> lin VPS { mkVPS : Temp -> Pol -> VP -> VPS = \tem,pol,vp -> lin VPS {
s = \\agr => (UseCl tem pol (S.mkClause (\_ -> []) agr vp)).s } ; s = \\agr => (UseCl tem pol (S.mkClause (\_ -> []) agr vp)).s } ;
mkVPI : VP -> VPI = \vp -> lin VPI { mkVPI : VP -> VPI = \vp -> lin VPI {
s = \\vt,agr => S.infVP vp.s.sc Pos agr vp (vvtype2infform vt) ; s = \\vt,agr => S.infVP vp.s.sc Pos agr vp (vvtype2infform vt) ;
sc = vp.s.sc } ; sc = vp.s.sc } ;
} lin
CompoundN n1 n2 =
let ukkos_ = (S.snoun2nounBind n1).s ! NCompound in {
s = \\c => ukkos_ ++ BIND ++ n2.s ! c ;
h = n2.h
} ;
}