mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
cleaning up VP to Cl
This commit is contained in:
@@ -89,7 +89,7 @@ fun
|
|||||||
PredV0 : V0 -> Cl ; -- "it is raining"
|
PredV0 : V0 -> Cl ; -- "it is raining"
|
||||||
|
|
||||||
-- These rules *use* verb phrases:
|
-- These rules *use* verb phrases:
|
||||||
-- $PredVP$, $IntVP$, $RelVP$, $QuestVP$, $QuestAdv$.
|
-- $PredVP$, $IntVP$, $RelVP$.
|
||||||
|
|
||||||
-- Partial saturation.
|
-- Partial saturation.
|
||||||
|
|
||||||
@@ -110,9 +110,9 @@ fun
|
|||||||
|
|
||||||
PosVP, NegVP : Ant -> VP -> VPI ;
|
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 ;
|
UseCl : TP -> Cl -> S ;
|
||||||
UseRCl : TP -> RCl -> RS ;
|
UseRCl : TP -> RCl -> RS ;
|
||||||
@@ -166,10 +166,10 @@ fun
|
|||||||
FunIP : N2 -> IP -> IP ; -- "the mother of whom"
|
FunIP : N2 -> IP -> IP ; -- "the mother of whom"
|
||||||
NounIPOne, NounIPMany : CN -> IP ; -- "which car", "which cars"
|
NounIPOne, NounIPMany : CN -> IP ; -- "which car", "which cars"
|
||||||
|
|
||||||
QuestVP : NP -> VP -> QCl ; -- "does John walk"; "doesn't John walk"
|
QuestCl : Cl -> QCl ; -- "does John walk"; "doesn't John walk"
|
||||||
IntVP : IP -> VP -> QCl ; -- "who walks"
|
IntVP : IP -> VP -> QCl ; -- "who walks"
|
||||||
IntSlash : IP -> Slash -> QCl ; -- "whom does John see"
|
IntSlash : IP -> Slash -> QCl ; -- "whom does John see"
|
||||||
QuestAdv : IAdv -> NP -> VP -> QCl ; -- "why do you walk"
|
QuestAdv : IAdv -> Cl -> QCl ; -- "why do you walk"
|
||||||
|
|
||||||
PosImperVP, NegImperVP : VP -> Imp ; -- "(don't) be a man"
|
PosImperVP, NegImperVP : VP -> Imp ; -- "(don't) be a man"
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ lincat
|
|||||||
|
|
||||||
S = {s : Str} ;
|
S = {s : Str} ;
|
||||||
Cl = Clause ;
|
Cl = Clause ;
|
||||||
-- = {s : Bool => SForm => Str} ;
|
-- = {s : Order => Bool => SForm => Str} ;
|
||||||
Slash = {s : QuestForm => Bool => SForm => Str ; s2 : Preposition} ;
|
Slash = {s : QuestForm => Bool => SForm => Str ; s2 : Preposition} ;
|
||||||
RP = {s : Gender => Number => NPForm => Str} ;
|
RP = {s : Gender => Number => NPForm => Str} ;
|
||||||
RCl = {s : Bool => SForm => Agr => Str} ;
|
RCl = {s : Bool => SForm => Agr => Str} ;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ lin
|
|||||||
|
|
||||||
ProgVG = progressiveVerbPhrase ;
|
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} ;
|
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} ;
|
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 ;
|
NounIPOne = nounIntPron singular ;
|
||||||
NounIPMany = nounIntPron plural ;
|
NounIPMany = nounIntPron plural ;
|
||||||
|
|
||||||
QuestVP = questVerbPhrase ;
|
QuestCl = questClause ;
|
||||||
IntVP = intVerbPhrase ;
|
IntVP = intVerbPhrase ;
|
||||||
IntSlash = intSlash ;
|
IntSlash = intSlash ;
|
||||||
QuestAdv = questAdverbial ;
|
QuestAdv = questAdverbial ;
|
||||||
|
|||||||
@@ -646,18 +646,33 @@ oper
|
|||||||
|
|
||||||
--3 Tensed clauses
|
--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 =
|
predVerbGroupClause : NounPhrase -> VerbGroup -> Clause =
|
||||||
\yo,sleep -> {
|
\yo,dosleep -> {
|
||||||
s = \\b,c =>
|
s = \\o,b,c =>
|
||||||
let
|
let
|
||||||
a = yo.a ;
|
a = yo.a ;
|
||||||
you = yo.s ! NomP
|
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
|
in
|
||||||
you ++ sleep.s ! b ! c ! a ++ sleep.s2 ! b ! c ! a
|
case o of {
|
||||||
|
Dir => you ++ do ++ sleeps ;
|
||||||
|
Inv => case <c,dosleep.isAux> of {
|
||||||
|
<VFinite Present Simul,False> => does ++ you ++ sleep ;
|
||||||
|
<VFinite Past Simul,False> => did ++ you ++ sleep ;
|
||||||
|
_ => do ++ you ++ sleeps
|
||||||
|
}
|
||||||
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
@@ -799,7 +814,7 @@ oper
|
|||||||
{s = table {
|
{s = table {
|
||||||
DirQ => \\b,f => (questVerbPhrase you (predVerb
|
DirQ => \\b,f => (questVerbPhrase you (predVerb
|
||||||
lookat)).s ! b ! f ! DirQ ;
|
lookat)).s ! b ! f ! DirQ ;
|
||||||
IndirQ => (predVerbGroupClause you (predVerb lookat)).s
|
IndirQ => (predVerbGroupClause you (predVerb lookat)).s ! Dir
|
||||||
} ;
|
} ;
|
||||||
s2 = lookat.s3
|
s2 = lookat.s3
|
||||||
} ;
|
} ;
|
||||||
@@ -834,7 +849,8 @@ oper
|
|||||||
relVerbPhrase : RelPron -> VerbGroup -> RelClause = \who,walks ->
|
relVerbPhrase : RelPron -> VerbGroup -> RelClause = \who,walks ->
|
||||||
{s = \\b,sf,a =>
|
{s = \\b,sf,a =>
|
||||||
let wa = fromAgr a in
|
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.
|
--- TODO: full tense variation in relative clauses.
|
||||||
@@ -855,7 +871,7 @@ oper
|
|||||||
-- "number x such that x is even".
|
-- "number x such that x is even".
|
||||||
|
|
||||||
relSuch : Clause -> RelClause = \A ->
|
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 main use of relative clauses is to modify common nouns.
|
||||||
-- The result is a common noun, out of which noun phrases can be formed
|
-- 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
|
-- rule, $questVerbPhrase'$. The word ("ob" / "whether") never appears
|
||||||
-- if there is an adverbial.
|
-- 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 : NounPhrase -> VerbGroup -> Question =
|
||||||
questVerbPhrase' False ;
|
questVerbPhrase' False ;
|
||||||
|
|
||||||
@@ -973,7 +996,7 @@ oper
|
|||||||
_ => walk.s ! b ! cl ! John.a ++ john ++ walk.s2 ! b ! cl ! John.a
|
_ => walk.s ! b ! cl ! John.a ++ john ++ walk.s2 ! b ! cl ! John.a
|
||||||
} ;
|
} ;
|
||||||
IndirQ => if_then_else Str adv [] (variants {"if" ; "whether"}) ++
|
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} ;
|
who : NounPhrase = {s = who.s ; a = toAgr who.n P3 who.g} ;
|
||||||
whowalks : Clause = predVerbGroupClause who walk
|
whowalks : Clause = predVerbGroupClause who walk
|
||||||
in
|
in
|
||||||
{s = \\b,sf,_ => whowalks.s ! b ! sf} ;
|
{s = \\b,sf,_ => whowalks.s ! Dir ! b ! sf} ;
|
||||||
|
|
||||||
intSlash : IntPron -> ClauseSlashNounPhrase -> Question = \who,yousee ->
|
intSlash : IntPron -> ClauseSlashNounPhrase -> Question = \who,yousee ->
|
||||||
{s = \\b,cl,q =>
|
{s = \\b,cl,q =>
|
||||||
@@ -1016,10 +1039,10 @@ oper
|
|||||||
-- A question adverbial can be applied to anything, and whether this makes
|
-- A question adverbial can be applied to anything, and whether this makes
|
||||||
-- sense is a semantic question.
|
-- sense is a semantic question.
|
||||||
|
|
||||||
questAdverbial : IntAdverb -> NounPhrase -> VerbGroup -> Question =
|
questAdverbial : IntAdverb -> Clause -> Question =
|
||||||
\why, you, walk ->
|
\why, youwalk ->
|
||||||
{s = \\b,cf,q =>
|
{s = \\b,cf,q =>
|
||||||
why.s ++ (questVerbPhrase' True you walk).s ! b ! cf ! q} ;
|
why.s ++ (questClause youwalk).s ! b ! cf ! q} ;
|
||||||
|
|
||||||
--2 Imperatives
|
--2 Imperatives
|
||||||
--
|
--
|
||||||
@@ -1042,7 +1065,7 @@ oper
|
|||||||
-- e.g. prepositional phrases.
|
-- e.g. prepositional phrases.
|
||||||
|
|
||||||
advClause : Clause -> Adverb -> Clause = \yousing,well ->
|
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
|
-- Conjunctive adverbs are such as "otherwise", "therefore", which are prefixed
|
||||||
-- to a sentence to form a phrase.
|
-- to a sentence to form a phrase.
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ lin
|
|||||||
NounIPOne = nounIntPron singular ;
|
NounIPOne = nounIntPron singular ;
|
||||||
NounIPMany = nounIntPron plural ;
|
NounIPMany = nounIntPron plural ;
|
||||||
|
|
||||||
QuestVP = questVerbPhrase ;
|
QuestCl = questClause ;
|
||||||
IntVP = intVerbPhrase ;
|
IntVP = intVerbPhrase ;
|
||||||
IntSlash = intSlash ;
|
IntSlash = intSlash ;
|
||||||
QuestAdv = questAdverbial ;
|
QuestAdv = questAdverbial ;
|
||||||
|
|||||||
@@ -1071,6 +1071,17 @@ oper
|
|||||||
-- rule, $questVerbPhrase'$. The only difference is if "om" appears
|
-- rule, $questVerbPhrase'$. The only difference is if "om" appears
|
||||||
-- in the indirect form.
|
-- 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 : NounPhrase -> VerbGroup -> Question =
|
||||||
questVerbPhrase' False ;
|
questVerbPhrase' False ;
|
||||||
|
|
||||||
@@ -1143,9 +1154,9 @@ oper
|
|||||||
-- A question adverbial can be applied to anything, and whether this makes
|
-- A question adverbial can be applied to anything, and whether this makes
|
||||||
-- sense is a semantic question.
|
-- sense is a semantic question.
|
||||||
|
|
||||||
questAdverbial : IntAdverb -> NounPhrase -> VerbGroup -> Question =
|
questAdverbial : IntAdverb -> Clause -> Question =
|
||||||
\hur, du, mår ->
|
\hur, dumår ->
|
||||||
{s = \\b,sf,q => hur.s ++ (questVerbPhrase' True du mår).s ! b ! sf ! q} ;
|
{s = \\b,sf,q => hur.s ++ (questClause dumår).s ! b ! sf ! q} ;
|
||||||
|
|
||||||
--2 Imperatives
|
--2 Imperatives
|
||||||
--
|
--
|
||||||
|
|||||||
Reference in New Issue
Block a user