From d7e10e843b81a4945651d299898258c06a4e6356 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 26 Apr 2020 13:30:00 +0200 Subject: [PATCH 01/11] (Hun) Add case to A and AP --- src/hungarian/AdjectiveHun.gf | 20 +++++++++++--------- src/hungarian/CatHun.gf | 2 +- src/hungarian/ConjunctionHun.gf | 14 +++++++------- src/hungarian/NounHun.gf | 10 ++++++---- src/hungarian/ParadigmsHun.gf | 4 ++-- src/hungarian/PhraseHun.gf | 2 +- src/hungarian/ResHun.gf | 26 +++++++++++++------------- src/hungarian/VerbHun.gf | 6 +++--- 8 files changed, 44 insertions(+), 40 deletions(-) diff --git a/src/hungarian/AdjectiveHun.gf b/src/hungarian/AdjectiveHun.gf index 4970a21a4..2e731e10f 100644 --- a/src/hungarian/AdjectiveHun.gf +++ b/src/hungarian/AdjectiveHun.gf @@ -6,19 +6,19 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in { -- : A -> AP ; PositA a = emptyAP ** { - s = a.s ! Posit + s = \\n,c => + let adj : Noun = (a ** {s = a.s ! Posit}) in + caseFromStem glue adj c n ; } ; -- : A -> NP -> AP ; - ComparA a np = emptyAP ** { - s = a.s ! Compar ; + ComparA a np = UseComparA a ** { compar = applyAdp (caseAdp Ade) np ; -- compar = applyAdp (prepos Nom "mint") np ; } ; -- : A2 -> NP -> AP ; -- married to her - ComplA2 a2 np = emptyAP ** { - s = a2.s ! Posit ; + ComplA2 a2 np = PositA a2 ** { compar = applyAdp a2.c2 np ; } ; @@ -30,12 +30,14 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in { -- : A -> AP ; -- warmer UseComparA a = emptyAP ** { - s = a.s ! Compar ; + s = \\n,c => + let adj : Noun = (a ** {s = a.s ! Compar}) in + caseFromStem glue adj c n ; } ; -- : CAdv -> AP -> NP -> AP ; -- as cool as John CAdvAP adv ap np = ap ** { - s = \\n => adv.s ++ ap.s ! n ; + s = \\n,c => adv.s ++ ap.s ! n ! c ; compar = ap.compar ++ adv.p ++ applyAdp (caseAdp Nom) np ; } ; @@ -54,7 +56,7 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in { -- : AdA -> AP -> AP ; AdAP ada ap = ap ** { - s = \\af => ada.s ++ ap.s ! af ; + s = \\n,c => ada.s ++ ap.s ! n ! c ; } ; @@ -62,7 +64,7 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in { -- : AP -> Adv -> AP ; -- warm by nature AdvAP ap adv = ap ** { - s = \\af => ap.s ! af ++ adv.s ; + s = \\n,c => ap.s ! n ! c ++ adv.s ; } ; } diff --git a/src/hungarian/CatHun.gf b/src/hungarian/CatHun.gf index 956554909..82583e2d1 100644 --- a/src/hungarian/CatHun.gf +++ b/src/hungarian/CatHun.gf @@ -66,7 +66,7 @@ concrete CatHun of Cat = CommonX - [Adv] ** open ResHun, Prelude in { Quant = ResHun.Quant ; Num = ResHun.Num ; Ord = { - s : Number => Str ; -- Number => Case => Str ; -- Ord can come from AP and become AP again + s : Number => Case => Str ; -- Ord can come from AP and become AP again n : Number -- Ord can come from Num, which has inherent number } ; DAP = ResHun.Determiner ; diff --git a/src/hungarian/ConjunctionHun.gf b/src/hungarian/ConjunctionHun.gf index 9fc6d33e9..613f4a3ea 100644 --- a/src/hungarian/ConjunctionHun.gf +++ b/src/hungarian/ConjunctionHun.gf @@ -20,18 +20,18 @@ lin -- Adjectival phrases lincat - [AP] = {s1,s2 : Number => Str} ; + [AP] = {s1,s2 : Number => Case => Str} ; lin BaseAP x y = -- Don't try to have discontinuous comparative forms - let xCont : AP = x ** {s = \\n => x.s ! n ++ x.compar} ; - yCont : AP = y ** {s = \\n => y.s ! n ++ y.compar} ; - in twoTable Number xCont yCont ; + let xCont : AP = x ** {s = \\n,c => x.s ! n ! c ++ x.compar} ; + yCont : AP = y ** {s = \\n,c => y.s ! n ! c ++ y.compar} ; + in twoTable2 Number Case xCont yCont ; ConsAP a as = - let aCont : AP = a ** {s = \\n => a.s ! n ++ a.compar} ; - in consrTable Number comma aCont as ; - ConjAP co as = conjunctDistrTable Number co as ** {compar = []} ; + let aCont : AP = a ** {s = \\n,c => a.s ! n ! c ++ a.compar} ; + in consrTable2 Number Case comma aCont as ; + ConjAP co as = conjunctDistrTable2 Number Case co as ** {compar = []} ; -- Noun phrases lincat diff --git a/src/hungarian/NounHun.gf b/src/hungarian/NounHun.gf index cd022af06..fb4c369f5 100644 --- a/src/hungarian/NounHun.gf +++ b/src/hungarian/NounHun.gf @@ -103,8 +103,8 @@ concrete NounHun of Noun = CatHun ** open -- : Quant -> Num -> Ord -> Det ; -- these five best DetQuantOrd quant num ord = let theseFive = DetQuant quant num in theseFive ** { - s = \\c => theseFive.s ! c ++ ord.s ! num.n ; - sp = \\c => theseFive.sp ! c ++ ord.s ! num.n ; + s = \\c => theseFive.s ! c ++ ord.s ! num.n ! Nom ; + sp = \\c => theseFive.sp ! c ++ ord.s ! num.n ! Nom ; } ; -- Whether the resulting determiner is singular or plural depends on the @@ -145,7 +145,9 @@ concrete NounHun of Noun = CatHun ** open -} -- : A -> Ord ; OrdSuperl a = { - s = a.s ! Superl ; + s = \\n,c => + let adj : Noun = (a ** {s = a.s ! Superl}) in + caseFromStem glue adj c n ; n = Sg -- ?? is this meaningful? } ; @@ -201,7 +203,7 @@ concrete NounHun of Noun = CatHun ** open -- : AP -> CN -> CN AdjCN ap cn = cn ** { - s = \\nc => ap.s ! Sg ++ cn.s ! nc ; + s = \\nc => ap.s ! Sg ! Nom ++ cn.s ! nc ; compl = \\n,c => ap.compar ++ cn.compl ! n ! c ; } ; diff --git a/src/hungarian/ParadigmsHun.gf b/src/hungarian/ParadigmsHun.gf index fc07c8c2d..93e457b42 100644 --- a/src/hungarian/ParadigmsHun.gf +++ b/src/hungarian/ParadigmsHun.gf @@ -159,9 +159,9 @@ oper mkA2 = overload { mkA2 : A -> A2 = \a -> a ** {c2 = casePrep Nom} ; mkA2 : Str -> Prep -> A2 = \s,p -> - lin A2 {s = (mkAdj s).s ; c2 = p} ; + lin A2 ((mkAdj s) ** {c2 = p}) ; mkA2 : Str -> Case -> A2 = \s,c -> - lin A2 {s = (mkAdj s).s ; c2 = casePrep c} ; + lin A2 ((mkAdj s) ** {c2 = casePrep c}) ; mkA2 : A -> Prep -> A2 = \a,p -> lin A2 (a ** {c2 = p}) ; } ; diff --git a/src/hungarian/PhraseHun.gf b/src/hungarian/PhraseHun.gf index 5e27da756..b4b5a8e14 100644 --- a/src/hungarian/PhraseHun.gf +++ b/src/hungarian/PhraseHun.gf @@ -17,7 +17,7 @@ concrete PhraseHun of Phrase = CatHun ** open Prelude, ResHun in { UttAdv adv = adv ; UttCN cn = {s = linCN cn} ; UttCard n = {s = n.s ! Indep} ; - UttAP ap = {s = ap.s ! Sg ++ ap.compar} ; + UttAP ap = {s = ap.s ! Sg ! Nom ++ ap.compar} ; UttInterj i = i ; NoPConj = {s = []} ; diff --git a/src/hungarian/ResHun.gf b/src/hungarian/ResHun.gf index 1495bf98f..23d8b62a6 100644 --- a/src/hungarian/ResHun.gf +++ b/src/hungarian/ResHun.gf @@ -305,35 +305,35 @@ oper -- Adjectives AdjPhrase : Type = { - s : Number => Str ; + s : Number => Case => Str ; compar : Str -- Discontinuous: Én *nagyobb* vagyok *nálad*. } ; emptyAP : AdjPhrase = { - s = \\_ => [] ; + s = \\_,_ => [] ; compar = [] ; } ; Adjective : Type = { - s : Degree => Number => Str + s : Degree => NumCaseStem => Str ; + h : Harm ; } ; + Adjective2 : Type = Adjective ** { c2 : Adposition ; } ; - mkAdj : Str -> Adjective = \sg -> { - s = \\d,n => + mkAdj : Str -> Adjective = \sgnom -> { + s = \\d,nc => let adj = case d of { - Compar => comparAdj sg ; - Superl => "leg" + comparAdj sg ; - _ => sg } ; - plural = case n of { - Sg => [] ; - Pl => pluralAdj adj } - in adj + plural + Compar => comparAdj sgnom ; + Superl => "leg" + comparAdj sgnom ; + _ => sgnom } ; + in (mkNoun adj).s ! nc ; + h = (mkNoun sgnom).h ; } ; - invarAP : Str -> AdjPhrase = \s -> emptyAP ** {s = \\_ => s} ; + invarAP : Str -> AdjPhrase = \s -> emptyAP ** {s = \\_,_ => s} ; -- https://en.wikisource.org/wiki/Simplified_Grammar_of_the_Hungarian_Language/Adjectives comparAdj : Str -> Str = \stem -> diff --git a/src/hungarian/VerbHun.gf b/src/hungarian/VerbHun.gf index b3fbb51d9..0abd729c4 100644 --- a/src/hungarian/VerbHun.gf +++ b/src/hungarian/VerbHun.gf @@ -110,9 +110,9 @@ lin -- : AP -> Comp ; CompAP ap = UseCopula ** { s = \\vf => case vf of { - VPres P3 n => ap.s ! n ; - VPres _ n => ap.s ! n ++ copula.s ! vf ; - _ => ap.s ! Sg ++ copula.s ! vf} + VPres P3 n => ap.s ! n ! Nom ; + VPres _ n => ap.s ! n ! Nom ++ copula.s ! vf ; + _ => ap.s ! Sg ! Nom ++ copula.s ! vf} ++ ap.compar ; } ; From b723ae1a75bad32aed550629053ec4a6f5137f99 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 26 Apr 2020 14:15:31 +0200 Subject: [PATCH 02/11] (Hun) Add number as a parameter to APs complement --- src/hungarian/AdjectiveHun.gf | 8 ++++---- src/hungarian/ConjunctionHun.gf | 8 ++++---- src/hungarian/NounHun.gf | 2 +- src/hungarian/PhraseHun.gf | 2 +- src/hungarian/ResHun.gf | 5 +++-- src/hungarian/VerbHun.gf | 7 +++---- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/hungarian/AdjectiveHun.gf b/src/hungarian/AdjectiveHun.gf index 2e731e10f..4a105d10a 100644 --- a/src/hungarian/AdjectiveHun.gf +++ b/src/hungarian/AdjectiveHun.gf @@ -13,13 +13,13 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in { -- : A -> NP -> AP ; ComparA a np = UseComparA a ** { - compar = applyAdp (caseAdp Ade) np ; - -- compar = applyAdp (prepos Nom "mint") np ; + compl = \\n => applyAdp (caseAdp Ade) np ; + -- compl = applyAdp (prepos Nom "mint") np ; } ; -- : A2 -> NP -> AP ; -- married to her ComplA2 a2 np = PositA a2 ** { - compar = applyAdp a2.c2 np ; + compl = \\n => applyAdp a2.c2 np ; } ; -- : A2 -> AP ; -- married to itself @@ -38,7 +38,7 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in { -- : CAdv -> AP -> NP -> AP ; -- as cool as John CAdvAP adv ap np = ap ** { s = \\n,c => adv.s ++ ap.s ! n ! c ; - compar = ap.compar ++ adv.p ++ applyAdp (caseAdp Nom) np ; + compl = \\n => ap.compl ! n ++ adv.p ++ applyAdp (caseAdp Nom) np ; } ; -- The superlative use is covered in $Ord$. diff --git a/src/hungarian/ConjunctionHun.gf b/src/hungarian/ConjunctionHun.gf index 613f4a3ea..689a9c891 100644 --- a/src/hungarian/ConjunctionHun.gf +++ b/src/hungarian/ConjunctionHun.gf @@ -25,13 +25,13 @@ lincat lin BaseAP x y = -- Don't try to have discontinuous comparative forms - let xCont : AP = x ** {s = \\n,c => x.s ! n ! c ++ x.compar} ; - yCont : AP = y ** {s = \\n,c => y.s ! n ! c ++ y.compar} ; + let xCont : AP = x ** {s = \\n,c => x.s ! n ! c ++ x.compl ! n} ; + yCont : AP = y ** {s = \\n,c => y.s ! n ! c ++ y.compl ! n} ; in twoTable2 Number Case xCont yCont ; ConsAP a as = - let aCont : AP = a ** {s = \\n,c => a.s ! n ! c ++ a.compar} ; + let aCont : AP = a ** {s = \\n,c => a.s ! n ! c ++ a.compl ! n} ; in consrTable2 Number Case comma aCont as ; - ConjAP co as = conjunctDistrTable2 Number Case co as ** {compar = []} ; + ConjAP co as = conjunctDistrTable2 Number Case co as ** {compl = \\_ => []} ; -- Noun phrases lincat diff --git a/src/hungarian/NounHun.gf b/src/hungarian/NounHun.gf index fb4c369f5..70dc98ba5 100644 --- a/src/hungarian/NounHun.gf +++ b/src/hungarian/NounHun.gf @@ -204,7 +204,7 @@ concrete NounHun of Noun = CatHun ** open -- : AP -> CN -> CN AdjCN ap cn = cn ** { s = \\nc => ap.s ! Sg ! Nom ++ cn.s ! nc ; - compl = \\n,c => ap.compar ++ cn.compl ! n ! c ; + compl = \\n,c => ap.compl ! n ++ cn.compl ! n ! c ; } ; -- : CN -> RS -> CN ; diff --git a/src/hungarian/PhraseHun.gf b/src/hungarian/PhraseHun.gf index b4b5a8e14..687668418 100644 --- a/src/hungarian/PhraseHun.gf +++ b/src/hungarian/PhraseHun.gf @@ -17,7 +17,7 @@ concrete PhraseHun of Phrase = CatHun ** open Prelude, ResHun in { UttAdv adv = adv ; UttCN cn = {s = linCN cn} ; UttCard n = {s = n.s ! Indep} ; - UttAP ap = {s = ap.s ! Sg ! Nom ++ ap.compar} ; + UttAP ap = {s = ap.s ! Sg ! Nom ++ ap.compl ! Sg} ; UttInterj i = i ; NoPConj = {s = []} ; diff --git a/src/hungarian/ResHun.gf b/src/hungarian/ResHun.gf index 23d8b62a6..16a69253e 100644 --- a/src/hungarian/ResHun.gf +++ b/src/hungarian/ResHun.gf @@ -306,12 +306,13 @@ oper AdjPhrase : Type = { s : Number => Case => Str ; - compar : Str -- Discontinuous: Én *nagyobb* vagyok *nálad*. + compl : Number => Str -- Discontinuous comparative: Én nagyobb vagyok nálad. + -- This depends on Number to allow postmodifier APs. } ; emptyAP : AdjPhrase = { s = \\_,_ => [] ; - compar = [] ; + compl = \\_ => [] ; } ; Adjective : Type = { diff --git a/src/hungarian/VerbHun.gf b/src/hungarian/VerbHun.gf index 0abd729c4..c07e22ba6 100644 --- a/src/hungarian/VerbHun.gf +++ b/src/hungarian/VerbHun.gf @@ -110,10 +110,9 @@ lin -- : AP -> Comp ; CompAP ap = UseCopula ** { s = \\vf => case vf of { - VPres P3 n => ap.s ! n ! Nom ; - VPres _ n => ap.s ! n ! Nom ++ copula.s ! vf ; - _ => ap.s ! Sg ! Nom ++ copula.s ! vf} - ++ ap.compar ; + VPres P3 n => ap.s ! n ! Nom ++ ap.compl ! n ; + VPres _ n => ap.s ! n ! Nom ++ copula.s ! vf ++ ap.compl ! n ; + _ => ap.s ! Sg ! Nom ++ copula.s ! vf ++ ap.compl ! Sg } ; } ; -- : CN -> Comp ; From ef3dc464cb90ed4b204f7c37536e56a01a3bc678 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 26 Apr 2020 14:15:53 +0200 Subject: [PATCH 03/11] (Hun) Update Symbol after changes in lincats --- src/hungarian/SymbolHun.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hungarian/SymbolHun.gf b/src/hungarian/SymbolHun.gf index 2d0b3909d..1fe3dffe0 100644 --- a/src/hungarian/SymbolHun.gf +++ b/src/hungarian/SymbolHun.gf @@ -18,7 +18,7 @@ lin oper mkPN : Str -> NounPhrase = \s -> emptyNP ** { - s = \\_ => s ; + s = \\_,_ => s ; } ; lin @@ -42,7 +42,7 @@ lin SymbNum sy = baseNum ** {s = \\_ => sy.s} ; -- : Symb -> Ord ; - SymbOrd sy = {s = \\n => sy.s ; n=Pl} ; + SymbOrd sy = {s = \\n,c => sy.s ; n=Pl} ; lincat Symb, [Symb] = SS ; From 797171fb31f8099b24af9fd63d2a1a9aca9246ff Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 26 Apr 2020 14:35:12 +0200 Subject: [PATCH 04/11] (Hun) Remove unnecessary distinction between digits and numbers --- src/hungarian/NounHun.gf | 2 +- src/hungarian/ParamHun.gf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hungarian/NounHun.gf b/src/hungarian/NounHun.gf index 70dc98ba5..185b361b5 100644 --- a/src/hungarian/NounHun.gf +++ b/src/hungarian/NounHun.gf @@ -125,7 +125,7 @@ concrete NounHun of Noun = CatHun ** open -- : Digits -> Card ; NumDigits dig = dig ** { s = \\place => dig.s ! NCard ; - numtype = IsDig ; + numtype = IsNum ; } ; -- : Numeral -> Card ; diff --git a/src/hungarian/ParamHun.gf b/src/hungarian/ParamHun.gf index 029969d0d..f340c33a0 100644 --- a/src/hungarian/ParamHun.gf +++ b/src/hungarian/ParamHun.gf @@ -112,7 +112,7 @@ param CardOrd = NOrd | NCard ; -- Not used yet - NumType = NoNum | IsDig | IsNum ; + NumType = NoNum | IsNum ; oper isNum : {numtype : NumType} -> Bool = \nt -> case nt.numtype of { From b6b462ca359694e793a6cb51860e4b089dcb7100 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 26 Apr 2020 15:19:43 +0200 Subject: [PATCH 05/11] (Hun) Temporarily comment out cases+change order in funs that pat. match --- src/hungarian/NounMorphoHun.gf | 12 ++++++------ src/hungarian/ParamHun.gf | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/hungarian/NounMorphoHun.gf b/src/hungarian/NounMorphoHun.gf index 4dd658241..5113a5b6c 100644 --- a/src/hungarian/NounMorphoHun.gf +++ b/src/hungarian/NounMorphoHun.gf @@ -436,18 +436,18 @@ oper Nom => harm1 [] ; Acc => harm3 "ot" "et" "öt" ; Dat => harm "nak" "nek" ; - Ins => harm "al" "el" ; - Tra => harm "á" "é" ; - Ill => harm "ba" "be" ; + Ade => harm "nál" "nél" ; + Sup => harm3 "on" "en" "ön" ; Ine => harm "ban" "ben" ; Ela => harm "ból" "ből" ; + Ins => harm "al" "el" ; + Tra => harm "á" "é" ; All => harm3 "hoz" "hez" "höz" ; - Ade => harm "nál" "nél" ; Abl => harm "tól" "től" ; Sub => harm "ra" "re" ; - Sup => harm3 "on" "en" "ön" ; Del => harm "ról" "ről" ; - Cau => harm1 "ért" + Cau => harm1 "ért" ; + Ill => harm "ba" "be" -- Ess => harm "stul" "stül" ; -- Essive-modal 'with and its parts' -- Ter => harm1 "ig" ; -- Terminative 'as far as ' -- For => harm1 "ként" ; -- Formal 'as ' diff --git a/src/hungarian/ParamHun.gf b/src/hungarian/ParamHun.gf index f340c33a0..9969dbd80 100644 --- a/src/hungarian/ParamHun.gf +++ b/src/hungarian/ParamHun.gf @@ -65,8 +65,16 @@ param Case = Nom | Acc | Dat - | Ill | Ine | Ela | All | Ade | Abl | Sub | Sup | Del -- Locatives - | Cau -- Causal-final 'for the purpose of, for the reason that' +-- | Ill -- Locatives + | Ine + | Ela + | All + | Ade +-- | Abl +-- | Sub + | Sup +-- | Del +-- | Cau -- Causal-final 'for the purpose of, for the reason that' | Ins -- Instrumental | Tra -- Translative -- | Ess | Ter | For @@ -87,14 +95,14 @@ oper Ins => ins ; Tra => tra ; Sup => sup ; - Sub => sub ; - Del => del ; - Ill => il ; Ine => ine ; Ela => el ; All => al ; Ade => ad ; Abl => ab ; + Sub => sub ; + Del => del ; + Ill => il ; Cau => ca } ; sc2case : SubjCase -> Case = \sc -> From 22cadd2ac64dbbc64426f9c3281ac88e12de91a5 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 26 Apr 2020 15:51:34 +0200 Subject: [PATCH 06/11] (Hun) Combine the parameters on definiteness and Quant/Det type --- src/hungarian/NounHun.gf | 21 +++++++++------------ src/hungarian/ParamHun.gf | 34 ++++++++++++++++++++++++++-------- src/hungarian/ResHun.gf | 8 ++------ 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/src/hungarian/NounHun.gf b/src/hungarian/NounHun.gf index 185b361b5..3698ef6ba 100644 --- a/src/hungarian/NounHun.gf +++ b/src/hungarian/NounHun.gf @@ -16,17 +16,18 @@ concrete NounHun of Noun = CatHun ** open True => det.s ! c ; False => det.s ! Nom } ++ case of { - + <_, DetPoss _> + => possessed ; + => standalone ; - <_, DetPoss _> - => possessed ; - + => let pron : Pronoun = pronTable ! ; -- Possessor's number dnum : CatHun.Num = case det.n of { -- Possessed's number Sg => NumSg ; Pl => NumPl } ; in caseFromPossStem cn (DetQuant (PossPron pron) dnum) c } ++ cn.compl ! det.n ! c ; agr = ; + objdef = dt2objdef det.dt ; } ; -- : PN -> NP ; @@ -96,8 +97,7 @@ concrete NounHun of Noun = CatHun ** open => [] ; _ => quant.sp ! num.n ! c } ++ num.s ! Indep ; - dt = case quant.qt of { QuantPoss stem => DetPoss stem ; - _ => NoPoss } ; + dt = qt2dt quant.qt ; } ; -- : Quant -> Num -> Ord -> Det ; -- these five best @@ -160,23 +160,20 @@ concrete NounHun of Noun = CatHun ** open DefArt = mkQuant "a" "a" ** { s, sp = \\_,_ => pre {"a" ; "az" / v } ; - qt = Article ; - objdef = Def ; + qt = DefQuant ; } ; -- : Quant IndefArt = mkQuant "egy" [] ** { s = \\n,_ => case n of {Sg => "egy" ; Pl => []} ; sp = \\n,_ => case n of {Sg => "egy" ; Pl => "sok"} ; - qt = Article ; - objdef = Indef ; + qt = IndefArticle ; } ; -- : Pron -> Quant PossPron pron = pron ** { s,sp = \\_ => pron.s ; - qt = QuantPoss (agr2PossStem pron.agr) ; - objdef = Def ; + qt = QuantPoss (agr2pstem pron.agr) ; caseagr = False ; } ; diff --git a/src/hungarian/ParamHun.gf b/src/hungarian/ParamHun.gf index 9969dbd80..dd396ddf3 100644 --- a/src/hungarian/ParamHun.gf +++ b/src/hungarian/ParamHun.gf @@ -18,13 +18,15 @@ oper param QuantType = - Article -- Needed to prevent "a 2 cars" - | Other -- Not poss, not article + IndefArticle -- Needed to prevent "a 2 cars" + | IndefQuant -- Not IndefArt, not poss, not def + | DefQuant | QuantPoss PossStem -- Which possessive stem it takes ; DetType = - NoPoss -- distinction between Article and Other no longer needed + DefDet -- distinction between Article and Other no longer needed + | IndefDet -- still need def or indef | DetPoss PossStem -- Sill need to know which stem it takes if Poss ; @@ -33,13 +35,29 @@ param oper -- standard trick to prevent "a one car" - isIndefArt : {qt : QuantType ; objdef : ObjDef} -> Bool = \quant -> - case of { - => True ; - _ => False + isIndefArt : {qt : QuantType} -> Bool = \quant -> + case quant.qt of { + IndefArticle => True ; + _ => False } ; - agr2PossStem : Person*Number -> PossStem = \pn -> + dt2objdef : DetType -> ObjDef = \dt -> case dt of { + IndefDet => Indef ; + _ => Def + } ; + + objdef2dt : ObjDef -> DetType = \od -> case od of { + Def => DefDet ; + Indef => IndefDet + } ; + + qt2dt : QuantType -> DetType = \qt -> case qt of { + QuantPoss x => DetPoss x ; + DefQuant => DefDet ; + _ => IndefDet + } ; + + agr2pstem : Person*Number -> PossStem = \pn -> case of { => dSg_rPl1 ; => dSg_rP3 n ; diff --git a/src/hungarian/ResHun.gf b/src/hungarian/ResHun.gf index 16a69253e..0ff69be26 100644 --- a/src/hungarian/ResHun.gf +++ b/src/hungarian/ResHun.gf @@ -185,7 +185,6 @@ oper BaseQuant : Type = { poss : HarmForms ; -- Quants made by PossPron need this, empty for others - objdef : ObjDef ; -- How V2 agrees if NP with this Det is an object caseagr : Bool ; -- If it agrees in case: "azoknak a nőknek" vs. "sok nőknek" } ; @@ -200,8 +199,7 @@ oper mkQuant : (s,sp : Str) -> Quant = \s,sp -> { s = mkCaseNoun s ; sp = mkCaseNoun sp ; - qt = Other ; - objdef = Def ; + qt = DefQuant ; caseagr = True ; poss = harm1 [] ; } ; @@ -212,7 +210,6 @@ oper s, sp : Case => Str ; n : Number ; --- numtype : NumType ; -- Whether its Num component is digit, numeral or Sg/Pl dt : DetType ; } ; @@ -221,9 +218,8 @@ oper sp = mkCaseNoun s ! n ; n = n ; numtype = NoNum ; - objdef = d ; caseagr = ca ; - dt = NoPoss ; + dt = objdef2dt d ; poss = harm1 [] ; } ; From bbcde26d72870ac0e71ae9c4a20e18cf9c0a95d8 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 26 Apr 2020 20:16:45 +0200 Subject: [PATCH 07/11] (Hun) Add 2-argument smart paradigm for A --- src/hungarian/ParadigmsHun.gf | 3 ++- src/hungarian/ResHun.gf | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/hungarian/ParadigmsHun.gf b/src/hungarian/ParadigmsHun.gf index 93e457b42..b382baf3b 100644 --- a/src/hungarian/ParadigmsHun.gf +++ b/src/hungarian/ParadigmsHun.gf @@ -151,7 +151,8 @@ oper mkA = overload { mkA : (sgnom : Str) -> A = \s -> lin A (mkAdj s) ; - mkA : (sgnom,sgacc : Str) -> A = \s,_ -> lin A (mkAdj s) ; -- TODO + mkA : (sgnom,sgacc : Str) -> A = \n,a -> + lin A (mkAdj2 n (regNounNomAcc n a)) ; -- mkA : (kiga : Str) -> (jakda : A) -> A = \kiga,jakda -> -- jakda ** {s = \\af => kiga ++ jakda.s ! af} ; } ; diff --git a/src/hungarian/ResHun.gf b/src/hungarian/ResHun.gf index 0ff69be26..55df9a1c3 100644 --- a/src/hungarian/ResHun.gf +++ b/src/hungarian/ResHun.gf @@ -320,14 +320,16 @@ oper c2 : Adposition ; } ; - mkAdj : Str -> Adjective = \sgnom -> { - s = \\d,nc => - let adj = case d of { - Compar => comparAdj sgnom ; - Superl => "leg" + comparAdj sgnom ; - _ => sgnom } ; - in (mkNoun adj).s ! nc ; - h = (mkNoun sgnom).h ; + mkAdj : Str -> Adjective = \sgnom -> mkAdj2 sgnom (mkNoun sgnom) ; + + + mkAdj2 : Str -> Noun -> Adjective = \sgnom,adjAsNoun -> adjAsNoun ** { + s = \\d => + let adj : Noun = case d of { + Compar => mkNoun (comparAdj sgnom) ; + Superl => mkNoun ("leg" + comparAdj sgnom) ; + _ => adjAsNoun } ; + in adj.s ; } ; invarAP : Str -> AdjPhrase = \s -> emptyAP ** {s = \\_,_ => s} ; From 69c73963358991d691021026345d53452bdddf46 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 26 Apr 2020 20:31:49 +0200 Subject: [PATCH 08/11] (Hun) Update unit tests to use stem-based morphology --- src/hungarian/unittest/dative.gftest | 8 +++--- src/hungarian/unittest/determiners.gftest | 10 +++---- src/hungarian/unittest/inflection/alma.gftest | 2 +- .../unittest/inflection/férfi.gftest | 2 +- src/hungarian/unittest/relative.gftest | 28 +++++++++---------- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/hungarian/unittest/dative.gftest b/src/hungarian/unittest/dative.gftest index d7345451a..2acdcb6e5 100644 --- a/src/hungarian/unittest/dative.gftest +++ b/src/hungarian/unittest/dative.gftest @@ -1,16 +1,16 @@ -- LangEng: I have a cat Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a have_V2) (DetCN (DetQuant IndefArt NumSg) (UseN cat_N)))))) NoVoc -LangHun: nekem van egy macskám +LangHun: nekem van egy macská &+ m -- LangEng: I have the cat Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a have_V2) (DetCN (DetQuant DefArt NumSg) (UseN cat_N)))))) NoVoc -LangHun: nekem van a macskám +LangHun: nekem van a macská &+ m --In this case we don't have to use plural -- LangEng: I have many cats Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a have_V2) (DetCN many_Det (UseN cat_N)))))) NoVoc -LangHun: nekem van sok macskám +LangHun: nekem van sok macská &+ m -- LangEng: I have some cats Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a have_V2) (DetCN somePl_Det (UseN cat_N)))))) NoVoc -LangHun: nekem van néhány macskám +LangHun: nekem van néhány macská &+ m diff --git a/src/hungarian/unittest/determiners.gftest b/src/hungarian/unittest/determiners.gftest index 8bb2c331f..ce4856b70 100644 --- a/src/hungarian/unittest/determiners.gftest +++ b/src/hungarian/unittest/determiners.gftest @@ -1,6 +1,6 @@ Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant this_Quant NumSg) (UseN apple_N)))))) NoVoc LangEng: I see this apple -LangHun: én látom ezt az almát +LangHun: én látom ezt az almá &+ t Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant this_Quant NumPl) (UseN apple_N)))))) NoVoc LangEng: I see these apples @@ -20,11 +20,11 @@ LangHun: én látom ezeket Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN somePl_Det (UseN apple_N)))))) NoVoc LangEng: I see some apples -LangHun: én látok néhány almát +LangHun: én látok néhány almá &+ t Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN somePl_Det (AdjCN (PositA red_A) (UseN apple_N))))))) NoVoc LangEng: I see some red apples -LangHun: én látok néhány piros almát +LangHun: én látok néhány piros almá &+ t Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetNP somePl_Det))))) NoVoc LangEng: I see some @@ -32,8 +32,8 @@ LangHun: én látok néhányat Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN few_Det (AdjCN (PositA red_A) (UseN apple_N))))))) NoVoc LangEng: I see few red apples -LangHun: én látok kevés piros almát +LangHun: én látok kevés piros almá &+ t Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN many_Det (AdjCN (PositA red_A) (UseN apple_N))))))) NoVoc LangEng: I see many red apples -LangHun: én látok sok piros almát +LangHun: én látok sok piros almá &+ t diff --git a/src/hungarian/unittest/inflection/alma.gftest b/src/hungarian/unittest/inflection/alma.gftest index a8600c754..994656c2b 100644 --- a/src/hungarian/unittest/inflection/alma.gftest +++ b/src/hungarian/unittest/inflection/alma.gftest @@ -2,7 +2,7 @@ Lang: MassNP (UseN apple_N) LangHun: alma Lang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant IndefArt NumSg) (UseN apple_N))) -LangHun: én látok egy almát +LangHun: én látok egy almá &+ t Lang: PrepNP on_Prep (DetCN (DetQuant IndefArt NumSg) (UseN apple_N)) LangHun: egy almán diff --git a/src/hungarian/unittest/inflection/férfi.gftest b/src/hungarian/unittest/inflection/férfi.gftest index 47de6fb33..171a59443 100644 --- a/src/hungarian/unittest/inflection/férfi.gftest +++ b/src/hungarian/unittest/inflection/férfi.gftest @@ -2,7 +2,7 @@ Lang: MassNP (UseN man_N) LangHun: férfi Lang: PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant IndefArt NumSg) (UseN man_N))) -LangHun: én látok egy férfit +LangHun: én látok egy férfi &+ t Lang: PrepNP on_Prep (DetCN (DetQuant IndefArt NumSg) (UseN man_N)) LangHun: egy férfin diff --git a/src/hungarian/unittest/relative.gftest b/src/hungarian/unittest/relative.gftest index a65477065..5e378b85e 100644 --- a/src/hungarian/unittest/relative.gftest +++ b/src/hungarian/unittest/relative.gftest @@ -6,39 +6,39 @@ -- LangEng: I see a man that flies Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant IndefArt NumSg) (RelCN (UseN man_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV fly_V))))))))) NoVoc -LangHun: én látok egy férfit ami repül +LangHun: én látok egy férfi &+ t ami repül -- LangEng: I see the man that flies Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN man_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV fly_V))))))))) NoVoc -LangHun: én látom a férfit ami repül +LangHun: én látom a férfi &+ t ami repül -- LangEng: I see the man that sees a cat Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN man_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant IndefArt NumSg) (UseN cat_N))))))))))) NoVoc -LangHun: én látom a férfit ami egy macskát lát +LangHun: én látom a férfi &+ t ami egy macská &+ t lát -- LangEng: I see the man that sees the cat Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN man_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant DefArt NumSg) (UseN cat_N))))))))))) NoVoc -LangHun: én látom a férfit ami a macskát látja +LangHun: én látom a férfi &+ t ami a macská &+ t látja -- LangEng: I see the man that has a cat Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN man_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a have_V2) (DetCN (DetQuant IndefArt NumSg) (UseN cat_N))))))))))) NoVoc -LangHun: én látom a férfit aminek egy macskája van +LangHun: én látom a férfi &+ t aminek egy macskáj &+ a van -- LangEng: I see the man that has the cat Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN man_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a have_V2) (DetCN (DetQuant DefArt NumSg) (UseN cat_N))))))))))) NoVoc -LangHun: én látom a férfit aminek megvan a macska +LangHun: én látom a férfi &+ t aminek megvan a macska -- vet inte riktigt hur jag ska tänka med "the cat", tyckte det kändes mer rätt med "meg-" konstruktionen -- LangEng: I see the cat that flies and that is red -- Do we need copula in "is red" or is it still fine without? -- This constructor repeats amit, we have other constructors that don't. I think we don't need it Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN cat_N) (ConjRS and_Conj (BaseRS (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV fly_V))) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseComp (CompAP (PositA red_A))))))))))))) NoVoc -LangHun: én látom a macskát ami repül és piros +LangHun: én látom a macská &+ t ami repül és piros --skulle dock byta plats på "piros" och "repül" -- LangEng: I see the man that flies and that has a cat Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN man_N) (ConjRS and_Conj (BaseRS (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV fly_V))) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a have_V2) (DetCN (DetQuant IndefArt NumSg) (UseN cat_N))))))))))))) NoVoc -LangHun: én látom a férfit ami repül és aminek egy macskája van +LangHun: én látom a férfi &+ t ami repül és aminek egy macskáj &+ a van ------------------------------------------------------------- @@ -47,26 +47,26 @@ LangHun: én látom a férfit ami repül és aminek egy macskája van -- LangEng: I see the man that the cat sees Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN man_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (SlashV2a see_V2)))))))))) NoVoc -LangHun: én látom a férfit amit a macska lát +LangHun: én látom a férfi &+ t amit a macska lát -- LangEng: I see a man that the cat sees -- Should this be "amit a macska lát"? Yes Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant IndefArt NumSg) (RelCN (UseN man_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (SlashV2a see_V2)))))))))) NoVoc -LangHun: én látok egy férfit amit a macska lát +LangHun: én látok egy férfi &+ t amit a macska lát --These last cases not corrected due to "van" confusion -- LangEng: I see a cat that the man has Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant DefArt NumSg) (UseN man_N)) (SlashV2a have_V2)))))))))) NoVoc -LangHun: én látok egy macskát amit a férfinak van +LangHun: én látok egy macská &+ t amit a férfi &+ nak van -- LangEng: I see the cat that the man has Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant DefArt NumSg) (UseN man_N)) (SlashV2a have_V2)))))))))) NoVoc -LangHun: én látom a macskát amit a férfinak van +LangHun: én látom a macská &+ t amit a férfi &+ nak van -- LangEng: I see the cat that the man has and that flies Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant DefArt NumSg) (RelCN (UseN cat_N) (ConjRS and_Conj (BaseRS (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant DefArt NumSg) (UseN man_N)) (SlashV2a have_V2)))) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV fly_V))))))))))) NoVoc -LangHun: én látom a macskát amit a férfinak van és amit repül +LangHun: én látom a macská &+ t amit a férfi &+ nak van és amit repül -- LangEng: I am redder than the cats that those women have Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseComp (CompAP (ComparA red_A (DetCN (DetQuant DefArt NumPl) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelSlash IdRP (SlashVP (DetCN (DetQuant that_Quant NumPl) (UseN woman_N)) (SlashV2a have_V2)))))))))))) NoVoc -LangHun: én pirosabb vagyok a macskáknál amik azoknak a nőknek vannak +LangHun: én pirosabb vagyok a macskák &+ nál amik azoknak a nők &+ nek vannak From c076409f6a5490b6c25dbc6b51fdc383ce6644b2 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 26 Apr 2020 20:32:01 +0200 Subject: [PATCH 09/11] (Hun) Fix some words --- src/hungarian/StructuralHun.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hungarian/StructuralHun.gf b/src/hungarian/StructuralHun.gf index f980a7310..3e6a44378 100644 --- a/src/hungarian/StructuralHun.gf +++ b/src/hungarian/StructuralHun.gf @@ -61,8 +61,8 @@ lin most_Predet = {s = ""} ; -} --lin every_Det = -lin few_Det = mkDet "kevés" Def Sg False ; -- TODO check -lin many_Det = mkDet "sok" Def Sg False ; -- TODO check +lin few_Det = mkDet "kevés" Indef Sg False ; +lin many_Det = mkDet "sok" Indef Sg False ; --lin much_Det = lin someSg_Det, From a9e02de33e407afe075765e83a2a666b5a08b484 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 26 Apr 2020 20:52:09 +0200 Subject: [PATCH 10/11] (Hun) Make VP smaller by forcing object of have_V2 in s field. Probably bad decision, makes word order fixed at VP already. But works for a particular application grammar. --- src/hungarian/PhraseHun.gf | 2 +- src/hungarian/ResHun.gf | 8 ++++---- src/hungarian/SentenceHun.gf | 2 +- src/hungarian/VerbHun.gf | 19 ++++++++++++------- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/hungarian/PhraseHun.gf b/src/hungarian/PhraseHun.gf index 687668418..8cc417d97 100644 --- a/src/hungarian/PhraseHun.gf +++ b/src/hungarian/PhraseHun.gf @@ -13,7 +13,7 @@ concrete PhraseHun of Phrase = CatHun ** open Prelude, ResHun in { -} UttIP, UttNP = \np -> {s = np.s ! NotPossessed ! Nom} ; - UttVP vp = {s = vp.obj ! ++ vp.adv ++ vp.s ! VInf} ; + UttVP vp = {s = vp.obj ++ vp.adv ++ vp.s ! VInf} ; UttAdv adv = adv ; UttCN cn = {s = linCN cn} ; UttCard n = {s = n.s ! Indep} ; diff --git a/src/hungarian/ResHun.gf b/src/hungarian/ResHun.gf index 55df9a1c3..bbaabd65a 100644 --- a/src/hungarian/ResHun.gf +++ b/src/hungarian/ResHun.gf @@ -457,7 +457,7 @@ oper -- VP VerbPhrase : Type = Verb ** { - obj : Person*Number => Str ; + obj : Str ; -- Person*Number => Str, if we want open word order in have_V2 adv : Str ; c2 : Case ; -- for RelSlash } ; -- TODO more fields @@ -467,7 +467,7 @@ oper } ; useV : Verb -> VerbPhrase = \v -> v ** { - obj = \\_ => [] ; + obj = [] ; adv = [] ; c2 = Acc ; -- TODO check } ; @@ -503,7 +503,7 @@ oper in np.s ! NotPossessed ! subjcase ++ if_then_Pol p [] "nem" ++ vp.s ! agr2vf np.agr - ++ vp.obj ! np.agr + ++ vp.obj -- ! np.agr ++ vp.adv ++ np.empty -- standard trick for prodrop+metavariable problem } ; @@ -521,7 +521,7 @@ oper SCDat => Dat } in rp.s ! n ! subjcase ++ if_then_Pol p [] "nem" - ++ vp.obj ! + ++ vp.obj -- ! ++ vp.adv ++ vp.s ! VPres rp.agr.p1 n -- variable by number } ; diff --git a/src/hungarian/SentenceHun.gf b/src/hungarian/SentenceHun.gf index e402dc22c..82f884ca0 100644 --- a/src/hungarian/SentenceHun.gf +++ b/src/hungarian/SentenceHun.gf @@ -15,7 +15,7 @@ lin --2 Clauses missing object noun phrases -- : NP -> VPSlash -> ClSlash ; - SlashVP np vps = predVP np (vps ** {s = vps.s ! Indef ; obj = \\_ => []}) ; + SlashVP np vps = predVP np (vps ** {s = vps.s ! Indef ; obj = []}) ; {- -- : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today AdvSlash cls adv = cls ** insertAdv adv cls ; diff --git a/src/hungarian/VerbHun.gf b/src/hungarian/VerbHun.gf index c07e22ba6..06cf22441 100644 --- a/src/hungarian/VerbHun.gf +++ b/src/hungarian/VerbHun.gf @@ -147,16 +147,21 @@ lin oper insertObj : ResHun.VPSlash -> NounPhrase -> VerbPhrase = \vps,np -> vps ** { - obj = \\agr => - -- have_V2 needs its object possessed by the subject - case of { - => np.s ! Poss agr.p1 agr.p2 ! vps.c2 ; - _ => np.s ! NotPossessed ! vps.c2 } ; + obj = case of { + => [] ; + _ => np.s ! NotPossessed ! vps.c2 } ; s = \\vf => -- If verb's subject case is Dat and object Nom, verb agrees with obj. - case of { - => vps.s ! np.objdef ! agr2vf np.agr; + case of { -- have_V2 needs its object possessed by the subject + => + let agr : Person*Number = case vf of { + VPres p n => ; + _ => } ; + in np.s ! Poss agr.p1 agr.p2 ! vps.c2 + ++ vps.s ! np.objdef ! agr2vf np.agr ; + + -- Default case: Verb agrees in person and number with subject _ => vps.s ! np.objdef ! vf } ; } ; From 61a3fe78b451a32328c68636687ac72d42c084e0 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Sun, 26 Apr 2020 21:17:14 +0200 Subject: [PATCH 11/11] (Hun) A2 can go before or after its complement --- src/hungarian/AdjectiveHun.gf | 8 ++++++-- src/hungarian/ParadigmsHun.gf | 8 ++++---- src/hungarian/ResHun.gf | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/hungarian/AdjectiveHun.gf b/src/hungarian/AdjectiveHun.gf index 4a105d10a..a9fdefd6e 100644 --- a/src/hungarian/AdjectiveHun.gf +++ b/src/hungarian/AdjectiveHun.gf @@ -18,8 +18,12 @@ concrete AdjectiveHun of Adjective = CatHun ** open ResHun, Prelude in { } ; -- : A2 -> NP -> AP ; -- married to her - ComplA2 a2 np = PositA a2 ** { - compl = \\n => applyAdp a2.c2 np ; + ComplA2 a2 np = let ap : AP = PositA a2 in ap ** { + s = case a2.isPost of {False => ap.s ; _ => \\_,_ => []} ; + compl = \\n => applyAdp a2.c2 np + ++ case a2.isPost of { + True => ap.s ! n ! Nom ; + False => [] } ; } ; -- : A2 -> AP ; -- married to itself diff --git a/src/hungarian/ParadigmsHun.gf b/src/hungarian/ParadigmsHun.gf index b382baf3b..57c5101b3 100644 --- a/src/hungarian/ParadigmsHun.gf +++ b/src/hungarian/ParadigmsHun.gf @@ -158,13 +158,13 @@ oper } ; mkA2 = overload { - mkA2 : A -> A2 = \a -> a ** {c2 = casePrep Nom} ; + mkA2 : A -> A2 = \a -> a ** {c2 = casePrep Nom ; isPost = False} ; mkA2 : Str -> Prep -> A2 = \s,p -> - lin A2 ((mkAdj s) ** {c2 = p}) ; + lin A2 ((mkAdj s) ** {c2 = p ; isPost = False}) ; mkA2 : Str -> Case -> A2 = \s,c -> - lin A2 ((mkAdj s) ** {c2 = casePrep c}) ; + lin A2 ((mkAdj s) ** {c2 = casePrep c ; isPost = False}) ; mkA2 : A -> Prep -> A2 = \a,p -> - lin A2 (a ** {c2 = p}) ; + lin A2 (a ** {c2 = p ; isPost = False}) ; } ; mkV = overload { diff --git a/src/hungarian/ResHun.gf b/src/hungarian/ResHun.gf index bbaabd65a..441fb6066 100644 --- a/src/hungarian/ResHun.gf +++ b/src/hungarian/ResHun.gf @@ -318,6 +318,7 @@ oper Adjective2 : Type = Adjective ** { c2 : Adposition ; + isPost : Bool ; -- put adjective past the thing it modifies } ; mkAdj : Str -> Adjective = \sgnom -> mkAdj2 sgnom (mkNoun sgnom) ;