1
0
forked from GitHub/gf-rgl

Implementation of prep+DefArt-gluing independent of |PCase| finished

This commit is contained in:
Hans Leiss
2023-08-04 20:34:02 +02:00
parent 0d5919d511
commit c8a424c023
6 changed files with 32 additions and 46 deletions

View File

@@ -5,5 +5,5 @@ concrete AllGer of AllGerAbs =
IrregGer,
---- ExtendGer, ---- to replace ExtraGer
ExtraGer
-- ** open ExtendGer in {} ---- to force compilation HL 7/22 todo: ListNP' in ExtendGer
** open ExtendGer in {} ---- to force compilation
;

View File

@@ -7,6 +7,7 @@ concrete ExtendGer of Extend =
VPS, ListVPS, VPI, ListVPI,
MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS,
MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,
GenModNP,
CardCNCard
]
with
@@ -24,9 +25,9 @@ concrete ExtendGer of Extend =
VPS = {s : Order => Agr => Str} ;
[VPS] = {s1,s2 : Order => Agr => Str} ;
lin
lin
InOrderToVP vp = {s = "um" ++ useInfVP False vp} ;
InOrderToVP vp = {s = "um" ++ useInfVP False vp} ;
BaseVPI = twoTable Bool ;
ConsVPI = consrTable Bool comma ;
@@ -43,7 +44,7 @@ lin
PredVPS np vpi =
let
subj = np.s ! NPC Nom ++ bigNP np ;
subj = np.s ! False ! Nom ++ bigNP np ;
agr = np.a ;
in {
s = \\o =>
@@ -114,31 +115,30 @@ lin
ConjVPS = conjunctDistrTable2 Order Agr ;
UseDAP det = {
s = \\c => det.sp ! Neutr ! c ;
s = \\b,c => det.sp ! Neutr ! c ;
a = agrP3 det.n ;
w = case det.isDef of { True => WLight ; _ => WHeavy } ;
rc, ext = []
} ;
UseDAPMasc det = {
s = \\c => det.sp ! Masc ! c ;
s = \\_,c => det.sp ! Masc ! c ;
a = agrP3 det.n ;
w = WLight ;
rc, ext = []
} ;
UseDAPFem det = {
s = \\c => det.sp ! Fem ! c ;
s = \\_,c => det.sp ! Fem ! c ;
a = agrP3 det.n ;
w = WLight ;
rc, ext = []
} ;
lin
CardCNCard card cn = {
s = \\g,c =>
(Grammar.DetCN (Grammar.DetQuant Grammar.IndefArt (Grammar.NumCard card)) cn).s ! NPC c ;
n = Pl
} ;
CardCNCard card cn = {
s = \\g,c =>
(Grammar.DetCN (Grammar.DetQuant Grammar.IndefArt (Grammar.NumCard card)) cn).s ! False ! c ;
n = Pl
} ;
}

View File

@@ -4,17 +4,18 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in {
flags optimize=all_subs ;
-- Remark: np.isLight makes ResGer.insertObjNP expensive, for ComplSlash, SlashVP
-- np.isLight = True and np.isPron = True are now part of np.w
-- HL 21.7.2022: the dropping of DefArt in Prep+DefArt works by selecting from
-- np.s via b = det.hasDefArt = True the forms without det.s and from prep.s
-- the preposition glued with definite article singular, depending on gender, case.
lin
DetCN det cn = {
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
-- don't see a|no man = sehe keinen Mann
-- w = case det.isDef of { True => WLight ; _ => WHeavy } ;
-- Would be clearer with w:Weight and hasDefArt:Bool with |NP|=|Agr|*3*2 = 108
-- instead of the more efficient w:Weigth' with |NP|=|Agr|*4 = 18*4 = 54
-- HL 6/2019 (but:) sehe (die|einige) Männer nicht; don't see a|no man = sehe keinen Mann
w = case det.isDef of { True => case det.hasDefArt of { True => WDefArt ;
_ => WLight } ;
_ => WHeavy } ;
@@ -25,7 +26,6 @@ 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 = \\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
w = case det.isDef of { True => WLight ; _ => WHeavy } ;
rc, ext = []
@@ -71,15 +71,6 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in {
w = WHeavy
} ;
-- HL 21.7.2022: the dropping of DefArt in Prep+DefArt via hasDefArt works by splitting the
-- np.s into det':Str and cn:Str and (det.s ! g ! n) into {quant:Str; num:Str}, so that in
-- PrepNP in_Prep np we can replace "in" + "das" by "im" to get
-- PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (warme Meer)) => im warmen Meer
-- 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 made Det.s and NP.s depend on t:PrepType = isPrep.
DetQuantOrd quant num ord =
let
n = num.n ;
@@ -167,9 +158,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in {
MassNP cn = {
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 ;
w = WLight ;
w = WLight ; -- ich trinke Bier nicht vs. ich trinke kein Bier
rc = cn.rc ! Sg ;
ext = cn.ext ;
hasDefArt = False

View File

@@ -197,13 +197,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, 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
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
@@ -522,10 +524,12 @@ mkV2 : overload {
--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

View File

@@ -73,8 +73,7 @@ concrete StructuralGer of Structural = CatGer **
only_Predet = {s = \\_,_,_ => "nur" ; c = noCase ; a = PAgNone} ;
no_Utt = ss "nein" ;
---b no_Phr = ss "nein" ;
-- on_Prep = mkPrep "auf" P.dative ;
on_Prep = P.mkPrep "auf" "auf den" "auf die" "aufs" P.accusative ; -- test HL 7/2022
on_Prep = mkPrep "auf" P.dative ;
or_Conj = {s1 = [] ; s2 = "oder" ; n = Sg} ;
otherwise_PConj = ss "sonst" ;
part_Prep = P.von_Prep ; -- obsolete, use PartNP cn np

View File

@@ -11,18 +11,12 @@ lin
CNIntNP cn i = {
s = \\b,c => cn.s ! Weak ! Sg ! Nom ++ i.s ;
a = agrP3 Sg ;
-- isPron = False ;
-- isLight = True ;
w = WLight ;
ext,rc = [] -- added
} ;
CNSymbNP det cn xs = let g = cn.g in {
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 ;
s = \\b,c => det.s ! b ! g ! c ++ cn.s ! adjfCase det.a c ! det.n ! c ++ xs.s ;
a = agrP3 det.n ;
-- isPron = False ;
-- isLight = True ;
w = WLight ;
ext,rc = [] -- added
} ;