mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 08:58:55 -06:00
(Hun) Add postmod field to CN and NP, to better control word order.
This commit is contained in:
@@ -122,5 +122,6 @@ concrete CatHun of Cat = CommonX - [Adv] ** open ResHun, Prelude in {
|
||||
|
||||
linref
|
||||
CN = linCN ;
|
||||
NP = linNP ;
|
||||
|
||||
}
|
||||
|
||||
@@ -35,17 +35,21 @@ lin
|
||||
|
||||
-- Noun phrases
|
||||
lincat
|
||||
[NP] = ResHun.BaseNP ** {s1,s2 : Possessor => Case => Str} ;
|
||||
[NP] = ResHun.BaseNP ** {s1,s2 : Possessor => Case => Str ; postmod : Str} ;
|
||||
|
||||
lin
|
||||
BaseNP x y = twoTable2 Possessor Case x y ** y ;
|
||||
ConsNP x xs = xs ** consrTable2 Possessor Case comma x xs ;
|
||||
BaseNP x y = twoTable2 Possessor Case (contNP x) y ** y ;
|
||||
ConsNP x xs = xs ** consrTable2 Possessor Case comma (contNP x) xs ;
|
||||
ConjNP co xs = conjunctDistrTable2 Possessor Case co xs ** xs ** {
|
||||
agr = <P3, case xs.agr.p2 of {
|
||||
Pl => Pl ;
|
||||
_ => co.n }>
|
||||
} ;
|
||||
|
||||
oper
|
||||
contNP : NP -> NP = \np ->
|
||||
let linTable : Possessor => Case => Str =
|
||||
\\p,c => case <p,c> of {_ => linNP' p c np} ;
|
||||
in np ** {s = linTable} ;
|
||||
-- Relative sentences
|
||||
lincat
|
||||
[RS] = {s1,s2 : Number => Case => Str} ;
|
||||
|
||||
@@ -36,6 +36,7 @@ concrete NounHun of Noun = CatHun ** open
|
||||
-- : Pron -> NP ;
|
||||
UsePron pron = pron ** {
|
||||
s = \\_ => pron.s ;
|
||||
postmod = [] ;
|
||||
} ;
|
||||
|
||||
-- : Predet -> NP -> NP ; -- only the man
|
||||
@@ -77,7 +78,7 @@ concrete NounHun of Noun = CatHun ** open
|
||||
} ;
|
||||
|
||||
-- : CN -> NP ;
|
||||
MassNP cn = emptyNP ** {
|
||||
MassNP cn = emptyNP ** cn ** {
|
||||
s = \\p,c => case p of {
|
||||
NoPoss => caseFromStem glue cn c Sg ;
|
||||
Poss per rnum =>
|
||||
@@ -192,6 +193,7 @@ concrete NounHun of Noun = CatHun ** open
|
||||
-- : N2 -> CN ;
|
||||
UseN,UseN2 = \n -> n ** {
|
||||
compl = \\_,_ => [] ;
|
||||
postmod = [] ;
|
||||
} ;
|
||||
|
||||
-- : N2 -> NP -> CN ;
|
||||
@@ -221,7 +223,7 @@ concrete NounHun of Noun = CatHun ** open
|
||||
-- : CN -> Adv -> CN ;
|
||||
AdvCN cn adv = case adv.isPre of {
|
||||
True => AdjCN (invarAP adv.s) cn ;
|
||||
False => cn ** {compl = \\n,c => cn.compl ! n ! c ++ adv.s}
|
||||
False => cn ** {postmod = cn.postmod ++ adv.s}
|
||||
} ;
|
||||
|
||||
-- Nouns can also be modified by embedded sentences and questions.
|
||||
|
||||
@@ -12,7 +12,7 @@ concrete PhraseHun of Phrase = CatHun ** open Prelude, ResHun in {
|
||||
UttImpPol = UttImpSg ;
|
||||
-}
|
||||
UttIP,
|
||||
UttNP = \np -> {s = np.s ! NoPoss ! Nom} ;
|
||||
UttNP = \np -> {s = linNP np} ;
|
||||
UttVP vp = {s = vp.obj ++ vp.adv ++ vp.s ! VInf} ;
|
||||
UttAdv adv = adv ;
|
||||
UttCN cn = {s = linCN cn} ;
|
||||
|
||||
@@ -15,6 +15,7 @@ resource ResHun = NounMorphoHun ** open Prelude, Predef in {
|
||||
oper
|
||||
CNoun : Type = Noun ** {
|
||||
compl : Number => Case => Str ;
|
||||
postmod : Str ;
|
||||
} ;
|
||||
|
||||
mkCaseNoun : Str -> Number => Case => Str = \s ->
|
||||
@@ -78,13 +79,14 @@ oper
|
||||
|
||||
NounPhrase : Type = BaseNP ** {
|
||||
s : Possessor => Case => Str ;
|
||||
postmod : Str ;
|
||||
} ;
|
||||
|
||||
emptyNP : NounPhrase = {
|
||||
s = \\_,_ => [] ;
|
||||
agr = <P3,Sg> ;
|
||||
objdef = Indef ;
|
||||
empty = [] ;
|
||||
postmod, empty = [] ;
|
||||
} ;
|
||||
|
||||
indeclNP : Str -> NounPhrase = \s -> emptyNP ** {s = \\p,c => s} ;
|
||||
@@ -95,7 +97,9 @@ oper
|
||||
objdef = Def ;
|
||||
} ;
|
||||
|
||||
linCN : CNoun -> Str = \cn -> cn.s ! SgNom ++ cn.compl ! Sg ! Nom ;
|
||||
linCN : CNoun -> Str = \cn -> cn.s ! SgNom ++ cn.compl ! Sg ! Nom ++ cn.postmod ;
|
||||
linNP' : Possessor -> Case -> NounPhrase -> Str = \p,c,np -> np.s ! p ! c ++ np.postmod ;
|
||||
linNP : NounPhrase -> Str = linNP' NoPoss Nom ;
|
||||
--------------------------------------------------------------------------------
|
||||
-- Pronouns
|
||||
|
||||
@@ -273,7 +277,7 @@ oper
|
||||
emptyAdp : Adposition = nomAdp [] ;
|
||||
|
||||
applyAdp : Adposition -> NounPhrase -> Str = \adp,np ->
|
||||
adp.pr ++ np.s ! NoPoss ! adp.c ++ adp.s ;
|
||||
adp.pr ++ np.s ! NoPoss ! adp.c ++ adp.s ++ np.postmod ;
|
||||
|
||||
applyCase : (Str->Str->Str) -> Case -> Noun -> NumCaseStem -> Str =
|
||||
\bind,cas,cn,stem -> bind (cn.s ! stem) (endCase cas ! cn.h) ;
|
||||
@@ -503,7 +507,7 @@ oper
|
||||
s = \\t,a,p => let subjcase : Case = case vp.sc of {
|
||||
SCNom => Nom ;
|
||||
SCDat => Dat }
|
||||
in np.s ! NoPoss ! subjcase
|
||||
in linNP' NoPoss subjcase np
|
||||
++ if_then_Pol p [] "nem"
|
||||
++ vp.s ! agr2vf np.agr
|
||||
++ vp.obj -- ! np.agr
|
||||
|
||||
@@ -128,13 +128,14 @@ lin
|
||||
_ => cn.s ! SgNom
|
||||
++ cn.compl ! Sg ! Nom
|
||||
++ copula.s ! vf} ;
|
||||
adv = cn.postmod ;
|
||||
} ;
|
||||
|
||||
-- : NP -> Comp ;
|
||||
CompNP np = UseCopula ** {
|
||||
s = \\vf => case vf of {
|
||||
VPres P3 _ => np.s ! NoPoss ! Nom ;
|
||||
_ => np.s ! NoPoss ! Nom ++ copula.s ! vf } ;
|
||||
VPres P3 _ => linNP np ;
|
||||
_ => linNP np ++ copula.s ! vf } ;
|
||||
} ;
|
||||
|
||||
-- : Adv -> Comp ;
|
||||
@@ -151,6 +152,12 @@ insertObj : ResHun.VPSlash -> NounPhrase -> VerbPhrase = \vps,np -> vps ** {
|
||||
<SCDat,Nom> => [] ;
|
||||
_ => np.s ! NoPoss ! vps.c2 } ;
|
||||
|
||||
-- To accommodate application grammars that use AdvCN in place of AdvVP.
|
||||
-- (Easy mistake to make, because in English it doesn't affect word order.)
|
||||
-- If you want the NP's postmodifiers to go right next to the NP,
|
||||
-- put np.postmod right after np.s.
|
||||
adv = vps.adv ++ np.postmod ;
|
||||
|
||||
s = \\vf =>
|
||||
-- If verb's subject case is Dat and object Nom, verb agrees with obj.
|
||||
case <vps.sc,vps.c2> of { -- have_V2 needs its object possessed by the subject
|
||||
|
||||
Reference in New Issue
Block a user