1
0
forked from GitHub/gf-rgl

The glueing of preposition with definite article is now implemented using

NP.s : Bool => Case => Str  and   NP.w = WDefArt

np.s ! False : Case => Str is the ordinary paradigm; if the np has a
definite article, np.w = WDefArt, and np.s ! True : Case => Str is the
paradigm with definite article omitted, if np.a = Ag g Sg p.

Prepositions now have type

  Prep = {s : GenNum => Str ; s2 :Str ; c : Case ; isPrep : PrepType},

and |Prep| = |Case|*|isPrep| = 4 * 3 = 12, independent of |PCase| >= 18.

A preposition p with p.isPrep = isPrepDefArt has in p.s ! (GSg g) : Str
the preposition glued with definite article of a following np in singular.

The modified linearization categories for Prep, NP, Det, DAP, Quant,
Predet are no longer Prep', NP' etc., but Prep, NP etc. in CatGer.
They are now also used in gf-rgl/tests/german/TestLangGer.gf.
The previous auxiliary files abstract/Adjective'.gf etc. are removed.

BUT: for complexitiy reasons,
- the glueing is omitted in SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash,
- SlashVP : NP -> SlashVP -> ClSlash (in SentenceGer and TestLanGer)
  are commented out.
SlashVP causes grammar compilation to crash due to memory limits, probably
because mkClause and its modification mkClSlash are too detailed.
This commit is contained in:
Hans Leiss
2022-08-23 15:32:17 +02:00
parent 787f9d10e8
commit 1cad178ec8
42 changed files with 238 additions and 1202 deletions

View File

