Merge pull request #433 from hleiss/prepDefArt

Prep def art
This commit is contained in:
Inari Listenmaa
2023-08-21 11:16:29 +03:00
committed by GitHub
29 changed files with 745 additions and 559 deletions

View File

@@ -51,12 +51,6 @@ oper
dative : Case ;
genitive : Case ;
anDat_Case : Case ; -- preposition "an" dative with contraction "am" --%
inAcc_Case : Case ; -- preposition "in" accusative with contraction "ins" --%
inDat_Case : Case ; -- preposition "in" dative with contraction "im" --%
zuDat_Case : Case ; -- preposition "zu" dative with contractions "zum", "zur" --%
vonDat_Case : Case ;
-- To abstract over number names, we define the following.
Number : Type ;
@@ -147,6 +141,7 @@ mkN : overload {
} ;
mkGN : overload {
mkGN : Str -> Sex -> GN ; -- regular name with genitive in "s"
mkGN : (nom,gen : Str) -> Sex -> GN ; -- name with other genitive
@@ -193,8 +188,8 @@ mkN : overload {
-- To extract the number of a noun phrase
ifPluralNP : NP -> Bool
= \np -> case (numberAgr np.a) of {Sg => False ; Pl => True} ;
-- ifPluralNP : NP -> Bool
-- = \np -> case (numberAgr np.a) of {Sg => False ; Pl => True} ;
--2 Adjectives
@@ -239,6 +234,10 @@ mkN : overload {
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
} ;
-- Often just a case with the empty string is enough.
@@ -247,13 +246,15 @@ mkN : overload {
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).
-- A couple of common prepositions (the first three always with the dative).
von_Prep : Prep ; -- von + dative
zu_Prep : Prep ; -- zu + dative, with contractions zum, zur
anDat_Prep : Prep ; -- an + dative, with contraction am
inDat_Prep : Prep ; -- in + dative, with contraction ins
inAcc_Prep : Prep ; -- in + accusative, with contraction im
von_Prep : Prep ; -- von + dative, with contraction vom
zu_Prep : Prep ; -- zu + dative, with contractions zum, zur
bei_Prep : Prep ; -- bei + dative, with contraction beim
anDat_Prep : Prep ; -- an + dative, with contraction am
inDat_Prep : Prep ; -- in + dative, with contraction im
inAcc_Prep : Prep ; -- in + accusative, with contraction ins
aufAcc_Prep : Prep ; -- auf + accusative, with contraction aufs
--2 Verbs
@@ -363,7 +364,7 @@ mkV2 : overload {
subjV2V : V2V -> V2V ; -- force subject-control
mkV2A : overload {
mkV2A : V -> V2A ;
mkV2A : V -> V2A ;
mkV2A : V -> Prep -> V2A ;
} ;
mkV2S : overload {
@@ -409,25 +410,20 @@ mkV2 : overload {
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
Gender = MorphoGer.Gender ;
Case = MorphoGer.PCase ;
Case = MorphoGer.Case ;
Number = MorphoGer.Number ;
masculine = Masc ;
feminine = Fem ;
neuter = Neutr ;
male = Male ;
female = Female ;
nominative = NPC Nom ;
accusative = NPC Acc ;
dative = NPC Dat ;
genitive = NPC Gen ;
anDat_Case = NPP CAnDat ;
inAcc_Case = NPP CInAcc ;
inDat_Case = NPP CInDat ;
zuDat_Case = NPP CZuDat ;
vonDat_Case = NPP CVonDat ;
neuter = Neutr ;
male = Male ;
female = Female ;
nominative = Nom ;
accusative = Acc ;
dative = Dat ;
genitive = Gen ;
singular = Sg ;
plural = Pl ;
@@ -570,7 +566,7 @@ mkV2 : overload {
dunk + "el" => mk3A a (dunk + "ler") (dunk + "leste") ;
te + "uer" => mk3A a (te + "urer") (te + "ureste") ;
_ + "e" => mk3A a (a + "r") (a + "ste") ;
_ + ("t" | "d" | "s" | "sch" | "z") => mk3A a (a + "er") (a + "este") ;
_ + ("t" | "d" | "s" | "ß" | "sch" | "z" | "au" | "eu") => mk3A a (a + "er") (a + "este") ;
_ => mk3A a (a + "er") (a + "ste")
} ;
@@ -581,20 +577,32 @@ mkV2 : overload {
mkAdv s = {s = s ; lock_Adv = <>} ;
mkPrep = overload {
mkPrep : Str -> PCase -> Prep = \s,c -> {s = s ; s2 = [] ; c = c ; isPrep = True ; lock_Prep = <>} ;
mkPrep : PCase -> Str -> Prep = \c,s -> {s = [] ; s2 = s ; c = c ; isPrep = True ; lock_Prep = <>} ;
mkPrep : Str -> PCase -> Str -> Prep = \s,c,t -> {s = s ; s2 = t ; c = c ; isPrep = True ; 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 = 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 = [] ; c = accusative ; isPrep = False ; lock_Prep = <>} ;
datPrep = {s,s2 = [] ; c = dative ; isPrep = False ; lock_Prep = <>} ;
genPrep = {s,s2 = [] ; c = genitive ; isPrep = False ; lock_Prep = <>} ;
--von_Prep = mkPrep "von" dative ;
von_Prep = mkPrep [] vonDat_Case ;
zu_Prep = mkPrep [] zuDat_Case ;
anDat_Prep = mkPrep [] anDat_Case ;
inDat_Prep = mkPrep [] inDat_Case ;
inAcc_Prep = mkPrep [] inAcc_Case ;
accPrep = mkPrep accusative ;
datPrep = mkPrep dative ;
genPrep = mkPrep genitive ;
--von_Prep = mkPrep "von" dative ;
von_Prep = mkPrep "von" "vom" "von der" "vom" dative ;
zu_Prep = mkPrep "zu" "zum" "zur" "zum" dative ;
bei_Prep = mkPrep "bei" "beim" "bei der" "beim" 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 ;
aufAcc_Prep = mkPrep "auf" "auf den" "auf die" "aufs" accusative ;
mk6V geben gibt gib gab gaebe gegeben =
let
@@ -635,7 +643,7 @@ mkV2 : overload {
habenV v = v ** {aux = VHaben} ;
seinV v = v ** {aux = VSein} ;
reflV v c = v ** {aux = VHaben ; vtype = VRefl (prepC c).c} ;
reflV v c = v ** {aux = VHaben ; vtype = VRefl c} ;
no_geV v = let vs = v.s in v ** {
s = table {
@@ -664,7 +672,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 = <>} ;
@@ -679,35 +687,34 @@ mkV2 : overload {
mkV0 v = v ** {lock_V = <>} ;
mkV2V = overload { -- default: object-control
mkV2V : V -> V2V
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
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 -> V2A = \v -> dirV2 v ** {isAux = False ; lock_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
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 = <>} ;
} ;
@@ -794,7 +801,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 = [] ; c = c ; isPrep = False}) ;
mkV2 : V -> Case -> V2 = \v,c -> prepV2 v (mkPrep c) ;
} ;
mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ;