1
0
forked from GitHub/gf-rgl

(Ger) small fix to make reimplementation of infinitives compile for 'present'

new SlashVP, RelSlash in tests/german/TestLangGer to control reflexives in relative clauses
This commit is contained in:
Hans Leiss
2022-04-11 15:33:36 +02:00
39 changed files with 1042 additions and 431 deletions

View File

@@ -1,5 +1,5 @@
abstract TestLang =
Grammar,
Grammar - [SlashVP, RelSlash],
TestLexiconGerAbs
, Construction
** {
@@ -32,4 +32,12 @@ abstract TestLang =
Pass2V3 : V3 -> NP -> VP ; -- uns erklärt werden ; Eng give_V3[indir,dir]: we are given the book
Pass2V4 : V4 -> NP -> VPSlash ; -- bei dir (für Gold) gekauft werden
cat
ClauseSlash ;
fun
RelSlash : RP -> ClauseSlash -> RCl ;
SlashVP : NP -> VPSlash -> ClauseSlash ;
} ;

View File

@@ -2,7 +2,7 @@
-- use the modified files in gf-rgl/src/german
concrete TestLangGer of TestLang =
GrammarGer
GrammarGer - [SlashVP, RelSlash]
, TestLexiconGer
, ConstructionGer
** open ResGer,Prelude,(P=ParadigmsGer) in {
@@ -100,12 +100,10 @@ concrete TestLangGer of TestLang =
insertExtrapos vp.ext (
insertInf inf vps) ** {c2 = v.c2 ; objCtrl = v.objCtrl} ;
}
-- SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
-- -- (the book) that (she (begged:V2V me:NP (to buy ()):VPSlash):VPSlash):ClSlash
-- 3/22 expensive:
-- 3/22 expensive: |NP|=54, |Prep|=|18|, |V2|=180, |V2V|=720, |VP|=360, |VPSlash|=12.290 (!)
-- i -v -src TestLangGer.gf
-- + ComplSlash 699840 (355680,532)
-- + SlashV2V 259200 (1440,20)
@@ -152,3 +150,99 @@ gr -tr (PredVP (UsePron ?) (ComplSlash (SlashV2V lassen_V2V (ReflVP (SlashV2a wa
-}
-- Reimplementation of SlashVP: replace mkClause by mkClSlash to let reflexives agree
-- with object in relative clauses, if objCtrl = true. To save memory, use
-- ClauseSlash.s : ... => RelGenNum => Str instead of : ... => Agr => Str.
-- + SlashVP 699840 gf: out of memory (requested 2097152 bytes) with Agr => Str
-- + SlashVP 699840 (2880,160) with RelGenNum => Str; |Agr| = 18, |RelGenNum| = 5.
-- Todo: replace other uses of ClSlash by ClauseSlash
lincat
ClauseSlash = {
s : Mood => ResGer.Tense => Anteriority => Polarity => Order => RelGenNum => Str ;
c2 : Preposition
} ;
lin
SlashVP np vp =
let subj = mkSubj np vp.c1
in mkClSlash subj.p1 subj.p2 vp ** { c2 = vp.c2 } ;
RelSlash rp cls = lin RCl {
s = \\m,t,a,p,gn =>
appPrep cls.c2 (\\k => usePrepC k (\c -> rp.s ! gn ! c)) ++
cls.s ! m ! t ! a ! p ! Sub ! gn ;
c = (prepC cls.c2.c).c
} ;
{-
QuestSlash ip slash = {
s = \\m,t,a,p =>
let
cls = slash.s ! m ! t ! a ! p ;
who = appPrep slash.c2 (\\k => usePrepC k (\c -> ip.s ! c)) ;
in table {
QDir => who ++ cls ! Inv ;
QIndir => who ++ cls ! Sub
}
} ;
-}
oper
gnToAgr : RelGenNum -> Agr = \gn ->
case gn of {RGenNum (GSg g) => Ag g Sg P3 ;
RGenNum GPl => Ag Neutr Pl P3 ;
RSentence => Ag Neutr Sg P3} ;
mkClSlash : Str -> Agr -> ResGer.VPSlash -> ClauseSlash = \subj,agr,vp ->
let vps = useVP vp in lin ClauseSlash {
c2 = vp.c2 ;
s = \\m,t,a,b,o,gn =>
let
ord = case o of {
Sub => True ; -- glue prefix to verb
_ => False
} ;
verb = vps.s ! ord ! agr ! VPFinite m t a ;
haben = verb.inf2 ;
neg = negation ! b ;
ag : Agr = case vp.objCtrl of {True => gnToAgr gn ; _ => agr} ;
obj1 = (vp.nn ! ag).p1 ++ (vp.nn ! ag).p2 ; -- refl ++ pronouns ++ light nps
obj2 = (vp.nn ! ag).p3 ; -- pp-objects and heavy nps
obj3 = (vp.nn ! ag).p4 ++ vp.adj ++ vp.a2 ; -- pred.AP|CN|Adv, via useComp HL 6/2019
compl : Str = obj1 ++ obj2 ++ neg ++ obj3 ;
infObjs = (vp.inf.inpl.p1) ! ag ;
infPred = vp.inf.inpl.p2 ;
infCompl : Str = case <t,a,vp.isAux> of {
<Fut|Cond,Anter,True> => [] ; _ => infObjs ++ infPred } ;
pred : {inf, infComplfin : Str} = case <t,a,vp.isAux> of {
<Fut|Cond,Anter,True> => --# notpresent
{inf = infObjs ++ haben ++ infPred ++ verb.inf ; --# notpresent Duden 318
infComplfin = -- es ++ wird ++ haben ++ tun ++ wollen --# notpresent
infObjs ++ verb.fin ++ haben ++ infPred ++ verb.inf} ; --# notpresent
<_,Anter,True> => --# notpresent
{inf = verb.inf ++ haben ; --# notpresent
infComplfin = -- es ++ wird/hat/hatte ++ tun ++ wollen --# notpresent
infObjs ++ verb.fin ++ infPred ++ verb.inf ++ haben} ; --# notpresent
<Pres,_,_> =>
{inf = verb.inf ++ haben ;
infComplfin = -- es zu tun ++ [] ++ [] ++ versucht
infCompl ++ verb.inf ++ haben ++ verb.fin}
; --# notpresent
_ => --# notpresent
{inf = verb.inf ++ haben ; --# notpresent
infComplfin = -- es zu tun ++ versucht ++ [] ++ hat --# notpresent
infCompl ++ verb.inf ++ haben ++ verb.fin} --# notpresent
} ;
extra : Str = (vp.inf.extr) ! ag ++ vp.ext ;
in
case o of {
Main => subj ++ verb.fin ++ compl ++ infCompl ++ pred.inf ++ extra ;
Inv => verb.fin ++ subj ++ compl ++ infCompl ++ pred.inf ++ extra ;
Subj => subj ++ compl ++ pred.infComplfin ++ extra
}
} ;
}