From 8a29598f3c86916eaa3d06dec4905da2e554f4a7 Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 20 Oct 2010 16:19:33 +0000 Subject: [PATCH] English and Swedish resource functions for Query --- lib/src/abstract/Adjective.gf | 4 +++ lib/src/abstract/Conjunction.gf | 14 ++++++---- lib/src/abstract/Extra.gf | 19 -------------- lib/src/abstract/Noun.gf | 2 +- lib/src/abstract/Question.gf | 10 +++++++ lib/src/abstract/Verb.gf | 3 +++ lib/src/english/AdjectiveEng.gf | 2 ++ lib/src/english/ConjunctionEng.gf | 10 +++++++ lib/src/english/ExtraEng.gf | 33 +++--------------------- lib/src/english/QuestionEng.gf | 12 +++++++++ lib/src/english/VerbEng.gf | 2 ++ lib/src/scandinavian/AdjectiveScand.gf | 5 ++++ lib/src/scandinavian/CatScand.gf | 2 +- lib/src/scandinavian/ConjunctionScand.gf | 12 +++++++++ lib/src/scandinavian/QuestionScand.gf | 19 ++++++++++++++ lib/src/scandinavian/VerbScand.gf | 13 +++++++--- 16 files changed, 103 insertions(+), 59 deletions(-) diff --git a/lib/src/abstract/Adjective.gf b/lib/src/abstract/Adjective.gf index d8fe2d9ac..e9c1c6b84 100644 --- a/lib/src/abstract/Adjective.gf +++ b/lib/src/abstract/Adjective.gf @@ -29,6 +29,10 @@ abstract Adjective = Cat ** { AdAP : AdA -> AP -> AP ; -- very warm +-- It can also be postmodified by an adverb, typically a prepositional phrase. + + AdvAP : AP -> Adv -> AP ; -- warm by nature + -- The formation of adverbs from adjective (e.g. "quickly") is covered -- in [Adverb Adverb.html]. diff --git a/lib/src/abstract/Conjunction.gf b/lib/src/abstract/Conjunction.gf index 3c40fe1f0..087c7d484 100644 --- a/lib/src/abstract/Conjunction.gf +++ b/lib/src/abstract/Conjunction.gf @@ -17,11 +17,13 @@ abstract Conjunction = Cat ** { --2 Rules fun - ConjS : Conj -> [S] -> S ; -- "he walks and she runs" - ConjRS : Conj -> [RS] -> RS ; -- "who walks and whose mother runs" - ConjAP : Conj -> [AP] -> AP ; -- "cold and warm" - ConjNP : Conj -> [NP] -> NP ; -- "she or we" - ConjAdv : Conj -> [Adv] -> Adv ; -- "here or there" + ConjS : Conj -> [S] -> S ; -- "he walks and she runs" + ConjRS : Conj -> [RS] -> RS ; -- "who walks and whose mother runs" + ConjAP : Conj -> [AP] -> AP ; -- "cold and warm" + ConjNP : Conj -> [NP] -> NP ; -- "she or we" + ConjAdv : Conj -> [Adv] -> Adv ; -- "here or there" + ConjIAdv : Conj -> [IAdv] -> IAdv ; -- "where and with whom" + ConjCN : Conj -> [CN] -> CN ; -- "man and woman" --2 Categories @@ -33,6 +35,8 @@ abstract Conjunction = Cat ** { [Adv]{2} ; [NP]{2} ; [AP]{2} ; + [IAdv]{2} ; + [CN] {2} ; --2 List constructors diff --git a/lib/src/abstract/Extra.gf b/lib/src/abstract/Extra.gf index 36abbae49..e7436a22e 100644 --- a/lib/src/abstract/Extra.gf +++ b/lib/src/abstract/Extra.gf @@ -63,26 +63,7 @@ abstract Extra = Cat ** { UseFoc : Temp -> Pol -> Foc -> Utt ; - cat - [CN] {2} ; fun - ConjCN : Conj -> [CN] -> CN ; -- (every) man and woman - PartVP : VP -> AP ; -- looking at Mary - cat - QVP ; -- buy what where - [IAdv] {2} ; -- when and where - fun - ComplSlashIP : VPSlash -> IP -> QVP ; -- buys what - AdvQVP : VP -> IAdv -> QVP ; -- lives where - AddAdvQVP : QVP -> IAdv -> QVP ; -- buys what where - - QuestQVP : IP -> QVP -> QCl ; -- who buys what where - - ConjIAdv : Conj -> [IAdv] -> IAdv ; -- when, where and with whom - - AdvAP : AP -> Adv -> AP ; -- hungry as a wolf - - UseCopula : VP ; } diff --git a/lib/src/abstract/Noun.gf b/lib/src/abstract/Noun.gf index 2daf141d6..a826ae91b 100644 --- a/lib/src/abstract/Noun.gf +++ b/lib/src/abstract/Noun.gf @@ -133,4 +133,4 @@ abstract Noun = Cat ** { ApposCN : CN -> NP -> CN ; -- city Paris (, numbers x and y) -} ; +} diff --git a/lib/src/abstract/Question.gf b/lib/src/abstract/Question.gf index a5d43d709..3a7c3e64e 100644 --- a/lib/src/abstract/Question.gf +++ b/lib/src/abstract/Question.gf @@ -42,4 +42,14 @@ abstract Question = Cat ** { -- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$. +-- Wh questions with two or more question words require a new, special category. + + cat + QVP ; -- buy what where + fun + ComplSlashIP : VPSlash -> IP -> QVP ; -- buys what + AdvQVP : VP -> IAdv -> QVP ; -- lives where + AddAdvQVP : QVP -> IAdv -> QVP ; -- buys what where + + QuestQVP : IP -> QVP -> QCl ; -- who buys what where } diff --git a/lib/src/abstract/Verb.gf b/lib/src/abstract/Verb.gf index de33cac05..958980d6b 100644 --- a/lib/src/abstract/Verb.gf +++ b/lib/src/abstract/Verb.gf @@ -69,4 +69,7 @@ abstract Verb = Cat ** { CompAdv : Adv -> Comp ; -- (be) here CompCN : CN -> Comp ; -- (be) a man/men +-- Copula alone + + UseCopula : VP ; -- be } diff --git a/lib/src/english/AdjectiveEng.gf b/lib/src/english/AdjectiveEng.gf index 94b8501ed..4ee8deee9 100644 --- a/lib/src/english/AdjectiveEng.gf +++ b/lib/src/english/AdjectiveEng.gf @@ -50,4 +50,6 @@ concrete AdjectiveEng of Adjective = CatEng ** open ResEng, Prelude in { isPre = True } ; + AdvAP ap adv = {s = \\a => ap.s ! a ++ adv.s ; isPre = False} ; + } diff --git a/lib/src/english/ConjunctionEng.gf b/lib/src/english/ConjunctionEng.gf index 758041c0c..b0e8924af 100644 --- a/lib/src/english/ConjunctionEng.gf +++ b/lib/src/english/ConjunctionEng.gf @@ -21,6 +21,10 @@ concrete ConjunctionEng of Conjunction = c = ss.c } ; + ConjIAdv = conjunctDistrSS ; + + ConjCN co ns = conjunctDistrTable2 Number Case co ns ** {g = Neutr} ; --- gender? + -- These fun's are generated from the list cat's. BaseS = twoSS ; @@ -33,12 +37,18 @@ concrete ConjunctionEng of Conjunction = ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ; BaseRS x y = twoTable Agr x y ** {c = y.c} ; ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ; + BaseIAdv = twoSS ; + ConsIAdv = consrSS comma ; + BaseCN = twoTable2 Number Case ; + ConsCN = consrTable2 Number Case comma ; lincat [S] = {s1,s2 : Str} ; [Adv] = {s1,s2 : Str} ; + [IAdv] = {s1,s2 : Str} ; [NP] = {s1,s2 : Case => Str ; a : Agr} ; [AP] = {s1,s2 : Agr => Str ; isPre : Bool} ; [RS] = {s1,s2 : Agr => Str ; c : Case} ; + [CN] = {s1,s2 : Number => Case => Str} ; } diff --git a/lib/src/english/ExtraEng.gf b/lib/src/english/ExtraEng.gf index 652c32e70..e23b1aea3 100644 --- a/lib/src/english/ExtraEng.gf +++ b/lib/src/english/ExtraEng.gf @@ -60,8 +60,9 @@ concrete ExtraEng of ExtraEngAbs = CatEng ** { s = table { RC _ Gen => "whose" ; RC _ _ => "that" ; - RPrep Neutr => "which" ; - RPrep _ => "whom" + _ => "that" ---- "in that" ? +-- RPrep Neutr => "which" ; +-- RPrep _ => "whom" } ; a = RNoAg } ; @@ -97,38 +98,10 @@ concrete ExtraEng of ExtraEngAbs = CatEng ** IAdvAdv adv = {s = "how" ++ adv.s} ; - lincat - [CN] = {s1,s2 : Number => Case => Str} ; - - lin - BaseCN = twoTable2 Number Case ; - ConsCN = consrTable2 Number Case comma ; - ConjCN co ns = conjunctDistrTable2 Number Case co ns ** {g = Neutr} ; --- gender? - PartVP vp = { s = \\a => vp.ad ++ vp.prp ++ vp.s2 ! a ; isPre = False ---- depends on whether there are complements } ; - lincat - QVP = ResEng.VP ; - [IAdv] = {s1,s2 : Str} ; - lin - ComplSlashIP vp np = insertObjPre (\\_ => vp.c2 ++ np.s ! Acc) vp ; - AdvQVP vp adv = insertObj (\\_ => adv.s) vp ; - AddAdvQVP vp adv = insertObj (\\_ => adv.s) vp ; - - QuestQVP qp vp = - let cl = mkClause (qp.s ! Nom) (agrP3 qp.n) vp - in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ; - - BaseIAdv = twoSS ; - ConsIAdv = consrSS comma ; - ConjIAdv = conjunctDistrSS ; - - AdvAP ap adv = {s = \\a => ap.s ! a ++ adv.s ; isPre = False} ; - - UseCopula = predAux auxBe ; - UttVPShort vp = {s = infVP True vp (agrP3 Sg)} ; } diff --git a/lib/src/english/QuestionEng.gf b/lib/src/english/QuestionEng.gf index 81f51c6ef..b3a4695d1 100644 --- a/lib/src/english/QuestionEng.gf +++ b/lib/src/english/QuestionEng.gf @@ -54,4 +54,16 @@ concrete QuestionEng of Question = CatEng ** open ResEng, Prelude in { CompIAdv a = a ; CompIP p = ss (p.s ! Nom) ; + lincat + QVP = ResEng.VP ; + lin + ComplSlashIP vp np = insertObjPre (\\_ => vp.c2 ++ np.s ! Acc) vp ; + AdvQVP vp adv = insertObj (\\_ => adv.s) vp ; + AddAdvQVP vp adv = insertObj (\\_ => adv.s) vp ; + + QuestQVP qp vp = + let cl = mkClause (qp.s ! Nom) (agrP3 qp.n) vp + in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ; + + } diff --git a/lib/src/english/VerbEng.gf b/lib/src/english/VerbEng.gf index 45c0f9818..bd78c6203 100644 --- a/lib/src/english/VerbEng.gf +++ b/lib/src/english/VerbEng.gf @@ -52,4 +52,6 @@ concrete VerbEng of Verb = CatEng ** open ResEng in { } } ; + UseCopula = predAux auxBe ; + } diff --git a/lib/src/scandinavian/AdjectiveScand.gf b/lib/src/scandinavian/AdjectiveScand.gf index 59580d135..13ef88b61 100644 --- a/lib/src/scandinavian/AdjectiveScand.gf +++ b/lib/src/scandinavian/AdjectiveScand.gf @@ -54,6 +54,11 @@ incomplete concrete AdjectiveScand of Adjective = isPre = ap.isPre } ; + AdvAP ap adv = { + s = \\a => ap.s ! a ++ adv.s ; + isPre = ap.isPre + } ; + UseA2 a = { s = \\ap => a.s ! AF (APosit ap) Nom ; isPre = True diff --git a/lib/src/scandinavian/CatScand.gf b/lib/src/scandinavian/CatScand.gf index 6839ef2bf..e83954b4e 100644 --- a/lib/src/scandinavian/CatScand.gf +++ b/lib/src/scandinavian/CatScand.gf @@ -52,7 +52,7 @@ incomplete concrete CatScand of Cat = n3 : Agr => Str ; -- object-control complement c2 : Complement } ; - Comp = {s : AFormPos => Str} ; + Comp = {s : Agr => Str} ; -- Adjective diff --git a/lib/src/scandinavian/ConjunctionScand.gf b/lib/src/scandinavian/ConjunctionScand.gf index 7f63d7f6b..5de87b477 100644 --- a/lib/src/scandinavian/ConjunctionScand.gf +++ b/lib/src/scandinavian/ConjunctionScand.gf @@ -21,6 +21,12 @@ incomplete concrete ConjunctionScand of Conjunction = c = ss.c } ; + ConjIAdv = conjunctDistrSS ; + + ConjCN co ns = conjunctDistrTable3 Number DetSpecies Case co ns ** + {g = utrum ; isMod = True} ; ---- + + -- These fun's are generated from the list cat's. BaseS = twoTable Order ; @@ -33,12 +39,18 @@ incomplete concrete ConjunctionScand of Conjunction = ConsAP xs x = consrTable AFormPos comma xs x ** {isPre = andB xs.isPre x.isPre} ; BaseRS x y = twoTable Agr x y ** {c = y.c} ; ConsRS xs x = consrTable Agr comma xs x ** {c = xs.c} ; + BaseIAdv = twoSS ; + ConsIAdv = consrSS comma ; + BaseCN = twoTable3 Number DetSpecies Case ; + ConsCN = consrTable3 Number DetSpecies Case comma ; lincat [S] = {s1,s2 : Order => Str} ; [Adv] = {s1,s2 : Str} ; + [IAdv] = {s1,s2 : Str} ; [NP] = {s1,s2 : NPForm => Str ; a : Agr} ; [AP] = {s1,s2 : AFormPos => Str ; isPre : Bool} ; [RS] = {s1,s2 : Agr => Str ; c : NPForm} ; + [CN] = {s1,s2 : Number => DetSpecies => Case => Str} ; --- g : NGender ; isMod : Bool} ; } diff --git a/lib/src/scandinavian/QuestionScand.gf b/lib/src/scandinavian/QuestionScand.gf index 762a19b13..03b31ebfa 100644 --- a/lib/src/scandinavian/QuestionScand.gf +++ b/lib/src/scandinavian/QuestionScand.gf @@ -98,4 +98,23 @@ incomplete concrete QuestionScand of Question = CompIAdv a = {s = \\_ => a.s} ; CompIP ip = {s = \\_ => ip.s ! nominative} ; + lincat + QVP = CommonScand.VP ; + lin + ComplSlashIP vp np = insertObj (\\_ => vp.c2.s ++ np.s ! accusative) vp ; + AdvQVP vp adv = insertObjPost (\\_ => adv.s) vp ; + AddAdvQVP vp adv = insertObjPost (\\_ => adv.s) vp ; + + QuestQVP qp vp = { + s = \\t,a,b,q => + let + somo = case q of { + QIndir => <"som",Sub> ; + _ => <[], Main> + } ; + cl = mkClause (qp.s ! nominative ++ somo.p1) {g = qp.g ; n = qp.n ; p = P3} vp + in + cl.s ! t ! a ! b ! somo.p2 + } ; + } diff --git a/lib/src/scandinavian/VerbScand.gf b/lib/src/scandinavian/VerbScand.gf index c2e89a900..1f087548d 100644 --- a/lib/src/scandinavian/VerbScand.gf +++ b/lib/src/scandinavian/VerbScand.gf @@ -50,16 +50,15 @@ incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand i ** {n3 = vp.n3 ; c2 = v.c2} ; UseComp comp = insertObj - (\\a => comp.s ! agrAdjNP a DIndef) (predV verbBe) ; + comp.s (predV verbBe) ; - CompAP ap = ap ; + CompAP ap = {s = \\a => ap.s ! agrAdjNP a DIndef} ; CompNP np = {s = \\_ => np.s ! accusative} ; CompAdv a = {s = \\_ => a.s} ; AdvVP vp adv = insertAdv adv.s vp ; AdVVP adv vp = insertAdV adv.s vp ; - ReflVP vp = insertObj (\\a => vp.c2.s ++ reflPron a ++ vp.n3 ! a) vp ; PassV2 v = @@ -67,4 +66,12 @@ incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand i (\\a => v.s ! VI (VPtPret (agrAdjNP a DIndef) Nom)) (predV verbBecome) ; + CompCN cn = {s = \\a => case a.n of { + Sg => artIndef ! cn.g ++ cn.s ! Sg ! DIndef ! Nom ; + Pl => cn.s ! Pl ! DIndef ! Nom + } + } ; + + UseCopula = predV verbBe ; + }