German resource grammar: major changes.

This commit is contained in:
scharolta_siencnik
2015-07-23 15:50:05 +00:00
parent 7b26356d35
commit ba14a8a7e5
18 changed files with 447 additions and 256 deletions

View File

@@ -6,54 +6,72 @@ concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in {
PositA a = { PositA a = {
s = a.s ! Posit ; s = a.s ! Posit ;
isPre = True isPre = True ;
c = <[],[]> ;
ext = []
} ; } ;
ComparA a np = { ComparA a np = {
s = \\af => a.s ! Compar ! af ++ conjThan ++ np.s ! NPC Nom ; s = \\af => a.s ! Compar ! af ++ conjThan ++ np.s ! NPC Nom ++ bigNP np ;
isPre = True isPre = True ;
c = <[],[]> ;
ext = []
} ; } ;
CAdvAP ad ap np = { CAdvAP ad ap np = ap ** {
s = \\af => ad.s ++ ap.s ! af ++ ad.p ++ np.s ! NPC Nom ; s = \\af => ad.s ++ ap.s ! af ++ ad.p ++ np.s ! NPC Nom ++ bigNP np ;
isPre = False isPre = False
} ; } ;
UseComparA a = { UseComparA a = {
s = \\af => a.s ! Compar ! af ; s = \\af => a.s ! Compar ! af ;
isPre = True isPre = True ;
c = <[],[]> ;
ext = []
} ; } ;
AdjOrd a = {
AdjOrd a = {
s = a.s ; s = a.s ;
isPre = True isPre = True ;
c = <[],[]> ;
ext = []
} ; } ;
-- $SuperlA$ belongs to determiner syntax in $Noun$. -- $SuperlA$ belongs to determiner syntax in $Noun$.
ComplA2 a np = { ComplA2 a np =
s = table { let CExt = case a.c2.isPrep of {
APred => a.s ! Posit ! APred ++ appPrep a.c2 np.s ; False => <appPrepNP a.c2 np, []> ;
af => appPrep a.c2 np.s ++ a.s ! Posit ! af True => <[], appPrepNP a.c2 np> }
} ; in {
isPre = True s = a.s ! Posit ;
isPre = True ;
c = CExt ;
ext = []
} ; } ;
ReflA2 a = { ReflA2 a =
s = \\af => a.s ! Posit ! APred ++ let
appPrep a.c2 (\\k => usePrepC k (\c -> reflPron ! agrP3 Sg ! c)) ; --- agr compl = appPrep a.c2 (\\k => usePrepC k (\c -> reflPron ! agrP3 Sg ! c)) ;
isPre = True CExt = case a.c2.isPrep of
{False => <compl, []> ;
True => <[], compl> }
in {
s = a.s ! Posit ;
isPre = True ;
c = CExt ;
ext = []
} ; } ;
SentAP ap sc = { SentAP ap sc = ap ** {
s = \\a => ap.s ! a ++ sc.s ; isPre = False ;
isPre = False ext = ap.ext ++ sc.s
} ; } ;
AdAP ada ap = { AdAP ada ap = ap ** {s = \\a => ada.s ++ ap.s ! a} ;
s = \\a => ada.s ++ ap.s ! a ;
isPre = ap.isPre
} ;
UseA2 a = { UseA2 a = {
s = a.s ! Posit ; s = a.s ! Posit ;
isPre = True isPre = True ;
c = <[],[]> ;
ext = []
} ; } ;
} }

View File

@@ -10,7 +10,7 @@ concrete AdverbGer of Adverb = CatGer ** open ResGer, Prelude in {
s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ s.s ! Sub s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ s.s ! Sub
} ; } ;
PrepNP prep np = {s = appPrep prep np.s} ; PrepNP prep np = {s = appPrepNP prep np} ;
AdAdv = cc2 ; AdAdv = cc2 ;

View File