@@ -1,4 +1,4 @@
concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in {
concrete AdjectiveGer of Adjective = CatGer ** open ResGer, Prelude in {
flags optimize=all_subs ;
@@ -11,7 +11,7 @@ concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in {
ext = []
} ;
ComparA a np =
let nps = np.s ! False ! Nom ++ bigNP' np
let nps = np.s ! False ! Nom ++ bigNP np
in {
s = \\af => a.s ! Compar ! af ++ conjThan ++ nps ;
isPre = True ;
@@ -19,7 +19,7 @@ concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in {
ext = []
} ;
CAdvAP ad ap np =
let nps = np.s ! False ! Nom ++ bigNP' np in
let nps = np.s ! False ! Nom ++ bigNP np in
ap ** {
s = \\af => ad.s ++ ap.s ! af ++ ad.p ++ nps ;
isPre = False
@@ -42,8 +42,8 @@ concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in {
ComplA2 a np =
let CExt = case a.c2.isPrep of {
isCase => <appPrepNP' a.c2 np, []> ;
_ => <[], appPrepNP' a.c2 np> } -- HL: check 7/22
isCase => <appPrepNP a.c2 np, []> ;
_ => <[], appPrepNP a.c2 np> } -- HL: check 7/22
in {
s = a.s ! Posit ;
isPre = True ;
@@ -53,7 +53,7 @@ concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in {
ReflA2 a =
let
compl = appPrep' a.c2 (reflPron ! agrP3 Sg) ;
compl = appPrep a.c2 (reflPron ! agrP3 Sg) ;
CExt = case a.c2.isPrep of
{isCase => <compl, []> ; _ => <[], compl> }
in {

View File

@@ -1,10 +1,10 @@
concrete AdverbGer of Adverb' = CatGer ** open ResGer, Prelude in {
concrete AdverbGer of Adverb = CatGer ** open ResGer, Prelude in {
lin
PositAdvAdj a = {s = a.s ! Posit ! APred} ;
ComparAdvAdj cadv a np =
let nps = np.s ! False ! Nom ++ bigNP' np in
let nps = np.s ! False ! Nom ++ bigNP np in
{
s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ nps
} ;
@@ -12,7 +12,7 @@ concrete AdverbGer of Adverb' = CatGer ** open ResGer, Prelude in {
s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ s.s ! Sub
} ;
PrepNP prep np = {s = appPrepNP' prep np} ;
PrepNP prep np = {s = appPrepNP prep np} ;
AdAdv = cc2 ;

View File

@@ -1,6 +1,6 @@
--# -path=.:../abstract:../common:../api:../prelude
concrete AllGer of AllGerAbs' =
concrete AllGer of AllGerAbs =
LangGer,
IrregGer,
---- ExtendGer, ---- to replace ExtraGer

View File

@@ -1,5 +1,5 @@
--# -path=.:../abstract:../common:../prelude
concrete CatGer of Cat' =
concrete CatGer of Cat =
CommonX - [Tense,Temp] **
open ResGer, Prelude in {
@@ -12,14 +12,14 @@ concrete CatGer of Cat' =
S = {s : Order => Str} ;
QS = {s : QForm => Str} ;
RS = {s : RelGenNum => Str ; c : Case} ;
SSlash = {s : Order => Str} ** {c2 : Preposition'} ;
SSlash = {s : Order => Str} ** {c2 : Preposition} ;
-- Sentence
Cl = {s : Mood => ResGer.Tense => Anteriority => Polarity => Order => Str} ;
ClSlash = {
s : Mood => ResGer.Tense => Anteriority => Polarity => Order => Str ;
c2 : Preposition'
c2 : Preposition
} ;
Imp = {s : Polarity => ImpForm => Str} ;
@@ -58,35 +58,23 @@ concrete CatGer of Cat' =
adv : Str ; -- Haus [adv auf dem Hügel]
g : Gender
} ;
-- NP = ResGer.NP ;
Pron = {s : NPForm => Str ; a : Agr} ;
{-
Det, DAP = {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} ;
Quant = {
s : Bool => Number => Gender => PCase => Str ; -- Bool is True if a cardinal number is present
sp : Bool => Number => Gender => PCase => Str ;
a : Adjf ;
aPl : Adjf ; --- to distinguish "meine guten Freunde" / "gute Freunde"
} ;
Predet = {
s : Number => Gender => PCase => Str ;
c : {p : Str ; k : PredetCase} ;
a : PredetAgr -- if an agr is forced, e.g. jeder von uns ist ...
} ;
-}
-- HL: To reduce PCase to Case:
NP' = ResGer.NP' ;
Det' = {s,sp : Bool => Gender => Case => Str ; -- True if DefArt is dropped
n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ;
DAP' = {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ;
Quant' = { -- HL 7/2022: first Bool = True if used to glue in Sg with preposition
s : Bool => Bool => Number => Gender => Case => Str ; -- second Bool is True if a cardinal number is present
sp : Bool => Bool => Number => Gender => Case => Str ;
-- simplified PCase to Case in NP, Det, DAP, Quant, Predet HL 8/22
NP = ResGer.NP ;
Det = {s,sp : Bool => Gender => Case => Str ; -- True if DefArt is dropped HL 8/22
n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ;
DAP = {s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ;
-- HL 7/2022: first Bool = True if used to glue in Sg with preposition
-- second Bool is True if a cardinal number is present
Quant = {
s, sp : Bool => Bool => Number => Gender => Case => Str ;
a : Adjf ;
aPl : Adjf ; --- to distinguish "meine guten Freunde" / "gute Freunde"
hasDefArt : Bool
} ;
Predet' = {
Predet = {
s : Number => Gender => Case => Str ;
c : {p : Str ; k : PredetCase'} ;
a : PredetAgr -- if an agr is forced, e.g. jeder von uns ist ...
@@ -105,23 +93,22 @@ concrete CatGer of Cat' =
Conj = {s1,s2 : Str ; n : Number} ;
Subj = {s : Str} ;
-- Prep = Preposition ;
Prep' = Preposition' ;
Prep = Preposition ;
-- Open lexical classes, e.g. Lexicon
V, VA, VS, VQ = ResGer.Verb ; -- = {s : VForm => Str} ;
VV = Verb ** {isAux : Bool} ;
V2, V2A, V2S, V2Q = Verb ** {c2 : Preposition'} ;
V2V = Verb ** {c2 : Preposition' ; isAux : Bool ; objCtrl : Bool} ;
V3 = Verb ** {c2, c3 : Preposition'} ;
V2, V2A, V2S, V2Q = Verb ** {c2 : Preposition} ;
V2V = Verb ** {c2 : Preposition ; isAux : Bool ; objCtrl : Bool} ;
V3 = Verb ** {c2, c3 : Preposition} ;
A = {s : Degree => AForm => Str} ;
A2 = {s : Degree => AForm => Str ; c2 : Preposition'} ;
A2 = {s : Degree => AForm => Str ; c2 : Preposition} ;
N = ResGer.Noun ;
N2 = ResGer.Noun ** {c2 : Preposition'} ;
N3 = ResGer.Noun ** {c2,c3 : Preposition'} ;
N2 = ResGer.Noun ** {c2 : Preposition} ;
N3 = ResGer.Noun ** {c2,c3 : Preposition} ;
PN = {s : Case => Str; g : Gender} ;
-- tense with possibility to choose conjunctive forms
@@ -130,8 +117,7 @@ concrete CatGer of Cat' =
Tense = {s : Str ; t : ResGer.Tense ; m : Mood} ;
linref
-- NP = \np -> np.s!(NPC Nom) ++ np.ext ++ np.rc ; -- HL 6/2019
NP' = \np -> np.s ! False ! Nom ++ np.ext ++ np.rc ; -- HL 7/2022 Bool added
NP = \np -> np.s ! False ! Nom ++ np.ext ++ np.rc ; -- HL 7/2022 Bool added
CN = \cn -> cn.s ! Strong ! Pl ! Nom ++ cn.adv ++ cn.ext ++ cn.rc ! Pl ;
SSlash = \ss -> ss.s ! Main ++ ss.c2.s ! GPl ;
@@ -152,7 +138,7 @@ concrete CatGer of Cat' =
Conj = \c -> c.s1 ++ c.s2 ;
Det' = \det -> det.s ! False ! Masc ! Nom ;
Prep' = \prep -> case prep.isPrep of {isPrepDefArt => prep.s ! GSg Masc ;
_ => prep.s ! GPl } ;
Det = \det -> det.s ! False ! Masc ! Nom ;
Prep = \prep -> case prep.isPrep of {isPrepDefArt => prep.s ! GSg Masc ;
_ => prep.s ! GPl } ;
}

View File

@@ -1,4 +1,4 @@
concrete ConjunctionGer of Conjunction' =
concrete ConjunctionGer of Conjunction =
CatGer ** open ResGer, Coordination, Prelude in {
flags optimize=all_subs ;
@@ -40,21 +40,21 @@ concrete ConjunctionGer of Conjunction' =
BaseAdv = twoSS ;
ConsAdv = consrSS comma ;
BaseNP' x y = {
s1 = \\c => x.s ! False ! c ++ bigNP' x ;
s2 = \\c => y.s ! False ! c ++ bigNP' y ;
BaseNP x y = {
s1 = \\c => x.s ! False ! c ++ bigNP x ;
s2 = \\c => y.s ! False ! c ++ bigNP y ;
a = conjAgr x.a y.a } ;
ConsNP' xs x = {
s1 = \\c => xs.s ! False ! c ++ bigNP' xs ++ comma ++ x.s1 ! c ;
ConsNP xs x = {
s1 = \\c => xs.s ! False ! c ++ bigNP xs ++ comma ++ x.s1 ! c ;
s2 = x.s2 ;
a = conjAgr xs.a x.a } ;
BaseAP x y = {
BaseAP x y = lin AP {
s1 = bigAP x ;
s2 = bigAP y ;
isPre = andB x.isPre y.isPre ;
c = <[],[]> ;
ext = []} ;
ConsAP xs x = {
ConsAP xs x = lin AP {
s1 = \\a => (bigAP xs) ! a ++ comma ++ x.s1 ! a ;
s2 = x.s2 ;
isPre = andB x.isPre xs.isPre ;
@@ -62,12 +62,12 @@ concrete ConjunctionGer of Conjunction' =
ext = []} ;
BaseRS x y = twoTable RelGenNum x y ** {c = y.c} ;
ConsRS xs x = consrTable RelGenNum comma xs x ** {c = xs.c} ;
BaseCN x y = {
BaseCN x y = lin CN {
s1 = bigCN x ;
s2 = bigCN y ;
g = x.g ; --- gender of first CN, used e.g. in articles
} ;
ConsCN x xs = {
ConsCN x xs = lin CN {
s1 = \\a,n,c => bigCN x ! a ! n ! c ++ comma ++ xs.s1 ! a ! n ! c ;
s2 = xs.s2 ;
g = x.g ; --- gender of first CN, used e.g. in articles
@@ -77,8 +77,7 @@ concrete ConjunctionGer of Conjunction' =
lincat
[S] = {s1,s2 : Order => Str} ;
[Adv] = {s1,s2 : Str} ;
-- [NP] = {s1,s2 : PCase => Str ; a : Agr} ;
[NP'] = {s1,s2 : Case => Str ; a : Agr} ;
[NP] = {s1,s2 : Case => Str ; a : Agr} ;
[AP] = {s1,s2 : AForm => Str ; isPre : Bool; c : Str * Str ; ext : Str} ;
[RS] = {s1,s2 : RelGenNum => Str ; c : Case} ;
[CN] = {s1,s2 : Adjf => Number => Case => Str ; g : Gender} ;

View File

@@ -1,6 +1,6 @@
--# -path=.:../abstract
concrete ConstructionGer of Construction' = CatGer **
concrete ConstructionGer of Construction = CatGer **
open SyntaxGer, SymbolicGer, ParadigmsGer,
(L = LexiconGer), (E = ExtraGer), (G = GrammarGer), (I = IrregGer), (R = ResGer), (N = NounGer), Prelude in {
flags coding=utf8 ;
@@ -63,9 +63,9 @@ lin
monthAdv m = SyntaxGer.mkAdv inDat_Prep (mkNP the_Det m) ;
yearAdv y = SyntaxGer.mkAdv (mkPrep "im Jahr" dative) y ; ----
dayMonthAdv d m = ParadigmsGer.mkAdv ("am" ++ d.s ! dative ++ BIND ++ "." ++ m.s ! R.Sg ! R.Nom) ; -- am 17 Mai
dayMonthAdv d m = ParadigmsGer.mkAdv ("am" ++ d.s ! True ! dative ++ BIND ++ "." ++ m.s ! R.Sg ! R.Nom) ; -- am 17 Mai
monthYearAdv m y = SyntaxGer.mkAdv inDat_Prep (mkNP the_Det (mkCN m y)) ; -- im Mai 2012
dayMonthYearAdv d m y = ParadigmsGer.mkAdv ("am" ++ d.s ! dative ++ BIND ++ "." ++ m.s ! R.Sg ! R.Nom ++ y.s ! accusative) ; -- am 17 Mai 2013
dayMonthYearAdv d m y = ParadigmsGer.mkAdv ("am" ++ d.s ! True ! dative ++ BIND ++ "." ++ m.s ! R.Sg ! R.Nom ++ y.s ! False ! accusative) ; -- am 17 Mai 2013
intYear = symb ;
intMonthday = symb ;

View File

@@ -1,4 +1,4 @@
concrete ExtraGer of ExtraGerAbs' = CatGer **
concrete ExtraGer of ExtraGerAbs = CatGer **
open ResGer, Coordination, Prelude, IrregGer, (P = ParadigmsGer) in {
flags coding=utf8 ;
@@ -49,7 +49,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer **
EmptyRelSlash slash = {
s = \\m,t,a,p,gn =>
appPrep' slash.c2 (relPron ! gn) ++ slash.s ! m ! t ! a ! p ! Sub ;
appPrep slash.c2 (relPron ! gn) ++ slash.s ! m ! t ! a ! p ! Sub ;
c = slash.c2.c
} ;
@@ -67,7 +67,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer **
Pass3V3 v = -- HL 7/19
let bekommenPass : Verb = P.habenV (P.irregV "bekommen" "bekommt" "bekam" "bekäme" "bekommen")
in insertObj (\\_ => (v.s ! VPastPart APred)) (predV bekommenPass) **
{ c1 = PrepNom' ; c2 = v.c2 ; objCtrl = False } ;
{ c1 = PrepNom ; c2 = v.c2 ; objCtrl = False } ;
PastPartAP vp =
let a = agrP3 Sg in {
@@ -80,7 +80,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer **
PastPartAgentAP vp np =
let a = agrP3 Sg ;
agent = appPrepNP' P.von_Prep np
agent = appPrepNP P.von_Prep np
in {
s = \\af => (vp.nn ! a).p1 ++ (vp.nn ! a).p2 ++ (vp.nn ! a).p3
++ vp.a2 ++ agent ++ vp.inf.inpl.p2
@@ -101,7 +101,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer **
PredVPS np vpi =
let
subj = np.s ! False ! Nom ++ bigNP' np ;
subj = np.s ! False ! Nom ++ bigNP np ;
agr = np.a ;
in {
s = \\o =>
@@ -175,7 +175,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer **
RNP = {s : Agr => Case => Str} ;
lin
ReflRNP vps rnp =
insertObj (\\a => appPrep' vps.c2 (rnp.s ! a)) vps ;
insertObj (\\a => appPrep vps.c2 (rnp.s ! a)) vps ;
ReflPoss num cn = {s = \\a,c => num.s ! cn.g ! c ++ possPron a num.n cn.g c ++ cn.s ! adjfCase Strong c ! num.n ! c} ;
@@ -202,7 +202,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer **
lin
FocObj np cl =
let n = appPrepNP' cl.c2 np in mkFoc n cl ;
let n = appPrepNP cl.c2 np in mkFoc n cl ;
FocAdv adv cl = mkFoc adv.s cl ;
@@ -214,7 +214,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer **
-- "treu ist sie ihm"
-- "froh ist sie dass er da ist"
-- "stolz ist sie auf ihn"
subj = mkSubj' np vp.c1 ;
subj = mkSubj np vp.c1 ;
cl = mkClause subj.p1 subj.p2 vp
in mkFoc adj cl ;
@@ -239,7 +239,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer **
-- "es wird gelacht"; generating formal sentences
lincat
FClause = ResGer.VP ** {subj : ResGer.NP'} ;
FClause = ResGer.VP ** {subj : ResGer.NP} ;
lin
VPass v =
@@ -250,7 +250,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer **
AdvFor adv fcl = fcl ** {a2 = adv.s} ;
FtoCl cl =
let subj = mkSubj' cl.subj cl.c1
let subj = mkSubj cl.subj cl.c1
in DisToCl subj.p1 subj.p2 cl ;
@@ -259,7 +259,7 @@ concrete ExtraGer of ExtraGerAbs' = CatGer **
mkFoc : Str -> Cl -> Foc = \focus, cl ->
lin Foc {s = \\m,t,a,p => focus ++ cl.s ! m ! t ! a ! p ! Inv} ;
esSubj : CatGer.NP' = lin NP' {
esSubj : CatGer.NP = lin NP {
s = \\_,_ => "es" ;
rc, ext = [] ;
a = Ag Neutr Sg P3 ;

View File

@@ -1,6 +1,6 @@
--# -path=.:../abstract:../common:prelude
concrete GrammarGer of Grammar' =
concrete GrammarGer of Grammar =
NounGer,
VerbGer,
AdjectiveGer,

View File

@@ -1,4 +1,4 @@
concrete IdiomGer of Idiom' = CatGer **
concrete IdiomGer of Idiom = CatGer **
open MorphoGer, ParadigmsGer, Prelude in {
flags optimize=all_subs ;
@@ -10,7 +10,7 @@ concrete IdiomGer of Idiom' = CatGer **
CleftNP np rs = mkClause "es" (agrP3 Sg)
(insertExtrapos (rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a))) ----
(insertObj (\\_ => (np.s ! False ! rs.c ++ bigNP' np)) (predV MorphoGer.sein_V))) ; --HL
(insertObj (\\_ => (np.s ! False ! rs.c ++ bigNP np)) (predV MorphoGer.sein_V))) ; --HL
CleftAdv ad s = mkClause "es" (agrP3 Sg)
(insertExtrapos (conjThat ++ s.s ! Sub)
@@ -19,7 +19,7 @@ concrete IdiomGer of Idiom' = CatGer **
ExistNP np =
mkClause "es" (agrP3 Sg)
(insertObj (\\_ => appPrep' geben.c2 (np.s ! False) ++ bigNP' np)
(insertObj (\\_ => appPrep geben.c2 (np.s ! False) ++ bigNP np)
(predV geben)) ;
ExistIP ip = {
@@ -35,8 +35,7 @@ concrete IdiomGer of Idiom' = CatGer **
ExistNPAdv np adv=
mkClause "es" (agrP3 Sg)
-- (insertAdv adv.s (insertObj (\\_ => appPrep geben.c2 np.s ++ bigNP np)
(insertAdv adv.s (insertObj (\\_ => appPrep' geben.c2 (np.s ! False) ++ bigNP' np)
(insertAdv adv.s (insertObj (\\_ => appPrep geben.c2 (np.s ! False) ++ bigNP np)
(predV geben))) ;
ExistIPAdv ip adv = {
@@ -59,14 +58,14 @@ concrete IdiomGer of Idiom' = CatGer **
} ;
ImpP3 np vp = {
s = (mkClause ((mkSubj' np vp.c1).p1) np.a vp).s !
s = (mkClause ((mkSubj np vp.c1).p1) np.a vp).s !
MConjunct ! Pres ! Simul ! Pos ! Inv
} ;
SelfAdvVP vp = insertAdv "selbst" vp ;
SelfAdVVP vp = insertAdv "selbst" vp ;
SelfNP np = np ** {
s = \\_,c => np.s ! False ! c ++ "selbst" ++ bigNP' np ;
s = \\_,c => np.s ! False ! c ++ "selbst" ++ bigNP np ;
isPron = False ;
} ;

View File

@@ -1,6 +1,6 @@
--# -path=.:../abstract:../common:../api:../prelude
concrete LangGer of Lang' =
concrete LangGer of Lang =
GrammarGer,
LexiconGer
-- ,ConstructionGer

View File

@@ -11,14 +11,14 @@ oper
{s = \\_,_,_ => s ; lock_IQuant = <>} ;
mkPredet = overload {
mkPredet : A -> Predet' = \a ->
lin Predet' {
mkPredet : A -> Predet = \a ->
lin Predet {
s = appAdj' a ;
c = noCase' ;
a = PAgNone
} ;
mkPredet : A -> Str -> Case -> Bool -> Number -> Predet' = \a,p,c,b,n ->
lin Predet' {
mkPredet : A -> Str -> Case -> Bool -> Number -> Predet = \a,p,c,b,n ->
lin Predet {
s = appAdj' a ;
c = {p = p ; k = PredCase' c} ;
a = case b of {True => PAg n ; _ => PAgNone}
@@ -26,11 +26,11 @@ oper
} ;
-- e.g. das selbe
mmkQuant : Quant' -> A -> Quant' = \q,a -> q ** {
mmkQuant : Quant -> A -> Quant = \q,a -> q ** {
s,sp = \\b,x,n,g,c => q.s ! b ! x ! n ! g ! c ++ a.s ! Posit ! agrAdj g q.a n c
} ;
-- e.g. derjenige
mmbQuant : Quant' -> A -> Quant' = \q,a -> q ** {
mmbQuant : Quant -> A -> Quant = \q,a -> q ** {
s,sp = \\b,x,n,g,c => q.s ! b ! x ! n ! g ! c + a.s ! Posit ! agrAdj g q.a n c
} ;

View File

@@ -17,7 +17,7 @@ oper
-- For $StructuralGer$.
mkPrep : Str -> Case -> Preposition' = \s,c ->
mkPrep : Str -> Case -> Preposition = \s,c ->
{s = \\_ => s ; s2 = [] ; c = c ; isPrep = isPrep} ;
nameNounPhrase' : Gender -> {s : Case => Str} -> {s : Bool => Case => Str ;

View File

@@ -1,5 +1,5 @@
--# -path=.:../abstract:../common:
concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in {
flags optimize=all_subs ;
@@ -183,18 +183,18 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
} ;
ComplN2 f x = {
s = \\_,n,c => f.s ! n ! c ++ appPrepNP' f.c2 x ;
s = \\_,n,c => f.s ! n ! c ++ appPrepNP f.c2 x ;
g = f.g ;
rc = \\_ => [] ;
ext,adv = []
} ;
ComplN3 f x = {
s = \\n,c => f.s ! n ! c ++ appPrepNP' f.c2 x ;
co = f.co ++ appPrepNP' f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2
s = \\n,c => f.s ! n ! c ++ appPrepNP f.c2 x ;
co = f.co ++ appPrepNP f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2
uncap = {
s = \\n,c => f.uncap.s ! n ! c ++ appPrepNP' f.c2 x ;
co = f.uncap.co ++ appPrepNP' f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2
s = \\n,c => f.uncap.s ! n ! c ++ appPrepNP f.c2 x ;
co = f.uncap.co ++ appPrepNP f.c2 x ; ---- should not occur at all; the abstract syntax is problematic in giving N2
} ;
g = f.g ;
c2 = f.c3 ;
@@ -231,15 +231,15 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
AdvCN cn a = cn ** {adv = cn.adv ++ a.s} ;
ApposCN cn np = let g = cn.g in cn ** {
s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! c ++ bigNP' np } ;
s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! c ++ bigNP np } ;
-- PossNP cn np = cn ** {
-- s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! NPP CVonDat ++ bigNP np } ;
PossNP cn np = cn ** {
s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep' vonDat' (np.s ! False) ++ bigNP' np } ; -- HL, ad hoc
s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep vonDat (np.s ! False) ++ bigNP np } ; -- HL, ad hoc
PartNP cn np = case np.w of {
WPron' => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep' vonDat' (np.s ! False) ++ np.rc} ;
WPron' => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ appPrep vonDat (np.s ! False) ++ np.rc} ;
_ => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! Gen} -- HL 7/2022, ad hoc
}; -- glass of wine
@@ -247,7 +247,7 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
-- det or numeral? np or rather (DefArt +) cn? drei (einiger Kinder) ?
let g = genderAgr np.a
in {
s = \\b,c => det.s ! b ! g ! c ++ appPrepNP' vonDat' np ++ bigNP' np ;
s = \\b,c => det.s ! b ! g ! c ++ appPrepNP vonDat np ++ bigNP np ;
a = agrgP3 g det.n ;
w = case det.isDef of { True => WLight' ; _ => WHeavy' } ;
rc = np.rc ;

View File

@@ -102,7 +102,7 @@ mkN : overload {
mkN2 : overload {
mkN2 : Str -> N2 ; --%
mkN2 : N -> N2 ; -- noun + von
mkN2 : N -> Prep' -> N2 -- noun + other preposition
mkN2 : N -> Prep -> N2 -- noun + other preposition
} ;
-- Use the function $mkPrep$ or see the section on prepositions below to
@@ -111,7 +111,7 @@ mkN : overload {
--
-- Three-place relational nouns ("die Verbindung von x nach y") need two prepositions.
mkN3 : N -> Prep' -> Prep' -> N3 ; -- noun + two prepositions
mkN3 : N -> Prep -> Prep -> N3 ; -- noun + two prepositions
--3 Proper names and noun phrases
--
@@ -168,7 +168,7 @@ mkN : overload {
-- Two-place adjectives are formed by adding a preposition to an adjective.
mkA2 : A -> Prep' -> A2 ; -- e.g. teilbar + durch
mkA2 : A -> Prep -> A2 ; -- e.g. teilbar + durch
--2 Adverbs
@@ -182,28 +182,28 @@ mkN : overload {
-- A preposition is formed from a string and a case.
mkPrep : overload {
mkPrep : Str -> Case -> Prep' ; -- e.g. "durch" + accusative
mkPrep : Case -> Str -> Prep' ; -- postposition
mkPrep : Str -> Case -> Str -> Prep' ; -- both sides
mkPrep : Str -> Case -> Prep ; -- e.g. "durch" + accusative
mkPrep : Case -> Str -> Prep ; -- postposition
mkPrep : Str -> Case -> Str -> Prep ; -- both sides
-- for preposition glued with DefArt in singular:
-- e.g. "auf" "auf den" "auf die" "aufs" + accusative
mkPrep : Str -> Str -> Str -> Str-> Case -> Prep' ;
mkPrep : Case -> Prep' ; -- convert case to preposition
mkPrep : Str -> Str -> Str -> Str-> Case -> Prep ;
mkPrep : Case -> Prep ; -- convert case to preposition
} ;
-- Often just a case with the empty string is enough.
accPrep : Prep' ; -- no string, just accusative case
datPrep : Prep' ; -- no string, just dative case
genPrep : Prep' ; -- no string, just genitive case
accPrep : Prep ; -- no string, just accusative case
datPrep : Prep ; -- no string, just dative case
genPrep : Prep ; -- no string, just genitive case
-- A couple of common prepositions (the first two always with the dative).
von_Prep : Prep' ; -- von + dative, with contraction vom
zu_Prep : Prep' ; -- zu + dative, with contractions zum, zur
anDat_Prep : Prep' ; -- an + dative, with contraction am
inDat_Prep : Prep' ; -- in + dative, with contraction im
inAcc_Prep : Prep' ; -- in + accusative, with contraction ins
von_Prep : Prep ; -- von + dative, with contraction vom
zu_Prep : Prep ; -- zu + dative, with contractions zum, zur
anDat_Prep : Prep ; -- an + dative, with contraction am
inDat_Prep : Prep ; -- in + dative, with contraction im
inAcc_Prep : Prep ; -- in + accusative, with contraction ins
--2 Verbs
@@ -273,7 +273,7 @@ mkV2 : overload {
-- Two-place verbs with a preposition.
mkV2 : V -> Prep' -> V2 ; -- preposition for complement
mkV2 : V -> Prep -> V2 ; -- preposition for complement
-- Two-place verbs with object in the given case.
@@ -287,11 +287,11 @@ mkV2 : overload {
-- the first one or both can be absent.
accdatV3 : V -> V3 ; -- geben + dat(c2) + acc(c3) (Eng: no prepositions)
dirV3 : V -> Prep' -> V3 ; -- senden + acc + nach (preposition on second arg)
dirV3 : V -> Prep -> V3 ; -- senden + acc + nach (preposition on second arg)
mkV3 : overload {
mkV3 : V -> V3 ; -- geben + dat(c3) + acc(c2) (Eng: give sth to-sb)
mkV3 : V -> Prep' -> Prep' -> V3 ; -- sprechen + mit + über
mkV3 : V -> Prep -> Prep -> V3 ; -- sprechen + mit + über
} ;
--3 Other complement patterns
@@ -314,15 +314,15 @@ mkV2 : overload {
mkV2A : overload {
mkV2A : V -> V2A ;
mkV2A : V -> Prep' -> V2A ;
mkV2A : V -> Prep -> V2A ;
} ;
mkV2S : overload {
mkV2S : V -> V2S ;
mkV2S : V -> Prep' -> V2S ;
mkV2S : V -> Prep -> V2S ;
} ;
mkV2Q : overload {
mkV2Q : V -> V2Q ;
mkV2Q : V -> Prep' -> V2Q ;
mkV2Q : V -> Prep -> V2Q ;
} ;
@@ -338,9 +338,9 @@ mkV2 : overload {
mkAS : A -> AS ; --%
mkA2S : A -> Prep' -> A2S ; --%
mkA2S : A -> Prep -> A2S ; --%
mkAV : A -> AV ; --%
mkA2V : A -> Prep' -> A2V ; --%
mkA2V : A -> Prep -> A2V ; --%
-- Notice: categories $AS, A2S, AV, A2V$ are just $A$,
-- and the second argument is given as an adverb. Likewise
@@ -447,11 +447,11 @@ mkV2 : overload {
mkN2 = overload {
mkN2 : Str -> N2 = \s -> vonN2 (regN s) ;
mkN2 : N -> N2 = vonN2 ;
mkN2 : N -> Prep' -> N2 = mmkN2
mkN2 : N -> Prep -> N2 = mmkN2
} ;
mmkN2 : N -> Prep' -> N2 = \n,p -> n ** {c2 = p ; lock_N2 = <>} ;
mmkN2 : N -> Prep -> N2 = \n,p -> n ** {c2 = p ; lock_N2 = <>} ;
vonN2 : N -> N2 = \n -> n ** {c2 = von_Prep ; lock_N2 = <>} ;
mkN3 = \n,p,q -> n ** {c2 = p ; c3 = q ; lock_N3 = <>} ;
@@ -502,17 +502,17 @@ mkV2 : overload {
mkAdv s = {s = s ; lock_Adv = <>} ;
mkPrep = overload {
mkPrep : Str -> Case -> Prep' = \s,c ->
{s = \\_ => s ; s2 = [] ; c = c ; isPrep = isPrep ; lock_Prep' = <>} ;
mkPrep : Case -> Str -> Prep' = \c,s ->
{s = \\_ => [] ; s2 = s ; c = c ; isPrep = isPrep ; lock_Prep' = <>} ;
mkPrep : Str -> Case -> Str -> Prep' = \s,c,t ->
{s = \\_ => s ; s2 = t ; c = c ; isPrep = isPrep ; lock_Prep' = <>} ;
mkPrep : Str -> Str -> Str -> Str-> Case -> Prep' = \s,masc,fem,neutr, c ->
mkPrep : Str -> Case -> Prep = \s,c ->
{s = \\_ => s ; s2 = [] ; c = c ; isPrep = isPrep ; lock_Prep = <>} ;
mkPrep : Case -> Str -> Prep = \c,s ->
{s = \\_ => [] ; s2 = s ; c = c ; isPrep = isPrep ; lock_Prep = <>} ;
mkPrep : Str -> Case -> Str -> Prep = \s,c,t ->
{s = \\_ => s ; s2 = t ; c = c ; isPrep = isPrep ; lock_Prep = <>} ;
mkPrep : Str -> Str -> Str -> Str-> Case -> Prep = \s,masc,fem,neutr, c ->
{s = table{GPl => s ; GSg Masc => masc ; GSg Fem => fem ; GSg Neutr => neutr} ;
s2 = [] ; c = c ; isPrep = isPrepDefArt ; lock_Prep' = <>} ;
mkPrep : Case -> Prep' = \c ->
{s = \\_ => [] ; s2 = [] ; c = c ; isPrep = isCase ; lock_Prep' = <>} ;
s2 = [] ; c = c ; isPrep = isPrepDefArt ; lock_Prep = <>} ;
mkPrep : Case -> Prep = \c ->
{s = \\_ => [] ; s2 = [] ; c = c ; isPrep = isCase ; lock_Prep = <>} ;
} ;
accPrep = mkPrep accusative ;
@@ -590,7 +590,7 @@ mkV2 : overload {
mkV3 = overload {
mkV3 : V -> V3
= \v -> lin V3 (v ** {c2 = accPrep ; c3 = datPrep}) ;
mkV3 : V -> Prep' -> Prep' -> V3
mkV3 : V -> Prep -> Prep -> V3
= \v,c,d -> lin V3 (v ** {c2 = c ; c3 = d}) ;
} ;
@@ -611,38 +611,38 @@ mkV2 : overload {
mkV2V = overload { -- default: object-control
mkV2V : V -> V2V
= \v -> dirV2 v ** {isAux = False ; objCtrl = True ; lock_V2V = <>} ; -- ermahne jmdn, sich zu waschen
mkV2V : V -> Prep' -> V2V
mkV2V : V -> Prep -> V2V
= \v,p -> prepV2 v p ** {isAux = False ; objCtrl = True ; lock_V2V = <>} ;
} ;
auxV2V = overload {
auxV2V : V -> V2V
= \v -> dirV2 v ** {isAux = True ; objCtrl = True ; lock_V2V = <>} ; -- lasse jmdn sich waschen
auxV2V : V -> Prep' -> V2V
auxV2V : V -> Prep -> V2V
= \v,p -> prepV2 v p ** {isAux = True ; objCtrl = True ; lock_V2V = <>} ;
} ;
subjV2V v = v ** {objCtrl = False} ;
mkV2A = overload {
mkV2A : V -> V2A = \v -> dirV2 v ** {isAux = False ; lock_V2A = <>} ;
mkV2A : V -> Prep' -> V2A
mkV2A : V -> Prep -> V2A
= \v,p -> prepV2 v p ** {isAux = False ; lock_V2A = <>} ;
} ;
mkV2S = overload {
mkV2S : V -> V2S
= \v -> dirV2 v ** {isAux = False ; lock_V2S = <>} ;
mkV2S : V -> Prep' -> V2S
mkV2S : V -> Prep -> V2S
= \v,p -> prepV2 v p ** {isAux = False ; lock_V2S = <>} ;
} ;
mkV2Q = overload {
mkV2Q : V -> V2Q
= \v -> dirV2 v ** {isAux = False ; lock_V2Q = <>} ;
mkV2Q : V -> Prep' -> V2Q
mkV2Q : V -> Prep -> V2Q
= \v,p -> prepV2 v p ** {isAux = False ; lock_V2Q = <>} ;
} ;
mkVA = overload {
mkVA : V -> VA = \v -> lin VA (dirV2 v) ;
mkVA : V -> Prep' -> VA = \v,p -> lin VA (v ** {c2 = p}) ;
mkVA : V -> Prep -> VA = \v,p -> lin VA (v ** {c2 = p}) ;
} ;
mkAS v = v ** {lock_A = <>} ;
@@ -713,7 +713,7 @@ mkV2 : overload {
};
prepV2 : V -> Prep' -> V2 ;
prepV2 : V -> Prep -> V2 ;
dirV2 : V -> V2 ;
@@ -722,7 +722,7 @@ mkV2 : overload {
mkV2 = overload {
mkV2 : Str -> V2 = \s -> dirV2 (regV s) ;
mkV2 : V -> V2 = dirV2 ;
mkV2 : V -> Prep' -> V2 = prepV2;
mkV2 : V -> Prep -> V2 = prepV2;
mkV2 : V -> Case -> V2 = \v,c -> prepV2 v (mkPrep c) ;
} ;

View File

@@ -1,5 +1,5 @@
--# -path=.:../abstract:../common:prelude -- HL
concrete PhraseGer of Phrase' = CatGer ** open Prelude, ResGer in {
concrete PhraseGer of Phrase = CatGer ** open Prelude, ResGer in {
flags optimize=all_subs ;
@@ -14,7 +14,7 @@ concrete PhraseGer of Phrase' = CatGer ** open Prelude, ResGer in {
UttIP ip = {s = ip.s ! Nom} ; --- Acc also
UttIAdv iadv = iadv ;
UttNP np = {s = np.s ! False ! Nom ++ bigNP' np} ;
UttNP np = {s = np.s ! False ! Nom ++ bigNP np} ;
UttVP vp = {s = useInfVP True vp} ; -- without zu
UttAdv adv = adv ;
UttCN n = {s = n.s ! Strong ! Sg ! Nom ++ n.adv ++ n.ext ++ n.rc ! Sg} ;
@@ -26,6 +26,6 @@ concrete PhraseGer of Phrase' = CatGer ** open Prelude, ResGer in {
PConjConj conj = ss (conj.s2) ;
NoVoc = {s = []} ;
VocNP np = {s = "," ++ np.s ! False ! Nom ++ bigNP' np} ;
VocNP np = {s = "," ++ np.s ! False ! Nom ++ bigNP np} ;
}

View File

@@ -1,4 +1,4 @@
concrete QuestionGer of Question' = CatGer ** open ResGer in {
concrete QuestionGer of Question = CatGer ** open ResGer in {
flags optimize=all_subs ;
@@ -28,8 +28,7 @@ concrete QuestionGer of Question' = CatGer ** open ResGer in {
s = \\m,t,a,p =>
let
cls = slash.s ! m ! t ! a ! p ;
-- who = appPrep slash.c2 (\\k => usePrepC k (\c -> ip.s ! c)) ;
who = appPrep' slash.c2 ip.s ;
who = appPrep slash.c2 ip.s ;
in table {
QDir => who ++ cls ! Inv ;
QIndir => who ++ cls ! Sub
@@ -51,7 +50,7 @@ concrete QuestionGer of Question' = CatGer ** open ResGer in {
s = \\m,t,a,p =>
let
vp = predV sein_V ** {ext = icomp.ext};
subj = mkSubj' np vp.c1 ;
subj = mkSubj np vp.c1 ;
cls = (mkClause subj.p1 subj.p2 vp).s ! m ! t ! a ! p ;
why = icomp.s ! np.a
in table {
@@ -61,7 +60,7 @@ concrete QuestionGer of Question' = CatGer ** open ResGer in {
} ;
PrepIP p ip = {
s = appPrep' p ip.s ;
s = appPrep p ip.s ;
} ;
AdvIP ip adv = {

View File

@@ -1,4 +1,4 @@
concrete RelativeGer of Relative' = CatGer ** open Prelude, ResGer in {
concrete RelativeGer of Relative = CatGer ** open Prelude, ResGer in {
flags optimize=all_subs ;
@@ -28,16 +28,12 @@ concrete RelativeGer of Relative' = CatGer ** open Prelude, ResGer in {
RelSlash rp slash = {
s = \\m,t,a,p,gn =>
-- appPrep slash.c2 (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ++
appPrep' slash.c2 (rp.s ! gn) ++
slash.s ! m ! t ! a ! p ! Sub ;
-- c = (prepC slash.c2.c).c
appPrep slash.c2 (rp.s ! gn) ++ slash.s ! m ! t ! a ! p ! Sub ;
c = slash.c2.c
} ;
FunRP p np rp = {
-- s = \\gn,c => np.s ! NPC c ++ appPrep p (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ;
s = \\gn,c => np.s ! False ! c ++ appPrep' p (rp.s ! gn) ;
s = \\gn,c => np.s ! False ! c ++ appPrep p (rp.s ! gn) ;
a = RAg (numberAgr np.a) (personAgr np.a)
} ;

View File

@@ -228,7 +228,7 @@ resource ResGer = ParamX ** open Prelude in {
g : Gender
} ;
NP' : Type = { -- HL 7/22: Bool = True if DefArt is dropped to combine with prep of type isPrepDefArt
NP : Type = { -- HL 7/22: Bool = True if DefArt is dropped to combine with prep of type isPrepDefArt
s : Bool => Case => Str ;
rc : Str ; -- die Frage , [rc die ich gestellt habe]
ext : Str ; -- die Frage , [sc wo sie schläft] ; die Regel , [vp kein Fleisch zu essen] | [s dass ...]
@@ -405,18 +405,18 @@ resource ResGer = ParamX ** open Prelude in {
PrepType = isCase | isPrep | isPrepDefArt ;
oper
Preposition' : Type = {s : GenNum => Str ; s2:Str ; c : Case ; isPrep : PrepType} ;
Preposition : Type = {s : GenNum => Str ; s2:Str ; c : Case ; isPrep : PrepType} ;
isaCase : Preposition' -> Bool = \p -> case p.isPrep of {isCase => True ; _ => False} ;
isaPrep : Preposition' -> Bool = \p -> case p.isPrep of {isPrep => True ; _ => False} ;
isaPrepDefArt : Preposition' -> Bool = \p -> case p.isPrep of {isPrepDefArt => True ; _ => False} ;
isaCase : Preposition -> Bool = \p -> case p.isPrep of {isCase => True ; _ => False} ;
isaPrep : Preposition -> Bool = \p -> case p.isPrep of {isPrep => True ; _ => False} ;
isaPrepDefArt : Preposition -> Bool = \p -> case p.isPrep of {isPrepDefArt => True ; _ => False} ;
-- To apply a preposition to a complement.
appPrep' : Preposition' -> (Case => Str) -> Str = \prep,arg ->
appPrep : Preposition -> (Case => Str) -> Str = \prep,arg ->
prep.s ! GPl ++ arg ! prep.c ++ prep.s2 ;
appPrepNP' : Preposition' -> NP' -> Str = \prep,np ->
appPrepNP : Preposition -> NP -> Str = \prep,np ->
let
g = (genderAgr np.a) ;
n = (numberAgr np.a) ;
@@ -428,27 +428,36 @@ resource ResGer = ParamX ** open Prelude in {
prep.s ! (GSg g) ++ nps ++ np.ext ++ prep.s2 ++ np.rc ;
_ => prep.s ! GPl ++ nps ++ np.ext ++ prep.s2 ++ np.rc
} ;
bigNP' : NP' -> Str = \np -> np.ext ++ np.rc ;
{-
-- Simplify to test the effect on grammar compilation complexity (without SlashV2VNP):
-- with glues = False: 27096 msec, 3,2M VerbGer.gfo, 854K SentenceGer.gfo
-- and SlashV2VNP:102597 msec, 16 M VerbGer.gfo, 854K SentenceGer.gfo (good!)
appPrepNP : Preposition -> NP -> Str = \prep,np ->
let
glues = False ;
nps = np.s ! glues ! prep.c
in prep.s ! GPl ++ nps ++ np.ext ++ prep.s2 ++ np.rc ;
-}
bigNP : NP -> Str = \np -> np.ext ++ np.rc ;
-- To build a preposition from just a case. -- HL 9/19: moved to mkPrep in ParadigmsGer
PrepNom' : Preposition' = {s = \\_ => []; isPrep = isCase ; c = Nom ; s2 = []} ;
PrepNom : Preposition = {s = \\_ => []; isPrep = isCase ; c = Nom ; s2 = []} ;
vonDat' : Preposition' = {s=table{GPl => "von" ; GSg Fem => "von der"; _ => "vom"};
s2=[]; c=Dat; isPrep=isPrepDefArt} ;
vonDat : Preposition = {s=table{GPl => "von" ; GSg Fem => "von der"; _ => "vom"};
s2=[]; c=Dat; isPrep=isPrepDefArt} ;
-- for testing:
Dat' : Preposition' = {s = \\_ => []; s2 = []; c=Dat; isPrep=isCase} ;
mit' : Preposition' = {s = \\_ => "zusammen mit"; s2 = []; c=Dat; isPrep=isPrep} ;
Dat' : Preposition = {s = \\_ => []; s2 = []; c=Dat; isPrep=isCase} ;
mit' : Preposition = {s = \\_ => "zusammen mit"; s2 = []; c=Dat; isPrep=isPrep} ;
zuDat' : Preposition' = {s=\\_ => "zu"; s2="herein"; c=Dat; isPrep=isPrep} ;
zum' : Preposition' = {s= table{GPl => "zu"; GSg Fem =>"zur"; _ => "zum"};
zuDat' : Preposition = {s=\\_ => "zu"; s2="herein"; c=Dat; isPrep=isPrep} ;
zum' : Preposition = {s= table{GPl => "zu"; GSg Fem =>"zur"; _ => "zum"};
s2="herein"; c=Dat; isPrep=isPrepDefArt} ;
inDat' : Preposition' = {s= \\_ => "in" ; s2="drin"; c=Dat; isPrep=isPrep} ;
im' : Preposition' = {s= table{GPl => "in"; GSg Fem=>"in der"; _ =>"im"};
inDat' : Preposition = {s= \\_ => "in" ; s2="drin"; c=Dat; isPrep=isPrep} ;
im' : Preposition = {s= table{GPl => "in"; GSg Fem=>"in der"; _ =>"im"};
s2="drin"; c=Dat; isPrep=isPrepDefArt} ;
inAcc' : Preposition' = {s=\\_ => "in"; s2="hinein"; c=Acc; isPrep=isPrep} ;
ins' : Preposition' = {s=table{GPl => "in"; GSg Masc=>"in den"; GSg Fem=>"in die"; GSg Neutr=>"ins"};
inAcc' : Preposition = {s=\\_ => "in"; s2="hinein"; c=Acc; isPrep=isPrep} ;
ins' : Preposition = {s=table{GPl => "in"; GSg Masc=>"in den"; GSg Fem=>"in die"; GSg Neutr=>"ins"};
s2="hinein"; c=Acc; isPrep=isPrepDefArt} ;
-- Pronouns and articles
@@ -558,9 +567,9 @@ resource ResGer = ParamX ** open Prelude in {
ext : Str ; -- sentential complement of V(2)S, V(2)Q, e.g. dass|ob sie kommt
inf : {inpl: (Agr => Str)*Str ; -- infinitival complement of V(2)V HL 3/2022
extr: (Agr => Str)} ; -- e.g. ihn [] versuchen (lasse) [, ihr zu helfen]
c1 : Preposition' -- case of subject
c1 : Preposition -- case of subject
} ;
VPSlash = VP ** {c2 : Preposition' ; objCtrl : Bool} ; -- HL 3/2019 objCtr added
VPSlash = VP ** {c2 : Preposition ; objCtrl : Bool} ; -- HL 3/2019 objCtr added
-- objCtrl distinguishes object-control from subject-control verb v:V2V in VP.s:
-- if True, reflexives in vp.inf and vp.nn have to agree with c2-object (added
@@ -622,7 +631,7 @@ resource ResGer = ParamX ** open Prelude in {
predV : Verb -> VP = predVGen False ;
predVc : Verb ** {c2 : Preposition'} -> VPSlash = \v ->
predVc : Verb ** {c2 : Preposition} -> VPSlash = \v ->
predV v ** {c2 = v.c2 ; objCtrl = False} ;
predVGen : Bool -> Verb -> VP = \isAux, verb -> {
@@ -636,7 +645,7 @@ resource ResGer = ParamX ** open Prelude in {
-- default infinitival complement:
inf = {inpl = <\\_ => [], []>; extr = \\_ => []} ;
ext,adj : Str = [] ;
c1 = PrepNom'
c1 = PrepNom
} ;
auxPerfect : Verb -> VForm => Str = \verb ->
@@ -711,16 +720,20 @@ resource ResGer = ParamX ** open Prelude in {
insertObjc : (Agr => Str) -> VPSlash -> VPSlash = \obj,vp ->
insertObj obj vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl } ;
insertObjNP' : NP' -> Preposition' -> VPSlash -> VPSlash = \np,prep,vp ->
let c = prep.c ;
obj = appPrepNP' prep np ;
isPrep : Bool = case prep.isPrep of {isPrep | isPrepDefArt => True ; _ => False} ;
in vp ** {
insertObjNP : NP -> Preposition -> VPSlash -> VPSlash = \np,prep,vp ->
let obj = appPrepNP prep np ;
b : Bool = case prep.isPrep of {isPrep | isPrepDefArt => True ; _ => False} ;
w = np.w ;
c = prep.c
in insertObj' obj b w c vp ;
insertObj' : Str -> Bool -> Weight' -> Case -> VPSlash -> VPSlash = \obj,isPrep,w,c,vp ->
vp ** {
nn = \\a =>
let vpnn = vp.nn ! a in
-- HL 11/6/19: rough object NP order (expensive):
-- vfin < accPron < refl < (gen|dat)Pron < lightNP < neg < heavyNP|PP < vinf|comp
case <isPrep, np.w, c> of { -- 2 * 3 * 4 = 24 cases
case <isPrep, w, c> of { -- 2 * 3 * 4 = 24 cases
<True, _,_> => -- <prons, light, heavy++pp, compl>
<vpnn.p1, vpnn.p2, vpnn.p3 ++ obj, vpnn.p4> ;
<False,WPron', Acc> => -- <ihn ++ sich, light, heavy, comp>
@@ -732,8 +745,8 @@ resource ResGer = ParamX ** open Prelude in {
<vpnn.p1, obj ++ vpnn.p2, vpnn.p3, vpnn.p4> ;
<False,WLight',_ > => -- <prons, np ++ gen|acc, heavy, comp>
<vpnn.p1, vpnn.p2 ++ obj, vpnn.p3, vpnn.p4> ;
-- <False,WHeavy'|WDefArt,Dat> => -- <prons, light, dat ++ np, comp>
-- <vpnn.p1, vpnn.p2, obj ++ vpnn.p3, vpnn.p4> ;
<False,WHeavy'|WDefArt,Dat> => -- <prons, light, dat ++ np, comp>
<vpnn.p1, vpnn.p2, obj ++ vpnn.p3, vpnn.p4> ;
<False,WHeavy'|WDefArt,_ > => -- <prons, light, np ++ gen|acc, comp>
<vpnn.p1, vpnn.p2, vpnn.p3 ++ obj, vpnn.p4> }
} ; -- the ordering of objects of v:V3 (and v:V4) is also determined by Slash?V3 (and Slash?V4)
@@ -983,7 +996,7 @@ resource ResGer = ParamX ** open Prelude in {
infPart : Bool -> Str = \b -> if_then_Str b [] "zu" ;
heavyNP' :
heavyNP :
{s : Bool => Case => Str ; a : Agr} -> {s : Bool => Case => Str ; a : Agr ; w : Weight' ; ext,rc : Str} = \np ->
np ** {w = WHeavy' ; ext,rc = []} ; -- this could be wrong
@@ -1002,10 +1015,10 @@ resource ResGer = ParamX ** open Prelude in {
-- Function that allows the construction of non-nominative subjects.
mkSubj' : NP' -> Preposition' -> Str * Agr = \np, prep ->
mkSubj : NP -> Preposition -> Str * Agr = \np, prep ->
let
agr = case prep.c of { Nom => np.a ; _ => Ag Masc Sg P3 } ;
subj = appPrepNP' prep np
subj = appPrepNP prep np
in <subj , agr> ;
}

View File

@@ -1,11 +1,11 @@
concrete SentenceGer of Sentence' = CatGer ** open ResGer, Prelude in {
concrete SentenceGer of Sentence = CatGer ** open ResGer, Prelude in {
flags optimize=all_subs ;
lin
PredVP np vp =
let subj = mkSubj' np vp.c1
let subj = mkSubj np vp.c1
in mkClause subj.p1 subj.p2 vp ;
{- applies verb's subject case to subject ;
@@ -33,10 +33,10 @@ concrete SentenceGer of Sentence' = CatGer ** open ResGer, Prelude in {
verb.fin ++ ps.p2 ++ (vp.nn ! agr).p1 ++ vp.a1 ++ negation ! pol ++ obj ++ vp.a2 ++ inf ++ vp.ext
} ;
-- to save (67299 - 27432 = 39863 msec) compile time: HL 7/22, comment out:
SlashVP np vp =
let subj = mkSubj' np vp.c1 ; -- HL 3/2022: need a mkClSlash to prevent
{- SlashVP np vp =
let subj = mkSubj np vp.c1 ; -- HL 3/2022: need a mkClSlash to prevent
in mkClause subj.p1 subj.p2 vp ** { c2 = vp.c2 } ; -- reflexives in vp instantiated to np.a
-} -- cf. tests/german/TestLangGer.gf
AdvSlash slash adv = {
s = \\m,t,a,b,o => slash.s ! m ! t ! a ! b ! o ++ adv.s ;
c2 = slash.c2
@@ -45,7 +45,7 @@ concrete SentenceGer of Sentence' = CatGer ** open ResGer, Prelude in {
SlashPrep cl prep = cl ** {c2 = prep} ;
SlashVS np vs slash =
let subj = mkSubj' np PrepNom' ;
let subj = mkSubj np PrepNom ;
vp = (insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs))
in mkClause subj.p1 subj.p2 vp ** {c2 = slash.c2} ;

View File

@@ -1,4 +1,4 @@
concrete StructuralGer of Structural' = CatGer **
concrete StructuralGer of Structural = CatGer **
open MorphoGer, MakeStructuralGer, (X = ConstructX),
(P = ParadigmsGer), IrregGer, Prelude in {

View File

@@ -9,27 +9,28 @@ lin
NumPN i = {s = i.s ! Neutr ; g = Neutr} ; --- c
CNIntNP cn i = {
s = \\c => cn.s ! Weak ! Sg ! Nom ++ i.s ;
s = \\b,c => cn.s ! Weak ! Sg ! Nom ++ i.s ;
a = agrP3 Sg ;
-- isPron = False ;
-- isLight = True ;
w = WLight ;
w = WLight' ;
ext,rc = [] -- added
} ;
CNSymbNP det cn xs = let g = cn.g in {
s = \\c => det.s ! g ! c ++
(let k = (prepC c).c in cn.s ! adjfCase det.a k ! det.n ! k) ++ xs.s ;
s = \\b,c => det.s ! b ! g ! c ++
-- (let k = (prepC c).c in cn.s ! adjfCase det.a k ! det.n ! k) ++ xs.s ;
(let k = c in cn.s ! adjfCase det.a k ! det.n ! k) ++ xs.s ;
a = agrP3 det.n ;
-- isPron = False ;
-- isLight = True ;
w = WLight ;
w = WLight' ;
ext,rc = [] -- added
} ;
CNNumNP cn i = {
-- s = \\c => artDefContr (GSg cn.g) c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ;
s = \\c => artDef (GSg cn.g) c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ;
s = \\_,c => artDef ! (GSg cn.g) ! c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ; -- HL 8/22 ad hoc
a = agrP3 Sg ;
w = WLight ;
w = WLight' ;
ext,rc = []
} ;

View File

@@ -1,4 +1,4 @@
concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in {
concrete VerbGer of Verb = CatGer ** open Prelude, ResGer, Coordination in {
flags optimize=all_subs ;
@@ -21,8 +21,8 @@ concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in {
SlashV2a v = (predVc v) ;
Slash2V3 v np = insertObjNP' np v.c2 (predVc v) ** {c2 = v.c3} ;
Slash3V3 v np = insertObjNP' np v.c3 (predVc v) ;
Slash2V3 v np = insertObjNP np v.c2 (predVc v) ** {c2 = v.c3} ;
Slash3V3 v np = insertObjNP np v.c3 (predVc v) ;
SlashV2S v s =
insertExtrapos (comma ++ conjThat ++ s.s ! Sub) (predV v) ** {c2 = v.c2; objCtrl = False} ;
@@ -46,7 +46,7 @@ concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in {
-- HL 3/22 better before inserting np, using objCtrl
let vp = case vps.objCtrl of { True => objAgr np vps ; _ => vps }
** { c2 = vps.c2 ; objCtrl = vps.objCtrl } ;
in insertObjNP' np vps.c2 vp ;
in insertObjNP np vps.c2 vp ;
-- compiler: + ComplSlash' 414720 (199680,352)
-- SlashVV v vps is like ComplVV v vp, but infinite vps should not be extracted
@@ -92,13 +92,17 @@ concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in {
-- expensive: + SlashV2VNP 503.884.800 (2880,540), reaches memory limit with SlashVV
-- does not work for nested uses: the nn-levels are confused HL 3/22
-- SlashV2VNP v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22
-- insertObjNP np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ;
-- without: 205539 msec
-- to save (571098 = 83669 = 487429 msec) compile time (in 58% memory), comment out:
-- SlashV2VNP v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22
-- insertObjNP' np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ;
-- to save a lot compile time and memory, avoid insertObjNP with glueing of prep+DefArt:
SlashV2VNP v np vp = -- bitte ihn, zu kaufen | lasse ihn kaufen HL 3/22
-- insertObjNP np v.c2 (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl}) ;
let prep = v.c2 ;
obj = appPrep prep (np.s!False) ; -- simplify: no glueing of prep+DefArt, HL 8/22
b : Bool = case prep.isPrep of {isPrep | isPrepDefArt => True ; _ => False} ;
c = prep.c ;
w = np.w ;
vps = (ComplVV v vp ** {c2 = vp.c2 ; objCtrl = vp.objCtrl})
in
insertObj' obj b w c vps ;
UseComp comp =
insertExtrapos comp.ext (insertObj comp.s (predV sein_V)) ; -- agr not used