grammar extensions for Codex

This commit is contained in:
Krasimir Angelov
2026-05-28 08:08:41 +02:00
parent fe56b729b4
commit b8bb7f1d72
3 changed files with 75 additions and 4 deletions

View File

@@ -83,6 +83,7 @@ concrete CatGer of Cat =
Num = {s,sp : AForm => Str ; n : Number ; isNum : Bool} ; -- Num,Card.s AForm HL 12/23
Card = {s : AForm => Str ; n : Number} ; -- inflection mainly for: einer,eine,eines
ACard = {s : Str ; n : Number} ;
Ord = {s : AForm => Str} ;
-- Numeral

View File

@@ -46,6 +46,10 @@ lin
is_wrong_VP = mkVP have_V2 (mkNP (P.mkN "Unrecht")) ;
n_units_AP card cn a = mkAP (lin AdA (mkUtt (mkNP <lin Card card : Card> (lin CN cn)))) (lin A a) ;
n_units_of_NP card cn np =
G.AdvNP
(mkNP <lin Card card : Card> (lin CN cn))
(SyntaxGer.mkAdv P.von_Prep (lin NP np)) ;
n_unit_CN card unit cn = mkCN (invarA (mkUtt (mkNP <lin Card card : Card> (lin CN unit))).s) cn ;
bottle_of_CN np = N.ApposCN (mkCN (P.mkN "Flasche")) np ;

View File

@@ -6,15 +6,17 @@ concrete ExtendGer of Extend =
GenNP, GenRP, EmptyRelSlash, GenIP, GenModIP,
VPS, ListVPS, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS,
VPI, ListVPI, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,
ListComp, BaseComp, ConsComp, ConjComp,
ListImp, BaseImp, ConsImp, ConjImp,
ICompAP, IAdvAdv, CompIQuant, PrepCN,
PastPartAP, PastPartAgentAP,
PresPartAP, PastPartAP, PastPartAgentAP,
PassVPSlash, PassAgentVPSlash,
AdvIsNP,
ProgrVPSlash, AdvIsNP, AdvRVP,
RNP, RNPList, Base_rr_RNP, Base_nr_RNP, Base_rn_RNP, Cons_rr_RNP, Cons_nr_RNP, ConjRNP,
ReflRNP, ReflPron, ReflPoss, PredetRNP, AdvRNP, ReflA2RNP, PossPronRNP,
CompoundN, DetNPMasc, DetNPFem, UseDAP, UseDAPMasc, UseDAPFem,
CardCNCard,
InOrderToVP
CardCNCard, CompoundAP, GerundCN, GerundNP, GerundAdv, ByVP, ApposNP,
InOrderToVP, PositAdVAdj
]
with
(Grammar = GrammarGer) **
@@ -188,8 +190,30 @@ concrete ExtendGer of Extend =
-- Conjunction of copula complements
lincat
[Comp] = {s1,s2 : Agr => Str} ;
lin
BaseComp x y =
twoTable Agr
{s = \\a => x.s ! a ++ x.ext ! numberAgr a}
{s = \\a => y.s ! a ++ y.ext ! numberAgr a} ;
ConsComp x xs =
consrTable Agr comma
{s = \\a => x.s ! a ++ x.ext ! numberAgr a}
xs ;
ConjComp conj xs = (conjunctDistrTable Agr conj xs) ** {ext = \\_ => []} ;
-- Conjunction of imperatives
lincat
ListImp = {s1,s2 : Polarity => ImpForm => Str} ;
lin
BaseImp = twoTable2 Polarity ImpForm ;
ConsImp = consrTable2 Polarity ImpForm comma ;
ConjImp conj xs = conjunctDistrTable2 Polarity ImpForm conj xs ;
ICompAP ap = {
s = \\_ => "wie" ++ ap.s ! APred ;
ext = ap.c.p1 ++ ap.c.p2 ++ ap.ext
@@ -209,6 +233,16 @@ concrete ExtendGer of Extend =
-- participle constructions
PresPartAP vp =
let a = agrP3 Sg in {
s = \\af => (vp.nn ! a).p1 ++ (vp.nn ! a).p2 ++ (vp.nn ! a).p3 ++ vp.a2 ++ vp.adj
++ vp.inf.inpl.p2 ++ (vp.inf.extr ! a) ++ vp.s.s ! VPresPart af ;
s2 = \\_ => [] ;
isPre = True ;
c = <[],[]> ;
ext = vp.ext
} ;
PastPartAP vp =
let a = agrP3 Sg in {
s = \\af => (vp.nn ! a).p1 ++ (vp.nn ! a).p2 ++ (vp.nn ! a).p3 ++ vp.a2 ++ vp.adj
@@ -246,8 +280,23 @@ concrete ExtendGer of Extend =
-- publishing of the document
GerundCN vp = {
s = \\_,_,_ => useInfVP False vp ;
rc = \\_ => [] ;
ext, adv = [] ;
g = Neutr
} ;
GerundNP vp = MassNP (GerundCN vp) ;
GerundAdv vp = {s = useInfVP False vp} ;
ByVP vp = {s = "durch" ++ useInfVP False vp} ;
-- counterpart to ProgrVP, for VPSlash
ProgrVPSlash vp = vp ;
-- construct VPSlash from A2 and N2
-- existential for mathematics
@@ -337,6 +386,9 @@ concrete ExtendGer of Extend =
adv = appPrep prep (rnp.s ! agrP3 Sg) ; -- bug: fixed agreement
in ap ** { s = \\af => ap.s ! af ++ adv } ; -- e.g. unknown in one's youth
AdvRVP vp prep rnp =
insertAdv (appPrep prep (rnp.s ! agrP3 Sg) ++ rnp.ext ++ rnp.rc) vp ;
ReflA2RNP adj rnp = -- would need AP.c : Agr => Str*Str, not AP.c : Str*Str
let -- as we have no reflexive AP,
compl = appPrep adj.c2 (rnp.s ! agrP3 Sg) ; -- we use a fixed agreement
@@ -435,9 +487,23 @@ concrete ExtendGer of Extend =
n = Pl
} ;
CompoundAP n a = {
s = \\af => n.co ++ Predef.BIND ++ a.s ! Posit ! af ;
s2 = \\_ => [] ;
isPre = True ;
c = <[],[]> ;
ext = []
} ;
ApposNP np app = np ** {
s = \\b,c => np.s ! b ! c ++ embedInCommas (app.s ! False ! c ++ bigNP app) ;
w = WHeavy
} ;
InOrderToVP vp = {s = "um" ++ useInfVP False vp} ;
PositAdVAdj a = {s = a.s ! Posit ! APred} ;
oper
insertObjReflNP : RNP -> ResGer.VPSlash -> ResGer.VP = -- HL 5/2022
\rnp,vp -> insertObjRNP rnp vp.c2 vp ;