@@ -26,7 +26,7 @@ concrete CatGer of Cat =
QCl = {s : Mood => ResGer.Tense => Anteriority => Polarity => QForm => Str} ; QCl = {s : Mood => ResGer.Tense => Anteriority => Polarity => QForm => Str} ;
IP = {s : Case => Str ; n : Number} ; IP = {s : Case => Str ; n : Number} ;
IComp = {s : Agr => Str} ; IComp = {s : Agr => Str ; ext : Str} ;
IDet = {s : Gender => Case => Str ; n : Number} ; IDet = {s : Gender => Case => Str ; n : Number} ;
IQuant = {s : Number => Gender => Case => Str} ; IQuant = {s : Number => Gender => Case => Str} ;
@@ -39,16 +39,23 @@ concrete CatGer of Cat =
VP = ResGer.VP ; VP = ResGer.VP ;
VPSlash = ResGer.VPSlash ; VPSlash = ResGer.VPSlash ;
Comp = {s : Agr => Str} ; Comp = {s : Agr => Str ; ext : Str} ;
-- Adjective -- Adjective
AP = {s : AForm => Str ; isPre : Bool} ; AP = {s : AForm => Str ; isPre : Bool ; c: Str * Str ; ext : Str} ;
-- ich bin [c1 ihm] treu
-- du bist so klug gewesen [ext ihn zu lesen]
-- ich bin stolz [c2 auf dich]
-- Noun -- Noun
CN = {s : Adjf => Number => Case => Str ; g : Gender} ; CN = {s : Adjf => Number => Case => Str ;
NP = {s : PCase => Str ; a : Agr ; isPron : Bool} ; rc : Number => Str ; -- Frage , [rc die ich gestellt habe]
ext : Str ; -- Frage , [sc wo sie schläft])
adv : Str ; -- Frage [a von Max]
g : Gender} ;
NP = ResGer.NP ;
Pron = {s : NPForm => Str ; a : Agr} ; Pron = {s : NPForm => Str ; a : Agr} ;
Det = {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} ; Det = {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} ;
Quant = { Quant = {
@@ -91,7 +98,7 @@ concrete CatGer of Cat =
N = ResGer.Noun ; N = ResGer.Noun ;
N2 = ResGer.Noun ** {c2 : Preposition} ; N2 = ResGer.Noun ** {c2 : Preposition} ;
N3 = ResGer.Noun ** {c2,c3 : Preposition} ; N3 = ResGer.Noun ** {c2,c3 : Preposition} ;
PN = {s : Case => Str} ; PN = {s : Case => Str; g : Gender} ;
-- tense with possibility to choose conjunctive forms -- tense with possibility to choose conjunctive forms
@@ -108,6 +115,7 @@ concrete CatGer of Cat =
V, VS, VQ, VA = \v -> useInfVP False (predV v) ; V, VS, VQ, VA = \v -> useInfVP False (predV v) ;
V2, V2A, V2Q, V2S = \v -> useInfVP False (predV v) ++ v.c2.s ; V2, V2A, V2Q, V2S = \v -> useInfVP False (predV v) ++ v.c2.s ;
V3 = \v -> useInfVP False (predV v) ++ v.c2.s ++ v.c3.s ; V3 = \v -> useInfVP False (predV v) ++ v.c2.s ++ v.c3.s ;
VV = \v -> useInfVP v.isAux (predVGen v.isAux v) ; VV = \v -> useInfVP v.isAux (predVGen v.isAux v) ;
V2V = \v -> useInfVP v.isAux (predVGen v.isAux v) ++ v.c2.s ; V2V = \v -> useInfVP v.isAux (predVGen v.isAux v) ++ v.c2.s ;

View File

@@ -10,12 +10,11 @@ concrete ConjunctionGer of Conjunction =
ConjAdv conj ss = conjunctDistrSS conj ss ; ConjAdv conj ss = conjunctDistrSS conj ss ;
ConjNP conj ss = heavyNP (conjunctDistrTable PCase conj ss ** { ConjNP conj ss = heavyNP (conjunctDistrTable PCase conj ss ** {
a = Ag Fem (conjNumber conj.n (numberAgr ss.a)) (personAgr ss.a) a = Ag Fem (conjNumber conj.n (numberAgr ss.a)) (personAgr ss.a) ;
}) ; }) ;
ConjAP conj ss = conjunctDistrTable AForm conj ss ** { ConjAP conj ss = conjunctDistrTable AForm conj ss ** {
isPre = ss.isPre isPre = ss.isPre ; c = ss.c ; ext = ss.ext} ;
} ;
ConjRS conj ss = conjunctDistrTable RelGenNum conj ss ** { ConjRS conj ss = conjunctDistrTable RelGenNum conj ss ** {
c = ss.c c = ss.c
@@ -35,10 +34,26 @@ concrete ConjunctionGer of Conjunction =
BaseAdv = twoSS ; BaseAdv = twoSS ;
ConsAdv = consrSS comma ; ConsAdv = consrSS comma ;
BaseNP x y = twoTable PCase x y ** {a = conjAgr x.a y.a} ; BaseNP x y = {
ConsNP xs x = consrTable PCase comma xs x ** {a = conjAgr xs.a x.a} ; s1 = \\c => x.s ! c ++ bigNP x ;
BaseAP x y = twoTable AForm x y ** {isPre = andB x.isPre y.isPre} ; s2 = \\c => y.s ! c ++ bigNP y ;
ConsAP xs x = consrTable AForm comma xs x ** {isPre = andB xs.isPre x.isPre} ; a = conjAgr x.a y.a } ;
ConsNP xs x = {
s1 = \\c => xs.s ! c ++ bigNP xs ++ comma ++ x.s1 ! c ;
s2 = x.s2 ;
a = conjAgr xs.a x.a } ;
BaseAP x y = {
s1 = bigAP x ;
s2 = bigAP y ;
isPre = andB x.isPre y.isPre ;
c = <[],[]> ;
ext = []} ;
ConsAP xs x = {
s1 = \\a => (bigAP xs) ! a ++ comma ++ x.s1 ! a ;
s2 = x.s2 ;
isPre = andB x.isPre xs.isPre ;
c = <[],[]> ;
ext = []} ;
BaseRS x y = twoTable RelGenNum x y ** {c = y.c} ; BaseRS x y = twoTable RelGenNum x y ** {c = y.c} ;
ConsRS xs x = consrTable RelGenNum comma xs x ** {c = xs.c} ; ConsRS xs x = consrTable RelGenNum comma xs x ** {c = xs.c} ;
@@ -46,7 +61,10 @@ concrete ConjunctionGer of Conjunction =
[S] = {s1,s2 : Order => Str} ; [S] = {s1,s2 : Order => Str} ;
[Adv] = {s1,s2 : Str} ; [Adv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : PCase => Str ; a : Agr} ; [NP] = {s1,s2 : PCase => Str ; a : Agr} ;
[AP] = {s1,s2 : AForm => Str ; isPre : Bool} ; [AP] = {s1,s2 : AForm => Str ; isPre : Bool; c : Str * Str ; ext : Str} ;
[RS] = {s1,s2 : RelGenNum => Str ; c : Case} ; [RS] = {s1,s2 : RelGenNum => Str ; c : Case} ;
oper
bigAP : AP -> AForm => Str = \ap ->
\\a => ap.c.p1 ++ ap.s ! a ++ ap.c.p2 ++ ap.ext;
} }

View File

@@ -32,22 +32,25 @@ concrete ExtraGer of ExtraGerAbs = CatGer **
moegen_VV = auxVV mögen_V ; moegen_VV = auxVV mögen_V ;
ICompAP ap = {s = \\_ => "wie" ++ ap.s ! APred} ; ICompAP ap = {s = \\_ => "wie" ++ ap.s ! APred ;
ext = ap.c.p1 ++ ap.c.p2 ++ ap.ext} ;
CompIQuant iq = {s = table {Ag g n p => iq.s ! n ! g ! Nom}} ; CompIQuant iq = {s = table {Ag g n p => iq.s ! n ! g ! Nom} ; ext = ""} ;
IAdvAdv adv = {s = "wie" ++ adv.s} ; IAdvAdv adv = {s = "wie" ++ adv.s} ;
DetNPMasc det = { DetNPMasc det = {
s = \\c => det.sp ! Masc ! c ; ---- genders s = \\c => det.sp ! Masc ! c ; ---- genders
a = agrP3 det.n ; a = agrP3 det.n ;
isPron = False isPron = False ;
ext, adv, rc = []
} ; } ;
DetNPFem det = { DetNPFem det = {
s = \\c => det.sp ! Fem ! c ; ---- genders s = \\c => det.sp ! Fem ! c ; ---- genders
a = agrP3 det.n ; a = agrP3 det.n ;
isPron = False isPron = False ;
ext, adv, rc = []
} ; } ;
EmptyRelSlash slash = { EmptyRelSlash slash = {
@@ -57,25 +60,36 @@ concrete ExtraGer of ExtraGerAbs = CatGer **
c = (prepC slash.c2.c).c c = (prepC slash.c2.c).c
} ; } ;
PassVPSlash vp = insertObj (\\_ => (PastPartAP (lin VPSlash vp)).s ! APred) (predV werdenPass) ; PassVPSlash vp =
let c = case <vp.c2.c,vp.c2.isPrep> of {
<NPC Acc,False> => NPC Nom ;
_ => vp.c2.c}
in insertObj (\\_ => (PastPartAP vp).s ! APred) (predV werdenPass) **
{subjc = vp.c2 ** {c= c}} ;
-- regulates passivised object: accusative objects -> nom; all others: same case
-- this also gives "mit dir wird gerechnet" ;
-- the alternative linearisation ("es wird mit dir gerechnet") is not implemented
PassAgentVPSlash vp np = ---- "von" here, "durch" in StructuralGer PassAgentVPSlash vp np = ---- "von" here, "durch" in StructuralGer
insertObj (\\_ => (PastPartAgentAP (lin VPSlash vp) (lin NP np)).s ! APred) (predV werdenPass) ; insertObj (\\_ => (PastPartAgentAP (lin VPSlash vp) (lin NP np)).s ! APred) (predV werdenPass) ;
PastPartAP vp = { PastPartAP vp = {
s = \\af => (vp.nn ! agrP3 Sg).p1 ++ (vp.nn ! agrP3 Sg).p2 ++ vp.a2 ++ vp.inf ++ s = \\af => (vp.nn ! agrP3 Sg).p1 ++ (vp.nn ! agrP3 Sg).p2 ++ vp.a2 ++ vp.inf ++
vp.c2.s ++ --- junk if not TV
vp.ext ++ vp.infExt ++ vp.s.s ! VPastPart af ; vp.ext ++ vp.infExt ++ vp.s.s ! VPastPart af ;
isPre = True isPre = True ;
c = <[],[]> ;
ext = []
} ; } ;
PastPartAgentAP vp np = PastPartAgentAP vp np =
let agent = appPrep P.von_Prep np.s let agent = appPrepNP P.von_Prep np
in { in {
s = \\af => (vp.nn ! agrP3 Sg).p1 ++ (vp.nn ! agrP3 Sg).p2 ++ vp.a2 ++ agent ++ vp.inf ++ s = \\af => (vp.nn ! agrP3 Sg).p1 ++ (vp.nn ! agrP3 Sg).p2 ++ vp.a2 ++ agent ++ vp.inf ++
vp.c2.s ++ --- junk if not TV vp.c2.s ++ --- junk if not TV
vp.ext ++ vp.infExt ++ vp.s.s ! VPastPart af ; vp.ext ++ vp.infExt ++ vp.s.s ! VPastPart af ;
isPre = True isPre = True ;
c = <[],[]> ;
ext = []
} ; } ;
lincat lincat
@@ -114,7 +128,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer **
m = tm.m ; m = tm.m ;
subj = [] ; subj = [] ;
verb = vps.s ! ord ! agr ! VPFinite m t a ; verb = vps.s ! ord ! agr ! VPFinite m t a ;
neg = vp.a1 ! b ; neg = tm.s ++ p.s ++ vp.a1 ! b ;
obj0 = (vp.nn ! agr).p1 ; obj0 = (vp.nn ! agr).p1 ;
obj = (vp.nn ! agr).p2 ; obj = (vp.nn ! agr).p2 ;
compl = obj0 ++ neg ++ obj ++ vp.a2 ; -- from EG 15/5 compl = obj0 ++ neg ++ obj ++ vp.a2 ; -- from EG 15/5
@@ -136,4 +150,108 @@ concrete ExtraGer of ExtraGerAbs = CatGer **
ConjVPS = conjunctDistrTable2 Order Agr ; ConjVPS = conjunctDistrTable2 Order Agr ;
-- implementation of some of the relevant Foc rules from Extra
lincat
Foc = {s : Mood => ResGer.Tense => Anteriority => Polarity => Str} ;
lin
FocObj np cl =
let n = appPrepNP cl.c2 np
in mkFoc n cl ;
FocAdv adv cl = mkFoc adv.s cl ;
FocAP ap np =
let adj = ap.s ! APred ;
vp = predV sein_V ** {ext = ap.c.p1 ++ ap.c.p2 ++ ap.ext};
-- potentially not correct analysis for all examples
-- works for:
-- "treu ist sie ihm"
-- "froh ist sie dass er da ist"
-- "stolz ist sie auf ihn"
subj = mkSubj np vp.subjc ;
cl = mkClause subj.p1 subj.p2 vp
in mkFoc adj cl ;
UseFoc t p f = {s = t.s ++ p.s ++ f.s ! t.m ! t.t ! t.a ! p.p} ;
-- extra rules to get some of the "es" alternative linearisations
lin
EsVV vv vp = predV vv ** {
nn = \\a => let n = vp.nn ! a in <"es" ++ n.p1 , n.p2 > ;
inf = vp.s.s ! (VInf True) ++ vp.inf ; -- ich genieße es zu versuchen zu gehen; alternative word order could be produced by vp.inf ++ vp.s.s... (zu gehen zu versuchen)
a1 = vp.a1 ;
a2 = vp.a2 ;
ext = vp.ext ;
infExt = vp.infExt ;
adj = vp.adj } ;
EsV2A v2a ap s = predV v2a ** {
nn = \\_ => <"es",[]> ;
adj = ap.s ! APred ;
ext = "," ++ "dass" ++ s.s ! Sub} ;
-- "es wird gelacht"; generating formal sentences
lincat
FClause = VP ** {subj : NP} ;
lin
VPass v =
let vp = predV werdenPass ;
in vp ** {
subj = esSubj ;
inf = v.s ! VPastPart APred } ; -- construct the formal clause
AdvFor adv fcl = fcl ** {a2 = adv.s} ;
FtoCl cl =
let subj = mkSubj cl.subj cl.subjc
in DisToCl subj.p1 subj.p2 cl ;
oper -- extra operations for ExtraGer
mkFoc : Str -> Cl -> Foc = \focus, cl ->
lin Foc {s = \\m,t,a,p => focus ++ cl.s ! m ! t ! a ! p ! Inv} ;
esSubj : NP = lin NP {
s = \\_ => "es" ;
rc, ext, adv = [] ;
a = Ag Neutr Sg P3 ;
isPron = True} ;
DisToCl : Str -> Agr -> FClause -> Clause = \subj,agr,vp ->
let vps = useVP vp in {
s = \\m,t,a,b,o =>
let
ord = case o of {
Sub => True ; -- glue prefix to verb
_ => False
} ;
verb = vps.s ! ord ! agr ! VPFinite m t a ;
neg = vp.a1 ! b ;
obj0 = (vp.nn ! agr).p1 ;
obj = (vp.nn ! agr).p2 ;
compl = obj0 ++ neg ++ vp.adj ++ obj ++ vp.a2 ; -- adj added
inf = vp.inf ++ verb.inf ; -- not used for linearisation of Main/Inv
extra = vp.ext ;
inffin : Str =
case <a,vp.isAux> of {
<Anter,True> => verb.fin ++ inf ; -- double inf --# notpresent
_ => inf ++ verb.fin --- or just auxiliary vp
}
in
case o of {
Main => subj ++ verb.fin ++ compl ++ vp.infExt ++ verb.inf ++ extra ++ vp.inf ;
Inv => verb.fin ++ compl ++ vp.infExt ++ verb.inf ++ extra ++ vp.inf ;
Sub => compl ++ vp.infExt ++ inffin ++ extra }
} ;
-- this function is not entirely satisfactory as largely
-- though not entirely duplicating mkClause in ResGer
} }

