mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 17:08:54 -06:00
Merge pull request #344 from inariksit/hungarian-postmod
Hungarian postmod
This commit is contained in:
@@ -122,5 +122,6 @@ concrete CatHun of Cat = CommonX - [Adv] ** open ResHun, Prelude in {
|
|||||||
|
|
||||||
linref
|
linref
|
||||||
CN = linCN ;
|
CN = linCN ;
|
||||||
|
NP = linNP ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,17 +35,21 @@ lin
|
|||||||
|
|
||||||
-- Noun phrases
|
-- Noun phrases
|
||||||
lincat
|
lincat
|
||||||
[NP] = ResHun.BaseNP ** {s1,s2 : Possessor => Case => Str} ;
|
[NP] = ResHun.BaseNP ** {s1,s2 : Possessor => Case => Str ; postmod : Str} ;
|
||||||
|
|
||||||
lin
|
lin
|
||||||
BaseNP x y = twoTable2 Possessor Case x y ** y ;
|
BaseNP x y = twoTable2 Possessor Case (contNP x) y ** y ;
|
||||||
ConsNP x xs = xs ** consrTable2 Possessor Case comma x xs ;
|
ConsNP x xs = xs ** consrTable2 Possessor Case comma (contNP x) xs ;
|
||||||
ConjNP co xs = conjunctDistrTable2 Possessor Case co xs ** xs ** {
|
ConjNP co xs = conjunctDistrTable2 Possessor Case co xs ** xs ** {
|
||||||
agr = <P3, case xs.agr.p2 of {
|
agr = <P3, case xs.agr.p2 of {
|
||||||
Pl => Pl ;
|
Pl => Pl ;
|
||||||
_ => co.n }>
|
_ => 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
|
-- Relative sentences
|
||||||
lincat
|
lincat
|
||||||
[RS] = {s1,s2 : Number => Case => Str} ;
|
[RS] = {s1,s2 : Number => Case => Str} ;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ concrete NounHun of Noun = CatHun ** open
|
|||||||
-- : Pron -> NP ;
|
-- : Pron -> NP ;
|
||||||
UsePron pron = pron ** {
|
UsePron pron = pron ** {
|
||||||
s = \\_ => pron.s ;
|
s = \\_ => pron.s ;
|
||||||
|
postmod = [] ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : Predet -> NP -> NP ; -- only the man
|
-- : Predet -> NP -> NP ; -- only the man
|
||||||
@@ -77,7 +78,7 @@ concrete NounHun of Noun = CatHun ** open
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : CN -> NP ;
|
-- : CN -> NP ;
|
||||||
MassNP cn = emptyNP ** {
|
MassNP cn = emptyNP ** cn ** {
|
||||||
s = \\p,c => case p of {
|
s = \\p,c => case p of {
|
||||||
NoPoss => caseFromStem glue cn c Sg ;
|
NoPoss => caseFromStem glue cn c Sg ;
|
||||||
Poss per rnum =>
|
Poss per rnum =>
|
||||||
@@ -192,6 +193,7 @@ concrete NounHun of Noun = CatHun ** open
|
|||||||
-- : N2 -> CN ;
|
-- : N2 -> CN ;
|
||||||
UseN,UseN2 = \n -> n ** {
|
UseN,UseN2 = \n -> n ** {
|
||||||
compl = \\_,_ => [] ;
|
compl = \\_,_ => [] ;
|
||||||
|
postmod = [] ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : N2 -> NP -> CN ;
|
-- : N2 -> NP -> CN ;
|
||||||
@@ -221,7 +223,7 @@ concrete NounHun of Noun = CatHun ** open
|
|||||||
-- : CN -> Adv -> CN ;
|
-- : CN -> Adv -> CN ;
|
||||||
AdvCN cn adv = case adv.isPre of {
|
AdvCN cn adv = case adv.isPre of {
|
||||||
True => AdjCN (invarAP adv.s) cn ;
|
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.
|
-- Nouns can also be modified by embedded sentences and questions.
|
||||||
|
|||||||
@@ -471,10 +471,14 @@ oper
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- Function to get a harmony from a string
|
-- Function to get a harmony from a string
|
||||||
getHarm : Str -> Harm = \s -> case s of {
|
getHarm : Str -> Harm = \s ->
|
||||||
_ + #back + _ => H_a ;
|
let lastWord : Str = case s of {
|
||||||
_ + #front_rounded + (#c|"") + (#c|"") => H_o ;
|
x + " " + y => y ;
|
||||||
_ => H_e
|
_ => s } ;
|
||||||
|
in case lastWord of {
|
||||||
|
_ + #back + _ => H_a ;
|
||||||
|
_ + #front_rounded + (#c|"") + (#c|"") => H_o ;
|
||||||
|
_ => H_e
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- Used as a table of allomorphs for a give case.
|
-- Used as a table of allomorphs for a give case.
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ param
|
|||||||
| Ela
|
| Ela
|
||||||
| All
|
| All
|
||||||
| Ade
|
| Ade
|
||||||
-- | Abl
|
| Abl
|
||||||
-- | Sub
|
-- | Sub
|
||||||
| Sup
|
| Sup
|
||||||
-- | Del
|
-- | Del
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ concrete PhraseHun of Phrase = CatHun ** open Prelude, ResHun in {
|
|||||||
UttImpPol = UttImpSg ;
|
UttImpPol = UttImpSg ;
|
||||||
-}
|
-}
|
||||||
UttIP,
|
UttIP,
|
||||||
UttNP = \np -> {s = np.s ! NoPoss ! Nom} ;
|
UttNP = \np -> {s = linNP np} ;
|
||||||
UttVP vp = {s = vp.obj ++ vp.adv ++ vp.s ! VInf} ;
|
UttVP vp = {s = vp.obj ++ vp.adv ++ vp.s ! VInf} ;
|
||||||
UttAdv adv = adv ;
|
UttAdv adv = adv ;
|
||||||
UttCN cn = {s = linCN cn} ;
|
UttCN cn = {s = linCN cn} ;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ resource ResHun = NounMorphoHun ** open Prelude, Predef in {
|
|||||||
oper
|
oper
|
||||||
CNoun : Type = Noun ** {
|
CNoun : Type = Noun ** {
|
||||||
compl : Number => Case => Str ;
|
compl : Number => Case => Str ;
|
||||||
|
postmod : Str ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
mkCaseNoun : Str -> Number => Case => Str = \s ->
|
mkCaseNoun : Str -> Number => Case => Str = \s ->
|
||||||
@@ -78,13 +79,14 @@ oper
|
|||||||
|
|
||||||
NounPhrase : Type = BaseNP ** {
|
NounPhrase : Type = BaseNP ** {
|
||||||
s : Possessor => Case => Str ;
|
s : Possessor => Case => Str ;
|
||||||
|
postmod : Str ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
emptyNP : NounPhrase = {
|
emptyNP : NounPhrase = {
|
||||||
s = \\_,_ => [] ;
|
s = \\_,_ => [] ;
|
||||||
agr = <P3,Sg> ;
|
agr = <P3,Sg> ;
|
||||||
objdef = Indef ;
|
objdef = Indef ;
|
||||||
empty = [] ;
|
postmod, empty = [] ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
indeclNP : Str -> NounPhrase = \s -> emptyNP ** {s = \\p,c => s} ;
|
indeclNP : Str -> NounPhrase = \s -> emptyNP ** {s = \\p,c => s} ;
|
||||||
@@ -95,7 +97,9 @@ oper
|
|||||||
objdef = Def ;
|
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
|
-- Pronouns
|
||||||
|
|
||||||
@@ -273,7 +277,7 @@ oper
|
|||||||
emptyAdp : Adposition = nomAdp [] ;
|
emptyAdp : Adposition = nomAdp [] ;
|
||||||
|
|
||||||
applyAdp : Adposition -> NounPhrase -> Str = \adp,np ->
|
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 =
|
applyCase : (Str->Str->Str) -> Case -> Noun -> NumCaseStem -> Str =
|
||||||
\bind,cas,cn,stem -> bind (cn.s ! stem) (endCase cas ! cn.h) ;
|
\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 {
|
s = \\t,a,p => let subjcase : Case = case vp.sc of {
|
||||||
SCNom => Nom ;
|
SCNom => Nom ;
|
||||||
SCDat => Dat }
|
SCDat => Dat }
|
||||||
in np.s ! NoPoss ! subjcase
|
in linNP' NoPoss subjcase np
|
||||||
++ if_then_Pol p [] "nem"
|
++ if_then_Pol p [] "nem"
|
||||||
++ vp.s ! agr2vf np.agr
|
++ vp.s ! agr2vf np.agr
|
||||||
++ vp.obj -- ! np.agr
|
++ vp.obj -- ! np.agr
|
||||||
|
|||||||
@@ -128,13 +128,14 @@ lin
|
|||||||
_ => cn.s ! SgNom
|
_ => cn.s ! SgNom
|
||||||
++ cn.compl ! Sg ! Nom
|
++ cn.compl ! Sg ! Nom
|
||||||
++ copula.s ! vf} ;
|
++ copula.s ! vf} ;
|
||||||
|
adv = cn.postmod ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : NP -> Comp ;
|
-- : NP -> Comp ;
|
||||||
CompNP np = UseCopula ** {
|
CompNP np = UseCopula ** {
|
||||||
s = \\vf => case vf of {
|
s = \\vf => case vf of {
|
||||||
VPres P3 _ => np.s ! NoPoss ! Nom ;
|
VPres P3 _ => linNP np ;
|
||||||
_ => np.s ! NoPoss ! Nom ++ copula.s ! vf } ;
|
_ => linNP np ++ copula.s ! vf } ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : Adv -> Comp ;
|
-- : Adv -> Comp ;
|
||||||
@@ -151,6 +152,12 @@ insertObj : ResHun.VPSlash -> NounPhrase -> VerbPhrase = \vps,np -> vps ** {
|
|||||||
<SCDat,Nom> => [] ;
|
<SCDat,Nom> => [] ;
|
||||||
_ => np.s ! NoPoss ! vps.c2 } ;
|
_ => 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 =>
|
s = \\vf =>
|
||||||
-- If verb's subject case is Dat and object Nom, verb agrees with obj.
|
-- 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
|
case <vps.sc,vps.c2> of { -- have_V2 needs its object possessed by the subject
|
||||||
|
|||||||
Reference in New Issue
Block a user