From 176dccf78bf5c6c5d7724a6a3fb0377f702963bc Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 2 Feb 2005 08:30:40 +0000 Subject: [PATCH] cleaning up VP to Cl --- lib/resource/abstract/Rules.gf | 14 +++--- lib/resource/english/CategoriesEng.gf | 2 +- lib/resource/english/RulesEng.gf | 4 +- lib/resource/english/SyntaxEng.gf | 55 +++++++++++++++++------- lib/resource/scandinavian/RulesScand.gf | 2 +- lib/resource/scandinavian/SyntaxScand.gf | 17 ++++++-- 6 files changed, 64 insertions(+), 30 deletions(-) diff --git a/lib/resource/abstract/Rules.gf b/lib/resource/abstract/Rules.gf index 7d2f7a8cf..e2672ee42 100644 --- a/lib/resource/abstract/Rules.gf +++ b/lib/resource/abstract/Rules.gf @@ -89,7 +89,7 @@ fun PredV0 : V0 -> Cl ; -- "it is raining" -- These rules *use* verb phrases: --- $PredVP$, $IntVP$, $RelVP$, $QuestVP$, $QuestAdv$. +-- $PredVP$, $IntVP$, $RelVP$. -- Partial saturation. @@ -110,9 +110,9 @@ fun PosVP, NegVP : Ant -> VP -> VPI ; - ProgVG : VP -> VP ; -- he is eating + ProgVG : VP -> VP ; -- he is eating - AdjPart : V -> A ; -- forgotten + AdjPart : V -> A ; -- forgotten UseCl : TP -> Cl -> S ; UseRCl : TP -> RCl -> RS ; @@ -166,10 +166,10 @@ fun FunIP : N2 -> IP -> IP ; -- "the mother of whom" NounIPOne, NounIPMany : CN -> IP ; -- "which car", "which cars" - QuestVP : NP -> VP -> QCl ; -- "does John walk"; "doesn't John walk" - IntVP : IP -> VP -> QCl ; -- "who walks" - IntSlash : IP -> Slash -> QCl ; -- "whom does John see" - QuestAdv : IAdv -> NP -> VP -> QCl ; -- "why do you walk" + QuestCl : Cl -> QCl ; -- "does John walk"; "doesn't John walk" + IntVP : IP -> VP -> QCl ; -- "who walks" + IntSlash : IP -> Slash -> QCl ; -- "whom does John see" + QuestAdv : IAdv -> Cl -> QCl ; -- "why do you walk" PosImperVP, NegImperVP : VP -> Imp ; -- "(don't) be a man" diff --git a/lib/resource/english/CategoriesEng.gf b/lib/resource/english/CategoriesEng.gf index 6ef7a3671..2a712bb7b 100644 --- a/lib/resource/english/CategoriesEng.gf +++ b/lib/resource/english/CategoriesEng.gf @@ -81,7 +81,7 @@ lincat S = {s : Str} ; Cl = Clause ; - -- = {s : Bool => SForm => Str} ; + -- = {s : Order => Bool => SForm => Str} ; Slash = {s : QuestForm => Bool => SForm => Str ; s2 : Preposition} ; RP = {s : Gender => Number => NPForm => Str} ; RCl = {s : Bool => SForm => Agr => Str} ; diff --git a/lib/resource/english/RulesEng.gf b/lib/resource/english/RulesEng.gf index 71ee79fd3..b69c9d98d 100644 --- a/lib/resource/english/RulesEng.gf +++ b/lib/resource/english/RulesEng.gf @@ -116,7 +116,7 @@ lin ProgVG = progressiveVerbPhrase ; - UseCl tp cl = {s = tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a} ; + UseCl tp cl = {s = tp.s ++ cl.s ! Dir ! tp.b ! VFinite tp.t tp.a} ; UseQCl tp cl = {s = \\q => tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a ! q} ; UseRCl tp cl = {s = \\a => tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a ! a} ; @@ -168,7 +168,7 @@ lin NounIPOne = nounIntPron singular ; NounIPMany = nounIntPron plural ; - QuestVP = questVerbPhrase ; + QuestCl = questClause ; IntVP = intVerbPhrase ; IntSlash = intSlash ; QuestAdv = questAdverbial ; diff --git a/lib/resource/english/SyntaxEng.gf b/lib/resource/english/SyntaxEng.gf index 4b950443d..a226cb459 100644 --- a/lib/resource/english/SyntaxEng.gf +++ b/lib/resource/english/SyntaxEng.gf @@ -646,18 +646,33 @@ oper --3 Tensed clauses - Clause = {s : Bool => SForm => Str} ; +-- We have direct (declarative) and inverted (interrogative) clauses. - ClForm = SForm ; ---- to be removed + Clause = {s : Order => Bool => SForm => Str} ; + param Order = Dir | Inv ; + + oper predVerbGroupClause : NounPhrase -> VerbGroup -> Clause = - \yo,sleep -> { - s = \\b,c => + \yo,dosleep -> { + s = \\o,b,c => let - a = yo.a ; - you = yo.s ! NomP + a = yo.a ; + you = yo.s ! NomP ; + do = dosleep.s ! b ! c ! a ; + sleeps = dosleep.s2 ! b ! c ! a ; + does = auxTense b Present a ; + did = auxTense b Past a ; + sleep = dosleep.s2 ! False ! c ! a in - you ++ sleep.s ! b ! c ! a ++ sleep.s2 ! b ! c ! a + case o of { + Dir => you ++ do ++ sleeps ; + Inv => case of { + => does ++ you ++ sleep ; + => did ++ you ++ sleep ; + _ => do ++ you ++ sleeps + } + } } ; @@ -799,7 +814,7 @@ oper {s = table { DirQ => \\b,f => (questVerbPhrase you (predVerb lookat)).s ! b ! f ! DirQ ; - IndirQ => (predVerbGroupClause you (predVerb lookat)).s + IndirQ => (predVerbGroupClause you (predVerb lookat)).s ! Dir } ; s2 = lookat.s3 } ; @@ -834,7 +849,8 @@ oper relVerbPhrase : RelPron -> VerbGroup -> RelClause = \who,walks -> {s = \\b,sf,a => let wa = fromAgr a in - (predVerbGroupClause (relNounPhrase who wa.g wa.n) walks).s ! b ! sf + (predVerbGroupClause (relNounPhrase who wa.g wa.n) walks).s ! Dir + ! b ! sf } ; --- TODO: full tense variation in relative clauses. @@ -855,7 +871,7 @@ oper -- "number x such that x is even". relSuch : Clause -> RelClause = \A -> - {s = \\b,sf,_ => "such" ++ "that" ++ A.s ! b ! sf} ; + {s = \\b,sf,_ => "such" ++ "that" ++ A.s ! Dir ! b ! sf} ; -- The main use of relative clauses is to modify common nouns. -- The result is a common noun, out of which noun phrases can be formed @@ -953,6 +969,13 @@ oper -- rule, $questVerbPhrase'$. The word ("ob" / "whether") never appears -- if there is an adverbial. + questClause : Clause -> Question = \cl -> + {s = \\b,c => table { + DirQ => cl.s ! Inv ! b ! c ; + IndirQ => cl.s ! Dir ! b ! c + } + } ; + questVerbPhrase : NounPhrase -> VerbGroup -> Question = questVerbPhrase' False ; @@ -973,7 +996,7 @@ oper _ => walk.s ! b ! cl ! John.a ++ john ++ walk.s2 ! b ! cl ! John.a } ; IndirQ => if_then_else Str adv [] (variants {"if" ; "whether"}) ++ - (predVerbGroupClause John walk).s ! b ! cl + (predVerbGroupClause John walk).s ! Dir ! b ! cl } } ; @@ -987,7 +1010,7 @@ oper who : NounPhrase = {s = who.s ; a = toAgr who.n P3 who.g} ; whowalks : Clause = predVerbGroupClause who walk in - {s = \\b,sf,_ => whowalks.s ! b ! sf} ; + {s = \\b,sf,_ => whowalks.s ! Dir ! b ! sf} ; intSlash : IntPron -> ClauseSlashNounPhrase -> Question = \who,yousee -> {s = \\b,cl,q => @@ -1016,10 +1039,10 @@ oper -- A question adverbial can be applied to anything, and whether this makes -- sense is a semantic question. - questAdverbial : IntAdverb -> NounPhrase -> VerbGroup -> Question = - \why, you, walk -> + questAdverbial : IntAdverb -> Clause -> Question = + \why, youwalk -> {s = \\b,cf,q => - why.s ++ (questVerbPhrase' True you walk).s ! b ! cf ! q} ; + why.s ++ (questClause youwalk).s ! b ! cf ! q} ; --2 Imperatives -- @@ -1042,7 +1065,7 @@ oper -- e.g. prepositional phrases. advClause : Clause -> Adverb -> Clause = \yousing,well -> - {s = \\b,c => yousing.s ! b ! c ++ well.s} ; + {s = \\o,b,c => yousing.s ! o ! b ! c ++ well.s} ; -- Conjunctive adverbs are such as "otherwise", "therefore", which are prefixed -- to a sentence to form a phrase. diff --git a/lib/resource/scandinavian/RulesScand.gf b/lib/resource/scandinavian/RulesScand.gf index 267112850..09c32ffb5 100644 --- a/lib/resource/scandinavian/RulesScand.gf +++ b/lib/resource/scandinavian/RulesScand.gf @@ -151,7 +151,7 @@ lin NounIPOne = nounIntPron singular ; NounIPMany = nounIntPron plural ; - QuestVP = questVerbPhrase ; + QuestCl = questClause ; IntVP = intVerbPhrase ; IntSlash = intSlash ; QuestAdv = questAdverbial ; diff --git a/lib/resource/scandinavian/SyntaxScand.gf b/lib/resource/scandinavian/SyntaxScand.gf index 9c9833fcf..b041a452f 100644 --- a/lib/resource/scandinavian/SyntaxScand.gf +++ b/lib/resource/scandinavian/SyntaxScand.gf @@ -1071,6 +1071,17 @@ oper -- rule, $questVerbPhrase'$. The only difference is if "om" appears -- in the indirect form. + questClause : Clause -> Question = \dusover -> + {s = \\b,sf => + let + dusov : Order => Str = \\o => dusover.s ! b ! s2cl sf o + in + table { + DirQ => dusov ! Inv ; + IndirQ => dusov ! Sub + } + } ; + questVerbPhrase : NounPhrase -> VerbGroup -> Question = questVerbPhrase' False ; @@ -1143,9 +1154,9 @@ oper -- A question adverbial can be applied to anything, and whether this makes -- sense is a semantic question. - questAdverbial : IntAdverb -> NounPhrase -> VerbGroup -> Question = - \hur, du, mår -> - {s = \\b,sf,q => hur.s ++ (questVerbPhrase' True du mår).s ! b ! sf ! q} ; + questAdverbial : IntAdverb -> Clause -> Question = + \hur, dumår -> + {s = \\b,sf,q => hur.s ++ (questClause dumår).s ! b ! sf ! q} ; --2 Imperatives --