View File

@@ -2,8 +2,13 @@ abstract ExtraGerAbs = Extra [
VPI,ListVPI,BaseVPI,ConsVPI,MkVPI,ComplVPIVV,ConjVPI,ClSlash,RCl, VPI,ListVPI,BaseVPI,ConsVPI,MkVPI,ComplVPIVV,ConjVPI,ClSlash,RCl,
VPS,ListVPS,BaseVPS,ConsVPS,ConjVPS,MkVPS,PredVPS,EmptyRelSlash, VPS,ListVPS,BaseVPS,ConsVPS,ConjVPS,MkVPS,PredVPS,EmptyRelSlash,
VPSlash, PassVPSlash, PassAgentVPSlash, CompIQuant, PastPartAP, PastPartAgentAP, VPSlash, PassVPSlash, PassAgentVPSlash, CompIQuant, PastPartAP, PastPartAgentAP,
Temp,Tense,Pol,S,NP,VV,VP,Conj,IAdv,IQuant,IComp,ICompAP,IAdvAdv,Adv,AP] ** { Temp,Tense,Pol,S,NP,VV,VP,Conj,IAdv,IQuant,IComp,ICompAP,IAdvAdv,Adv,AP,
Foc,FocObj,FocAdv,FocAP,UseFoc] ** {
flags coding=utf8; flags coding=utf8;
cat
FClause ; -- formal clause
fun fun
PPzuAdv : CN -> Adv ; -- zum Lied, zur Flasche PPzuAdv : CN -> Adv ; -- zum Lied, zur Flasche
TImpfSubj : Tense ; -- ich möchte... --# notpresent TImpfSubj : Tense ; -- ich möchte... --# notpresent
@@ -11,4 +16,11 @@ abstract ExtraGerAbs = Extra [
moegen_VV : VV ; -- ich mag/möchte singen moegen_VV : VV ; -- ich mag/möchte singen
DetNPMasc, DetNPFem : Det -> NP ; DetNPMasc, DetNPFem : Det -> NP ;
EsVV : VV -> VP -> VP ; -- ich genieße es zu schlafen
EsV2A : V2A -> AP -> S -> VP ; -- ich finde es schön, dass ...
VPass : V -> FClause ; -- (es) wird getanzt
AdvFor : Adv -> FClause -> FClause ; -- es wird heute gelacht - addition of adverbs
FtoCl : FClause -> Cl ; -- embedding FClause within the RGL, to allow generation of S, Utt, etc.
} }

View File

@@ -68,7 +68,8 @@ concrete IdiomGer of Idiom = CatGer **
SelfNP np = { SelfNP np = {
s = \\c => np.s ! c ++ "selbst" ; s = \\c => np.s ! c ++ "selbst" ;
a = np.a ; a = np.a ;
isPron = False isPron = False ;
adv, rc, ext = []
} ; } ;
oper oper

View File

