mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
part of English works with tense
This commit is contained in:
@@ -48,9 +48,8 @@ lincat
|
|||||||
|
|
||||||
V = Verb ;
|
V = Verb ;
|
||||||
-- = {s : VForm => Str ; s1 : Particle}
|
-- = {s : VForm => Str ; s1 : Particle}
|
||||||
VG = {s : Bool => SForm => Str ; s2 : Bool => Number => Str ;
|
VG = {s,s2 : Bool => VPForm => Str ; s3 : Number => Str ; isAux : Bool} ;
|
||||||
isAuxT, isAuxF : Bool} ;
|
VP = {s,s2 : VPForm => Str ; s3 : Number => Str ; isAux : Bool} ;
|
||||||
VP = {s : SForm => Str ; s2 : Number => Str ; isAux : Bool} ;
|
|
||||||
TV = TransVerb ;
|
TV = TransVerb ;
|
||||||
-- = Verb ** {s3 : Preposition} ;
|
-- = Verb ** {s3 : Preposition} ;
|
||||||
V3 = TransVerb ** {s4 : Preposition} ;
|
V3 = TransVerb ** {s4 : Preposition} ;
|
||||||
@@ -67,7 +66,7 @@ lincat
|
|||||||
RC = {s : Gender => Number => Str} ;
|
RC = {s : Gender => Number => Str} ;
|
||||||
|
|
||||||
IP = {s : NPForm => Str ; n : Number} ;
|
IP = {s : NPForm => Str ; n : Number} ;
|
||||||
Qu = {s : QuestForm => Str} ;
|
----- Qu = {s : QuestForm => Str} ;
|
||||||
Imp = {s : Number => Str} ;
|
Imp = {s : Number => Str} ;
|
||||||
Phr = {s : Str} ;
|
Phr = {s : Str} ;
|
||||||
Text = {s : Str} ;
|
Text = {s : Str} ;
|
||||||
|
|||||||
@@ -19,78 +19,26 @@
|
|||||||
-- one has to know how the syntactic categories are
|
-- one has to know how the syntactic categories are
|
||||||
-- implemented. The parameter types are defined in $TypesEng.gf$.
|
-- implemented. The parameter types are defined in $TypesEng.gf$.
|
||||||
|
|
||||||
concrete CombinationsEng of Combinations = open Prelude, SyntaxEng in {
|
concrete RulesEng of Rules = CategoriesEng ** open Prelude, SyntaxEng in {
|
||||||
|
|
||||||
flags
|
flags
|
||||||
startcat=Phr ;
|
startcat=Phr ;
|
||||||
lexer=text ;
|
lexer=text ;
|
||||||
unlexer=text ;
|
unlexer=text ;
|
||||||
|
|
||||||
lincat
|
|
||||||
N = CommNoun ;
|
|
||||||
-- = {s : Number => Case => Str}
|
|
||||||
CN = CommNounPhrase ;
|
|
||||||
-- = CommNoun ** {g : Gender}
|
|
||||||
NP = {s : NPForm => Str ; n : Number ; p : Person} ;
|
|
||||||
PN = {s : Case => Str} ;
|
|
||||||
Det = {s : Str ; n : Number} ;
|
|
||||||
Fun = Function ;
|
|
||||||
-- = CommNounPhrase ** {s2 : Preposition} ;
|
|
||||||
Fun2 = Function ** {s3 : Preposition} ;
|
|
||||||
Num = {s : Case => Str} ;
|
|
||||||
|
|
||||||
Adj1 = Adjective ;
|
|
||||||
-- = {s : AForm => Str}
|
|
||||||
Adj2 = Adjective ** {s2 : Preposition} ;
|
|
||||||
AdjDeg = {s : Degree => AForm => Str} ;
|
|
||||||
AP = Adjective ** {p : Bool} ;
|
|
||||||
|
|
||||||
V = Verb ;
|
|
||||||
-- = {s : VForm => Str ; s1 : Particle}
|
|
||||||
VG = {s : Bool => VForm => Str ; s2 : Bool => Number => Str ;
|
|
||||||
isAuxT, isAuxF : Bool} ;
|
|
||||||
VP = {s : VForm => Str ; s2 : Number => Str ; isAux : Bool} ;
|
|
||||||
TV = TransVerb ;
|
|
||||||
-- = Verb ** {s3 : Preposition} ;
|
|
||||||
V3 = TransVerb ** {s4 : Preposition} ;
|
|
||||||
VS = Verb ;
|
|
||||||
VV = Verb ** {isAux : Bool} ;
|
|
||||||
|
|
||||||
AdV = {s : Str ; p : Bool} ;
|
|
||||||
|
|
||||||
S = {s : Str} ;
|
|
||||||
Slash = {s : Bool => Str ; s2 : Preposition} ;
|
|
||||||
RP = {s : Gender => Number => NPForm => Str} ;
|
|
||||||
RC = {s : Gender => Number => Str} ;
|
|
||||||
|
|
||||||
IP = {s : NPForm => Str ; n : Number} ;
|
|
||||||
Qu = {s : QuestForm => Str} ;
|
|
||||||
Imp = {s : Number => Str} ;
|
|
||||||
Phr = {s : Str} ;
|
|
||||||
Text = {s : Str} ;
|
|
||||||
|
|
||||||
Conj = {s : Str ; n : Number} ;
|
|
||||||
ConjD = {s1 : Str ; s2 : Str ; n : Number} ;
|
|
||||||
|
|
||||||
ListS = {s1 : Str ; s2 : Str} ;
|
|
||||||
ListAP = {s1,s2 : AForm => Str ; p : Bool} ;
|
|
||||||
ListNP = {s1,s2 : NPForm => Str ; n : Number ; p : Person} ;
|
|
||||||
|
|
||||||
--.
|
|
||||||
|
|
||||||
lin
|
lin
|
||||||
UseN = noun2CommNounPhrase ;
|
UseN = noun2CommNounPhrase ;
|
||||||
ModAdj = modCommNounPhrase ;
|
ModAP = modCommNounPhrase ;
|
||||||
ModGenOne = npGenDet singular noNum ;
|
ModGenOne = npGenDet singular noNum ;
|
||||||
ModGenNum = npGenDet plural ;
|
ModGenNum = npGenDet plural ;
|
||||||
UsePN = nameNounPhrase ;
|
UsePN = nameNounPhrase ;
|
||||||
UseFun = funAsCommNounPhrase ;
|
UseN2 = funAsCommNounPhrase ;
|
||||||
AppFun = appFunComm ;
|
AppN2 = appFunComm ;
|
||||||
AppFun2 = appFun2 ;
|
AppN3 = appFun2 ;
|
||||||
AdjP1 = adj2adjPhrase ;
|
UseA = adj2adjPhrase ;
|
||||||
ComplAdj = complAdj ;
|
ComplA2 = complAdj ;
|
||||||
PositAdjP = positAdjPhrase ;
|
PositADeg = positAdjPhrase ;
|
||||||
ComparAdjP = comparAdjPhrase ;
|
ComparADeg = comparAdjPhrase ;
|
||||||
SuperlNP = superlNounPhrase ;
|
SuperlNP = superlNounPhrase ;
|
||||||
|
|
||||||
DetNP = detNounPhrase ;
|
DetNP = detNounPhrase ;
|
||||||
@@ -108,29 +56,35 @@ lin
|
|||||||
SymbCN cn s =
|
SymbCN cn s =
|
||||||
{s = \\n,c => cn.s ! n ! c ++ s.s ;
|
{s = \\n,c => cn.s ! n ! c ++ s.s ;
|
||||||
g = cn.g} ;
|
g = cn.g} ;
|
||||||
|
IntCN cn s =
|
||||||
|
{s = \\n,c => cn.s ! n ! c ++ s.s ;
|
||||||
|
g = cn.g} ;
|
||||||
|
|
||||||
PredVP = predVerbPhrase ;
|
PredVP = predVerbPhrase ;
|
||||||
PosVG = predVerbGroup True ;
|
PosVG = predVerbGroup True ;
|
||||||
NegVG = predVerbGroup False ;
|
NegVG = predVerbGroup False ;
|
||||||
|
|
||||||
|
PredVG = predVerbGroupClause ;
|
||||||
|
|
||||||
PredV = predVerb ;
|
PredV = predVerb ;
|
||||||
PredAP = predAdjective ;
|
PredAP = predAdjective ;
|
||||||
PredCN = predCommNoun ;
|
PredCN = predCommNoun ;
|
||||||
PredTV = complTransVerb ;
|
----- PredV2 = complTransVerb ;
|
||||||
PredV3 = complDitransVerb ;
|
PredV3 = complDitransVerb ;
|
||||||
PredPassV = passVerb ;
|
PredPassV = passVerb ;
|
||||||
PredNP = predNounPhrase ;
|
PredNP = predNounPhrase ;
|
||||||
PredAdV = predAdverb ;
|
----- PredPP = predAdverb ;
|
||||||
PredVS = complSentVerb ;
|
PredVS = complSentVerb ;
|
||||||
PredVV = complVerbVerb ;
|
PredVV = complVerbVerb ;
|
||||||
VTrans = transAsVerb ;
|
----- VTrans = transAsVerb ;
|
||||||
|
|
||||||
AdjAdv a = advPost (a.s ! AAdv) ;
|
AdjAdv a = advPost (a.s ! AAdv) ;
|
||||||
|
AdvPP p = p ;
|
||||||
PrepNP p = prepPhrase p.s ; ---
|
PrepNP p = prepPhrase p.s ; ---
|
||||||
AdvVP = adVerbPhrase ;
|
----- AdvVP = adVerbPhrase ;
|
||||||
AdvCN = advCommNounPhrase ;
|
----- AdvCN = advCommNounPhrase ;
|
||||||
AdvAP = advAdjPhrase ;
|
AdvAP = advAdjPhrase ;
|
||||||
|
} {- -----
|
||||||
PosSlashTV = slashTransVerb True ;
|
PosSlashTV = slashTransVerb True ;
|
||||||
NegSlashTV = slashTransVerb False ;
|
NegSlashTV = slashTransVerb False ;
|
||||||
OneVP = predVerbPhrase (nameNounPhrase (nameReg "one")) ;
|
OneVP = predVerbPhrase (nameNounPhrase (nameReg "one")) ;
|
||||||
@@ -196,3 +150,4 @@ lin
|
|||||||
ConsPhr = cc2 ;
|
ConsPhr = cc2 ;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
-}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
-- Aarne Ranta 2002 -- 2003
|
-- Aarne Ranta 2002 -- 2003
|
||||||
--
|
--
|
||||||
concrete StructuralEng of Structural =
|
concrete StructuralEng of Structural =
|
||||||
CombinationsEng ** open Prelude, SyntaxEng in {
|
CategoriesEng ** open Prelude, SyntaxEng in {
|
||||||
lin
|
lin
|
||||||
INP = pronI ;
|
INP = pronI ;
|
||||||
ThouNP = pronYouSg ;
|
ThouNP = pronYouSg ;
|
||||||
|
|||||||
@@ -324,11 +324,6 @@ oper
|
|||||||
<Present,_,_> => "have" ;
|
<Present,_,_> => "have" ;
|
||||||
<Past,_,_> => "had"
|
<Past,_,_> => "had"
|
||||||
} ;
|
} ;
|
||||||
do : Tense -> Number -> Person -> Str = \t,n,p -> case <t,n,p> of {
|
|
||||||
<Present,Sg,P3> => "does" ;
|
|
||||||
<Present,_,_> => "do" ;
|
|
||||||
<Past,_,_> => "did"
|
|
||||||
} ;
|
|
||||||
simple : VForm -> {fin,inf : Str} = \v -> {
|
simple : VForm -> {fin,inf : Str} = \v -> {
|
||||||
fin = goes.s ! v ;
|
fin = goes.s ! v ;
|
||||||
inf = []
|
inf = []
|
||||||
@@ -351,18 +346,61 @@ oper
|
|||||||
VInfinit Anter => compound "have" gone
|
VInfinit Anter => compound "have" gone
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} ;
|
|
||||||
{-
|
|
||||||
useVerb : Verb -> (Number => Str) -> VerbGroup = \verb,arg ->
|
useVerb : Verb -> (Number => Str) -> VerbGroup = \verb,arg ->
|
||||||
let go = verbVPForm go
|
let
|
||||||
|
go = verbVPForm verb ;
|
||||||
|
off = verb.s1 ;
|
||||||
|
has : VPForm => Str = \\f => (go f).fin ;
|
||||||
|
gone : VPForm => Str = \\f => (go f).inf ++ off
|
||||||
in {
|
in {
|
||||||
s = \\b,vf => (go sf).fin ;
|
s = table {
|
||||||
s2 = \\b,vf => (go sf).inf ;
|
True => has ;
|
||||||
s3 = arg
|
False => table {
|
||||||
|
VIndic t Simul n p => auxDo t n p ;
|
||||||
|
VImperat => auxDo Present Sg P2 ;
|
||||||
|
VInfinit a => "not" ++ has ! VInfinit a ;
|
||||||
|
vf => has ! vf
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
s2 = table {
|
||||||
|
True => gone ;
|
||||||
|
False => table {
|
||||||
|
VIndic t Simul n p => "not" ++ has ! VInfinit Simul ++ off ;
|
||||||
|
VImperat => "not" ++ has ! VInfinit Simul ++ off ;
|
||||||
|
VInfinit a => gone ! VInfinit a ;
|
||||||
|
vf => "not" ++ gone ! vf
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
s3 = arg ;
|
||||||
|
isAux = False
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
useVerbAux : Verb -> (Number => Str) -> VerbGroup = \verb,arg ->
|
||||||
|
let
|
||||||
|
go = verbVPForm verb ;
|
||||||
|
has : VPForm => Str = \\f => (go f).fin ;
|
||||||
|
gone : VPForm => Str = \\f => (go f).inf
|
||||||
|
in {
|
||||||
|
s = \\_ => has ;
|
||||||
|
s2 = table {
|
||||||
|
True => gone ;
|
||||||
|
False => \\vf => "not" ++ gone ! vf
|
||||||
|
} ;
|
||||||
|
s3 = arg ;
|
||||||
|
isAux = True
|
||||||
|
} ;
|
||||||
|
|
||||||
|
auxDo : Tense -> Number -> Person -> Str = \t,n,p -> case <t,n,p> of {
|
||||||
|
<Present,Sg,P3> => "does" ;
|
||||||
|
<Present,_,_> => "do" ;
|
||||||
|
<Past,_,_> => "did"
|
||||||
|
} ;
|
||||||
|
|
||||||
|
beGroup : (Number => Str) -> VerbGroup =
|
||||||
|
useVerbAux (verbBe ** {s1 = []}) ;
|
||||||
|
|
||||||
|
---- TODO: the contracted forms.
|
||||||
|
|
||||||
-- Verb phrases are discontinuous: the three parts of a verb phrase are
|
-- Verb phrases are discontinuous: the three parts of a verb phrase are
|
||||||
-- (s) an inflected verb, (s2) infinitive or participle, and (s3) complement.
|
-- (s) an inflected verb, (s2) infinitive or participle, and (s3) complement.
|
||||||
-- For instance: "doesn't" - "walk" - ""; "hasn't" - "been" - "old".
|
-- For instance: "doesn't" - "walk" - ""; "hasn't" - "been" - "old".
|
||||||
@@ -383,11 +421,13 @@ oper
|
|||||||
isAux : Bool ;
|
isAux : Bool ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
-- All negative verb phrase behave as auxiliary ones in questions.
|
||||||
|
|
||||||
predVerbGroup : Bool -> VerbGroup -> VerbPhrase = \b,vg -> {
|
predVerbGroup : Bool -> VerbGroup -> VerbPhrase = \b,vg -> {
|
||||||
s = vg.s ! b ;
|
s = vg.s ! b ;
|
||||||
s2 = vg.s2 ! b ;
|
s2 = vg.s2 ! b ;
|
||||||
s3 = vg.s3 ;
|
s3 = vg.s3 ;
|
||||||
isAux = vg.isAux
|
isAux = orB (notB b) vg.isAux
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- A simple verb can be made into a verb phrase with an empty complement.
|
-- A simple verb can be made into a verb phrase with an empty complement.
|
||||||
@@ -396,18 +436,7 @@ oper
|
|||||||
-- double negations with "don't" are not grammatical.
|
-- double negations with "don't" are not grammatical.
|
||||||
|
|
||||||
predVerb : Verb -> VerbGroup = \walk ->
|
predVerb : Verb -> VerbGroup = \walk ->
|
||||||
{s = \\b,v => if_then_Str b
|
useVerb walk (\\_ => []) ;
|
||||||
(walk.s ! v ++ walk.s1)
|
|
||||||
(contractNot (verbP3Do.s ! v)) ;
|
|
||||||
s2 = \\b,_ => if_then_Str b
|
|
||||||
[]
|
|
||||||
(walk.s ! InfImp ++ walk.s1) ;
|
|
||||||
isAux = False
|
|
||||||
} ;
|
|
||||||
|
|
||||||
-- Sometimes we want to extract the verb part of a verb phrase.
|
|
||||||
|
|
||||||
verbOfPhrase : VerbPhrase -> VerbP3 = \v -> {s = v.s} ;
|
|
||||||
|
|
||||||
-- Verb phrases can also be formed from adjectives ("is old"),
|
-- Verb phrases can also be formed from adjectives ("is old"),
|
||||||
-- common nouns ("is a man"), and noun phrases ("ist John").
|
-- common nouns ("is a man"), and noun phrases ("ist John").
|
||||||
@@ -415,39 +444,17 @@ oper
|
|||||||
-- on semantic grounds.
|
-- on semantic grounds.
|
||||||
|
|
||||||
predAdjective : Adjective -> VerbGroup = \old ->
|
predAdjective : Adjective -> VerbGroup = \old ->
|
||||||
{s = beOrNotBe ;
|
beGroup (\\_ => old.s ! AAdj) ;
|
||||||
s2 = \\_,_ => old.s ! AAdj ;
|
|
||||||
isAux = True
|
|
||||||
} ;
|
|
||||||
|
|
||||||
predCommNoun : CommNoun -> VerbGroup = \man ->
|
predCommNoun : CommNoun -> VerbGroup = \man ->
|
||||||
{s = beOrNotBe ;
|
beGroup (\\n => indefNoun n man) ;
|
||||||
s2 = \\_,n => indefNoun n man ;
|
|
||||||
isAux = True
|
|
||||||
} ;
|
|
||||||
|
|
||||||
predNounPhrase : NounPhrase -> VerbGroup = \john ->
|
predNounPhrase : NounPhrase -> VerbGroup = \john ->
|
||||||
{s = beOrNotBe ;
|
beGroup (\\_ => john.s ! NomP) ;
|
||||||
s2 = \\_,_ => john.s ! NomP ;
|
|
||||||
isAux = True
|
|
||||||
} ;
|
|
||||||
|
|
||||||
predAdverb : Adverb -> VerbGroup = \elsewhere ->
|
predAdverb : Adverb -> VerbGroup = \elsewhere ->
|
||||||
{s = beOrNotBe ;
|
beGroup (\\_ => elsewhere.s) ;
|
||||||
s2 = \\_,_ => elsewhere.s ;
|
|
||||||
isAux = True
|
|
||||||
} ;
|
|
||||||
|
|
||||||
-- We use an auxiliary giving all forms of "be".
|
|
||||||
|
|
||||||
beOrNotBe : Bool => VForm => Str = \\b =>
|
|
||||||
if_then_else (VForm => Str) b
|
|
||||||
verbBe.s
|
|
||||||
(table {
|
|
||||||
InfImp => contractNot "do" ++ "be" ;
|
|
||||||
Indic P1 => "am" ++ "not" ;
|
|
||||||
v => contractNot (verbBe.s ! v)
|
|
||||||
}) ;
|
|
||||||
|
|
||||||
--3 Transitive verbs
|
--3 Transitive verbs
|
||||||
--
|
--
|
||||||
@@ -461,25 +468,24 @@ oper
|
|||||||
|
|
||||||
-- The rule for using transitive verbs is the complementization rule.
|
-- The rule for using transitive verbs is the complementization rule.
|
||||||
-- Particles produce free variation: before or after the complement
|
-- Particles produce free variation: before or after the complement
|
||||||
-- ("I switch on the TV" / "I switch the TV on").
|
-- ("I switch on the radio" / "I switch the radio on").
|
||||||
|
---- TODO: do this again.
|
||||||
complTransVerb : TransVerb -> NounPhrase -> VerbGroup = \lookat,john ->
|
|
||||||
let lookatjohn = bothWays lookat.s1 (lookat.s3 ++ john.s ! AccP)
|
|
||||||
in {s = \\b,v => if_then_Str b (lookat.s ! v) (contractNot (verbP3Do.s ! v)) ;
|
|
||||||
s2 = \\b,_ => if_then_Str b lookatjohn (lookat.s ! InfImp ++ lookatjohn) ;
|
|
||||||
isAux = False
|
|
||||||
} ;
|
|
||||||
|
|
||||||
|
complTransVerb : TransVerb -> NounPhrase -> VerbGroup = \switch,radio ->
|
||||||
|
useVerb switch (\\_ => switch.s3 ++ radio.s ! AccP) ;
|
||||||
|
|
||||||
-- Verbs that take direct object and a particle:
|
-- Verbs that take direct object and a particle:
|
||||||
|
|
||||||
mkTransVerbPart : VerbP3 -> Str -> TransVerb = \turn,off ->
|
mkTransVerbPart : VerbP3 -> Str -> TransVerb = \turn,off ->
|
||||||
{s = turn.s ; s1 = off ; s3 = []} ;
|
{s = turn.s ; s1 = off ; s3 = []} ;
|
||||||
|
|
||||||
-- Verbs that take prepositional object, no particle:
|
-- Verbs that take prepositional object, no particle:
|
||||||
|
|
||||||
mkTransVerb : VerbP3 -> Str -> TransVerb = \wait,for ->
|
mkTransVerb : VerbP3 -> Str -> TransVerb = \wait,for ->
|
||||||
{s = wait.s ; s1 = [] ; s3 = for} ;
|
{s = wait.s ; s1 = [] ; s3 = for} ;
|
||||||
|
|
||||||
-- Verbs that take direct object, no particle:
|
-- Verbs that take direct object, no particle:
|
||||||
|
|
||||||
mkTransVerbDir : VerbP3 -> TransVerb = \love ->
|
mkTransVerbDir : VerbP3 -> TransVerb = \love ->
|
||||||
mkTransVerbPart love [] ;
|
mkTransVerbPart love [] ;
|
||||||
|
|
||||||
@@ -496,7 +502,6 @@ oper
|
|||||||
|
|
||||||
--- reflTransVerb : TransVerb -> VerbGroup = \love ->
|
--- reflTransVerb : TransVerb -> VerbGroup = \love ->
|
||||||
|
|
||||||
|
|
||||||
-- Transitive verbs can be used elliptically as verbs. The semantics
|
-- Transitive verbs can be used elliptically as verbs. The semantics
|
||||||
-- is left to applications. The definition is trivial, due to record
|
-- is left to applications. The definition is trivial, due to record
|
||||||
-- subtyping.
|
-- subtyping.
|
||||||
@@ -505,8 +510,8 @@ oper
|
|||||||
love ;
|
love ;
|
||||||
|
|
||||||
-- *Ditransitive verbs* are verbs with three argument places.
|
-- *Ditransitive verbs* are verbs with three argument places.
|
||||||
-- We treat so far only the rule in which the ditransitive
|
---- TODO: We treat so far only the rule in which the ditransitive
|
||||||
-- verb takes both complements to form a verb phrase.
|
---- verb takes both complements to form a verb phrase.
|
||||||
|
|
||||||
DitransVerb = TransVerb ** {s4 : Preposition} ;
|
DitransVerb = TransVerb ** {s4 : Preposition} ;
|
||||||
|
|
||||||
@@ -515,18 +520,12 @@ oper
|
|||||||
|
|
||||||
complDitransVerb : DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup =
|
complDitransVerb : DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup =
|
||||||
\give,you,beer ->
|
\give,you,beer ->
|
||||||
let
|
useVerb give
|
||||||
youbeer = give.s1 ++ give.s3 ++ you.s ! AccP ++ give.s4 ++ beer.s ! AccP
|
(\\_ => give.s1 ++ give.s3 ++ you.s ! AccP ++ give.s4 ++ beer.s ! AccP) ;
|
||||||
in
|
|
||||||
{s = \\b,v => if_then_Str b (give.s ! v) (contractNot (verbP3Do.s ! v)) ;
|
|
||||||
s2 = \\b,_ => if_then_Str b youbeer (give.s ! InfImp ++ youbeer) ;
|
|
||||||
isAux = False
|
|
||||||
} ;
|
|
||||||
|
|
||||||
|
--2 Adverbs
|
||||||
--2 Adverbials
|
|
||||||
--
|
--
|
||||||
-- Adverbials are not inflected (we ignore comparison, and treat
|
-- Adverbs are not inflected (we ignore comparison, and treat
|
||||||
-- compared adverbials as separate expressions; this could be done another way).
|
-- compared adverbials as separate expressions; this could be done another way).
|
||||||
-- We distinguish between post- and pre-verbal adverbs.
|
-- We distinguish between post- and pre-verbal adverbs.
|
||||||
|
|
||||||
@@ -543,6 +542,7 @@ oper
|
|||||||
{
|
{
|
||||||
s = \\v => (if_then_else Str postp [] well.s) ++ sings.s ! v ;
|
s = \\v => (if_then_else Str postp [] well.s) ++ sings.s ! v ;
|
||||||
s2 = \\n => sings.s2 ! n ++ (if_then_else Str postp well.s []) ;
|
s2 = \\n => sings.s2 ! n ++ (if_then_else Str postp well.s []) ;
|
||||||
|
s3 = sings.s3 ;
|
||||||
isAux = sings.isAux
|
isAux = sings.isAux
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -575,7 +575,6 @@ oper
|
|||||||
g = car.g
|
g = car.g
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
--2 Sentences
|
--2 Sentences
|
||||||
--
|
--
|
||||||
-- Sentences are not inflected in this fragment of English without tense.
|
-- Sentences are not inflected in this fragment of English without tense.
|
||||||
@@ -587,10 +586,47 @@ oper
|
|||||||
-- contain negation.
|
-- contain negation.
|
||||||
|
|
||||||
predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence = \john,walks ->
|
predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence = \john,walks ->
|
||||||
ss (john.s ! NomP ++ indicVerb (verbOfPhrase walks) john.p john.n ++
|
ss (
|
||||||
walks.s2 ! john.n) ;
|
john.s ! NomP ++
|
||||||
|
presentIndicative walks john.n john.p
|
||||||
|
) ;
|
||||||
|
|
||||||
|
presentIndicative : VerbPhrase -> Number -> Person -> Str = \sleep,n,p ->
|
||||||
|
let
|
||||||
|
cf = VIndic Present Simul n p
|
||||||
|
in
|
||||||
|
sleep.s ! cf ++ sleep.s2 ! cf ++ sleep.s3 ! n ;
|
||||||
|
|
||||||
|
--3 Tensed clauses
|
||||||
|
|
||||||
|
param
|
||||||
|
ClForm =
|
||||||
|
ClIndic Tense Anteriority
|
||||||
|
| ClFut Anteriority
|
||||||
|
| ClCondit Anteriority
|
||||||
|
| ClInfinit Anteriority -- "naked infinitive" clauses
|
||||||
|
;
|
||||||
|
|
||||||
|
oper
|
||||||
|
cl2s : ClForm -> Number -> Person -> VPForm = \c,n,p -> case c of {
|
||||||
|
ClIndic t a => VIndic t a n p ;
|
||||||
|
ClFut a => VFut a ;
|
||||||
|
ClCondit a => VCondit a ;
|
||||||
|
ClInfinit a => VInfinit a
|
||||||
|
} ;
|
||||||
|
|
||||||
|
Clause = {s : Bool => ClForm => Str} ;
|
||||||
|
|
||||||
|
predVerbGroupClause : NounPhrase -> VerbGroup -> Clause =
|
||||||
|
\you,sleep -> {
|
||||||
|
s = \\b,c =>
|
||||||
|
let
|
||||||
|
n = you.n ;
|
||||||
|
cf = cl2s c n you.p
|
||||||
|
in
|
||||||
|
you.s ! NomP ++ sleep.s ! b ! cf ++ sleep.s2 ! b ! cf ++
|
||||||
|
sleep.s3 ! n
|
||||||
|
} ;
|
||||||
|
|
||||||
--3 Sentence-complement verbs
|
--3 Sentence-complement verbs
|
||||||
--
|
--
|
||||||
@@ -599,13 +635,11 @@ oper
|
|||||||
SentenceVerb : Type = Verb ;
|
SentenceVerb : Type = Verb ;
|
||||||
|
|
||||||
-- To generate "says that John walks" / "doesn't say that John walks":
|
-- To generate "says that John walks" / "doesn't say that John walks":
|
||||||
|
---- TODO: the alternative without "that"
|
||||||
|
|
||||||
complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \say,johnruns ->
|
complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \say,johnruns ->
|
||||||
let {thatjohnruns = optStr "that" ++ johnruns.s} in
|
useVerb say (\\_ => "that" ++ johnruns.s) ;
|
||||||
{s = \\b,v => if_then_Str b (say.s ! v) (contractNot (verbP3Do.s ! v)) ;
|
|
||||||
s2 = \\b,_ => if_then_Str b thatjohnruns (say.s ! InfImp ++ thatjohnruns) ;
|
|
||||||
isAux = False
|
|
||||||
} ;
|
|
||||||
|
|
||||||
--3 Verb-complement verbs
|
--3 Verb-complement verbs
|
||||||
--
|
--
|
||||||
@@ -627,22 +661,13 @@ oper
|
|||||||
let
|
let
|
||||||
taux = try.isAux ;
|
taux = try.isAux ;
|
||||||
to = if_then_Str taux [] "to" ;
|
to = if_then_Str taux [] "to" ;
|
||||||
dont = table VForm {v => if_then_Str taux
|
torun : Number => Str =
|
||||||
(try.s ! v ++ "not") -- can not
|
\\n => to ++ run.s ! True ! VInfinit Simul ++
|
||||||
(contractNot (verbP3Do.s ! v)) -- doesn't ...
|
run.s2 ! True ! VInfinit Simul ++ run.s3 ! n
|
||||||
} ;
|
|
||||||
trnot = if_then_Str taux
|
|
||||||
[] --
|
|
||||||
(try.s ! InfImp ++ try.s1) ; -- ... try
|
|
||||||
in
|
in
|
||||||
{s = \\b,v => if_then_Str b
|
if_then_else VerbGroup taux
|
||||||
(try.s ! v ++ try.s1 ++ to ++ run.s ! True ! InfImp)
|
(useVerb try torun)
|
||||||
(dont ! v) ;
|
(useVerbAux try torun) ;
|
||||||
s2 = \\b,v => if_then_Str b
|
|
||||||
(run.s2 ! True ! v)
|
|
||||||
(trnot ++ run.s ! True ! InfImp ++ run.s2 ! True ! v) ;
|
|
||||||
isAux = taux
|
|
||||||
} ;
|
|
||||||
|
|
||||||
-- The three most important example auxiliaries.
|
-- The three most important example auxiliaries.
|
||||||
|
|
||||||
@@ -650,7 +675,7 @@ oper
|
|||||||
{s = table {
|
{s = table {
|
||||||
InfImp => beable ;
|
InfImp => beable ;
|
||||||
Indic _ => can ;
|
Indic _ => can ;
|
||||||
Past _ => could ;
|
Pastt _ => could ;
|
||||||
PPart => beenable
|
PPart => beenable
|
||||||
} ;
|
} ;
|
||||||
s1 = [] ;
|
s1 = [] ;
|
||||||
@@ -660,6 +685,7 @@ oper
|
|||||||
vvCan : VerbVerb = mkVerbAux ["be able to"] "can" "could" ["been able to"] ;
|
vvCan : VerbVerb = mkVerbAux ["be able to"] "can" "could" ["been able to"] ;
|
||||||
vvMust : VerbVerb = mkVerbAux ["have to"] "must" ["had to"] ["had to"] ;
|
vvMust : VerbVerb = mkVerbAux ["have to"] "must" ["had to"] ["had to"] ;
|
||||||
|
|
||||||
|
}{- -----
|
||||||
--2 Sentences missing noun phrases
|
--2 Sentences missing noun phrases
|
||||||
--
|
--
|
||||||
-- This is one instance of Gazdar's *slash categories*, corresponding to his
|
-- This is one instance of Gazdar's *slash categories*, corresponding to his
|
||||||
|
|||||||
54
lib/resource/english/TestResourceEng.gf
Normal file
54
lib/resource/english/TestResourceEng.gf
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
--# -path=.:../abstract:../../prelude
|
||||||
|
|
||||||
|
concrete TestResourceEng of TestResource = RulesEng, StructuralEng **
|
||||||
|
{}
|
||||||
|
{- -----
|
||||||
|
open SyntaxEng, ParadigmsEng in {
|
||||||
|
|
||||||
|
flags startcat=Phr ; lexer=textlit ; parser=chart ; unlexer=text ;
|
||||||
|
|
||||||
|
-- a random sample from the lexicon
|
||||||
|
|
||||||
|
lin
|
||||||
|
Big = adjDegrIrreg "big" "bigger" "biggest";
|
||||||
|
Happy = adjDegrReg "happy" ;
|
||||||
|
Small = adjDegrReg "small" ;
|
||||||
|
Old = adjDegrReg "old" ;
|
||||||
|
Young = adjDegrReg "young" ;
|
||||||
|
American = regAdjective "American" ;
|
||||||
|
Finnish = regAdjective "Finnish" ;
|
||||||
|
Married = regAdjective "married" ** {s2 = "to"} ;
|
||||||
|
Man = cnHum (mkNoun "man" "men" "man's" "men's") ;
|
||||||
|
Woman = cnHum (mkNoun "woman" "women" "woman's" "women's") ;
|
||||||
|
Car = cnNoHum (nounReg "car") ;
|
||||||
|
House = cnNoHum (nounReg "house") ;
|
||||||
|
Light = cnNoHum (nounReg "light") ;
|
||||||
|
Bar = cnNoHum (nounReg "bar") ;
|
||||||
|
Bottle = cnNoHum (nounReg "bottle") ;
|
||||||
|
Wine = cnNoHum (nounReg "wine") ;
|
||||||
|
Walk = verbNoPart (regVerbP3 "walk") ;
|
||||||
|
Run = verbNoPart (mkVerb "run" "ran" "run") ;
|
||||||
|
Say = verbNoPart (mkVerb "say" "said" "said") ;
|
||||||
|
Prove = verbNoPart (regVerbP3 "prove") ;
|
||||||
|
Send = mkTransVerbDir (verbNoPart (mkVerb "send" "sent" "sent")) ;
|
||||||
|
Love = mkTransVerbDir (verbNoPart (verbP3e "love")) ;
|
||||||
|
Wait = mkTransVerb (verbNoPart (regVerbP3 "wait")) "for" ;
|
||||||
|
Drink = mkTransVerbDir (verbNoPart (mkVerb "drink" "drank" "drunk")) ;
|
||||||
|
Give = mkDitransVerb (verbNoPart (mkVerb "give" "gave" "given")) [] [] ;
|
||||||
|
Prefer = mkDitransVerb
|
||||||
|
(verbNoPart (mkVerb "prefer" "preferred" "preferred")) [] "to" ;
|
||||||
|
Mother = funOfReg "mother" human ;
|
||||||
|
Uncle = funOfReg "uncle" human ;
|
||||||
|
Connection = cnNoHum (nounReg "connection") ** {s2 = "from" ; s3 = "to"} ;
|
||||||
|
|
||||||
|
Always = advPre "always" ;
|
||||||
|
Well = advPost "well" ;
|
||||||
|
|
||||||
|
SwitchOn = mkTransVerbPart (verbP3s "switch") "on" ;
|
||||||
|
SwitchOff = mkTransVerbPart (verbP3s "switch") "off" ;
|
||||||
|
|
||||||
|
John = nameReg "John" ;
|
||||||
|
Mary = nameReg "Mary" ;
|
||||||
|
|
||||||
|
} ;
|
||||||
|
-}
|
||||||
Reference in New Issue
Block a user