Modifications of Prep\', Predet\', Quant\', Det\', NP\' to remove PCase and use NP.s : Agr => Str * Str instead

This commit is contained in:
Hans Leiss
2022-07-19 18:27:56 +02:00
parent d3de861e86
commit 8eee3df739
34 changed files with 1331 additions and 187 deletions

View File

@@ -92,6 +92,15 @@ resource ResGer = ParamX ** open Prelude in {
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
-- isPron : {w : Weight} -> Bool = \np ->
-- case np.w of {WPron => True ; _ => False} ;
-- isLight : {w : Weight} -> Bool = \np ->
-- case np.w of {WHeavy => False ; _ => True} ;
--2 For $Adjective$
-- The predicative form of adjectives is not inflected further.
@@ -257,6 +266,13 @@ resource ResGer = ParamX ** open Prelude in {
-- isPron : Bool ; -- needed to put accPron before datPron
w : Weight } ;
NP' : Type = {
s : Case => Str * 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' } ;
mkN : (x1,_,_,_,_,x6,x7 : Str) -> Gender -> Noun =
\Mann, Mannen, Manne, Mannes, Maenner, Maennern, Mann_, g -> {
s = table {
@@ -436,11 +452,75 @@ resource ResGer = ParamX ** open Prelude in {
-- 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 ->
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 ;
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 ;
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
} } ;
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};
Dat' : Preposition' = {s=""; s2=""; sg = \\c => []; c=Dat; isPrep=isCase} ;
mit' : Preposition' = {s="zusammen mit"; s2=""; sg = \\_ => []; 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} ;
-- Pronouns and articles
-- Here we define personal and relative pronouns.
@@ -504,6 +584,15 @@ resource ResGer = ParamX ** open Prelude in {
_ => 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 ->
adj.s ! Posit ! AMod gn c
in
\\n,g,c => case n of {Sg => ad (GSg g) c ;_ => ad GPl c} ;
-- This auxiliary gives the forms in each degree of adjectives.
adjForms : (x1,x2 : Str) -> AForm => Str = \teuer,teur ->
@@ -551,10 +640,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
@@ -616,7 +704,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 -> {
@@ -630,7 +718,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 ->
@@ -731,16 +819,44 @@ resource ResGer = ParamX ** open Prelude in {
<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 ;
isPrep : Bool = case prep.isPrep of {isPrep | isPrepDefArt => True ; _ => False} ;
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 <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'|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>
<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 ;
c = case prep.c of { NPC cc => cc ; _ => Acc } ;
obj : Agr => Str = \\a => prep.s ++ reflPron ! a ! c ; -- HL: to test ReflVP: reflPronSelf
c = prep.c ; -- HL 7/22 reduced to c:Case
obj : Agr => Str = \\a => prep.s ++ reflPron ! a ! c ++ prep.s2 ;
in vp ** {
nn = \\a =>
let vpnn = vp.nn ! a in
case prep.isPrep of {
False => <obj ! a ++ vpnn.p1, vpnn.p2, vpnn.p3, vpnn.p4> ;
True => <vpnn.p1, obj ! a ++ vpnn.p2, vpnn.p3, vpnn.p4> }
isCase => <obj ! a ++ vpnn.p1, vpnn.p2, vpnn.p3, vpnn.p4> ;
_ => <vpnn.p1, obj ! a ++ vpnn.p2, vpnn.p3, vpnn.p4> }
} ;
insertAdV : Str -> VP -> VP = \adv,vp -> vp ** { -- not used in Ger, so VP.a1 can be skipped
@@ -979,6 +1095,9 @@ resource ResGer = ParamX ** open Prelude in {
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 ->
np ** {w = WHeavy' ; ext,rc = []} ; -- this could be wrong
relPron : RelGenNum => Case => Str = \\rgn,c =>
case rgn of {
@@ -999,5 +1118,10 @@ resource ResGer = ParamX ** open Prelude in {
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 } ;
subj = appPrepNP' prep np
in <subj , agr> ;
}