@@ -43,7 +43,7 @@ in {
lin erlöschen_V = irregV "erlöschen" "erlischt" "erlosch" "erlösche" "erloschen" ; lin erlöschen_V = irregV "erlöschen" "erlischt" "erlosch" "erlösche" "erloschen" ;
lin erkennen_V = irregV "erkennen" "erkennt" "erkannte" "erkannte" "erkannt" ; lin erkennen_V = irregV "erkennen" "erkennt" "erkannte" "erkannte" "erkannt" ;
lin erschrecken_V = irregV "erschrecken" "erschrickt" "erschrak" "erschräke" "erschrocken" ; lin erschrecken_V = irregV "erschrecken" "erschrickt" "erschrak" "erschräke" "erschrocken" ;
lin essen_V = irregV "essen" "ißt" "aß" "äße" "gegessen" ; lin essen_V = irregV "essen" "isst" "aß" "äße" "gegessen" ;
lin fahren_V = irregV "fahren" "fährt" "fuhr" "führe" "gefahren" ; lin fahren_V = irregV "fahren" "fährt" "fuhr" "führe" "gefahren" ;
lin fallen_V = irregV "fallen" "fällt" "fiel" "fiele" "gefallen" ; lin fallen_V = irregV "fallen" "fällt" "fiel" "fiele" "gefallen" ;
lin fangen_V = irregV "fangen" "fängt" "fing" "finge" "gefangen" ; lin fangen_V = irregV "fangen" "fängt" "fing" "finge" "gefangen" ;

View File

@@ -57,14 +57,14 @@ lin
clean_A = regA "rein" ; clean_A = regA "rein" ;
clever_A = mk3A "klug" "klüger" "klügste" ; clever_A = mk3A "klug" "klüger" "klügste" ;
close_V2 = dirV2 Irreg.schließen_V ; close_V2 = dirV2 Irreg.schließen_V ;
coat_N = mkN "Jacke" ; coat_N = mkN "Jacke" | mkN "Mantel" "Mantel" masculine;
cold_A = regA "kalt" ; cold_A = regA "kalt" ;
come_V = seinV (mk6V "kommen" "kommt" "komm" "kam" "käme" "gekommen") ; come_V = seinV (mk6V "kommen" "kommt" "komm" "kam" "käme" "gekommen") ;
computer_N = reg2N "Rechner" "Rechner" masculine ; computer_N = reg2N "Rechner" "Rechner" masculine ;
country_N = reg2N "Land" "Länder" neuter ; country_N = reg2N "Land" "Länder" neuter ;
cousin_N = reg2N "Vetter" "Vetter" masculine ; --- Kusine cousin_N = reg2N "Vetter" "Vetter" masculine ; --- Kusine
cow_N = reg2N "Kuh" "Kühe" feminine ; cow_N = reg2N "Kuh" "Kühe" feminine ;
die_V = seinV Irreg.sterben_V ; die_V = seinV Irreg.sterben_V | seinV (prefixV "um" Irreg.kommen_V);
distance_N3 = mkN3 (mkN "Entfernung") von_Prep zu_Prep ; distance_N3 = mkN3 (mkN "Entfernung") von_Prep zu_Prep ;
dirty_A = regA "schmutzig" ; dirty_A = regA "schmutzig" ;
do_V2 = dirV2 Irreg.tun_V ; do_V2 = dirV2 Irreg.tun_V ;
@@ -141,7 +141,7 @@ lin
open_V2 = dirV2 (regV "öffnen") ; open_V2 = dirV2 (regV "öffnen") ;
paint_V2A = mkV2A (regV "malen") accPrep ; paint_V2A = mkV2A (regV "malen") accPrep ;
paper_N = reg2N "Papier" "Papiere" neuter ; paper_N = reg2N "Papier" "Papiere" neuter ;
paris_PN = mkPN "Paris" ; -- neuter ; paris_PN = mkPN "Paris" neuter ;
peace_N = mk6N "Friede" "Frieden" "Frieden" "Friedens" "Frieden" "Frieden" masculine ; peace_N = mk6N "Friede" "Frieden" "Frieden" "Friedens" "Frieden" "Frieden" masculine ;
pen_N = mkN "Bleistift" ; ---- pen_N = mkN "Bleistift" ; ----
planet_N = reg2N "Planet" "Planeten" masculine ; planet_N = reg2N "Planet" "Planeten" masculine ;
@@ -328,7 +328,7 @@ lin
stand_V = Irreg.stehen_V ; stand_V = Irreg.stehen_V ;
swell_V = prefixV "an" (regV "schwellen") ; swell_V = prefixV "an" (regV "schwellen") ;
swim_V = seinV (Irreg.schwimmen_V) ; swim_V = seinV (Irreg.schwimmen_V) ;
think_V = Irreg.denken_V ; think_V = Irreg.denken_V | prefixV "nach" Irreg.denken_V;
turn_V = regV "drehen" ; turn_V = regV "drehen" ;
vomit_V = regV "kotzen" ; vomit_V = regV "kotzen" ;
bite_V2 = dirV2 Irreg.beißen_V ; bite_V2 = dirV2 Irreg.beißen_V ;
@@ -357,7 +357,7 @@ lin
language_N = mkN "Sprache" ; language_N = mkN "Sprache" ;
rule_N = reg2N "Regel" "Regeln" feminine ; rule_N = reg2N "Regel" "Regeln" feminine ;
john_PN = mkPN "Johann" ; -- should be: masculine ; john_PN = mkPN "Johann" masculine ;
question_N = mkN "Frage" ; question_N = mkN "Frage" ;
ready_A = regA "fertig" ; ready_A = regA "fertig" ;
reason_N = reg2N "Grund" "Gründe" masculine ; reason_N = reg2N "Grund" "Gründe" masculine ;

View File

@@ -20,9 +20,10 @@ oper
mkPrep : Str -> PCase -> Preposition = \s,c -> mkPrep : Str -> PCase -> Preposition = \s,c ->
{s = s ; s2 = [] ; c = c ; isPrep = True} ; {s = s ; s2 = [] ; c = c ; isPrep = True} ;
nameNounPhrase : {s : Case => Str} -> {s : PCase => Str ; a : Agr ; isPron : Bool} = \name -> heavyNP { nameNounPhrase : {s : Case => Str} -> {s : PCase => Str ; a : Agr ; isPron : Bool ; ext,adv,rc : Str} = \name -> heavyNP {
s = \\c => usePrepC c (\k -> name.s ! k) ; s = \\c => usePrepC c (\k -> name.s ! k) ;
a = agrP3 Sg a = agrP3 Sg ;
ext, adv, rc = [] -- added
} ; } ;
detLikeAdj : Bool -> Number -> Str -> detLikeAdj : Bool -> Number -> Str ->

View File

@@ -7,48 +7,58 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in {
s = \\c => det.s ! cn.g ! c ++ s = \\c => det.s ! cn.g ! c ++
(let k = (prepC c).c in cn.s ! adjfCase det.a k ! det.n ! k) ; (let k = (prepC c).c in cn.s ! adjfCase det.a k ! det.n ! k) ;
a = agrgP3 cn.g det.n ; a = agrgP3 cn.g det.n ;
isPron = det.isDef -- ich sehe den Mann nicht vs. ich sehe nicht einen Mann isPron = det.isDef ; -- ich sehe den Mann nicht vs. ich sehe nicht einen Mann
rc = cn.rc ! det.n ;
adv = cn.adv ;
ext = cn.ext
} ; } ;
DetNP det = { DetNP det = {
s = \\c => det.sp ! Neutr ! c ; -- more genders in ExtraGer s = \\c => det.sp ! Neutr ! c ; -- more genders in ExtraGer
a = agrP3 det.n ; a = agrP3 det.n ;
isPron = det.isDef isPron = det.isDef ;
rc, adv, ext = []
} ; } ;
UsePN pn = { UsePN pn = {
s = \\c => usePrepC c (\k -> pn.s ! k) ; s = \\c => usePrepC c (\k -> pn.s ! k) ;
a = agrP3 Sg ; a = agrgP3 pn.g Sg ;
isPron = True --- means: this is not a heavy NP, but comes before negation isPron = True ; --- means: this is not a heavy NP, but comes before negation
rc, adv, ext = []
} ; } ;
UsePron pron = { UsePron pron = {
s = \\c => usePrepC c (\k -> pron.s ! NPCase k) ; s = \\c => usePrepC c (\k -> pron.s ! NPCase k) ;
a = pron.a ; a = pron.a ;
isPron = True isPron = True ;
rc, adv, ext = []
} ; } ;
PredetNP pred np = PredetNP pred np =
let ag = case pred.a of {PAg n => agrP3 n ; _ => np.a} in heavyNP { let ag = case pred.a of {PAg n => agrP3 n ; _ => np.a} in np ** {
s = \\c0 => s = \\c0 =>
let c = case pred.c.k of {NoCase => c0 ; PredCase k => k} in let c = case pred.c.k of {NoCase => c0 ; PredCase k => k} in
pred.s ! numberAgr ag ! genderAgr np.a ! c0 ++ pred.c.p ++ np.s ! c ; pred.s ! numberAgr ag ! genderAgr np.a ! c0 ++ pred.c.p ++ np.s ! c ;
a = ag a = ag ;
isPron = False
} ; } ;
PPartNP np v2 = heavyNP { PPartNP np v2 = np ** {
s = \\c => np.s ! c ++ v2.s ! VPastPart APred ; --- invar part s = \\c => np.s ! c ++ v2.s ! VPastPart APred ; --- invar part
a = np.a isPron = False
} ;
{- possibly structures such as
"sie ist eine erfolgreiche Frau geliebt von vielen"
but only with v2 not possible in German? -}
AdvNP np adv = np ** {
adv = np.adv ++ adv.s ;
isPron = False
} ; } ;
AdvNP np adv = heavyNP { ExtAdvNP np adv = np ** {
s = \\c => np.s ! c ++ adv.s ; adv = np.adv ++ embedInCommas adv.s ;
a = np.a isPron = False
} ;
ExtAdvNP np adv = heavyNP {
s = \\c => np.s ! c ++ embedInCommas adv.s ;
a = np.a
} ; } ;
DetQuantOrd quant num ord = DetQuantOrd quant num ord =
@@ -131,79 +141,70 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in {
MassNP cn = { MassNP cn = {
s = \\c => usePrepC c (\k -> cn.s ! Strong ! Sg ! k) ; s = \\c => usePrepC c (\k -> cn.s ! Strong ! Sg ! k) ;
a = agrgP3 cn.g Sg ; a = agrgP3 cn.g Sg ;
isPron = False isPron = False ;
rc = cn.rc ! Sg ;
adv = cn.adv ;
ext = cn.ext
} ; } ;
UseN, UseN2 = \n -> { UseN, UseN2 = \n -> {
s = \\_ => n.s ; s = \\_ => n.s ;
g = n.g g = n.g ;
rc = \\_ => [] ;
ext,adv = []
} ; } ;
ComplN2 f x = { ComplN2 f x = {
s = \\_,n,c => f.s ! n ! c ++ appPrep f.c2 x.s ; s = \\_,n,c => f.s ! n ! c ++ appPrepNP f.c2 x ;
g = f.g g = f.g ;
rc = \\_ => [] ;
ext,adv = []
} ; } ;
ComplN3 f x = { ComplN3 f x = {
s = \\n,c => f.s ! n ! c ++ appPrep f.c2 x.s ; s = \\n,c => f.s ! n ! c ++ appPrepNP f.c2 x ;
co = f.co ++ appPrep f.c2 x.s ; ---- should not occur at all; the abstract syntax is problematic in giving N2 co = f.co ++ appPrepNP f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2
uncap = { uncap = {
s = \\n,c => f.uncap.s ! n ! c ++ appPrep f.c2 x.s ; s = \\n,c => f.uncap.s ! n ! c ++ appPrepNP f.c2 x ;
co = f.uncap.co ++ appPrep f.c2 x.s ; ---- should not occur at all; the abstract syntax is problematic in giving N2 co = f.uncap.co ++ appPrepNP f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2
} ; } ;
g = f.g ; g = f.g ;
c2 = f.c3 c2 = f.c3 ;
rc = \\_ => [] ;
ext,adv = []
} ; } ;
Use2N3 f = f ; Use2N3 f = f ;
Use3N3 f = f ** { Use3N3 f = f ** {
c2 = f.c3 c2 = f.c3;
} ; } ;
AdjCN ap cn = AdjCN ap cn =
let let
g = cn.g g = cn.g
in { in cn ** {
s = \\a,n,c => s = \\a,n,c =>
preOrPost ap.isPre preOrPost ap.isPre
(ap.s ! agrAdj g a n c) (ap.c.p1 ++ ap.c.p2 ++ ap.s ! agrAdj g a n c ++ ap.ext)
(cn.s ! a ! n ! c) ; (cn.s ! a ! n ! c) ;
g = g g = g
} ; } ;
RelCN cn rs = {
s = \\a,n,c => cn.s ! a ! n ! c ++ "," ++
rs.s ! RGenNum (gennum cn.g n) ;
g = cn.g
} ;
RelNP np rs = { RelCN cn rs = cn ** {rc = \\n => embedInCommas (rs.s ! RGenNum (gennum cn.g n))} ;
s = \\c => np.s ! c ++ "," ++
rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a)) ;
a = np.a ;
isPron = False
} ;
SentCN cn s = { RelNP np rs = np ** {
s = \\a,n,c => cn.s ! a ! n ! c ++ s.s ; rc = embedInCommas (rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a))) ;
g = cn.g isPron = False } ;
} ;
AdvCN cn s = { SentCN cn s = cn ** {ext = embedInCommas s.s} ;
s = \\a,n,c => cn.s ! a ! n ! c ++ s.s ;
g = cn.g
} ;
ApposCN cn np = let g = cn.g in { AdvCN cn a = cn ** {adv = a.s} ;
s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! NPC c ;
g = g ;
isMod = cn.isMod
} ;
PossNP cn np = { ApposCN cn np = let g = cn.g in cn ** {
s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! NPP CVonDat ; s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! NPC c ++ bigNP np } ;
g = cn.g
} ;
PossNP cn np = cn ** {
s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! NPP CVonDat } ;
} }

