1
0
forked from GitHub/gf-core

English update complete though buggy

This commit is contained in:
aarne
2005-01-25 20:36:42 +00:00
parent 9f0ac830db
commit 7018c38be2
6 changed files with 198 additions and 39 deletions

View File

@@ -45,6 +45,10 @@ lincat
A2 = Adjective ** {s2 : Preposition} ; A2 = Adjective ** {s2 : Preposition} ;
ADeg = {s : Degree => AForm => Str} ; ADeg = {s : Degree => AForm => Str} ;
AP = Adjective ** {p : Bool} ; 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 ; V = Verb ;
-- = {s : VForm => Str ; s1 : Particle} -- = {s : VForm => Str ; s1 : Particle}
@@ -56,6 +60,16 @@ lincat
VS = Verb ; VS = Verb ;
VV = Verb ** {isAux : Bool} ; 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 TP = {s : Str ; b : Bool ; t : ClTense ; a : Anteriority} ; --- the Str field is dummy
Tense = {s : Str ; t : ClTense} ; Tense = {s : Str ; t : ClTense} ;
Ant = {s : Str ; a : Anteriority} ; Ant = {s : Str ; a : Anteriority} ;

View File

@@ -62,6 +62,26 @@ lin
AdjPart = adjPastPart ; AdjPart = adjPastPart ;
ReflV2 = reflTransVerb ; 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 ; ProgVP = progressiveVerbPhrase ;
PosTP t a = {s = t.s ++ a.s ; b = True ; t = t.t ; a = a.a} ; 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) ; PredSuperl a = predAdjective (superlAdjPhrase a) ;
PredCN = predCommNoun ; PredCN = predCommNoun ;
PredV2 = complTransVerb ; PredV2 = complTransVerb ;
---- PredV3 = complDitransVerb ; PredV3 = complDitransVerb ;
PredPassV = passVerb ; PredPassV = passVerb ;
PredNP = predNounPhrase ; PredNP = predNounPhrase ;
PredPP = predAdverb ; PredPP = predAdverb ;
PredVS = complSentVerb ; PredVS = complSentVerb ;
PredVV = complVerbVerb ; PredVV = complVerbVerb ;
PredVQ = complQuestVerb ;
VTrans = transAsVerb ; 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) ; AdjAdv a = advPost (a.s ! AAdv) ;
AdvPP p = advPost p.s ; AdvPP p = advPost p.s ;
@@ -96,8 +124,17 @@ lin
AdvAP = advAdjPhrase ; AdvAP = advAdjPhrase ;
SlashV2 = slashTransVerbCl ; SlashV2 = slashTransVerbCl ;
---- OneVP = predVerbPhrase (nameNounPhrase (nameReg "one")) ; OneVP = predVerbGroupClause (nameNounPhrase (nameReg "one")) ;
---- ThereNP = thereIs ; ---- 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 ; IdRP = identRelPron ;
FunRP = funRelPron ; FunRP = funRelPron ;
@@ -106,6 +143,11 @@ lin
ModRS = modRelClause ; ModRS = modRelClause ;
RelCl = relSuch ; 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 ; WhoOne = intPronWho singular ;
WhoMany = intPronWho plural ; WhoMany = intPronWho plural ;
WhatOne = intPronWhat singular ; WhatOne = intPronWhat singular ;
@@ -119,8 +161,17 @@ lin
IntSlash = intSlash ; IntSlash = intSlash ;
QuestAdv = questAdverbial ; QuestAdv = questAdverbial ;
---- ExistQCl : CN -> QCl ; -- "is there a bar", UseQCl tp cl = {s = \\q => tp.s ++ cl.s ! tp.b ! t2cl tp.t tp.a ! q} ;
---- ExistNumQCl : Num -> CN -> QCl ; -- "are there (86) bars"
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 ; PosImperVP = imperVerbPhrase True ;

View File

