mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
English update complete though buggy
This commit is contained in:
@@ -45,6 +45,10 @@ lincat
|
||||
A2 = Adjective ** {s2 : Preposition} ;
|
||||
ADeg = {s : Degree => AForm => Str} ;
|
||||
AP = Adjective ** {p : Bool} ;
|
||||
AS = Adjective ; --- "more difficult for him to come than..."
|
||||
A2S = Adjective ** {s2 : Preposition} ;
|
||||
AV = Adjective ;
|
||||
A2V = Adjective ** {s2 : Preposition} ;
|
||||
|
||||
V = Verb ;
|
||||
-- = {s : VForm => Str ; s1 : Particle}
|
||||
@@ -56,6 +60,16 @@ lincat
|
||||
VS = Verb ;
|
||||
VV = Verb ** {isAux : Bool} ;
|
||||
|
||||
VS = Verb ;
|
||||
VQ = Verb ;
|
||||
VA = Verb ;
|
||||
|
||||
V2S = TransVerb ;
|
||||
V2Q = TransVerb ;
|
||||
V2V = TransVerb ** {isAux : Bool} ;
|
||||
V2A = TransVerb ;
|
||||
V0 = Verb ;
|
||||
|
||||
TP = {s : Str ; b : Bool ; t : ClTense ; a : Anteriority} ; --- the Str field is dummy
|
||||
Tense = {s : Str ; t : ClTense} ;
|
||||
Ant = {s : Str ; a : Anteriority} ;
|
||||
|
||||
@@ -62,6 +62,26 @@ lin
|
||||
|
||||
AdjPart = adjPastPart ;
|
||||
ReflV2 = reflTransVerb ;
|
||||
|
||||
PredV2A = complDitransAdjVerb ;
|
||||
PredSubjV2V = complDitransVerbVerb False ;
|
||||
PredObjV2V = complDitransVerbVerb True ;
|
||||
PredV2S = complDitransSentVerb ;
|
||||
PredV2Q = complDitransQuestVerb ;
|
||||
PredVA = complAdjVerb ;
|
||||
PredVV2 = transVerbVerb ;
|
||||
|
||||
UseV2V x = x ;
|
||||
UseV2S x = x ;
|
||||
UseV2Q x = x ;
|
||||
UseA2S x = x ;
|
||||
UseA2V x = x ;
|
||||
|
||||
UseCl tp cl = {s = tp.s ++ cl.s ! tp.b ! t2cl tp.t tp.a} ;
|
||||
|
||||
PosVP tp = predVerbGroup True tp.a ;
|
||||
NegVP tp = predVerbGroup False tp.a ;
|
||||
|
||||
ProgVP = progressiveVerbPhrase ;
|
||||
|
||||
PosTP t a = {s = t.s ++ a.s ; b = True ; t = t.t ; a = a.a} ;
|
||||
@@ -80,13 +100,21 @@ lin
|
||||
PredSuperl a = predAdjective (superlAdjPhrase a) ;
|
||||
PredCN = predCommNoun ;
|
||||
PredV2 = complTransVerb ;
|
||||
---- PredV3 = complDitransVerb ;
|
||||
PredV3 = complDitransVerb ;
|
||||
PredPassV = passVerb ;
|
||||
PredNP = predNounPhrase ;
|
||||
PredPP = predAdverb ;
|
||||
PredVS = complSentVerb ;
|
||||
PredVV = complVerbVerb ;
|
||||
PredVQ = complQuestVerb ;
|
||||
VTrans = transAsVerb ;
|
||||
PredV0 rain = predVerbGroupClause pronIt (predVerb rain) ;
|
||||
|
||||
PredAS = predAdjSent ;
|
||||
PredA2S = predAdjSent2 ;
|
||||
PredAV = complVerbAdj ;
|
||||
PredSubjA2V = complVerbAdj2 False ;
|
||||
PredObjA2V = complVerbAdj2 True ;
|
||||
|
||||
AdjAdv a = advPost (a.s ! AAdv) ;
|
||||
AdvPP p = advPost p.s ;
|
||||
@@ -96,8 +124,17 @@ lin
|
||||
AdvAP = advAdjPhrase ;
|
||||
|
||||
SlashV2 = slashTransVerbCl ;
|
||||
---- OneVP = predVerbPhrase (nameNounPhrase (nameReg "one")) ;
|
||||
OneVP = predVerbGroupClause (nameNounPhrase (nameReg "one")) ;
|
||||
---- ThereNP = thereIs ;
|
||||
ExistCN A = predVerbGroupClause
|
||||
(nameNounPhrase (nameReg "there"))
|
||||
(complTransVerb (mkTransVerbDir verbBe)
|
||||
(indefNounPhrase singular A)) ;
|
||||
ExistNumCN nu A =
|
||||
predVerbGroupClause
|
||||
(nameNounPhrasePl (nameReg "there"))
|
||||
(complTransVerb (mkTransVerbDir verbBe)
|
||||
(indefNounPhraseNum plural nu A)) ;
|
||||
|
||||
IdRP = identRelPron ;
|
||||
FunRP = funRelPron ;
|
||||
@@ -106,6 +143,11 @@ lin
|
||||
ModRS = modRelClause ;
|
||||
RelCl = relSuch ;
|
||||
|
||||
UseRCl tp cl =
|
||||
{s = \\g,n =>
|
||||
tp.s ++ cl.s ! tp.b ! (cl2s (t2cl tp.t tp.a) n P3).form ! g ! n} ;
|
||||
--- P3 ==> p
|
||||
|
||||
WhoOne = intPronWho singular ;
|
||||
WhoMany = intPronWho plural ;
|
||||
WhatOne = intPronWhat singular ;
|
||||
@@ -119,8 +161,17 @@ lin
|
||||
IntSlash = intSlash ;
|
||||
QuestAdv = questAdverbial ;
|
||||
|
||||
---- ExistQCl : CN -> QCl ; -- "is there a bar",
|
||||
---- ExistNumQCl : Num -> CN -> QCl ; -- "are there (86) bars"
|
||||
UseQCl tp cl = {s = \\q => tp.s ++ cl.s ! tp.b ! t2cl tp.t tp.a ! q} ;
|
||||
|
||||
ExistQCl A = questVerbPhrase
|
||||
(nameNounPhrase (nameReg "there"))
|
||||
(complTransVerb (mkTransVerbDir verbBe)
|
||||
(indefNounPhrase singular A)) ;
|
||||
ExistNumQCl nu A =
|
||||
questVerbPhrase
|
||||
(nameNounPhrasePl (nameReg "there"))
|
||||
(complTransVerb (mkTransVerbDir verbBe)
|
||||
(indefNounPhraseNum plural nu A)) ;
|
||||
|
||||
|
||||
PosImperVP = imperVerbPhrase True ;
|
||||
|
||||
@@ -60,6 +60,7 @@ oper
|
||||
|
||||
noNum : Numeral = {s = \\_ => []} ;
|
||||
|
||||
|
||||
--2 Determiners
|
||||
--
|
||||
-- Determiners are inflected according to the nouns they determine.
|
||||
@@ -475,6 +476,15 @@ oper
|
||||
predAdverb : PrepPhrase -> VerbGroup = \elsewhere ->
|
||||
beGroup (\\_ => elsewhere.s) ;
|
||||
|
||||
predAdjSent : Adjective -> Sentence -> Clause = \bra,hansover ->
|
||||
predVerbGroupClause
|
||||
pronIt
|
||||
(beGroup (
|
||||
\\n => bra.s ! AAdj ++ "that" ++ hansover.s)) ;
|
||||
|
||||
predAdjSent2 : AdjCompl -> NounPhrase -> Adjective = \bra,han ->
|
||||
{s = \\af => bra.s ! af ++ bra.s2 ++ han.s ! AccP} ;
|
||||
|
||||
|
||||
--3 Transitive verbs
|
||||
--
|
||||
@@ -539,10 +549,30 @@ oper
|
||||
mkDitransVerb : Verb -> Preposition -> Preposition -> DitransVerb = \v,p1,p2 ->
|
||||
v ** {s3 = p1 ; s4 = p2} ;
|
||||
|
||||
complDitransVerb : DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup =
|
||||
\give,you,beer ->
|
||||
useVerb give
|
||||
(\\_ => give.s1 ++ give.s3 ++ you.s ! AccP ++ give.s4 ++ beer.s ! AccP) ;
|
||||
complDitransVerb :
|
||||
DitransVerb -> NounPhrase -> TransVerb = \ge,dig ->
|
||||
{s = ge.s ;
|
||||
s1 = ge.s1 ++ ge.s3 ++ dig.s ! AccP ;
|
||||
s3 = ge.s4
|
||||
} ;
|
||||
-- complDitransVerb : DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup =
|
||||
-- \give,you,beer ->
|
||||
-- useVerb give
|
||||
-- (\\_ => give.s1 ++ give.s3 ++ you.s ! AccP ++ give.s4 ++ beer.s ! AccP) ;
|
||||
|
||||
complDitransAdjVerb :
|
||||
TransVerb -> NounPhrase -> AdjPhrase -> VerbGroup = \gor,dig,sur ->
|
||||
useVerb
|
||||
gor
|
||||
(\\_ => gor.s1 ++ gor.s3 ++ dig.s ! AccP ++
|
||||
sur.s ! AAdj) ;
|
||||
|
||||
complAdjVerb :
|
||||
Verb -> AdjPhrase -> VerbGroup = \seut,sur ->
|
||||
useVerb
|
||||
seut
|
||||
(\\n => sur.s ! AAdj ++ seut.s1) ;
|
||||
|
||||
|
||||
--2 Adverbs
|
||||
--
|
||||
@@ -643,6 +673,8 @@ oper
|
||||
|
||||
param
|
||||
|
||||
--- would need cleaning up so we wouldn't need this type
|
||||
|
||||
ClTense = ClPresent | ClPast | ClFuture | ClConditional ;
|
||||
|
||||
ClForm =
|
||||
@@ -653,18 +685,26 @@ oper
|
||||
;
|
||||
|
||||
oper
|
||||
cl2s : ClForm -> Number -> Person -> {form : SForm ; order : Order} = \c,n,p -> case c of {
|
||||
cl2s : ClForm -> Number -> Person -> {form : SForm ; order : Order} =
|
||||
\c,n,p -> case c of {
|
||||
ClIndic Indirect t Simul => {form = VQuest t n p ; order = Indirect} ;
|
||||
ClIndic o t a => {form = VIndic t a n p ; order = o} ;
|
||||
ClFut o a => {form = VFut a ; order = o} ;
|
||||
ClCondit o a => {form = VCondit a ; order = o} ;
|
||||
ClInfinit a => {form = VInfinit a ; order = Direct} --- order does not matter
|
||||
ClInfinit a => {form = VInfinit a ; order = Direct} --- order doesn't matter
|
||||
} ;
|
||||
s2cl : SForm -> Order -> ClForm = \s,o -> case s of {
|
||||
VIndic t a _ _ => ClIndic o t a ;
|
||||
VInfinit a => ClInfinit a ;
|
||||
_ => ClInfinit Simul ---- ??
|
||||
} ;
|
||||
t2cl : ClTense -> Anteriority -> ClForm = \t,a -> case t of {
|
||||
ClPresent => ClIndic Direct Present a ;
|
||||
ClPast => ClIndic Direct Past a ;
|
||||
ClFuture => ClFut Direct a ;
|
||||
ClConditional => ClCondit Direct a
|
||||
} ;
|
||||
|
||||
|
||||
Clause = {s : Bool => ClForm => Str} ;
|
||||
|
||||
@@ -698,6 +738,19 @@ oper
|
||||
complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \say,johnruns ->
|
||||
useVerb say (\\_ => "that" ++ johnruns.s) ;
|
||||
|
||||
complQuestVerb : SentenceVerb -> QuestionSent -> VerbGroup = \se,omduler ->
|
||||
useVerb se (\\_ => se.s1 ++ omduler.s ! IndirQ) ;
|
||||
|
||||
complDitransSentVerb : TransVerb -> NounPhrase -> Sentence -> VerbGroup =
|
||||
\sa,honom,duler ->
|
||||
useVerb sa
|
||||
(\\_ => sa.s1 ++ sa.s3 ++ honom.s ! AccP ++ "that" ++ duler.s) ;
|
||||
|
||||
complDitransQuestVerb : TransVerb -> NounPhrase -> QuestionSent -> VerbGroup =
|
||||
\sa,honom,omduler ->
|
||||
useVerb sa
|
||||
(\\_ => sa.s1 ++ sa.s3 ++ honom.s ! AccP ++ omduler.s ! IndirQ) ;
|
||||
|
||||
|
||||
--3 Verb-complement verbs
|
||||
--
|
||||
@@ -743,6 +796,50 @@ oper
|
||||
vvCan : VerbVerb = mkVerbAux ["be able to"] "can" "could" ["been able to"] ;
|
||||
vvMust : VerbVerb = mkVerbAux ["have to"] "must" ["had to"] ["had to"] ;
|
||||
|
||||
-- Notice agreement to object vs. subject:
|
||||
|
||||
DitransVerbVerb = TransVerb ** {s3 : Str} ;
|
||||
|
||||
complDitransVerbVerb :
|
||||
Bool -> DitransVerbVerb -> NounPhrase -> VerbPhrase -> VerbGroup =
|
||||
\obj,be,dig,simma ->
|
||||
useVerb be
|
||||
(\\n => be.s1 ++ be.s3 ++ dig.s ! AccP ++ be.s3 ++
|
||||
simma.s ++ simma.s2 ++
|
||||
if_then_Str obj
|
||||
(simma.s3 ! dig.n) ---- dig.g ! dig.n ! dig.p)
|
||||
(simma.s3 ! n) ---- g ! n ! p)
|
||||
) ;
|
||||
|
||||
transVerbVerb : VerbVerb -> TransVerb -> TransVerb = \vilja,hitta ->
|
||||
{s = vilja.s ;
|
||||
s1 = vilja.s1 ++ if_then_Str vilja.isAux [] "to" ++
|
||||
hitta.s ! InfImp ++ hitta.s1 ;
|
||||
s3 = hitta.s3
|
||||
} ;
|
||||
|
||||
complVerbAdj : Adjective -> VerbPhrase -> VerbGroup = \grei, simma ->
|
||||
beGroup
|
||||
(\\n =>
|
||||
grei.s ! AAdj ++
|
||||
"to" ++
|
||||
simma.s ++ simma.s2 ++
|
||||
simma.s3 ! n) ;
|
||||
|
||||
complVerbAdj2 :
|
||||
Bool -> AdjCompl -> NounPhrase -> VerbPhrase -> VerbGroup =
|
||||
\obj,grei,dig,simma ->
|
||||
beGroup
|
||||
(\\n =>
|
||||
grei.s ! AAdj ++
|
||||
grei.s2 ++ dig.s ! AccP ++
|
||||
"to" ++
|
||||
simma.s ++ simma.s2 ++
|
||||
if_then_Str obj
|
||||
(simma.s3 ! dig.n) ---- dig.g ! dig.n ! dig.p)
|
||||
(simma.s3 ! n) ---- g ! n ! p)
|
||||
) ;
|
||||
|
||||
|
||||
--2 Sentences missing noun phrases
|
||||
--
|
||||
@@ -777,18 +874,6 @@ oper
|
||||
\you,lookat ->
|
||||
predVerbGroupClause you (predVerb lookat) ** {s2 = lookat.s3} ;
|
||||
|
||||
{-
|
||||
--- TODO: "there is" with tense variation.
|
||||
|
||||
thereIs : NounPhrase -> Sentence = \abar ->
|
||||
predVerbPhrase
|
||||
(case abar.n of {
|
||||
Sg => nameNounPhrase (nameReg "there") ;
|
||||
Pl => {s = \\_ => "there" ; n = Pl ; p = P3}
|
||||
})
|
||||
(predVerbGroup True (predNounPhrase abar)) ;
|
||||
-}
|
||||
|
||||
|
||||
--2 Relative pronouns and relative clauses
|
||||
--
|
||||
@@ -949,16 +1034,6 @@ oper
|
||||
}
|
||||
} ;
|
||||
|
||||
{-
|
||||
isThere : NounPhrase -> Question = \abar ->
|
||||
questVerbPhrase
|
||||
(case abar.n of {
|
||||
Sg => nameNounPhrase (nameReg "there") ;
|
||||
Pl => {s = \\_ => "there" ; n = Pl ; p = P3}
|
||||
})
|
||||
(predVerbGroup True (predNounPhrase abar)) ;
|
||||
-}
|
||||
|
||||
--3 Wh-questions
|
||||
--
|
||||
-- Wh-questions are of two kinds: ones that are like $NP - VP$ sentences,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
concrete TestResourceEng of TestResource = RulesEng, StructuralEng **
|
||||
open SyntaxEng, ParadigmsEng in {
|
||||
open Prelude, SyntaxEng, ParadigmsEng in {
|
||||
|
||||
flags startcat=Phr ; lexer=textlit ; parser=chart ; unlexer=text ;
|
||||
|
||||
@@ -48,4 +48,23 @@ lin
|
||||
John = nameReg "John" ;
|
||||
Mary = nameReg "Mary" ;
|
||||
|
||||
--- next
|
||||
AlreadyAdv = advPre "already" ;
|
||||
NowAdv = advPre "now" ;
|
||||
|
||||
Paint = mkTransVerbDir (verbNoPart (regVerbP3 "paint")) ;
|
||||
Green = adjDegrReg "green" ;
|
||||
Beg = mkTransVerbDir (verbNoPart (regVerbP3 "ask")) ** {isAux = False} ;
|
||||
Promise = mkTransVerbDir (verbNoPart (verbP3e "promise")) ** {isAux = False} ;
|
||||
Wonder = verbNoPart (regVerbP3 "wonder") ;
|
||||
Ask = mkTransVerbDir (verbNoPart (regVerbP3 "ask")) ;
|
||||
Tell = mkTransVerbDir (verbNoPart (mkVerb "tell" "told" "told")) ;
|
||||
Look = verbNoPart (regVerbP3 "look") ;
|
||||
|
||||
Try = mkTransVerbDir (verbNoPart (verbP3y "try")) ** {isAux = False} ;
|
||||
Important = regAdjective "important" ** {s2 = "for"} ;
|
||||
Probable = regAdjective "probable" ; ---- reg
|
||||
Easy = regAdjective "easy" ** {s2 = "for"} ;
|
||||
Rain = verbNoPart (regVerbP3 "rain") ;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -57,7 +57,7 @@ lin
|
||||
UseA2S x = x ;
|
||||
UseA2V x = x ;
|
||||
|
||||
UseCl tp cl = {s = \\o => tp.s ++ cl.s ! tp.b ! ClFinite tp.t tp.a o} ;
|
||||
UseCl tp cl = {s = \\o => tp.s ++ cl.s ! tp.b ! ClFinite tp.t tp.a o} ;
|
||||
|
||||
PosVP tp = predVerbGroup True tp.a ;
|
||||
NegVP tp = predVerbGroup False tp.a ;
|
||||
@@ -148,7 +148,6 @@ lin
|
||||
|
||||
UseQCl tp cl = {s = \\q => tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a ! q} ;
|
||||
|
||||
|
||||
PosImperVP = imperVerbPhrase True ;
|
||||
NegImperVP = imperVerbPhrase False ;
|
||||
|
||||
|
||||
@@ -852,9 +852,10 @@ oper
|
||||
) ;
|
||||
|
||||
complVerbAdj2 :
|
||||
Bool -> AdjCompl -> NounPhrase -> VerbPhrase -> VerbGroup = \obj,grei,dig,simma ->
|
||||
vara
|
||||
(\\g,n,p =>
|
||||
Bool -> AdjCompl -> NounPhrase -> VerbPhrase -> VerbGroup =
|
||||
\obj,grei,dig,simma ->
|
||||
vara
|
||||
(\\g,n,p =>
|
||||
grei.s ! predFormAdj g n ! Nom ++
|
||||
grei.s2 ++ dig.s ! PAcc ++
|
||||
infinAtt ++
|
||||
@@ -862,7 +863,7 @@ oper
|
||||
if_then_Str obj
|
||||
(simma.s3 ! dig.g ! dig.n ! dig.p)
|
||||
(simma.s3 ! g ! n ! p)
|
||||
) ;
|
||||
) ;
|
||||
|
||||
--2 Sentences missing noun phrases
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user