View File

@@ -119,7 +119,6 @@ mkN : overload {
mkN3 : N -> Prep -> Prep -> N3 ; -- noun + two prepositions mkN3 : N -> Prep -> Prep -> N3 ; -- noun + two prepositions
--3 Proper names and noun phrases --3 Proper names and noun phrases
-- --
-- Proper names, with an "s" genitive and other cases like the -- Proper names, with an "s" genitive and other cases like the
@@ -127,15 +126,15 @@ mkN : overload {
-- taken into account. -- taken into account.
mkPN : overload { mkPN : overload {
mkPN : Str -> PN ; -- regular name with genitive in "s" mkPN : Str -> Gender -> PN ; -- regular name with genitive in "s"
-- If only the genitive differs, two strings are needed. -- If only the genitive differs, two strings are needed.
mkPN : (nom,gen : Str) -> PN ; -- name with other genitive mkPN : (nom,gen : Str) -> Gender -> PN ; -- name with other genitive
-- In the worst case, all four forms are needed. -- In the worst case, all four forms are needed.
mkPN : (nom,acc,dat,gen : Str) -> PN ; -- name with all case forms mkPN : (nom,acc,dat,gen : Str) -> Gender -> PN ; -- name with all case forms
-- Inflection can also be inherited from the singular forms of a common noun. -- Inflection can also be inherited from the singular forms of a common noun.
@@ -145,6 +144,8 @@ mkN : overload {
--2 Adjectives --2 Adjectives
mkA : overload { mkA : overload {
@@ -454,21 +455,22 @@ mkV2 : overload {
mkN3 = \n,p,q -> n ** {c2 = p ; c3 = q ; lock_N3 = <>} ; mkN3 = \n,p,q -> n ** {c2 = p ; c3 = q ; lock_N3 = <>} ;
mk2PN = \karolus, karoli -> mk2PN = \karolus, karoli, g ->
{s = table {Gen => karoli ; _ => karolus} ; lock_PN = <>} ; {s = table {Gen => karoli ; _ => karolus} ; g = g ; lock_PN = <>} ;
regPN = \horst -> regPN = \horst, g ->
mk2PN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) ; mk2PN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) g ;
mkPN = overload { mkPN = overload {
mkPN : Str -> PN = regPN ; mkPN : Str -> Gender -> PN = regPN ;
mkPN : N -> PN = \n -> lin PN {s = n.s ! Sg} ; mkPN : N -> PN = \n -> lin PN {s = n.s ! Sg; g = n.g} ;
mkPN : (nom,gen : Str) -> PN = mk2PN ; mkPN : (nom,gen : Str) -> Gender -> PN = mk2PN ;
mkPN : (nom,acc,dat,gen : Str) -> PN = \nom,acc,dat,gen -> mkPN : (nom,acc,dat,gen : Str) -> Gender -> PN = \nom,acc,dat,gen,g ->
{s = table {Nom => nom ; Acc => acc ; Dat => dat ; Gen => gen} ; lock_PN = <>} {s = table {Nom => nom ; Acc => acc ; Dat => dat ; Gen => gen} ;
g = g ; lock_PN = <>}
} ; } ;
mk2PN : (karolus, karoli : Str) -> PN ; -- karolus, karoli mk2PN : (karolus, karoli : Str) -> Gender -> PN ; -- karolus, karoli
regPN : (Johann : Str) -> PN ; regPN : (Johann : Str) -> Gender -> PN ;
-- Johann, Johanns ; Johannes, Johannes -- Johann, Johanns ; Johannes, Johannes
@@ -553,22 +555,17 @@ mkV2 : overload {
seinV v = v ** {aux = VSein} ; seinV v = v ** {aux = VSein} ;
reflV v c = v ** {aux = VHaben ; vtype = VRefl (prepC c).c} ; reflV v c = v ** {aux = VHaben ; vtype = VRefl (prepC c).c} ;
no_geV v = let vs = v.s in { no_geV v = let vs = v.s in v ** {
s = table { s = table {
p@(VPastPart _) => Predef.drop 2 (vs ! p) ; p@(VPastPart _) => Predef.drop 2 (vs ! p) ;
p => vs ! p p => vs ! p }};
} ;
prefix = v.prefix ; particle = v.particle ; lock_V = v.lock_V ; aux = v.aux ; vtype = v.vtype
} ;
fixprefixV s v = let vs = v.s in { fixprefixV s v = let vs = v.s in v ** {
s = table { s = table {
VInf True => "zu" ++ (s + vs ! VInf False) ; VInf True => "zu" ++ (s + vs ! VInf False) ;
p@(VPastPart _) => s + Predef.drop 2 (vs ! p) ; p@(VPastPart _) => s + Predef.drop 2 (vs ! p) ;
p => s + vs ! p p => s + vs ! p
} ; }} ;
prefix = v.prefix ; particle = v.particle ; lock_V = v.lock_V ; aux = v.aux ; vtype = v.vtype
} ;
haben_V = MorphoGer.haben_V ** {particle = [] ; lock_V = <>} ; haben_V = MorphoGer.haben_V ** {particle = [] ; lock_V = <>} ;
sein_V = MorphoGer.sein_V ** {particle = [] ; lock_V = <>} ; sein_V = MorphoGer.sein_V ** {particle = [] ; lock_V = <>} ;

View File

@@ -49,7 +49,7 @@ concrete QuestionGer of Question = CatGer ** open ResGer in {
QuestIComp icomp np = { QuestIComp icomp np = {
s = \\m,t,a,p => s = \\m,t,a,p =>
let let
vp = predV sein_V ; vp = predV sein_V ** {ext = icomp.ext};
cls = (mkClause (np.s ! NPC Nom) np.a vp).s ! m ! t ! a ! p ; cls = (mkClause (np.s ! NPC Nom) np.a vp).s ! m ! t ! a ! p ;
why = icomp.s ! np.a why = icomp.s ! np.a
in table { in table {
@@ -95,9 +95,9 @@ concrete QuestionGer of Question = CatGer ** open ResGer in {
AdvIAdv i a = {s = i.s ++ a.s} ; AdvIAdv i a = {s = i.s ++ a.s} ;
CompIAdv a = {s = \\_ => a.s} ; CompIAdv a = {s = \\_ => a.s ; ext = ""} ;
CompIP ip = {s = \\_ => ip.s ! Nom} ; CompIP ip = {s = \\_ => ip.s ! Nom ; ext = "" } ;
} }

View File

@@ -14,6 +14,10 @@ resource ResGer = ParamX ** open Prelude in {
flags optimize=all ; flags optimize=all ;
coding=utf8 ; coding=utf8 ;
--------------------------------------------
--PARAMETERS DEFINITIONS
--------------------------------------------
--2 For $Noun$ --2 For $Noun$
-- These are the standard four-value case and three-value gender. -- These are the standard four-value case and three-value gender.
@@ -42,6 +46,7 @@ resource ResGer = ParamX ** open Prelude in {
oper oper
NPNom : PCase = NPC Nom ; NPNom : PCase = NPC Nom ;
PrepNom : Preposition = {s,s2 = "" ; isPrep = False ; c = NPNom} ;
prepC : PCase -> {s : Str ; c : Case} = \cp -> case cp of { prepC : PCase -> {s : Str ; c : Case} = \cp -> case cp of {
NPC c => {s = [] ; c = c} ; NPC c => {s = [] ; c = c} ;
NPP CAnDat => {s = "an" ; c = Dat} ; NPP CAnDat => {s = "an" ; c = Dat} ;
@@ -196,6 +201,10 @@ resource ResGer = ParamX ** open Prelude in {
p = conjPerson (personAgr a) (personAgr b) p = conjPerson (personAgr a) (personAgr b)
} ; } ;
--------------------------------------------
--TYPE DEFINITIONS + WORST-CASE CONSTRUCTORS
--------------------------------------------
-- For $Lex$. -- For $Lex$.
-- For conciseness and abstraction, we first define a method for -- For conciseness and abstraction, we first define a method for
@@ -228,6 +237,14 @@ resource ResGer = ParamX ** open Prelude in {
g : Gender g : Gender
} ; } ;
NP : Type = {
s : PCase => Str ;
rc : Str ; -- die Frage , [rc die ich gestellt habe]
ext : Str ; -- die Frage , [sc wo sie schläft])
adv : Str ; -- die Frage [a von Max]
a : Agr ;
isPron : Bool } ;
mkN : (x1,_,_,_,_,x6,x7 : Str) -> Gender -> Noun = mkN : (x1,_,_,_,_,x6,x7 : Str) -> Gender -> Noun =
\Mann, Mannen, Manne, Mannes, Maenner, Maennern, Mann_, g -> { \Mann, Mannen, Manne, Mannes, Maenner, Maennern, Mann_, g -> {
s = table { s = table {
@@ -265,10 +282,11 @@ resource ResGer = ParamX ** open Prelude in {
Adjective : Type = {s : Degree => AForm => Str} ; Adjective : Type = {s : Degree => AForm => Str} ;
mkA : (x1,_,_,x4 : Str) -> Adjective = \gut,gute,besser,best -> mkA : (x1,_,_,x4 : Str) -> Adjective = \gut,gute,besser,best ->
let besten = best + "en" in
{s = table { {s = table {
Posit => adjForms gut gute ; Posit => adjForms gut gute ;
Compar => adjForms besser besser ; Compar => adjForms besser besser ;
Superl => adjForms best best Superl => adjForms ("am" ++ besten) best
} }
} ; } ;
@@ -387,6 +405,13 @@ resource ResGer = ParamX ** open Prelude in {
appPrep : Preposition -> (PCase => Str) -> Str = \prep,arg -> appPrep : Preposition -> (PCase => Str) -> Str = \prep,arg ->
prep.s ++ arg ! prep.c ++ prep.s2 ; prep.s ++ arg ! prep.c ++ prep.s2 ;
appPrepNP : Preposition -> NP -> Str = \prep,np ->
prep.s ++ np.s ! prep.c ++ bigNP np ++ prep.s2 ;
-- revised appPrep for discontinuous NPs
bigNP : NP -> Str = \np ->
np.adv ++ np.ext ++ np.rc ;
-- To build a preposition from just a case. -- To build a preposition from just a case.
noPreposition : Case -> Preposition = \c -> noPreposition : Case -> Preposition = \c ->
@@ -469,6 +494,10 @@ resource ResGer = ParamX ** open Prelude in {
caselist (teur+"e") (teur+"e") (teur+"en") (teur+"er") ! c caselist (teur+"e") (teur+"e") (teur+"en") (teur+"er") ! c
} ; } ;
--------------------------------------------
--VP CONSTRUCTION
--------------------------------------------
-- For $Verb$. -- For $Verb$.
VPC : Type = { VPC : Type = {
@@ -478,15 +507,17 @@ resource ResGer = ParamX ** open Prelude in {
} }
} ; } ;
VP : Type = { VP : Type = {
s : Verb ; s : Verb ;
a1 : Polarity => Str ; -- nicht
nn : Agr => Str * Str ; -- dich/deine Frau nn : Agr => Str * Str ; -- dich/deine Frau
a2 : Str ; -- heute a1 : Polarity => Str ; -- nicht = adV
a2 : Str ; -- heute = adv
adj : Str ; -- space for adjectival complements ("ich finde dich schön")
isAux : Bool ; -- is a double infinitive isAux : Bool ; -- is a double infinitive
inf : Str ; -- sagen inf : Str ; -- sagen
ext : Str ; -- dass sie kommt ext : Str ; -- dass sie kommt
infExt : Str infExt : Str ; -- infinitival complements of inf e.g. ich hoffe [zu gehen] zu versuchen
subjc : Preposition -- determines case of "subj"
} ; } ;
predV : Verb -> VP = predVGen False ; predV : Verb -> VP = predVGen False ;
@@ -556,13 +587,14 @@ resource ResGer = ParamX ** open Prelude in {
} ; } ;
a1 : Polarity => Str = negation ; a1 : Polarity => Str = negation ;
a2 : Str = [] ;
nn : Agr => Str * Str = case verb.vtype of { nn : Agr => Str * Str = case verb.vtype of {
VAct => \\_ => <[],[]> ; VAct => \\_ => <[],[]> ;
VRefl c => \\a => <reflPron ! a ! c,[]> VRefl c => \\a => <reflPron ! a ! c,[]>
} ; } ;
a2 : Str = [] ;
isAux = isAux ; ---- isAux = isAux ; ----
inf,ext,infExt : Str = [] inf,ext,infExt,adj : Str = [] ;
subjc = PrepNom
} ; } ;
auxPerfect : Verb -> VForm => Str = \verb -> auxPerfect : Verb -> VForm => Str = \verb ->
@@ -628,21 +660,13 @@ resource ResGer = ParamX ** open Prelude in {
insertObj : (Agr => Str) -> VP -> VP = insertObjNP False ; insertObj : (Agr => Str) -> VP -> VP = insertObjNP False ;
insertObjNP : Bool -> (Agr => Str) -> VP -> VP = \isPron, obj,vp -> { insertObjNP : Bool -> (Agr => Str) -> VP -> VP = \isPron, obj,vp -> vp ** {
s = vp.s ;
a1 = vp.a1 ;
nn = \\a => nn = \\a =>
let vpnn = vp.nn ! a in let vpnn = vp.nn ! a in
case isPron of { case isPron of {
True => <obj ! a ++ vpnn.p1, vpnn.p2> ; True => <obj ! a ++ vpnn.p1, vpnn.p2> ;
False => < vpnn.p1, obj ! a ++ vpnn.p2> False => < vpnn.p1, obj ! a ++ vpnn.p2>
} ; }} ;
a2 = vp.a2 ;
isAux = vp.isAux ;
inf = vp.inf ;
ext = vp.ext ;
infExt = vp.infExt
} ;
isLightComplement : Bool -> Preposition -> Bool = \isPron,prep -> case isPron of { isLightComplement : Bool -> Preposition -> Bool = \isPron,prep -> case isPron of {
False => False ; False => False ;
@@ -652,60 +676,31 @@ resource ResGer = ParamX ** open Prelude in {
} }
} ; } ;
insertAdV : Str -> VP -> VP = \adv,vp -> { insertAdV : Str -> VP -> VP = \adv,vp -> vp ** {
s = vp.s ; a1 = \\a => adv ++ vp.a1 ! a } ; -- immer nicht
a1 = \\a => adv ++ vp.a1 ! a ; -- immer nicht
nn = vp.nn ;
a2 = vp.a2 ;
isAux = vp.isAux ;
inf = vp.inf ;
ext = vp.ext ;
infExt = vp.infExt
} ;
insertAdv : Str -> VP -> VP = \adv,vp -> { insertAdv : Str -> VP -> VP = \adv,vp -> vp ** {
s = vp.s ; a2 = vp.a2 ++ adv } ;
a1 = vp.a1 ;
nn = vp.nn ;
a2 = vp.a2 ++ adv ;
isAux = vp.isAux ;
inf = vp.inf ;
ext = vp.ext ;
infExt = vp.infExt
} ;
insertExtrapos : Str -> VP -> VP = \ext,vp -> { insertExtrapos : Str -> VP -> VP = \ext,vp -> vp ** {
s = vp.s ; ext = vp.ext ++ ext } ;
a1 = vp.a1 ;
nn = vp.nn ;
a2 = vp.a2 ;
isAux = vp.isAux ;
inf = vp.inf ;
ext = vp.ext ++ ext ;
infExt = vp.infExt
} ;
insertInfExt : Str -> VP -> VP = \infExt,vp -> { insertInfExt : Str -> VP -> VP = \infExt,vp -> vp ** {
s = vp.s ; infExt = vp.infExt ++ infExt } ;
a1 = vp.a1 ;
nn = vp.nn ;
a2 = vp.a2 ;
isAux = vp.isAux ;
inf = vp.inf ;
ext = vp.ext ;
infExt = vp.infExt ++ infExt
} ;
insertInf : Str -> VP -> VP = \inf,vp -> { insertInf : Str -> VP -> VP = \inf,vp -> vp ** {
s = vp.s ; inf = inf ++ vp.inf } ;
a1 = vp.a1 ;
nn = vp.nn ; insertAdj : Str -> Str * Str -> Str -> VP -> VP = \adj,c,ext,vp -> vp ** {
a2 = vp.a2 ; nn = \\a =>
isAux = vp.isAux ; ---- let vpnn = vp.nn ! a in
inf = inf ++ vp.inf ; <vpnn.p1 ++ c.p1 , vpnn.p2> ;
ext = vp.ext ; adj = vp.adj ++ adj ++ c.p2 ;
infExt = vp.infExt ext = vp.ext ++ ext} ;
} ;
--------------------------------------------
--CLAUSE CONSTRUCTION
--------------------------------------------
-- For $Sentence$. -- For $Sentence$.
@@ -713,7 +708,6 @@ resource ResGer = ParamX ** open Prelude in {
s : Mood => Tense => Anteriority => Polarity => Order => Str s : Mood => Tense => Anteriority => Polarity => Order => Str
} ; } ;
mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> let vps = useVP vp in { mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> let vps = useVP vp in {
s = \\m,t,a,b,o => s = \\m,t,a,b,o =>
let let
@@ -725,8 +719,8 @@ resource ResGer = ParamX ** open Prelude in {
neg = vp.a1 ! b ; neg = vp.a1 ! b ;
obj0 = (vp.nn ! agr).p1 ; obj0 = (vp.nn ! agr).p1 ;
obj = (vp.nn ! agr).p2 ; obj = (vp.nn ! agr).p2 ;
compl = obj0 ++ neg ++ obj ++ vp.a2 ; -- from EG 15/5 compl = obj0 ++ neg ++ vp.adj ++ obj ++ vp.a2 ; -- adj added
inf = vp.inf ++ verb.inf ; inf = vp.inf ++ verb.inf ; -- not used for linearisation of Main/Inv
extra = vp.ext ; extra = vp.ext ;
inffin : Str = inffin : Str =
case <a,vp.isAux> of { case <a,vp.isAux> of {
@@ -735,12 +729,9 @@ resource ResGer = ParamX ** open Prelude in {
} }
in in
case o of { case o of {
Main => subj ++ verb.fin ++ compl ++ vp.infExt ++ inf ++ extra ; Main => subj ++ verb.fin ++ compl ++ vp.infExt ++ verb.inf ++ extra ++ vp.inf ;
Inv => verb.fin ++ subj ++ compl ++ vp.infExt ++ inf ++ extra ; Inv => verb.fin ++ subj ++ compl ++ vp.infExt ++ verb.inf ++ extra ++ vp.inf ;
Sub => subj ++ compl ++ vp.infExt ++ inffin ++ extra Sub => subj ++ compl ++ vp.infExt ++ inffin ++ extra
-- Main => subj ++ verb.fin ++ compl ++ "[N]" ++ vp.infExt ++ "[/N]" ++ "[I]" ++ inf ++ "[/I]" ++ "[E]" ++ extra ++ "[/E]" ;
-- Inv => verb.fin ++ subj ++ compl ++ inf ++ extra ;
-- Sub => subj ++ compl ++ "(n)" ++ vp.infExt ++ "(/n)" ++ "(if)" ++ inffin ++ "(/if)" ++ "(e)" ++ extra ++ "(/e)"
} }
} ; } ;
@@ -798,10 +789,11 @@ resource ResGer = ParamX ** open Prelude in {
infPart : Bool -> Str = \b -> if_then_Str b [] "zu" ; infPart : Bool -> Str = \b -> if_then_Str b [] "zu" ;
heavyNP : heavyNP :
{s : PCase => Str ; a : Agr} -> {s : PCase => Str ; a : Agr ; isPron : Bool} = \np -> {s : PCase => Str ; a : Agr} -> {s : PCase => Str ; a : Agr ; isPron : Bool ; adv,ext,rc : Str} = \np ->
np ** {isPron = False} ; np ** {isPron = False; adv,ext,rc = []} ; -- this could be wrong
oper oper
relPron : RelGenNum => Case => Str = \\rgn,c => relPron : RelGenNum => Case => Str = \\rgn,c =>
case rgn of { case rgn of {
RGenNum gn => RGenNum gn =>
@@ -815,4 +807,14 @@ resource ResGer = ParamX ** open Prelude in {
RSentence => "was" RSentence => "was"
} ; } ;
-- Function that allows the construction of non-nominative subjects.
mkSubj : NP -> Preposition -> Str * Agr = \np, subjc ->
let
sub = subjc ;
agr = case sub.c of {
NPC Nom => np.a ;
_ => Ag Masc Sg P3 } ;
subj = appPrepNP sub np
in <subj , agr> ;
} }

View File

@@ -4,7 +4,16 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in {
lin lin
PredVP np vp = mkClause (np.s ! NPC Nom) np.a vp ; PredVP np vp =
let subj = mkSubj np vp.subjc
in mkClause subj.p1 subj.p2 vp ;
{- applies verb's subject case to subject ;
forces 3rd person sg agreement for any non-nom subjects -->
"uns graut" "*uns grauen"
allows pre/post-positions in subjects -->
"nach mir wurde gedürstet" "*mir wurde gedürstet"
can't think of case of postpositions in subject -}
PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ; PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ;
@@ -24,10 +33,8 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in {
} ; } ;
SlashVP np vp = SlashVP np vp =
mkClause let subj = mkSubj np vp.subjc
(np.s ! NPC Nom) np.a in mkClause subj.p1 subj.p2 vp ** {c2 = vp.c2} ;
vp **
{c2 = vp.c2} ;
AdvSlash slash adv = { AdvSlash slash adv = {
s = \\m,t,a,b,o => slash.s ! m ! t ! a ! b ! o ++ adv.s ; s = \\m,t,a,b,o => slash.s ! m ! t ! a ! b ! o ++ adv.s ;
@@ -37,9 +44,10 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in {
SlashPrep cl prep = cl ** {c2 = prep} ; SlashPrep cl prep = cl ** {c2 = prep} ;
SlashVS np vs slash = SlashVS np vs slash =
mkClause (np.s ! NPC Nom) np.a let subj = mkSubj np PrepNom
(insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs)) ** in mkClause subj.p1 subj.p2
{c2 = slash.c2} ; (insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs)) **
{c2 = slash.c2} ;
EmbedS s = {s = conjThat ++ s.s ! Sub} ; EmbedS s = {s = conjThat ++ s.s ! Sub} ;
EmbedQS qs = {s = qs.s ! QIndir} ; EmbedQS qs = {s = qs.s ! QIndir} ;
@@ -66,6 +74,7 @@ concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in {
SSubjS a s b = {s = \\o => a.s ! o ++ "," ++ s.s ++ b.s ! Sub} ; SSubjS a s b = {s = \\o => a.s ! o ++ "," ++ s.s ++ b.s ! Sub} ;
RelS s r = {s = \\o => s.s ! o ++ "," ++ r.s ! RSentence} ; --- "welches" RelS s r = {s = \\o => s.s ! o ++ "," ++ r.s ! RSentence} ; --- "was"
} }

View File

@@ -19,7 +19,7 @@ concrete StructuralGer of Structural = CatGer **
before_Prep = mkPrep "vor" P.dative ; before_Prep = mkPrep "vor" P.dative ;
behind_Prep = mkPrep "hinter" P.dative ; behind_Prep = mkPrep "hinter" P.dative ;
between_Prep = mkPrep "zwischen" P.dative ; between_Prep = mkPrep "zwischen" P.dative ;
both7and_DConj = sd2 "sowohl" ["als auch"] ** {n = Pl} ; both7and_DConj = sd2 "sowohl" ["als auch"] ** {n = Sg} ;
but_PConj = ss "aber" ; but_PConj = ss "aber" ;
by8agent_Prep = mkPrep "durch" P.accusative ; by8agent_Prep = mkPrep "durch" P.accusative ;
by8means_Prep = mkPrep "mit" P.dative ; by8means_Prep = mkPrep "mit" P.dative ;
@@ -29,7 +29,7 @@ concrete StructuralGer of Structural = CatGer **
"konnte" "konntest" "konnten" "konntet" "konnte" "konntest" "konnten" "konntet"
"könnte" "gekonnt" [] "könnte" "gekonnt" []
VHaben) ; VHaben) ;
during_Prep = mkPrep "während" P.genitive ; during_Prep = mkPrep "während" P.genitive | P.mkPrep P.accusative "über" ;
either7or_DConj = sd2 "entweder" "oder" ** {n = Sg} ; either7or_DConj = sd2 "entweder" "oder" ** {n = Sg} ;
everybody_NP = nameNounPhrase {s = caselist "jeder" "jeden" "jedem" "jedes"} ; everybody_NP = nameNounPhrase {s = caselist "jeder" "jeden" "jedem" "jedes"} ;
every_Det = detLikeAdj False Sg "jed" ; every_Det = detLikeAdj False Sg "jed" ;
@@ -46,7 +46,7 @@ concrete StructuralGer of Structural = CatGer **
how_IAdv = ss "wie" ; how_IAdv = ss "wie" ;
how8much_IAdv = ss "wieviel" ; how8much_IAdv = ss "wieviel" ;
how8many_IDet = {s = \\g,c => (detLikeAdj False Pl "wie viel").s ! g ! NPC c ; n = Pl} ; how8many_IDet = {s = \\g,c => (detLikeAdj False Pl "wie viel").s ! g ! NPC c ; n = Pl} ;
if_Subj = ss "wenn" ; if_Subj = ss "wenn" | ss "falls" ;
in8front_Prep = mkPrep "vor" P.dative ; in8front_Prep = mkPrep "vor" P.dative ;
i_Pron = mkPronPers "ich" "mich" "mir" "meiner" "mein" Masc Sg P1 ; i_Pron = mkPronPers "ich" "mich" "mir" "meiner" "mein" Masc Sg P1 ;
in_Prep = mkPrep [] (NPP CInDat) ; in_Prep = mkPrep [] (NPP CInDat) ;
@@ -91,7 +91,7 @@ concrete StructuralGer of Structural = CatGer **
jener : Number => Gender => PCase => Str = \\n => (detLikeAdj True n "jen").s in jener : Number => Gender => PCase => Str = \\n => (detLikeAdj True n "jen").s in
{s,sp = \\_ => jener ; a,aPl = Weak} ; {s,sp = \\_ => jener ; a,aPl = Weak} ;
---b that_NP = nameNounPhrase {s = caselist "das" "das" "denem" "dessen"} ; ---- ---b that_NP = nameNounPhrase {s = caselist "das" "das" "denem" "dessen"} ; ----
there_Adv = ss "da" ; there_Adv = ss "da" | ss "dort" ;
there7to_Adv = ss "dahin" ; there7to_Adv = ss "dahin" ;
there7from_Adv = ss ["daher"] ; there7from_Adv = ss ["daher"] ;
therefore_PConj = ss "deshalb" ; therefore_PConj = ss "deshalb" ;
@@ -145,7 +145,7 @@ concrete StructuralGer of Structural = CatGer **
nobody_NP = nobody_NP =
nameNounPhrase {s = caselist "niemand" "niemanden" "niemandem" "niemands"} ; nameNounPhrase {s = caselist "niemand" "niemanden" "niemandem" "niemands"} ;
nothing_NP = nothing_NP =
nameNounPhrase {s = \\_ => "nichts"} ; nameNounPhrase {s = \\_ => "nichts"} ; --maybe add: nameNounPhrase {s = \\_ => "garnichts"}
at_least_AdN = ss "wenigstens" ; at_least_AdN = ss "wenigstens" ;
at_most_AdN = ss "höchstens" ; at_most_AdN = ss "höchstens" ;
except_Prep = mkPrep "außer" P.dative ; except_Prep = mkPrep "außer" P.dative ;

View File

@@ -11,18 +11,21 @@ lin
CNIntNP cn i = { CNIntNP cn i = {
s = \\c => cn.s ! Weak ! Sg ! Nom ++ i.s ; s = \\c => cn.s ! Weak ! Sg ! Nom ++ i.s ;
a = agrP3 Sg ; a = agrP3 Sg ;
isPron = False isPron = False ;
ext,rc,adv = [] -- added
} ; } ;
CNSymbNP det cn xs = let g = cn.g in { CNSymbNP det cn xs = let g = cn.g in {
s = \\c => det.s ! g ! c ++ s = \\c => det.s ! g ! c ++
(let k = (prepC c).c in cn.s ! adjfCase det.a k ! det.n ! k) ++ xs.s ; (let k = (prepC c).c in cn.s ! adjfCase det.a k ! det.n ! k) ++ xs.s ;
a = agrP3 det.n ; a = agrP3 det.n ;
isPron = False isPron = False ;
ext,rc,adv = [] -- added
} ; } ;
CNNumNP cn i = { CNNumNP cn i = {
s = \\c => artDefContr (GSg cn.g) c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! (prepC c).c ; s = \\c => artDefContr (GSg cn.g) c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! (prepC c).c ;
a = agrP3 Sg ; a = agrP3 Sg ;
isPron = False isPron = False ;
ext,rc,adv = [] -- added
} ; } ;
SymbS sy = {s = \\_ => sy.s} ; SymbS sy = {s = \\_ => sy.s} ;

View File

@@ -19,14 +19,14 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in {
insertExtrapos (comma ++ conjThat ++ s.s ! Sub) (predV v) ; insertExtrapos (comma ++ conjThat ++ s.s ! Sub) (predV v) ;
ComplVQ v q = ComplVQ v q =
insertExtrapos (comma ++ q.s ! QIndir) (predV v) ; insertExtrapos (comma ++ q.s ! QIndir) (predV v) ;
ComplVA v ap = insertObj (\\ _ => ap.s ! APred) (predV v) ; ComplVA v ap = insertAdj (ap.s ! APred) ap.c ap.ext (predV v) ; -- changed
SlashV2a v = predV v ** {c2 = v.c2} ; SlashV2a v = predV v ** {c2 = v.c2} ;
Slash2V3 v np = Slash2V3 v np =
insertObj (\\_ => appPrep v.c2 np.s) (predV v) ** {c2 = v.c3} ; insertObj (\\_ => appPrepNP v.c2 np) (predV v) ** {c2 = v.c3} ;
Slash3V3 v np = Slash3V3 v np =
insertObj (\\_ => appPrep v.c3 np.s) (predV v) ** {c2 = v.c2} ; insertObj (\\_ => appPrepNP v.c3 np) (predV v) ** {c2 = v.c2} ;
SlashV2S v s = SlashV2S v s =
insertExtrapos (conjThat ++ s.s ! Sub) (predV v) ** {c2 = v.c2} ; insertExtrapos (conjThat ++ s.s ! Sub) (predV v) ** {c2 = v.c2} ;
@@ -41,9 +41,9 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in {
insertObj vpi.p1 ((predVGen v.isAux v)))) ** {c2 = v.c2} ; insertObj vpi.p1 ((predVGen v.isAux v)))) ** {c2 = v.c2} ;
SlashV2A v ap = SlashV2A v ap =
insertObj (\\_ => ap.s ! APred) (predV v) ** {c2 = v.c2} ; insertAdj (ap.s ! APred) ap.c ap.ext (predV v) ** {c2 = v.c2} ; -- changed
ComplSlash vp np = insertObjNP (isLightComplement np.isPron vp.c2) (\\_ => appPrep vp.c2 np.s) vp ; ComplSlash vp np = insertObjNP (isLightComplement np.isPron vp.c2) (\\_ => appPrepNP vp.c2 np) vp ;
SlashVV v vp = SlashVV v vp =
let let
@@ -61,21 +61,24 @@ concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in {
insertExtrapos vpi.p3 ( insertExtrapos vpi.p3 (
insertInf vpi.p2 ( insertInf vpi.p2 (
insertObj vpi.p1 ( insertObj vpi.p1 (
insertObj (\\_ => appPrep v.c2 np.s) ( insertObj (\\_ => appPrepNP v.c2 np) (
predVGen v.isAux v)))) ** {c2 = v.c2} ; predVGen v.isAux v)))) ** {c2 = v.c2} ;
UseComp comp = insertObj comp.s (predV sein_V) ; -- agr not used UseComp comp = insertObj comp.s (predV sein_V) ; -- agr not used
-- we want to say "ich liebe sie nicht" but not "ich bin alt nicht" -- adj slot not used here for e.g. "ich bin alt" but same behaviour as NPs?
-- "ich bin nicht alt" "ich bin nicht Doris"
UseCopula = predV sein_V ; UseCopula = predV sein_V ;
CompAP ap = {s = \\_ => ap.s ! APred} ; CompAP ap = {s = \\_ => ap.c.p1 ++ ap.s ! APred ++ ap.c.p2 ; ext = ap.ext} ;
CompNP np = {s = \\_ => np.s ! NPC Nom} ; CompNP np = {s = \\_ => np.s ! NPC Nom ++ np.adv ++ np.rc ; ext = np.ext} ;
CompAdv a = {s = \\_ => a.s} ; CompAdv a = {s = \\_ => a.s ; ext = []} ;
CompCN cn = {s = \\a => case numberAgr a of { CompCN cn = {s = \\a => case numberAgr a of {
Sg => "ein" + pronEnding ! GSg cn.g ! Nom ++ cn.s ! Strong ! Sg ! Nom ; Sg => "ein" + pronEnding ! GSg cn.g ! Nom ++ cn.s ! Strong ! Sg ! Nom ;
Pl => cn.s ! Strong ! Pl ! Nom Pl => cn.s ! Strong ! Pl ! Nom
} } ;
ext = []
} ; } ;
AdvVP vp adv = insertAdv adv.s vp ; AdvVP vp adv = insertAdv adv.s vp ;