mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 08:58:55 -06:00
The files for GrammarGer and AllGer (but not Construction, Documentation, Markup)
are edited to allow for glued Prep+DefArt, using new categories NP',Det',Quant',
Predet',DAP'.
The previous NP.s : Case => Str*Str allows parsing
"in dem Meer" = in_Prep ++ (np.s ! Case).p1
"im Meer" = in_Prep ++ (np.s ! Case).p2,
but since only one of the strings of (np.s!Case) is used, the tree
contains a metavariable like ?2 (the grammar is "erasing"). (Similarly, if we used
NP.s : Case => Str and NP.s2 : Case => Str.)
To get rid of the metavariables, we have to choose BY A PARAMETER, say
NP.s : droppedDefArt? => Case => Str
Using np.a = Ag g n p, the preposition can select between preposition
alone or preposition with definite article (glued or not), via
Prep = {s : GenNum => Str ; s2 :Str ; c : Case ; isPrep : PrepType }
The combination is done in appPrepNP' and appPrep'. This is
independent of the number of glued Prep+DefArt. But LangGer compiles
now in 200s using 30% memory (without SlashV2VNP). Can AppPrepNP' (and
insertObjNP') be simplified?
This commit is contained in:
@@ -20,12 +20,12 @@ abstract Conjunction' = Cat' ** {
|
||||
ConjS : Conj -> ListS -> S ; -- he walks and she runs
|
||||
ConjRS : Conj -> ListRS -> RS ; -- who walks and whose mother runs
|
||||
ConjAP : Conj -> ListAP -> AP ; -- cold and warm
|
||||
ConjNP' : Conj -> ListNP' -> NP' ; -- she or we
|
||||
ConjNP : Conj -> ListNP' -> NP' ; -- she or we
|
||||
ConjAdv : Conj -> ListAdv -> Adv ; -- here or there
|
||||
ConjAdV : Conj -> ListAdV -> AdV ; -- always or sometimes
|
||||
ConjIAdv : Conj -> ListIAdv -> IAdv ; -- where and with whom
|
||||
ConjCN : Conj -> ListCN -> CN ; -- man and woman
|
||||
ConjDet : Conj -> ListDAP -> Det ; -- his or her
|
||||
ConjDet : Conj -> ListDAP -> Det' ; -- his or her
|
||||
|
||||
--2 Categories
|
||||
|
||||
|
||||
@@ -21,4 +21,3 @@ abstract Grammar' =
|
||||
Tense,
|
||||
Transfer'
|
||||
;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ abstract Lang' =
|
||||
Lexicon
|
||||
-- ,Construction --- could be compiled here, but not in concretes, as they call Syntax and Grammar
|
||||
-- ,Documentation --# notpresent
|
||||
,Markup' - [stringMark]
|
||||
-- ,Markup' - [stringMark]
|
||||
** {
|
||||
flags startcat=Phr ;
|
||||
} ;
|
||||
|
||||
@@ -148,11 +148,11 @@ abstract Noun' = Cat' ** {
|
||||
|
||||
-- This is different from the partitive, as shown by many languages.
|
||||
|
||||
CountNP : Det -> NP -> NP ; -- three of them, some of the boys
|
||||
CountNP : Det' -> NP' -> NP' ; -- three of them, some of the boys
|
||||
|
||||
--3 Conjoinable determiners and ones with adjectives
|
||||
|
||||
AdjDAP : DAP -> AP -> DAP ; -- the large (one)
|
||||
AdjDAP : DAP' -> AP -> DAP' ; -- the large (one)
|
||||
DetDAP : Det' -> DAP' ; -- this (or that)
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ abstract Question' = Cat' ** {
|
||||
|
||||
-- Interrogative adverbs can be formed prepositionally.
|
||||
|
||||
PrepIP : Prep -> IP -> IAdv ; -- with whom
|
||||
PrepIP : Prep' -> IP -> IAdv ; -- with whom
|
||||
|
||||
-- They can be modified with other adverbs.
|
||||
|
||||
|
||||
@@ -29,8 +29,7 @@ abstract Verb' = Cat' ** {
|
||||
ComplSlash : VPSlash -> NP' -> VP ; -- love it
|
||||
|
||||
SlashVV : VV -> VPSlash -> VPSlash ; -- want to buy
|
||||
SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
|
||||
SlashV2VNP' : V2V -> NP' -> VPSlash -> VPSlash ; -- beg me to buy
|
||||
SlashV2VNP : V2V -> NP' -> VPSlash -> VPSlash ; -- beg me to buy
|
||||
|
||||
--2 Other ways of forming verb phrases
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ resource CombinatorsGer = Combinators - [appCN, appCNc] with
|
||||
(Constructors = ConstructorsGer) **
|
||||
{
|
||||
oper
|
||||
appCN : CN -> NP -> NP
|
||||
appCN : CN -> NP' -> NP'
|
||||
= \cn,x -> mkNP the_Art (PossNP cn x) ;
|
||||
appCNc : CN -> [NP] -> NP
|
||||
= \cn,xs -> let np : NP = mkNP and_Conj xs
|
||||
appCNc : CN -> [NP'] -> NP'
|
||||
= \cn,xs -> let np : NP' = mkNP and_Conj xs
|
||||
in mkNP the_Art (PossNP cn np) ;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsGer = Constructors with (Grammar = GrammarGer) ;
|
||||
resource ConstructorsGer = Constructors' with (Grammar = GrammarGer) ;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
--# -path=../abstract:.:alltenses:prelude:
|
||||
|
||||
instance SyntaxGer of Syntax = ConstructorsGer, CatGer, StructuralGer, CombinatorsGer ;
|
||||
instance SyntaxGer of Syntax' = ConstructorsGer, CatGer, StructuralGer, CombinatorsGer ;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ concrete AdjectiveGer of Adjective' = CatGer ** open ResGer, Prelude in {
|
||||
ext = []
|
||||
} ;
|
||||
ComparA a np =
|
||||
let nps = (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ 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 ! Nom).p1 ++ (np.s ! Nom).p2 ++ 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
|
||||
|
||||
@@ -4,7 +4,7 @@ concrete AdverbGer of Adverb' = CatGer ** open ResGer, Prelude in {
|
||||
PositAdvAdj a = {s = a.s ! Posit ! APred} ;
|
||||
|
||||
ComparAdvAdj cadv a np =
|
||||
let nps = (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ bigNP' np in
|
||||
let nps = np.s ! False ! Nom ++ bigNP' np in
|
||||
{
|
||||
s = cadv.s ++ a.s ! Posit ! APred ++ cadv.p ++ nps
|
||||
} ;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
--# -path=.:../abstract:../common:../api:../prelude
|
||||
|
||||
concrete AllGer of AllGerAbs =
|
||||
concrete AllGer of AllGerAbs' =
|
||||
LangGer,
|
||||
IrregGer,
|
||||
---- ExtendGer, ---- to replace ExtraGer
|
||||
ExtraGer
|
||||
**
|
||||
open ExtendGer in ---- to force compilation
|
||||
{} ;
|
||||
-- ** open ExtendGer in {} ---- to force compilation HL 7/22 todo: ListNP' in ExtendGer
|
||||
;
|
||||
|
||||
@@ -58,8 +58,9 @@ concrete CatGer of Cat' =
|
||||
adv : Str ; -- Haus [adv auf dem Hügel]
|
||||
g : Gender
|
||||
} ;
|
||||
NP = ResGer.NP ;
|
||||
-- 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
|
||||
@@ -72,14 +73,15 @@ concrete CatGer of Cat' =
|
||||
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 : Gender => Case => {quant,num:Str}; n : Number ; a : Adjf ; isDef, hasDefArt : Bool } ;
|
||||
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' = {
|
||||
s : Bool => Number => Gender => Case => Str ; -- Bool is True if a cardinal number is present
|
||||
sp : Bool => Number => Gender => Case => Str ;
|
||||
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 ;
|
||||
a : Adjf ;
|
||||
aPl : Adjf ; --- to distinguish "meine guten Freunde" / "gute Freunde"
|
||||
hasDefArt : Bool
|
||||
@@ -103,7 +105,7 @@ 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
|
||||
@@ -128,29 +130,29 @@ 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!Nom).p1 ++ (np.s!Nom).p2 ++ np.ext ++ np.rc ; -- HL 7/2022
|
||||
-- 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
|
||||
CN = \cn -> cn.s ! Strong ! Pl ! Nom ++ cn.adv ++ cn.ext ++ cn.rc ! Pl ;
|
||||
|
||||
SSlash = \ss -> ss.s ! Main ++ ss.c2.s ;
|
||||
ClSlash = \cls -> cls.s ! MIndic ! Pres ! Simul ! Pos ! Main ++ cls.c2.s ;
|
||||
SSlash = \ss -> ss.s ! Main ++ ss.c2.s ! GPl ;
|
||||
ClSlash = \cls -> cls.s ! MIndic ! Pres ! Simul ! Pos ! Main ++ cls.c2.s ! GPl ;
|
||||
|
||||
VP = \vp -> useInfVP False vp ;
|
||||
VPSlash = \vps -> useInfVP False vps ++ vps.c2.s ++ vps.ext;
|
||||
VPSlash = \vps -> useInfVP False vps ++ vps.c2.s ! GPl ++ vps.ext;
|
||||
|
||||
AP = \ap -> ap.c.p1 ++ ap.s ! APred ++ ap.c.p2 ++ ap.ext ;
|
||||
A2 = \a2 -> a2.s ! Posit ! APred ++ a2.c2.s ;
|
||||
AP = \ap -> ap.c.p1 ++ ap.s ! APred ++ ap.c.p2 ++ ap.ext ;
|
||||
A2 = \a2 -> a2.s ! Posit ! APred ++ a2.c2.s ! GPl ;
|
||||
|
||||
V, VS, VQ, VA = \v -> useInfVP False (predV v) ;
|
||||
V2, V2A, V2Q, V2S = \v -> useInfVP False (predV v) ++ v.c2.s ;
|
||||
V3 = \v -> useInfVP False (predV v) ++ v.c2.s ++ v.c3.s ;
|
||||
V2, V2A, V2Q, V2S = \v -> useInfVP False (predV v) ++ v.c2.s ! GPl ;
|
||||
V3 = \v -> useInfVP False (predV v) ++ v.c2.s ! GPl ++ v.c3.s ! GPl;
|
||||
|
||||
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 ! GPl ;
|
||||
|
||||
Conj = \c -> c.s1 ++ c.s2 ;
|
||||
|
||||
Det' = \det -> (det.s ! Masc ! Nom).quant ++ (det.s ! Masc ! Nom).num ;
|
||||
Prep' = \prep -> case prep.isPrep of {PrepDefArf => prep.sg ! Masc ;
|
||||
_ => prep.s ++ prep.s2 } ;
|
||||
Det' = \det -> det.s ! False ! Masc ! Nom ;
|
||||
Prep' = \prep -> case prep.isPrep of {isPrepDefArt => prep.s ! GSg Masc ;
|
||||
_ => prep.s ! GPl } ;
|
||||
}
|
||||
|
||||
@@ -9,9 +9,11 @@ concrete ConjunctionGer of Conjunction' =
|
||||
|
||||
ConjAdv conj ss = conjunctDistrSS conj ss ;
|
||||
|
||||
ConjNP conj ss = heavyNP' (conjunctDistrTable Case conj ss ** {
|
||||
-- ConjNP : Conj -> ListNP' -> NP' ; -- she or we
|
||||
|
||||
ConjNP conj ss = { s = \\_ => (conjunctDistrTable Case conj { s1 = ss.s1 ; s2 = ss.s2 }).s } ** {
|
||||
a = Ag Fem (conjNumber conj.n (numberAgr ss.a)) (personAgr ss.a) ;
|
||||
}) ;
|
||||
w = WHeavy' ; ext,rc = [] } ;
|
||||
|
||||
ConjAP conj ss = conjunctDistrTable AForm conj ss ** {
|
||||
isPre = ss.isPre ; c = ss.c ; ext = ss.ext} ;
|
||||
@@ -38,12 +40,12 @@ concrete ConjunctionGer of Conjunction' =
|
||||
|
||||
BaseAdv = twoSS ;
|
||||
ConsAdv = consrSS comma ;
|
||||
BaseNP x y = {
|
||||
s1 = \\c => (x.s ! c).p1 ++ (x.s ! c).p2 ++ bigNP x ;
|
||||
s2 = \\c => y.s ! 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 => (x.s ! c).p1 ++ (x.s ! c).p2 ++ 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 = {
|
||||
@@ -75,7 +77,8 @@ concrete ConjunctionGer of Conjunction' =
|
||||
lincat
|
||||
[S] = {s1,s2 : Order => Str} ;
|
||||
[Adv] = {s1,s2 : Str} ;
|
||||
[NP] = {s1,s2 : PCase => Str ; a : Agr} ;
|
||||
-- [NP] = {s1,s2 : PCase => 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} ;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--# -path=.:../abstract
|
||||
|
||||
concrete ConstructionGer of Construction = CatGer **
|
||||
open SyntaxGer, SymbolicGer, ParadigmsGer,
|
||||
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 ;
|
||||
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
@@ -34,30 +34,27 @@ concrete ExtraGer of ExtraGerAbs = CatGer **
|
||||
IAdvAdv adv = {s = "wie" ++ adv.s} ;
|
||||
|
||||
DetNPMasc det = {
|
||||
s = \\c => det.sp ! Masc ! c ; ---- genders
|
||||
a = agrP3 det.n ;
|
||||
w = WLight ;
|
||||
s = \\b,c => det.sp ! b ! Masc ! c ;
|
||||
a = agrgP3 Masc det.n ;
|
||||
w = case det.isDef of { True => WLight' ; _ => WHeavy' } ;
|
||||
ext, rc = []
|
||||
} ;
|
||||
|
||||
DetNPFem det = {
|
||||
s = \\c => det.sp ! Fem ! c ; ---- genders
|
||||
a = agrP3 det.n ;
|
||||
w = WLight ;
|
||||
s = \\b,c => det.sp ! b ! Fem ! c ;
|
||||
a = agrgP3 Fem det.n ;
|
||||
w = case det.isDef of { True => WLight' ; _ => WHeavy' } ;
|
||||
ext, rc = []
|
||||
} ;
|
||||
|
||||
EmptyRelSlash slash = {
|
||||
s = \\m,t,a,p,gn =>
|
||||
appPrep slash.c2 (\\k => usePrepC k (\c -> relPron ! gn ! c)) ++
|
||||
slash.s ! m ! t ! a ! p ! Sub ;
|
||||
c = (prepC slash.c2.c).c
|
||||
appPrep' slash.c2 (relPron ! gn) ++ slash.s ! m ! t ! a ! p ! Sub ;
|
||||
c = slash.c2.c
|
||||
} ;
|
||||
|
||||
PassVPSlash vp =
|
||||
let c = case <vp.c2.c,vp.c2.isPrep> of {
|
||||
<NPC Acc,False> => NPC Nom ;
|
||||
_ => vp.c2.c}
|
||||
let c = case <vp.c2.c,vp.c2.isPrep> of {<Acc,isCase> => Nom ; _ => vp.c2.c}
|
||||
in insertObj (\\_ => (PastPartAP vp).s ! APred) (predV werdenPass) **
|
||||
{ c1 = vp.c2 ** {c = c}} ;
|
||||
-- regulates passivised object: accusative objects -> nom; all others: same case
|
||||
@@ -70,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 {
|
||||
@@ -83,11 +80,11 @@ 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
|
||||
++ vp.c2.s -- junk if not TV
|
||||
++ vp.c2.s ! GPl -- junk if not TV
|
||||
++ vp.ext ++ (vp.inf.extr ! a) ++ vp.s.s ! VPastPart af ;
|
||||
isPre = True ;
|
||||
c = <[],[]> ;
|
||||
@@ -104,7 +101,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer **
|
||||
|
||||
PredVPS np vpi =
|
||||
let
|
||||
subj = np.s ! NPC Nom ++ bigNP np ;
|
||||
subj = np.s ! False ! Nom ++ bigNP' np ;
|
||||
agr = np.a ;
|
||||
in {
|
||||
s = \\o =>
|
||||
@@ -178,8 +175,7 @@ concrete ExtraGer of ExtraGerAbs = CatGer **
|
||||
RNP = {s : Agr => Case => Str} ;
|
||||
lin
|
||||
ReflRNP vps rnp =
|
||||
insertObj (\\a => appPrep vps.c2
|
||||
(\\k => usePrepC k (\c -> rnp.s ! a ! c))) 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} ;
|
||||
|
||||
@@ -206,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 ;
|
||||
|
||||
@@ -218,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 ;
|
||||
|
||||
@@ -243,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 =
|
||||
@@ -254,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 ;
|
||||
|
||||
|
||||
@@ -263,11 +259,11 @@ 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 {
|
||||
s = \\_ => "es" ;
|
||||
esSubj : CatGer.NP' = lin NP' {
|
||||
s = \\_,_ => "es" ;
|
||||
rc, ext = [] ;
|
||||
a = Ag Neutr Sg P3 ;
|
||||
w = WPron
|
||||
w = WPron'
|
||||
} ;
|
||||
|
||||
DisToCl : Str -> Agr -> FClause -> Clause = \subj,agr,vp ->
|
||||
|
||||
@@ -13,7 +13,7 @@ concrete GrammarGer of Grammar' =
|
||||
PhraseGer,
|
||||
TextX - [Tense,Temp],
|
||||
IdiomGer,
|
||||
StructuralGer,
|
||||
StructuralGer - [part_Prep,possess_Prep], -- use PartNP, PossNP instead
|
||||
TenseGer
|
||||
** {
|
||||
|
||||
|
||||
@@ -8,26 +8,24 @@ concrete IdiomGer of Idiom' = CatGer **
|
||||
ImpersCl vp = mkClause "es" (agrP3 Sg) vp ;
|
||||
GenericCl vp = mkClause "man" (agrP3 Sg) vp ;
|
||||
|
||||
CleftNP np rs = mkClause "es" (agrP3 Sg)
|
||||
CleftNP np rs = mkClause "es" (agrP3 Sg)
|
||||
(insertExtrapos (rs.s ! RGenNum (gennum (genderAgr np.a) (numberAgr np.a))) ----
|
||||
-- (insertObj (\\_ => np.s ! NPC rs.c ++ bigNP np) (predV MorphoGer.sein_V))) ;
|
||||
(insertObj (\\_ => (np.s ! rs.c).p1 ++ (np.s ! rs.c).p2 ++ 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)
|
||||
CleftAdv ad s = mkClause "es" (agrP3 Sg)
|
||||
(insertExtrapos (conjThat ++ s.s ! Sub)
|
||||
(insertObj (\\_ => ad.s) (predV MorphoGer.sein_V))) ;
|
||||
|
||||
|
||||
ExistNP np =
|
||||
mkClause "es" (agrP3 Sg)
|
||||
(insertObj (\\_ => appPrep2' geben.c2 np.s ++ bigNP' np)
|
||||
mkClause "es" (agrP3 Sg)
|
||||
(insertObj (\\_ => appPrep' geben.c2 (np.s ! False) ++ bigNP' np)
|
||||
(predV geben)) ;
|
||||
|
||||
ExistIP ip = {
|
||||
s = \\m,t,a,p =>
|
||||
let
|
||||
cls =
|
||||
(mkClause "es" (agrP3 Sg) (predV geben)).s ! m ! t ! a ! p ;
|
||||
s = \\m,t,a,p =>
|
||||
let
|
||||
cls = (mkClause "es" (agrP3 Sg) (predV geben)).s ! m ! t ! a ! p ;
|
||||
who = ip.s ! Acc
|
||||
in table {
|
||||
QDir => who ++ cls ! Inv ;
|
||||
@@ -38,7 +36,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 (\\_ => appPrep2' geben.c2 np.s ++ bigNP' np)
|
||||
(insertAdv adv.s (insertObj (\\_ => appPrep' geben.c2 (np.s ! False) ++ bigNP' np)
|
||||
(predV geben))) ;
|
||||
|
||||
ExistIPAdv ip adv = {
|
||||
@@ -68,7 +66,7 @@ concrete IdiomGer of Idiom' = CatGer **
|
||||
SelfAdvVP vp = insertAdv "selbst" vp ;
|
||||
SelfAdVVP vp = insertAdv "selbst" vp ;
|
||||
SelfNP np = np ** {
|
||||
s = \\c => <(np.s ! c).p1, (np.s ! c).p2 ++ "selbst" ++ bigNP' np> ;
|
||||
s = \\_,c => np.s ! False ! c ++ "selbst" ++ bigNP' np ;
|
||||
isPron = False ;
|
||||
} ;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ concrete LangGer of Lang' =
|
||||
LexiconGer
|
||||
-- ,ConstructionGer
|
||||
-- ,DocumentationGer --# notpresent
|
||||
,MarkupGer - [stringMark]
|
||||
-- ,MarkupGer - [stringMark]
|
||||
** {
|
||||
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
@@ -214,7 +214,8 @@ lin
|
||||
university_N = reg2N "Universität" "Universitäten" feminine ;
|
||||
village_N = reg2N "Dorf" "Dörfer" neuter ;
|
||||
-- wait_V2 = prepV2 (regV "warten") (mkPrep "auf" accusative) ;
|
||||
wait_V2 = prepV2 (regV "warten") (mkPrep "auf" "auf den" "auf die" "aufs" accusative) ;
|
||||
-- wait_V2 = prepV2 (regV "warten") ((mkPrep "auf" "auf den" "auf die" "aufs" accusative) | (mkPrep "auf" accusative));
|
||||
wait_V2 = prepV2 (regV "warten") (mkPrep "auf" "auf den" "auf die" ("aufs" | "auf das") accusative);
|
||||
walk_V = seinV Irreg.gehen_V ;
|
||||
warm_A = mk3A "warm" "wärmer" "wärmste" ;
|
||||
war_N = mkN "Krieg" ;
|
||||
|
||||
@@ -5,33 +5,33 @@ resource MakeStructuralGer = open CatGer, (P = ParadigmsGer), MorphoGer, Prelude
|
||||
oper
|
||||
mkConj : Str -> Str -> Number -> Conj = \x,y,n ->
|
||||
{s1 = x ; s2 = y ; n = n ; lock_Conj = <>} ;
|
||||
mkSubj : Str -> Subj = \x ->
|
||||
mkSubj : Str -> Subj = \x ->
|
||||
{s = x ; lock_Subj = <>} ;
|
||||
mkIQuant : Str -> IQuant = \s ->
|
||||
{s = \\_,_,_ => s ; lock_IQuant = <>} ;
|
||||
|
||||
mkPredet = overload {
|
||||
mkPredet : A -> Predet = \a ->
|
||||
lin Predet {
|
||||
s = appAdj a ;
|
||||
c = noCase ;
|
||||
mkPredet : A -> Predet' = \a ->
|
||||
lin Predet' {
|
||||
s = appAdj' a ;
|
||||
c = noCase' ;
|
||||
a = PAgNone
|
||||
} ;
|
||||
mkPredet : A -> Str -> PCase -> Bool -> Number -> Predet = \a,p,c,b,n ->
|
||||
lin Predet {
|
||||
s = appAdj a ;
|
||||
c = {p = p ; k = PredCase c} ;
|
||||
} ;
|
||||
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}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
-- e.g. das selbe
|
||||
mmkQuant : Quant -> A -> Quant = \q,a -> q ** {
|
||||
s,sp = \\x,n,g,c => q.s ! x ! n ! g ! c ++ a.s ! Posit ! agrAdj g q.a n ((prepC c).c)
|
||||
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 ** {
|
||||
s,sp = \\x,n,g,c => q.s ! x ! n ! g ! c + a.s ! Posit ! agrAdj g q.a n ((prepC c).c)
|
||||
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
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
--# -path=.:../abstract:../common
|
||||
|
||||
concrete MarkupGer of Markup' = CatGer, MarkHTMLX ** {
|
||||
concrete MarkupGer of Markup = CatGer, MarkHTMLX ** {
|
||||
|
||||
lin
|
||||
MarkupCN m cn = cn ** {s = \\a,n,c => appMark m (cn.s ! a ! n ! c)} ; --- other fields e.g ext intact
|
||||
MarkupNP m np = np ** {s = \\c => appMark m (np.s ! c)} ;
|
||||
MarkupNP' m np = np ** {s = \\c => appMark2 m (np.s ! c)} ;
|
||||
MarkupAP m ap = ap ** {s = \\a => appMark m (ap.s ! a)} ;
|
||||
MarkupAdv m adv = {s = appMark m adv.s} ;
|
||||
MarkupS m s = {s = \\o => appMark m (s.s ! o)} ;
|
||||
@@ -13,8 +12,5 @@ lin
|
||||
MarkupPhr m phr = {s = appMark m phr.s} ;
|
||||
MarkupText m txt = {s = appMark m txt.s} ;
|
||||
|
||||
oper
|
||||
appMark2 : {begin,end : Str} -> Str * Str -> Str * Str
|
||||
= \m,s -> <m.begin ++ s.p1, s.p2 ++ m.end> ;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,35 +18,19 @@ oper
|
||||
-- For $StructuralGer$.
|
||||
|
||||
mkPrep : Str -> Case -> Preposition' = \s,c ->
|
||||
{s = s ; s2 = [] ; c = c ; sg = \\_ => [] ; isPrep = isPrep} ;
|
||||
{s = \\_ => s ; s2 = [] ; c = c ; isPrep = isPrep} ;
|
||||
|
||||
nameNounPhrase : {s : Case => Str} -> {s : PCase => Str ; a : Agr ;
|
||||
-- isLight, isPron : Bool ;
|
||||
w : Weight ;
|
||||
ext,rc : Str} = \name -> heavyNP {
|
||||
s = \\c => usePrepC c (\k -> name.s ! k) ;
|
||||
a = agrP3 Sg
|
||||
} ;
|
||||
nameNounPhrase' : Gender -> {s : Case => Str} -> {s : Case => Str * Str;
|
||||
nameNounPhrase' : Gender -> {s : Case => Str} -> {s : Bool => Case => Str ;
|
||||
a : Agr ;
|
||||
w : Weight' ;
|
||||
ext,rc : Str} =
|
||||
\g,name -> {
|
||||
s = \\c => <[],name.s ! c> ;
|
||||
s = \\_,c => name.s ! c ;
|
||||
a = agrgP3 g Sg ;
|
||||
ext,rc = [] ;
|
||||
w = WHeavy' -- ok?
|
||||
} ;
|
||||
|
||||
detLikeAdj : Bool -> Number -> Str ->
|
||||
{s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies ->
|
||||
{s,sp = appAdj (regA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ;
|
||||
|
||||
detUnlikeAdj : Bool -> Number -> Str ->
|
||||
{s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies ->
|
||||
{s,sp = appAdj (regDetA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ;
|
||||
|
||||
-- HL: to reduce PCase to Case:
|
||||
detLikeAdj' : Bool -> Number -> Str ->
|
||||
{s,sp : Gender => Case => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies ->
|
||||
{s,sp = appAdj' (regA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ;
|
||||
|
||||
@@ -7,8 +7,7 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
|
||||
|
||||
lin
|
||||
DetCN det cn = {
|
||||
s = \\c => <(det.s ! cn.g ! c).quant,
|
||||
(det.s ! cn.g ! c).num ++ cn.s ! (adjfCase det.a c) ! det.n ! c ++ cn.adv> ;
|
||||
s = \\b,c => det.s ! b ! cn.g ! c ++ cn.s ! (adjfCase det.a c) ! det.n ! c ++ cn.adv ;
|
||||
a = agrgP3 cn.g det.n ;
|
||||
-- isLight = det.isDef ; -- ich sehe den Mann nicht vs. ich sehe nicht einen Mann
|
||||
-- isPron = False ; -- HL 6/2019 (but:) sehe (die|einige) Männer nicht
|
||||
@@ -24,7 +23,7 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
|
||||
} ;
|
||||
|
||||
DetNP det = { -- more genders in ExtraGer -- HL: der+er,den+en ; der drei,den drei+en
|
||||
s = \\c => <(det.sp ! Neutr ! c).quant, (det.sp ! Neutr ! c).num> ;
|
||||
s = \\b,c => det.sp ! b ! Neutr ! c ;
|
||||
a = agrP3 det.n ;
|
||||
-- isLight = det.isDef ;
|
||||
-- isPron = False ; -- HL 6/2019: don't apply pronoun switch: ich gebe ihr das vs. ich gebe es ihr
|
||||
@@ -33,14 +32,14 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
|
||||
} ;
|
||||
|
||||
UsePN pn = {
|
||||
s = \\c => <[], pn.s ! c> ;
|
||||
s = \\_,c => pn.s ! c ;
|
||||
a = agrgP3 pn.g Sg ;
|
||||
w = WLight' ; -- means: this is not a heavy NP, but comes before negation
|
||||
rc, ext = [] -- Pron => Light HL 6/2019: to regulate Pron/NonPronNP order
|
||||
} ;
|
||||
|
||||
UsePron pron = {
|
||||
s = \\c => <[], pron.s ! NPCase c> ;
|
||||
s = \\_,c => pron.s ! NPCase c ;
|
||||
a = pron.a ;
|
||||
w = WPron' ;
|
||||
rc, ext = []
|
||||
@@ -48,28 +47,27 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
|
||||
|
||||
PredetNP pred np =
|
||||
let ag = case pred.a of {PAg n => agrP3 n ; _ => np.a} in np ** {
|
||||
s = \\c0 =>
|
||||
s = \\b,c0 =>
|
||||
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).p1, (np.s ! c).p2> ;
|
||||
pred.s ! numberAgr ag ! genderAgr np.a ! c0 ++ pred.c.p ++ np.s ! b ! c ;
|
||||
a = ag ;
|
||||
w = WHeavy'
|
||||
w = WHeavy'
|
||||
} ;
|
||||
|
||||
PPartNP np v2 = np ** {
|
||||
s = incr2 np.s (embedInCommas (v2.s ! VPastPart APred)) ; --- invar part
|
||||
s = \\b,c => np.s ! b ! c ++ (embedInCommas (v2.s ! VPastPart APred)) ; --- invar part
|
||||
w = WHeavy'
|
||||
} ;
|
||||
{- "eine erfolgreiche Frau, geliebt von vielen," but only with v2 not possible in German?
|
||||
HL: PPartNP np vps|vp: "der Autor, heute vergessen" , "der Mond, gerade aufgegangen,"
|
||||
-}
|
||||
-- SS: "eine erfolgreiche Frau, geliebt von vielen," but only with v2 not possible in German?
|
||||
-- HL: PPartNP np vps|vp: "der Autor, heute vergessen" , "der Mond, gerade aufgegangen,"
|
||||
|
||||
AdvNP np adv = np ** {
|
||||
s = incr2 np.s adv.s ;
|
||||
s = \\b,c => np.s ! b ! c ++ adv.s ;
|
||||
w = WHeavy'
|
||||
} ;
|
||||
|
||||
ExtAdvNP np adv = np ** {
|
||||
s = incr2 np.s (embedInCommas adv.s) ;
|
||||
s = \\b,c => np.s ! b ! c ++ (embedInCommas adv.s) ;
|
||||
w = WHeavy'
|
||||
} ;
|
||||
|
||||
@@ -80,17 +78,17 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
|
||||
-- But parsing "im warmen Meer" results in a
|
||||
-- PrepNP in_Prep (DetCN (DetQuant ? NumSg) (AdjCN ... ))
|
||||
-- because (DetQuant.s!g!c).quant is ignored, but the .num is part of (np.s!c).p2.
|
||||
-- To avoid the metavariable ?, we have to make Det.s and NP.s depend on t:PrepType = isPrep.
|
||||
-- To avoid the metavariable ?, we have to made Det.s and NP.s depend on t:PrepType = isPrep.
|
||||
|
||||
DetQuantOrd quant num ord =
|
||||
let -- does not work, since here DefArt is combined with ord
|
||||
n = num.n ; --
|
||||
let
|
||||
n = num.n ;
|
||||
a = quant.a
|
||||
in {
|
||||
s = \\g,c => {quant = quant.s ! num.isNum ! n ! g ! c;
|
||||
num = num.s!g!c ++ ord.s ! agrAdj g (adjfCase a c) n c} ;
|
||||
sp = \\g,c => {quant = quant.sp ! num.isNum ! n ! g ! c;
|
||||
num = num.s!g!c ++ ord.s ! agrAdj g (adjfCase quant.aPl c) n c} ;
|
||||
s = \\b,g,c => quant.s ! b ! num.isNum ! n ! g ! c ++ num.s!g!c ++
|
||||
ord.s ! agrAdj g (adjfCase a c) n c ;
|
||||
sp = \\b,g,c => quant.sp ! b ! num.isNum ! n ! g ! c ++ num.s!g!c ++
|
||||
ord.s ! agrAdj g (adjfCase quant.aPl c) n c ;
|
||||
n = n ;
|
||||
a = case n of {Sg => a ; Pl => quant.aPl} ;
|
||||
isDef = case <quant.a, quant.aPl> of {<Strong,Strong> => False ; _ => True} ;
|
||||
@@ -100,10 +98,11 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
|
||||
DetQuant quant num =
|
||||
let
|
||||
n = num.n ;
|
||||
a = quant.a
|
||||
a = quant.a ;
|
||||
b = andB quant.hasDefArt (case num.n of {Sg => True ; _ => False}) ;
|
||||
in {
|
||||
s = \\g,c => {quant = quant.s ! num.isNum ! n ! g ! c ; num = num.s!g!c} ;
|
||||
sp = \\g,c => {quant = quant.sp ! num.isNum ! n ! g ! c ; num = num.s!g!c} ;
|
||||
s = \\b,g,c => quant.s ! b ! num.isNum ! n ! g ! c ++ num.s ! g ! c ;
|
||||
sp = \\_,g,c => quant.sp ! False ! num.isNum ! n ! g ! c ++ num.s!g!c ;
|
||||
-- HL: der+er,den+en ; der drei,den drei+en
|
||||
n = n ;
|
||||
a = case n of {Sg => a ; Pl => quant.aPl} ;
|
||||
@@ -112,8 +111,8 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
|
||||
} ;
|
||||
|
||||
PossPron p = {
|
||||
s = \\_,n,g,c => p.s ! NPPoss (gennum g n) c ;
|
||||
sp = \\_,n,g,c => p.s ! NPPoss (gennum g n) c ;
|
||||
s = \\_,_,n,g,c => p.s ! NPPoss (gennum g n) c ;
|
||||
sp = \\_,_,n,g,c => p.s ! NPPoss (gennum g n) c ;
|
||||
a = Strong ;
|
||||
aPl = Weak ;
|
||||
hasDefArt = False ;
|
||||
@@ -137,8 +136,9 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
|
||||
OrdNumeralSuperl n a = {s = \\af => n.s ! NOrd APred ++ Predef.BIND ++ a.s ! Superl ! af} ; -- drittbeste
|
||||
|
||||
DefArt = {
|
||||
s = \\_,n,g,c => artDef ! (gennum g n) ! c ;
|
||||
sp = \\_,n,g,c => case <n,c> of {
|
||||
s = table{True => \\_,n,g,c => [] ; -- defart dropped
|
||||
False => \\_,n,g,c => artDef ! (gennum g n) ! c} ;
|
||||
sp = \\_,_,n,g,c => case <n,c> of {
|
||||
<Pl,Dat> => "denen" ; -- HL 6/2019
|
||||
<Pl,Gen> => "derer" ; -- HL 6/2019
|
||||
_ => artDef ! (gennum g n) ! c } ;
|
||||
@@ -146,14 +146,14 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
|
||||
hasDefArt = True
|
||||
} ;
|
||||
IndefArt = {
|
||||
s = table {
|
||||
s = \\_ => table {
|
||||
True => \\_,_,c => [] ;
|
||||
False => table {
|
||||
Sg => \\g,c => "ein" + pronEnding ! GSg g ! c ;
|
||||
Pl => \\_,c => []
|
||||
}
|
||||
} ;
|
||||
sp = table {
|
||||
sp = \\_ => table {
|
||||
True => \\_,_,c => [] ;
|
||||
False => table {
|
||||
Sg => \\g,c => (detUnlikeAdj' False Sg "ein").s ! g ! c ;
|
||||
@@ -165,7 +165,7 @@ concrete NounGer of Noun' = CatGer ** open ResGer, MorphoGer, Prelude in {
|
||||
} ;
|
||||
|
||||
MassNP cn = {
|
||||
s = \\c => <[], cn.s ! Strong ! Sg ! c ++ cn.adv> ;
|
||||
s = \\_,c => cn.s ! Strong ! Sg ! c ++ cn.adv ;
|
||||
a = agrgP3 cn.g Sg ;
|
||||
-- isLight = True ; -- ich trinke Bier nicht vs. ich trinke kein Bier
|
||||
-- isPron = False ;
|
||||
@@ -231,33 +231,36 @@ 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 ! c).p1 ++ (np.s ! c).p2 ++ 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 ++ appPrep2' vonDat' np.s ++ 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 = todo -- glass of wine
|
||||
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} ;
|
||||
_ => cn ** {s = \\a,n,c => cn.s ! a ! n ! c ++ np.s ! False ! Gen} -- HL 7/2022, ad hoc
|
||||
}; -- glass of wine
|
||||
|
||||
CountNP det np = -- drei der Kinder | drei von den Kindern -- HL 7/22, ad-hoc
|
||||
CountNP det np = -- drei der Kinder | drei von den Kindern -- HL 7/22, ad-hoc TODO
|
||||
-- det or numeral? np or rather (DefArt +) cn? drei (einiger Kinder) ?
|
||||
let g = genderAgr np.a
|
||||
in {
|
||||
s = \\c => det.s ! g ! c ++ np.s ! NPP CVonDat ++ 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 } ;
|
||||
w = case det.isDef of { True => WLight' ; _ => WHeavy' } ;
|
||||
rc = np.rc ;
|
||||
ext = np.ext
|
||||
} ;
|
||||
|
||||
-- AdjDAP dap adj = ?? TODO -- the large (one)
|
||||
|
||||
DetDAP det = {s = \\g,c => (det.s ! g ! c).quant ++ (det.s ! g ! c).num ; -- HL 7/22
|
||||
sp = \\g,c => (det.sp ! g ! c).quant ++ (det.sp ! g ! c).num ;
|
||||
AdjDAP dap ap = -- the large (one) -- HL 8/22 der auf dich stolze; die ihm treue; der so dumme, infzu
|
||||
{s, sp = \\g,c => dap.s ! g ! c ++ ap.c.p1 ++ ap.c.p2 ++ ap.s ! (AMod (gennum g dap.n) c) ++ ap.ext ;
|
||||
a = dap.a ; n = dap.n ; isDef = dap.isDef ; hasDefArt = dap.hasDefArt } ;
|
||||
|
||||
DetDAP det = {s = \\g,c => det.s ! False ! g ! c ; -- HL 7/22 todo: check
|
||||
sp = \\g,c => det.sp ! False ! g ! c ;
|
||||
n = det.n ; a = det.a ; isDef = det.isDef ; hasDefArt = det.hasDefArt} ;
|
||||
oper
|
||||
incr2 : (Case => Str * Str) -> Str -> (Case => Str * Str) = \tab,str ->
|
||||
\\c => <(tab ! c).p1, (tab ! c).p2 ++ str> ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -188,6 +188,7 @@ mkN : overload {
|
||||
-- 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
|
||||
} ;
|
||||
|
||||
-- Often just a case with the empty string is enough.
|
||||
@@ -501,31 +502,30 @@ mkV2 : overload {
|
||||
mkAdv s = {s = s ; lock_Adv = <>} ;
|
||||
|
||||
mkPrep = overload {
|
||||
mkPrep : Str -> Case -> Prep' = \s,c -> {s = s ; s2 = [] ; sg = \\_ => [] ;
|
||||
c = c ; isPrep = isPrep ; lock_Prep' = <>} ;
|
||||
mkPrep : Case -> Str -> Prep' = \c,s -> {s = [] ; s2 = s ; sg = \\_ => [] ;
|
||||
c = c ; isPrep = isPrep ; lock_Prep' = <>} ;
|
||||
mkPrep : Str -> Case -> Str -> Prep' = \s,c,t -> {s = s ; s2 = t ; sg = \\_ => [] ;
|
||||
c = c ; isPrep = isPrep ; lock_Prep' = <>} ;
|
||||
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 = s ; s2 = [] ; sg = table{Masc => masc ; Fem => fem ; Neutr => neutr} ;
|
||||
c = c ; isPrep = isPrepDefArt ; lock_Prep' = <>} ;
|
||||
{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' = <>} ;
|
||||
} ;
|
||||
accPrep = {s,s2 = [] ; sg = \\_ => [] ; c = accusative ; isPrep = isCase ; lock_Prep' = <>} ;
|
||||
datPrep = {s,s2 = [] ; sg = \\_ => [] ; c = dative ; isPrep = isCase ; lock_Prep' = <>} ;
|
||||
genPrep = {s,s2 = [] ; sg = \\_ => [] ; c = genitive ; isPrep = isCase ; lock_Prep' = <>} ;
|
||||
|
||||
accPrep = mkPrep accusative ;
|
||||
datPrep = mkPrep dative ;
|
||||
genPrep = mkPrep genitive ;
|
||||
|
||||
--von_Prep = mkPrep "von" dative ;
|
||||
von_Prep = {s = "von"; s2=[]; sg = table{ Masc|Neutr => "vom" ; Fem => "von der" } ;
|
||||
c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ;
|
||||
zu_Prep = {s = "zu"; s2=[]; sg = table{ Masc|Neutr => "zum" ; Fem => "zur" } ;
|
||||
c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ;
|
||||
anDat_Prep = {s = "an"; s2=[]; sg = table{ Masc|Neutr => "am" ; Fem => "an der" } ;
|
||||
c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ;
|
||||
inDat_Prep = {s = "in"; s2=[]; sg = table{ Masc|Neutr => "im" ; Fem => "in der" } ;
|
||||
c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ;
|
||||
inAcc_Prep = {s = "in"; s2=[]; sg = table{ Masc => "in den" ; Fem => "in die" ; Neutr => "ins" } ;
|
||||
c = dative ; isPrep = isPrepDefArt ; lock_Prep' = <>} ;
|
||||
von_Prep = mkPrep "von" "vom" "von der" "vom" dative ;
|
||||
zu_Prep = mkPrep "zu" "zum" "zur" "zum" dative ;
|
||||
inDat_Prep = mkPrep "in" "im" "in der" "im" dative ;
|
||||
inAcc_Prep = mkPrep "in" "in den" "in die" "ins" accusative ;
|
||||
anDat_Prep = mkPrep "an" "am" "an der" "am" dative ;
|
||||
anAcc_Prep = mkPrep "an" "an den" "an die" "ans" accusative ;
|
||||
|
||||
mk6V geben gibt gib gab gaebe gegeben =
|
||||
let
|
||||
@@ -594,7 +594,7 @@ mkV2 : overload {
|
||||
= \v,c,d -> lin V3 (v ** {c2 = c ; c3 = d}) ;
|
||||
} ;
|
||||
|
||||
dirV3 v p = mkV3 v accPrep p ; -- accPrep sets isPrep=False
|
||||
dirV3 v p = mkV3 v accPrep p ;
|
||||
accdatV3 v = mkV3 v datPrep accPrep ; -- to fit to Eng ditransitives (no preposition):
|
||||
-- give sb(indir) sth(dir) = geben jmdm(dat) etwas(acc)
|
||||
mkVS v = v ** {lock_VS = <>} ;
|
||||
@@ -723,8 +723,7 @@ mkV2 : overload {
|
||||
mkV2 : Str -> V2 = \s -> dirV2 (regV s) ;
|
||||
mkV2 : V -> V2 = dirV2 ;
|
||||
mkV2 : V -> Prep' -> V2 = prepV2;
|
||||
mkV2 : V -> Case -> V2 = \v,c ->
|
||||
prepV2 v (lin Prep' {s,s2 = [] ; sg = \\_ => [] ; c = c ; isPrep = isCase}) ;
|
||||
mkV2 : V -> Case -> V2 = \v,c -> prepV2 v (mkPrep c) ;
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -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 ! Nom).p1 ++ (np.s ! Nom).p2 ++ 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 ! Nom).p1 ++ (np.s ! Nom).p2 ++ bigNP' np} ;
|
||||
VocNP np = {s = "," ++ np.s ! False ! Nom ++ bigNP' np} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ concrete QuestionGer of Question' = CatGer ** open ResGer in {
|
||||
} ;
|
||||
|
||||
PrepIP p ip = {
|
||||
s = appPrep p (\\k => usePrepC k (\c -> ip.s ! c)) ;
|
||||
s = appPrep' p ip.s ;
|
||||
} ;
|
||||
|
||||
AdvIP ip adv = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete RelativeGer of Relative' = CatGer ** open ResGer in {
|
||||
concrete RelativeGer of Relative' = CatGer ** open Prelude, ResGer in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
@@ -37,7 +37,7 @@ concrete RelativeGer of Relative' = CatGer ** open ResGer in {
|
||||
|
||||
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 ! c).p1 ++ (np.s !c).p2 ++ 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)
|
||||
} ;
|
||||
|
||||
|
||||
@@ -39,27 +39,6 @@ resource ResGer = ParamX ** open Prelude in {
|
||||
|
||||
Agr = Ag Gender Number Person ;
|
||||
|
||||
-- Case of $NP$ extended to deal with contractions like "zur", "im".
|
||||
|
||||
PCase = NPC Case | NPP CPrep ;
|
||||
CPrep = CAnDat | CInAcc | CInDat | CZuDat | CVonDat ;
|
||||
|
||||
oper
|
||||
NPNom : PCase = NPC Nom ;
|
||||
PrepNom : Preposition = {s,s2 = "" ; isPrep = False ; c = NPNom} ;
|
||||
prepC : PCase -> {s : Str ; c : Case} = \cp -> case cp of {
|
||||
NPC c => {s = [] ; c = c} ;
|
||||
NPP CAnDat => {s = "an" ; c = Dat} ;
|
||||
NPP CInAcc => {s = "in" ; c = Acc} ;
|
||||
NPP CInDat => {s = "in" ; c = Dat} ;
|
||||
NPP CZuDat => {s = "zu" ; c = Dat} ;
|
||||
NPP CVonDat => {s = "von" ; c = Dat}
|
||||
|
||||
} ;
|
||||
|
||||
usePrepC : PCase -> (Case -> Str) -> Str = \c,fs ->
|
||||
let sc = prepC c in sc.s ++ fs sc.c ;
|
||||
|
||||
oper
|
||||
mkAgr : {g : Gender ; n : Number ; p : Person} -> Agr = \r ->
|
||||
Ag r.g r.n r.p ;
|
||||
@@ -73,35 +52,22 @@ resource ResGer = ParamX ** open Prelude in {
|
||||
param NPForm = NPCase Case | NPPoss GenNum Case ;
|
||||
|
||||
-- Predeterminers sometimes require a case ("ausser mir"), sometimes not ("nur ich").
|
||||
-- A number is sometimes inherited ("alle Menschen"),
|
||||
-- sometimes forced ("jeder von den Menschen").
|
||||
|
||||
param
|
||||
PredetCase = NoCase | PredCase PCase ;
|
||||
PredetAgr = PAg Number | PAgNone ;
|
||||
oper
|
||||
noCase : {p : Str ; k : PredetCase} = {p = [] ; k = NoCase} ;
|
||||
-- A number is sometimes inherited ("alle Menschen"), sometimes forced ("jeder von
|
||||
-- den Menschen").
|
||||
|
||||
param
|
||||
PredetCase' = NoCase' | PredCase' Case ;
|
||||
-- PredetAgr = PAg Number | PAgNone ;
|
||||
PredetAgr = PAg Number | PAgNone ;
|
||||
|
||||
oper
|
||||
noCase' : {p : Str ; k : PredetCase'} = {p = [] ; k = NoCase'} ;
|
||||
|
||||
-- Pronominal nps are ordered differently, and light nps come before negation in clauses.
|
||||
-- (To save space, reduce isPron * isLight = 4 values to the following three.) HL 9/19
|
||||
param
|
||||
Weight = WPron | WLight | WHeavy ;
|
||||
oper
|
||||
isPron : {w : Weight} -> Bool = \np ->
|
||||
case np.w of {WPron => True ; _ => False} ;
|
||||
isLight : {w : Weight} -> Bool = \np ->
|
||||
case np.w of {WHeavy => False ; _ => True} ;
|
||||
|
||||
-- To reduce c:PCase to c:Case in Preposition' and NP.s:PCase => Str to NP'.s:Case => Str*Str:
|
||||
param
|
||||
Weight' = WPron' | WLight' | WHeavy' | WDefArt ;
|
||||
oper
|
||||
Weight' = WPron' | WLight' | WHeavy' | WDefArt ; -- HL: may need WIndefArt for nicht+ein => kein
|
||||
oper -- to handle clause negation properly
|
||||
isPron' : {w : Weight'} -> Bool = \np ->
|
||||
case np.w of {WPron' => True ; _ => False} ;
|
||||
isLight' : {w : Weight'} -> Bool = \np ->
|
||||
@@ -262,22 +228,12 @@ resource ResGer = ParamX ** open Prelude in {
|
||||
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] ; die Regel , [vp kein Fleisch zu essen] | [s dass ...]
|
||||
-- adv : Str ; -- die Frage [a von Max] -- HL: cannot be extracted
|
||||
a : Agr ;
|
||||
-- isLight : Bool ; -- light NPs come before negation in simple clauses (expensive)
|
||||
-- isPron : Bool ; -- needed to put accPron before datPron
|
||||
w : Weight } ;
|
||||
|
||||
NP' : Type = {
|
||||
s : Case => Str * Str ;
|
||||
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 ...]
|
||||
a : Agr ;
|
||||
w : Weight' } ;
|
||||
w : Weight' } ; -- light NPs come before negation in simple clauses
|
||||
|
||||
mkN : (x1,_,_,_,_,x6,x7 : Str) -> Gender -> Noun =
|
||||
\Mann, Mannen, Manne, Mannes, Maenner, Maennern, Mann_, g -> {
|
||||
@@ -441,94 +397,59 @@ resource ResGer = ParamX ** open Prelude in {
|
||||
legte ("ge" + legt)
|
||||
[] VHaben ;
|
||||
|
||||
-- Prepositions for complements indicate the complement case.
|
||||
-- Prepositions are of three types: (i) cases, (ii) pure pre-, post- and circum-positions,
|
||||
-- and (iii) prepositions glued with definite article in singular (using s!(GSg g)).
|
||||
-- Prepositions indicate the case of their complement noun phrase.
|
||||
|
||||
Preposition : Type = {s : Str ; s2 : Str ; c : PCase ; isPrep : Bool} ;
|
||||
param
|
||||
PrepType = isCase | isPrep | isPrepDefArt ;
|
||||
|
||||
-- HL 7/19: German has very few circumpositions: um (Gen) Willen, von (Adv) an|ab|aus
|
||||
-- ? bis (Adv) hin|her. So maybe we should skip s2 (and save readings with empty preps).
|
||||
oper
|
||||
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} ;
|
||||
|
||||
-- To apply a preposition to a complement.
|
||||
|
||||
appPrep : Preposition -> (PCase => Str) -> Str = \prep,arg ->
|
||||
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.ext ++ np.rc ;
|
||||
bigNP' : NP' -> Str = \np -> np.ext ++ np.rc ;
|
||||
|
||||
-- To build a preposition from just a case. -- HL 9/19: no longer used in RGL
|
||||
|
||||
noPreposition : Case -> Preposition = \c ->
|
||||
{s,s2 = [] ; c = NPC c ; isPrep = False} ;
|
||||
noPreposition' : Case -> Preposition' = \c ->
|
||||
{s,s2 = [] ; c = c ; isPrep = isCase ; sg = \\_ => []} ;
|
||||
PrepNom' : Preposition' = {s,s2 = "" ; sg = \\_ => []; isPrep = isCase ; c = Nom} ;
|
||||
|
||||
-- New version of Prepositions to reduce c:PCase to c:Case.
|
||||
|
||||
param PrepType = isCase | isPrep | isPrepDefArt ;
|
||||
oper
|
||||
Preposition' : Type = {s : Str ; s2 : Str ; sg : Gender => Str;
|
||||
c : Case ; isPrep : PrepType} ;
|
||||
|
||||
appPrep' : Preposition' -> (Case => Str) -> Str = \prep,arg ->
|
||||
prep.s ++ arg ! prep.c ++ prep.s2 ; -- todo
|
||||
appPrep2' : Preposition' -> (Case => Str * Str) -> Str = \prep,arg ->
|
||||
let det : Str = (arg ! prep.c).p1 ;
|
||||
cn : Str = (arg ! prep.c).p2 ;
|
||||
in prep.s ++ det ++ cn ++ prep.s2 ;
|
||||
prep.s ! GPl ++ arg ! prep.c ++ prep.s2 ;
|
||||
|
||||
appPrepNP' : Preposition' -> NP' -> Str = \prep,np ->
|
||||
let n = numberAgr np.a ;
|
||||
g = genderAgr np.a ;
|
||||
w = np.w ;
|
||||
det = (np.s ! prep.c).p1 ;
|
||||
cn = (np.s ! prep.c).p2 ;
|
||||
let
|
||||
g = (genderAgr np.a) ;
|
||||
n = (numberAgr np.a) ;
|
||||
glues = case <prep.isPrep,n> of {<isPrepDefArt,Sg> => True ; _ => False} ;
|
||||
nps = np.s ! glues ! prep.c
|
||||
in
|
||||
case prep.isPrep of {
|
||||
isCase => det ++ cn ++ np.ext ++ np.rc;
|
||||
isPrep => prep.s ++ det ++ cn ++ prep.s2 ++ np.ext ++ np.rc;
|
||||
isPrepDefArt => case <n,w> of {
|
||||
<Sg,WDefArt> => -- e.g. "zum Hof|zur Tür|zum Fenster herein"
|
||||
prep.sg!g ++ cn ++ prep.s2 ++ np.ext ++ np.rc ;
|
||||
_ =>
|
||||
prep.s ++ det ++ cn ++ prep.s2 ++ np.ext ++ np.rc
|
||||
} } ;
|
||||
case <glues, np.w> of {
|
||||
<True, WDefArt> => -- e.g. "zum Hof|zur Tür|zum Fenster herein"
|
||||
prep.s ! (GSg g) ++ nps ++ np.ext ++ prep.s2 ++ np.rc ;
|
||||
_ => prep.s ! GPl ++ nps ++ np.ext ++ prep.s2 ++ np.rc
|
||||
} ;
|
||||
|
||||
npM' : NP' = {s = table Case {Nom => <"der","Hund">; Acc => <"den","Hund">;
|
||||
Dat => <"dem","Hund">; Gen => <"des","Hundes">};
|
||||
rc = []; ext=[]; a = (Ag Masc Sg P3); w = WDefArt};
|
||||
npN' : NP' = {s = table Case {Nom => <"das","Haus">; Acc => <"das","Haus">;
|
||||
Dat => <"dem","Haus">; Gen => <"des","Hauses">};
|
||||
rc = []; ext=[]; a = (Ag Neutr Sg P3); w = WDefArt};
|
||||
npInDefM' : NP' = {s = table Case {Nom => <"ein","Hund">; Acc => <"einen","Hund">;
|
||||
Dat => <"einem","Hund">; Gen => <"eines","Hundes">};
|
||||
rc = []; ext=[]; a = (Ag Masc Sg P3); w = WLight'};
|
||||
npInDefN' : NP' = {s = table Case {Nom => <"ein","Haus">; Acc => <"ein","Haus">;
|
||||
Dat => <"einem","Haus">; Gen => <"eines","Hauses">};
|
||||
rc = []; ext=[]; a = (Ag Neutr Sg P3); w = WLight'}; -- WHeavy' ?
|
||||
npF' : NP' = {s = table Case {Nom => <"die","Frau">; Acc => <"die","Frau">;
|
||||
Dat => <"der","Frau">; Gen => <"der","Frau">};
|
||||
rc = []; ext=[]; a = (Ag Fem Sg P3); w = WDefArt};
|
||||
bigNP' : NP' -> Str = \np -> np.ext ++ np.rc ;
|
||||
|
||||
-- To build a preposition from just a case. -- HL 9/19: moved to mkPrep in ParadigmsGer
|
||||
|
||||
Dat' : Preposition' = {s=""; s2=""; sg = \\c => []; c=Dat; isPrep=isCase} ;
|
||||
mit' : Preposition' = {s="zusammen mit"; s2=""; sg = \\_ => []; c=Dat; isPrep=isPrep} ;
|
||||
PrepNom' : Preposition' = {s = \\_ => []; isPrep = isCase ; c = Nom ; s2 = []} ;
|
||||
|
||||
vonDat' : Preposition' = {s="von"; s2=""; sg = table{Fem => "von der"; _ => "vom"}; c=Dat; isPrep=isPrep} ;
|
||||
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} ;
|
||||
|
||||
zuDat' : Preposition' = {s="zu"; s2="herein"; sg = \\_ => ""; c=Dat; isPrep=isPrep} ;
|
||||
zum' : Preposition' = {s="zu"; s2="herein"; sg = table{Masc=>"zum"; Fem=>"zur"; Neutr=>"zum"};
|
||||
c=Dat; isPrep=isPrepDefArt} ;
|
||||
inDat' : Preposition' = {s="in"; s2="drin"; sg = \\_ => ""; c=Dat; isPrep=isPrep} ;
|
||||
im' : Preposition' = {s="in"; s2="drin"; sg = table{Masc=>"im"; Fem=>"in der"; Neutr=>"im"};
|
||||
c=Dat; isPrep=isPrepDefArt} ;
|
||||
inAcc' : Preposition' = {s="in"; s2="hinein"; sg = \\_ => ""; c=Acc; isPrep=isPrep} ;
|
||||
ins' : Preposition' = {s="in"; s2="hinein"; sg = table{Masc=>"in den"; Fem=>"in die"; Neutr=>"ins"};
|
||||
c=Acc; isPrep=isPrepDefArt} ;
|
||||
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"};
|
||||
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"};
|
||||
s2="hinein"; c=Acc; isPrep=isPrepDefArt} ;
|
||||
|
||||
-- Pronouns and articles
|
||||
-- Here we define personal and relative pronouns.
|
||||
@@ -565,6 +486,7 @@ resource ResGer = ParamX ** open Prelude in {
|
||||
GPl => caselist "die" "die" "den" "der"
|
||||
} ;
|
||||
|
||||
{- -- used in SymbolGer:
|
||||
artDefContr : GenNum -> PCase -> Str = \gn,np -> case np of {
|
||||
NPC c => artDef ! gn ! c ;
|
||||
NPP p => case <p,gn> of {
|
||||
@@ -578,22 +500,10 @@ resource ResGer = ParamX ** open Prelude in {
|
||||
_ => let sp = prepC np in sp.s ++ artDef ! gn ! sp.c
|
||||
}
|
||||
} ;
|
||||
|
||||
-}
|
||||
|
||||
-- This is used when forming determiners that are like adjectives.
|
||||
|
||||
appAdj : Adjective -> Number => Gender => PCase => Str = \adj ->
|
||||
let
|
||||
ad : GenNum -> Case -> Str = \gn,c ->
|
||||
adj.s ! Posit ! AMod gn c
|
||||
in
|
||||
\\n,g,c => usePrepC c (\k -> case n of {
|
||||
Sg => ad (GSg g) k ;
|
||||
_ => ad GPl k
|
||||
}) ;
|
||||
|
||||
-- HL: To reduce PCase to Case: todo: check if we can omit the prep-string of a PCase
|
||||
-- perhaps needed for "am besten"? But the adj is used in Posit only
|
||||
appAdj' : Adjective -> Number => Gender => Case => Str = \adj ->
|
||||
let
|
||||
ad : GenNum -> Case -> Str = \gn,c ->
|
||||
@@ -801,32 +711,6 @@ 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 = case prep.c of { NPC cc => cc ; _ => Nom } ;
|
||||
obj = appPrepNP prep np ;
|
||||
in 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 <prep.isPrep, np.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>
|
||||
<obj ++ vpnn.p1, vpnn.p2, vpnn.p3, vpnn.p4> ;
|
||||
<False,WPron, _ > => -- <sich ++ ihm|seiner, light, heavy, comp>
|
||||
<vpnn.p1 ++ obj, vpnn.p2, vpnn.p3, vpnn.p4> ;
|
||||
<False,WLight,Dat> => -- (assuming v.c2=acc) nonPron: dat < acc|gen
|
||||
-- <prons, dat ++ np, heavy, comp>
|
||||
<vpnn.p1, obj ++ vpnn.p2, vpnn.p3, vpnn.p4> ;
|
||||
<False,WHeavy,Dat> => -- <prons, light, dat ++ np, comp>
|
||||
<vpnn.p1, vpnn.p2, obj ++ vpnn.p3, vpnn.p4> ;
|
||||
<False,WLight,_ > => -- <prons, np ++ gen|acc, heavy, comp>
|
||||
<vpnn.p1, vpnn.p2 ++ obj, vpnn.p3, vpnn.p4> ;
|
||||
<False,WHeavy,_ > => -- <prons, light, dat ++ np, 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)
|
||||
|
||||
insertObjNP' : NP' -> Preposition' -> VPSlash -> VPSlash = \np,prep,vp ->
|
||||
let c = prep.c ;
|
||||
obj = appPrepNP' prep np ;
|
||||
@@ -846,18 +730,18 @@ resource ResGer = ParamX ** open Prelude in {
|
||||
<False,WLight',Dat> => -- (assuming v.c2=acc) nonPron: dat < acc|gen
|
||||
-- <prons, dat ++ np, heavy, comp>
|
||||
<vpnn.p1, obj ++ vpnn.p2, vpnn.p3, vpnn.p4> ;
|
||||
<False,WHeavy'|WDefArt,Dat> => -- <prons, light, dat ++ np, comp>
|
||||
<vpnn.p1, vpnn.p2, obj ++ vpnn.p3, vpnn.p4> ;
|
||||
<False,WLight',_ > => -- <prons, np ++ gen|acc, heavy, comp>
|
||||
<vpnn.p1, vpnn.p2 ++ obj, vpnn.p3, vpnn.p4> ;
|
||||
<False,WHeavy'|WDefArt,_ > => -- <prons, light, dat ++ np, comp>
|
||||
-- <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)
|
||||
|
||||
|
||||
insertObjRefl : VPSlash -> VPSlash = \vp -> -- HL 6/2019, to order reflPron < neg < prep+reflPron
|
||||
let prep = vp.c2 ; -- HL 7/22 reduced to c:Case
|
||||
obj : Agr => Str = \\a => prep.s ++ reflPron ! a ! prep.c ++ prep.s2 ;
|
||||
obj : Agr => Str = \\a => prep.s ! GPl ++ reflPron ! a ! prep.c ++ prep.s2 ;
|
||||
in vp ** {
|
||||
nn = \\a =>
|
||||
let vpnn = vp.nn ! a in
|
||||
@@ -1099,11 +983,8 @@ resource ResGer = ParamX ** open Prelude in {
|
||||
|
||||
infPart : Bool -> Str = \b -> if_then_Str b [] "zu" ;
|
||||
|
||||
heavyNP :
|
||||
{s : PCase => Str ; a : Agr} -> {s : PCase => Str ; a : Agr ; w : Weight ; ext,rc : Str} = \np ->
|
||||
np ** {w = WHeavy ; ext,rc = []} ; -- this could be wrong
|
||||
heavyNP' :
|
||||
{s : Case => Str ; a : Agr} -> {s : Case => Str ; a : Agr ; w : Weight' ; ext,rc : Str} = \np ->
|
||||
{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
|
||||
|
||||
relPron : RelGenNum => Case => Str = \\rgn,c =>
|
||||
@@ -1120,11 +1001,7 @@ resource ResGer = ParamX ** open Prelude in {
|
||||
} ;
|
||||
|
||||
-- Function that allows the construction of non-nominative subjects.
|
||||
mkSubj : NP -> Preposition -> Str * Agr = \np, prep ->
|
||||
let
|
||||
agr = case prep.c of { NPC Nom => np.a ; _ => Ag Masc Sg P3 } ;
|
||||
subj = appPrepNP prep np
|
||||
in <subj , agr> ;
|
||||
|
||||
mkSubj' : NP' -> Preposition' -> Str * Agr = \np, prep ->
|
||||
let
|
||||
agr = case prep.c of { Nom => np.a ; _ => Ag Masc Sg P3 } ;
|
||||
|
||||
@@ -45,10 +45,9 @@ concrete SentenceGer of Sentence' = CatGer ** open ResGer, Prelude in {
|
||||
SlashPrep cl prep = cl ** {c2 = prep} ;
|
||||
|
||||
SlashVS np vs slash =
|
||||
let subj = mkSubj' np PrepNom'
|
||||
in mkClause subj.p1 subj.p2
|
||||
(insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs)) **
|
||||
{c2 = slash.c2} ;
|
||||
let subj = mkSubj' np PrepNom' ;
|
||||
vp = (insertExtrapos (conjThat ++ slash.s ! Sub) (predV vs))
|
||||
in mkClause subj.p1 subj.p2 vp ** {c2 = slash.c2} ;
|
||||
|
||||
EmbedS s = {s = conjThat ++ s.s ! Sub} ; -- no leading comma, if sentence-initial
|
||||
EmbedQS qs = {s = qs.s ! QIndir} ;
|
||||
|
||||
@@ -48,7 +48,7 @@ concrete StructuralGer of Structural' = CatGer **
|
||||
here_Adv = ss "hier" ;
|
||||
how_IAdv = ss "wie" ;
|
||||
how8much_IAdv = ss "wieviel" ;
|
||||
how8many_IDet = {s = \\g,c => (detUnlikeAdj False Pl "wie viel").s ! g ! NPC c ; n = Pl} ;
|
||||
how8many_IDet = {s = \\g,c => (detUnlikeAdj' False Pl "wie viel").s ! g ! c ; n = Pl} ;
|
||||
if_Subj = ss "wenn" ; --- no variants in the RGL! | ss "falls" ;
|
||||
in8front_Prep = mkPrep "vor" P.dative ;
|
||||
i_Pron = mkPronPers "ich" "mich" "mir" "meiner" "mein" Masc Sg P1 ;
|
||||
@@ -77,9 +77,9 @@ concrete StructuralGer of Structural' = CatGer **
|
||||
on_Prep = P.mkPrep "auf" "auf den" "auf die" "aufs" P.accusative ; -- test HL 7/2022
|
||||
or_Conj = {s1 = [] ; s2 = "oder" ; n = Sg} ;
|
||||
otherwise_PConj = ss "sonst" ;
|
||||
part_Prep = P.von_Prep ; -- mkPrep "von" P.dative ;
|
||||
part_Prep = P.von_Prep ; -- obsolete, use PartNP cn np
|
||||
please_Voc = ss "bitte" ;
|
||||
possess_Prep = P.von_Prep ;-- mkPrep "von" P.dative ;
|
||||
possess_Prep = P.von_Prep ; -- obsolete, use PossNP cn np
|
||||
quite_Adv = ss "ziemlich" ;
|
||||
she_Pron = mkPronPers "sie" "sie" "ihr" "ihrer" "ihr" Fem Sg P3 ;
|
||||
so_AdA = ss "so" ;
|
||||
@@ -97,7 +97,7 @@ concrete StructuralGer of Structural' = CatGer **
|
||||
somewhere_Adv = ss "irgendwo" ;
|
||||
that_Quant = let
|
||||
jener : Number => Gender => Case => Str = \\n => (detUnlikeAdj' True n "jen").s in
|
||||
{s,sp = \\_ => jener ; a,aPl = Weak ; hasDefArt = False} ;
|
||||
{s,sp = \\_,_ => jener ; a,aPl = Weak ; hasDefArt = False} ;
|
||||
---b that_NP = nameNounPhrase {s = caselist "das" "das" "denem" "dessen"} ; ----
|
||||
there_Adv = ss "da" ; --- no variants in the rgl | ss "dort" ;
|
||||
there7to_Adv = ss "dahin" ;
|
||||
@@ -107,7 +107,7 @@ concrete StructuralGer of Structural' = CatGer **
|
||||
they_Pron = mkPronPers "sie" "sie" "ihnen" "ihrer" "ihr" Fem Pl P3 ;
|
||||
this_Quant = let
|
||||
dieser : Number => Gender => Case => Str = \\n => (detUnlikeAdj' True n "dies").s in
|
||||
{s,sp = \\_ => dieser ; a,aPl = Weak ; hasDefArt = False} ;
|
||||
{s,sp = \\_,_ => dieser ; a,aPl = Weak ; hasDefArt = False} ;
|
||||
---b this_NP = nameNounPhrase {s = caselist "dies" "dies" "diesem" "dieses"} ; ----
|
||||
---b those_NP = {s = caselist "jene" "jene" "jenen" "jener" ; a = agrP3 Pl} ;
|
||||
through_Prep = mkPrep "durch" P.accusative ;
|
||||
@@ -148,7 +148,7 @@ concrete StructuralGer of Structural' = CatGer **
|
||||
Pl => (detUnlikeAdj' False Pl "kein").s
|
||||
}
|
||||
in
|
||||
{s,sp = \\_ => keiner ; a = Strong ; aPl = Weak ; hasDefArt = False} ; ---- sp
|
||||
{s,sp = \\_,_ => keiner ; a = Strong ; aPl = Weak ; hasDefArt = False} ; ---- sp
|
||||
if_then_Conj = {s1 = "wenn" ; s2 = "dann" ; n = Sg ; lock_Conj = <>} ;
|
||||
nobody_NP =
|
||||
nameNounPhrase' Masc {s = caselist "niemand" "niemanden" "niemandem" "niemands"} ;
|
||||
@@ -165,8 +165,8 @@ concrete StructuralGer of Structural' = CatGer **
|
||||
lin language_title_Utt = ss "Deutsch" ;
|
||||
|
||||
oper
|
||||
asQuant : (Gender => Case => Str) -> (Gender => Case => {quant,num:Str}) =
|
||||
\tab -> \\g,c => {quant = tab ! g ! c; num = []} ;
|
||||
asQuant : (Gender => Case => Str) -> (Bool => Gender => Case => Str) =
|
||||
\tab -> \\_,g,c => tab ! g ! c ;
|
||||
asNum : (Gender => Case => Str) -> (Gender => Case => {quant,num:Str}) =
|
||||
\tab -> \\g,c => {quant = []; num = tab ! g ! c} ;
|
||||
pairTable : (Gender => Case => Str) -> (Gender => Case => Str) -> (Gender => Case => {quant,num:Str})
|
||||
|
||||
@@ -26,12 +26,11 @@ lin
|
||||
ext,rc = [] -- added
|
||||
} ;
|
||||
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 ! c ;
|
||||
s = \\c => artDef (GSg cn.g) c ++ cn.s ! Weak ! Sg ! Nom ++ i.s ! Neutr ! c ;
|
||||
a = agrP3 Sg ;
|
||||
-- isPron = False ;
|
||||
-- isLight = True ;
|
||||
w = WLight ;
|
||||
ext,rc = [] -- added
|
||||
ext,rc = []
|
||||
} ;
|
||||
|
||||
SymbS sy = {s = \\_ => sy.s} ;
|
||||
|
||||
@@ -94,11 +94,12 @@ concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in {
|
||||
|
||||
-- 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}) ;
|
||||
-}
|
||||
-- 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}) ;
|
||||
|
||||
UseComp comp =
|
||||
insertExtrapos comp.ext (insertObj comp.s (predV sein_V)) ; -- agr not used
|
||||
-- adj slot not used here for e.g. "ich bin alt" but same behaviour as NPs?
|
||||
@@ -107,7 +108,7 @@ concrete VerbGer of Verb' = CatGer ** open Prelude, ResGer, Coordination in {
|
||||
UseCopula = predV sein_V ;
|
||||
|
||||
CompAP ap = {s = \\_ => ap.c.p1 ++ ap.s ! APred ++ ap.c.p2 ; ext = ap.ext} ;
|
||||
CompNP np = {s = \\_ => (np.s ! Nom).p1 ++ (np.s ! Nom).p2 ++ np.rc ; ext = np.ext} ;
|
||||
CompNP np = {s = \\_ => np.s ! False ! Nom ++ np.rc ; ext = np.ext} ;
|
||||
CompAdv a = {s = \\_ => a.s ; ext = []} ;
|
||||
|
||||
CompCN cn = {s = \\a => case numberAgr a of {
|
||||
|
||||
Reference in New Issue
Block a user