@@ -60,6 +60,7 @@ oper
noNum : Numeral = {s = \\_ => []} ; noNum : Numeral = {s = \\_ => []} ;
--2 Determiners --2 Determiners
-- --
-- Determiners are inflected according to the nouns they determine. -- Determiners are inflected according to the nouns they determine.
@@ -475,6 +476,15 @@ oper
predAdverb : PrepPhrase -> VerbGroup = \elsewhere -> predAdverb : PrepPhrase -> VerbGroup = \elsewhere ->
beGroup (\\_ => elsewhere.s) ; 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 --3 Transitive verbs
-- --
@@ -539,10 +549,30 @@ oper
mkDitransVerb : Verb -> Preposition -> Preposition -> DitransVerb = \v,p1,p2 -> mkDitransVerb : Verb -> Preposition -> Preposition -> DitransVerb = \v,p1,p2 ->
v ** {s3 = p1 ; s4 = p2} ; v ** {s3 = p1 ; s4 = p2} ;
complDitransVerb : DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup = complDitransVerb :
\give,you,beer -> DitransVerb -> NounPhrase -> TransVerb = \ge,dig ->
useVerb give {s = ge.s ;
(\\_ => give.s1 ++ give.s3 ++ you.s ! AccP ++ give.s4 ++ beer.s ! AccP) ; 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 --2 Adverbs
-- --
@@ -643,6 +673,8 @@ oper
param param
--- would need cleaning up so we wouldn't need this type
ClTense = ClPresent | ClPast | ClFuture | ClConditional ; ClTense = ClPresent | ClPast | ClFuture | ClConditional ;
ClForm = ClForm =
@@ -653,18 +685,26 @@ oper
; ;
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 Indirect t Simul => {form = VQuest t n p ; order = Indirect} ;
ClIndic o t a => {form = VIndic t a n p ; order = o} ; ClIndic o t a => {form = VIndic t a n p ; order = o} ;
ClFut o a => {form = VFut a ; order = o} ; ClFut o a => {form = VFut a ; order = o} ;
ClCondit o a => {form = VCondit 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 { s2cl : SForm -> Order -> ClForm = \s,o -> case s of {
VIndic t a _ _ => ClIndic o t a ; VIndic t a _ _ => ClIndic o t a ;
VInfinit a => ClInfinit a ; VInfinit a => ClInfinit a ;
_ => ClInfinit Simul ---- ?? _ => 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} ; Clause = {s : Bool => ClForm => Str} ;
@@ -698,6 +738,19 @@ oper
complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \say,johnruns -> complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \say,johnruns ->
useVerb say (\\_ => "that" ++ johnruns.s) ; 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 --3 Verb-complement verbs
-- --
@@ -743,6 +796,50 @@ 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"] ;
-- 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 --2 Sentences missing noun phrases
-- --
@@ -777,18 +874,6 @@ oper
\you,lookat -> \you,lookat ->
predVerbGroupClause you (predVerb lookat) ** {s2 = lookat.s3} ; 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 --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 --3 Wh-questions
-- --
-- Wh-questions are of two kinds: ones that are like $NP - VP$ sentences, -- Wh-questions are of two kinds: ones that are like $NP - VP$ sentences,

View File

@@ -1,7 +1,7 @@
--# -path=.:../abstract:../../prelude --# -path=.:../abstract:../../prelude
concrete TestResourceEng of TestResource = RulesEng, StructuralEng ** concrete TestResourceEng of TestResource = RulesEng, StructuralEng **
open SyntaxEng, ParadigmsEng in { open Prelude, SyntaxEng, ParadigmsEng in {
flags startcat=Phr ; lexer=textlit ; parser=chart ; unlexer=text ; flags startcat=Phr ; lexer=textlit ; parser=chart ; unlexer=text ;
@@ -48,4 +48,23 @@ lin
John = nameReg "John" ; John = nameReg "John" ;
Mary = nameReg "Mary" ; 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") ;
} ; } ;

View File

@@ -57,7 +57,7 @@ lin
UseA2S x = x ; UseA2S x = x ;
UseA2V 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 ; PosVP tp = predVerbGroup True tp.a ;
NegVP tp = predVerbGroup False 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} ; UseQCl tp cl = {s = \\q => tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a ! q} ;
PosImperVP = imperVerbPhrase True ; PosImperVP = imperVerbPhrase True ;
NegImperVP = imperVerbPhrase False ; NegImperVP = imperVerbPhrase False ;

View File

@@ -852,9 +852,10 @@ oper
) ; ) ;
complVerbAdj2 : complVerbAdj2 :
Bool -> AdjCompl -> NounPhrase -> VerbPhrase -> VerbGroup = \obj,grei,dig,simma -> Bool -> AdjCompl -> NounPhrase -> VerbPhrase -> VerbGroup =
vara \obj,grei,dig,simma ->
(\\g,n,p => vara
(\\g,n,p =>
grei.s ! predFormAdj g n ! Nom ++ grei.s ! predFormAdj g n ! Nom ++
grei.s2 ++ dig.s ! PAcc ++ grei.s2 ++ dig.s ! PAcc ++
infinAtt ++ infinAtt ++
@@ -862,7 +863,7 @@ oper
if_then_Str obj if_then_Str obj
(simma.s3 ! dig.g ! dig.n ! dig.p) (simma.s3 ! dig.g ! dig.n ! dig.p)
(simma.s3 ! g ! n ! p) (simma.s3 ! g ! n ! p)
) ; ) ;
--2 Sentences missing noun phrases --2 Sentences missing noun phrases
-- --