mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-16 00:09:31 -06:00
starting to add tense to English resource
This commit is contained in:
@@ -79,13 +79,13 @@ cat
|
||||
--3 Adjectives and adjectival phrases
|
||||
--
|
||||
|
||||
A1 ; -- one-place adjective, e.g. "even"
|
||||
A ; -- one-place adjective, e.g. "even"
|
||||
A2 ; -- two-place adjective, e.g. "divisible (by)"
|
||||
ADeg ; -- degree adjective, e.g. "big/bigger/biggest"
|
||||
|
||||
AP ; -- adjective phrase, e.g. "divisible by two", "bigger than John"
|
||||
|
||||
-- The difference between $A1$ and $ADeg$ is that the former has no
|
||||
-- The difference between $A$ and $ADeg$ is that the former has no
|
||||
-- comparison forms.
|
||||
|
||||
--!
|
||||
|
||||
@@ -33,7 +33,7 @@ fun
|
||||
AppN3 : N3 -> NP -> N2 ; -- "flight from Paris"
|
||||
UseN2 : N2 -> CN ; -- "successor"
|
||||
|
||||
ModAdj : AP -> CN -> CN ; -- "red car"
|
||||
ModAP : AP -> CN -> CN ; -- "red car"
|
||||
CNthatS : CN -> S -> CN ; -- "idea that the Earth is flat"
|
||||
|
||||
ModGenOne : NP -> CN -> NP ; -- "John's car"
|
||||
@@ -46,14 +46,14 @@ fun
|
||||
--3 Adjectives and adjectival phrases
|
||||
--
|
||||
|
||||
UseA1 : A1 -> AP ; -- "red"
|
||||
UseA : A -> AP ; -- "red"
|
||||
ComplA2 : A2 -> NP -> AP ; -- "divisible by two"
|
||||
|
||||
PositADeg : ADeg -> AP ; -- "old"
|
||||
ComparADeg : ADeg -> NP -> AP ; -- "older than John"
|
||||
SuperlNP : ADeg -> CN -> NP ; -- "the oldest man"
|
||||
|
||||
---- AdjPart : V -> A1 ; -- "forgotten"
|
||||
---- AdjPart : V -> A ; -- "forgotten"
|
||||
|
||||
--!
|
||||
--3 Verbs and verb phrases
|
||||
|
||||
@@ -4,7 +4,7 @@ abstract TestResource = Rules, Structural ** {
|
||||
|
||||
fun
|
||||
Big, Happy, Small, Old, Young : ADeg ;
|
||||
American, Finnish : A1 ;
|
||||
American, Finnish : A ;
|
||||
Married : A2 ;
|
||||
Man, Woman, Car, House, Light, Bar, Bottle, Wine, Level : N ;
|
||||
Walk, Run : V ;
|
||||
|
||||
82
lib/resource/english/CategoriesEng.gf
Normal file
82
lib/resource/english/CategoriesEng.gf
Normal file
@@ -0,0 +1,82 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
--1 The Top-Level English Resource Grammar: Combination Rules
|
||||
--
|
||||
-- Aarne Ranta 2002 -- 2003
|
||||
--
|
||||
-- This is the English concrete syntax of the multilingual resource
|
||||
-- grammar. Most of the work is done in the file $syntax.Eng.gf$.
|
||||
-- However, for the purpose of documentation, we make here explicit the
|
||||
-- linearization types of each category, so that their structures and
|
||||
-- dependencies can be seen.
|
||||
-- Another substantial part are the linearization rules of some
|
||||
-- structural words.
|
||||
--
|
||||
-- The users of the resource grammar should not look at this file for the
|
||||
-- linearization rules, which are in fact hidden in the document version.
|
||||
-- They should use $resource.Abs.gf$ to access the syntactic rules.
|
||||
-- This file can be consulted in those, hopefully rare, occasions in which
|
||||
-- one has to know how the syntactic categories are
|
||||
-- implemented. The parameter types are defined in $TypesEng.gf$.
|
||||
|
||||
concrete CategoriesEng of Categories = open Prelude, SyntaxEng in {
|
||||
|
||||
flags
|
||||
startcat=Phr ;
|
||||
lexer=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} ;
|
||||
N2 = Function ;
|
||||
-- = CommNounPhrase ** {s2 : Preposition} ;
|
||||
N3 = Function ** {s3 : Preposition} ;
|
||||
Num = {s : Case => Str} ;
|
||||
Prep = {s : Str} ;
|
||||
|
||||
A = Adjective ;
|
||||
-- = {s : AForm => Str}
|
||||
A2 = Adjective ** {s2 : Preposition} ;
|
||||
ADeg = {s : Degree => AForm => Str} ;
|
||||
AP = Adjective ** {p : Bool} ;
|
||||
|
||||
V = Verb ;
|
||||
-- = {s : VForm => Str ; s1 : Particle}
|
||||
VG = {s : Bool => SForm => Str ; s2 : Bool => Number => Str ;
|
||||
isAuxT, isAuxF : Bool} ;
|
||||
VP = {s : SForm => 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} ;
|
||||
Cl = Clause ;
|
||||
-- = {s : Bool => SForm => 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} ;
|
||||
|
||||
} ;
|
||||
215
lib/resource/english/MorphoEng.gf
Normal file
215
lib/resource/english/MorphoEng.gf
Normal file
@@ -0,0 +1,215 @@
|
||||
--# -path=.:../../prelude
|
||||
|
||||
--1 A Simple English Resource Morphology
|
||||
--
|
||||
-- Aarne Ranta 2002
|
||||
--
|
||||
-- This resource morphology contains definitions needed in the resource
|
||||
-- syntax. It moreover contains the most usual inflectional patterns.
|
||||
--
|
||||
-- We use the parameter types and word classes defined in $Types.gf$.
|
||||
|
||||
resource MorphoEng = TypesEng ** open Prelude, (Predef=Predef) in {
|
||||
|
||||
--2 Nouns
|
||||
--
|
||||
-- For conciseness and abstraction, we define a worst-case macro for
|
||||
-- noun inflection. It is used for defining special case that
|
||||
-- only need one string as argument.
|
||||
|
||||
oper
|
||||
mkNoun : (_,_,_,_ : Str) -> CommonNoun =
|
||||
\man,men, mans, mens -> {s = table {
|
||||
Sg => table {Nom => man ; Gen => mans} ;
|
||||
Pl => table {Nom => men ; Gen => mens}
|
||||
}} ;
|
||||
|
||||
nounReg : Str -> CommonNoun = \dog ->
|
||||
mkNoun dog (dog + "s") (dog + "'s") (dog + "s'");
|
||||
|
||||
nounS : Str -> CommonNoun = \kiss ->
|
||||
mkNoun kiss (kiss + "es") (kiss + "'s") (kiss + "es'") ;
|
||||
|
||||
nounY : Str -> CommonNoun = \fl ->
|
||||
mkNoun (fl + "y") (fl + "ies") (fl + "y's") (fl + "ies'") ;
|
||||
|
||||
nounGen : Str -> CommonNoun = \dog -> case last dog of {
|
||||
"y" => nounY "dog" ;
|
||||
"s" => nounS (init "dog") ;
|
||||
_ => nounReg "dog"
|
||||
} ;
|
||||
|
||||
--3 Proper names
|
||||
--
|
||||
-- Regular proper names are inflected with "'s" in the genitive.
|
||||
|
||||
nameReg : Str -> ProperName = \john ->
|
||||
{s = table {Nom => john ; Gen => john + "'s"}} ;
|
||||
|
||||
|
||||
--2 Pronouns
|
||||
--
|
||||
-- Here we define personal and relative pronouns.
|
||||
|
||||
mkPronoun : (_,_,_,_ : Str) -> Number -> Person -> Pronoun = \I,me,my,mine,n,p ->
|
||||
{s = table {NomP => I ; AccP => me ; GenP => my ; GenSP => mine} ;
|
||||
n = n ; p = p} ;
|
||||
|
||||
pronI = mkPronoun "I" "me" "my" "mine" Sg P1 ;
|
||||
pronYouSg = mkPronoun "you" "you" "your" "yours" Sg P2 ; -- verb form still OK
|
||||
pronHe = mkPronoun "he" "him" "his" "his" Sg P3 ;
|
||||
pronShe = mkPronoun "she" "her" "her" "hers" Sg P3 ;
|
||||
pronIt = mkPronoun "it" "it" "its" "it" Sg P3 ;
|
||||
|
||||
pronWe = mkPronoun "we" "us" "our" "ours" Pl P1 ;
|
||||
pronYouPl = mkPronoun "you" "you" "your" "yours" Pl P2 ;
|
||||
pronThey = mkPronoun "they" "them" "their" "theirs" Pl P3 ;
|
||||
|
||||
-- Relative pronouns in the accusative have the 'no pronoun' variant.
|
||||
-- The simple pronouns do not really depend on number.
|
||||
|
||||
relPron : RelPron = {s = table {
|
||||
NoHum => \\_ => table {
|
||||
NomP => variants {"that" ; "which"} ;
|
||||
AccP => variants {"that" ; "which" ; []} ;
|
||||
GenP => variants {"whose"} ;
|
||||
GenSP => variants {"which"}
|
||||
} ;
|
||||
Hum => \\_ => table {
|
||||
NomP => variants {"that" ; "who"} ;
|
||||
AccP => variants {"that" ; "who" ; "whom" ; []} ;
|
||||
GenP => variants {"whose"} ;
|
||||
GenSP => variants {"whom"}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
--3 Determiners
|
||||
--
|
||||
-- We have just a heuristic definition of the indefinite article.
|
||||
-- There are lots of exceptions: consonantic "e" ("euphemism"), consonantic
|
||||
-- "o" ("one-sided"), vocalic "u" ("umbrella").
|
||||
|
||||
artIndef = pre {"a" ;
|
||||
"an" / strs {"a" ; "e" ; "i" ; "o" ; "A" ; "E" ; "I" ; "O" }} ;
|
||||
|
||||
artDef = "the" ;
|
||||
|
||||
--2 Adjectives
|
||||
--
|
||||
-- To form the adjectival and the adverbial forms, two strings are needed
|
||||
-- in the worst case.
|
||||
|
||||
mkAdjective : Str -> Str -> Adjective = \free,freely -> {
|
||||
s = table {
|
||||
AAdj => free ;
|
||||
AAdv => freely
|
||||
}
|
||||
} ;
|
||||
|
||||
-- However, the ending "iy" is sufficient for most cases. This function
|
||||
-- automatically changes the word-final "y" to "i" ("happy" - "happily").
|
||||
-- N.B. this is not correct for "shy", but $mkAdjective$ has to be used.
|
||||
|
||||
regAdjective : Str -> Adjective = \free ->
|
||||
let
|
||||
y = Predef.dp 1 free
|
||||
in mkAdjective
|
||||
free
|
||||
(ifTok Str y "y" (Predef.tk 1 free + ("ily")) (free + "ly")) ;
|
||||
|
||||
-- For the comparison of adjectives, six forms are needed to cover all cases.
|
||||
-- But there is no adjective that actually needs all these.
|
||||
|
||||
mkAdjDegrWorst : (_,_,_,_,_,_ : Str) -> AdjDegr =
|
||||
\good,well,better,betterly,best,bestly ->
|
||||
{s = table {
|
||||
Pos => (mkAdjective good well).s ;
|
||||
Comp => (mkAdjective better betterly).s ;
|
||||
Sup => (mkAdjective best bestly).s
|
||||
}
|
||||
} ;
|
||||
|
||||
-- What is usually needed for irregular comparisons are just three forms,
|
||||
-- since the adverbial form is the same (in comparative or superlative)
|
||||
-- or formed in the regular way (positive).
|
||||
|
||||
adjDegrIrreg : (_,_,_ : Str) -> AdjDegr = \bad,worse,worst ->
|
||||
let badly = (regAdjective bad).s ! AAdv
|
||||
in mkAdjDegrWorst bad badly worse worse worst worst ;
|
||||
|
||||
-- Like above, the regular formation takes account of final "y".
|
||||
|
||||
adjDegrReg : Str -> AdjDegr = \happy ->
|
||||
let happi = ifTok Str (Predef.dp 1 happy) "y" (Predef.tk 1 happy + "i") happy
|
||||
in adjDegrIrreg happy (happi + "er") (happi + "est") ;
|
||||
|
||||
-- Many adjectives are 'inflected' by adding a comparison word.
|
||||
|
||||
adjDegrLong : Str -> AdjDegr = \ridiculous ->
|
||||
adjDegrIrreg ridiculous ("more" ++ ridiculous) ("most" ++ ridiculous) ;
|
||||
|
||||
|
||||
--3 Verbs
|
||||
--
|
||||
-- Except for "be", the worst case needs four forms.
|
||||
|
||||
mkVerbP3 : (_,_,_,_: Str) -> VerbP3 = \go,goes,went,gone ->
|
||||
{s = table {
|
||||
InfImp => go ;
|
||||
Indic P3 => goes ;
|
||||
Indic _ => go ;
|
||||
Pastt _ => went ;
|
||||
PPart => gone
|
||||
}
|
||||
} ;
|
||||
|
||||
mkVerb : (_,_,_ : Str) -> VerbP3 = \ring,rang,rung ->
|
||||
mkVerbP3 ring (ring + "s") rang rung ;
|
||||
|
||||
regVerbP3 : Str -> VerbP3 = \walk ->
|
||||
mkVerb walk (walk + "ed") (walk + "ed") ;
|
||||
|
||||
verbP3s : Str -> VerbP3 = \kiss ->
|
||||
mkVerbP3 kiss (kiss + "es") (kiss + "ed") (kiss + "ed") ;
|
||||
|
||||
verbP3e : Str -> VerbP3 = \love ->
|
||||
mkVerbP3 love (love + "s") (love + "d") (love + "d") ;
|
||||
|
||||
verbP3y : Str -> VerbP3 = \cr ->
|
||||
mkVerbP3 (cr + "y") (cr + "ies") (cr + "ied") (cr + "ied") ;
|
||||
|
||||
verbGen : Str -> VerbP3 = \kill -> case last kill of {
|
||||
"y" => verbP3y (init "kill") ;
|
||||
"e" => verbP3y (init "kill") ;
|
||||
"s" => verbP3s (init "kill") ;
|
||||
_ => regVerbP3 "kill"
|
||||
} ;
|
||||
|
||||
verbP3Have = mkVerbP3 "have" "has" "had" "had" ;
|
||||
|
||||
verbP3Do = mkVerbP3 "do" "does" "did" "done" ;
|
||||
|
||||
verbBe : VerbP3 = {s = table {
|
||||
InfImp => "be" ;
|
||||
Indic P1 => "am" ;
|
||||
Indic P2 => "are" ;
|
||||
Indic P3 => "is" ;
|
||||
Pastt Sg => "was" ;
|
||||
Pastt Pl => "were" ;
|
||||
PPart => "been"
|
||||
}} ;
|
||||
|
||||
verbPart : VerbP3 -> Particle -> Verb = \v,p ->
|
||||
v ** {s1 = p} ;
|
||||
|
||||
verbNoPart : VerbP3 -> Verb = \v -> verbPart v [] ;
|
||||
|
||||
-- The optional negation contraction is a useful macro e.g. for "do".
|
||||
|
||||
contractNot : Str -> Str = \is -> variants {is ++ "not" ; is + "n't"} ;
|
||||
|
||||
dont = contractNot (verbP3Do.s ! InfImp) ;
|
||||
} ;
|
||||
|
||||
198
lib/resource/english/Rules.gf
Normal file
198
lib/resource/english/Rules.gf
Normal file
@@ -0,0 +1,198 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
--1 The Top-Level English Resource Grammar: Combination Rules
|
||||
--
|
||||
-- Aarne Ranta 2002 -- 2003
|
||||
--
|
||||
-- This is the English concrete syntax of the multilingual resource
|
||||
-- grammar. Most of the work is done in the file $syntax.Eng.gf$.
|
||||
-- However, for the purpose of documentation, we make here explicit the
|
||||
-- linearization types of each category, so that their structures and
|
||||
-- dependencies can be seen.
|
||||
-- Another substantial part are the linearization rules of some
|
||||
-- structural words.
|
||||
--
|
||||
-- The users of the resource grammar should not look at this file for the
|
||||
-- linearization rules, which are in fact hidden in the document version.
|
||||
-- They should use $resource.Abs.gf$ to access the syntactic rules.
|
||||
-- This file can be consulted in those, hopefully rare, occasions in which
|
||||
-- one has to know how the syntactic categories are
|
||||
-- implemented. The parameter types are defined in $TypesEng.gf$.
|
||||
|
||||
concrete CombinationsEng of Combinations = open Prelude, SyntaxEng in {
|
||||
|
||||
flags
|
||||
startcat=Phr ;
|
||||
lexer=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
|
||||
UseN = noun2CommNounPhrase ;
|
||||
ModAdj = modCommNounPhrase ;
|
||||
ModGenOne = npGenDet singular noNum ;
|
||||
ModGenNum = npGenDet plural ;
|
||||
UsePN = nameNounPhrase ;
|
||||
UseFun = funAsCommNounPhrase ;
|
||||
AppFun = appFunComm ;
|
||||
AppFun2 = appFun2 ;
|
||||
AdjP1 = adj2adjPhrase ;
|
||||
ComplAdj = complAdj ;
|
||||
PositAdjP = positAdjPhrase ;
|
||||
ComparAdjP = comparAdjPhrase ;
|
||||
SuperlNP = superlNounPhrase ;
|
||||
|
||||
DetNP = detNounPhrase ;
|
||||
IndefOneNP = indefNounPhrase singular ;
|
||||
IndefNumNP = indefNounPhraseNum plural ;
|
||||
DefOneNP = defNounPhrase singular ;
|
||||
DefNumNP = defNounPhraseNum plural ;
|
||||
MassNP = detNounPhrase (mkDeterminer Sg []) ;
|
||||
|
||||
CNthatS = nounThatSentence ;
|
||||
UseInt i = {s = table {Nom => i.s ; Gen => i.s ++ "'s"}} ; ---
|
||||
NoNum = noNum ;
|
||||
|
||||
SymbPN i = {s = table {Nom => i.s ; Gen => i.s ++ "'s"}} ; ---
|
||||
SymbCN cn s =
|
||||
{s = \\n,c => cn.s ! n ! c ++ s.s ;
|
||||
g = cn.g} ;
|
||||
|
||||
PredVP = predVerbPhrase ;
|
||||
PosVG = predVerbGroup True ;
|
||||
NegVG = predVerbGroup False ;
|
||||
|
||||
PredV = predVerb ;
|
||||
PredAP = predAdjective ;
|
||||
PredCN = predCommNoun ;
|
||||
PredTV = complTransVerb ;
|
||||
PredV3 = complDitransVerb ;
|
||||
PredPassV = passVerb ;
|
||||
PredNP = predNounPhrase ;
|
||||
PredAdV = predAdverb ;
|
||||
PredVS = complSentVerb ;
|
||||
PredVV = complVerbVerb ;
|
||||
VTrans = transAsVerb ;
|
||||
|
||||
AdjAdv a = advPost (a.s ! AAdv) ;
|
||||
PrepNP p = prepPhrase p.s ; ---
|
||||
AdvVP = adVerbPhrase ;
|
||||
AdvCN = advCommNounPhrase ;
|
||||
AdvAP = advAdjPhrase ;
|
||||
|
||||
PosSlashTV = slashTransVerb True ;
|
||||
NegSlashTV = slashTransVerb False ;
|
||||
OneVP = predVerbPhrase (nameNounPhrase (nameReg "one")) ;
|
||||
ThereNP = thereIs ;
|
||||
|
||||
IdRP = identRelPron ;
|
||||
FunRP = funRelPron ;
|
||||
RelVP = relVerbPhrase ;
|
||||
RelSlash = relSlash ;
|
||||
ModRC = modRelClause ;
|
||||
RelSuch = relSuch ;
|
||||
|
||||
WhoOne = intPronWho singular ;
|
||||
WhoMany = intPronWho plural ;
|
||||
WhatOne = intPronWhat singular ;
|
||||
WhatMany = intPronWhat plural ;
|
||||
FunIP = funIntPron ;
|
||||
NounIPOne = nounIntPron singular ;
|
||||
NounIPMany = nounIntPron plural ;
|
||||
|
||||
QuestVP = questVerbPhrase ;
|
||||
IntVP = intVerbPhrase ;
|
||||
IntSlash = intSlash ;
|
||||
QuestAdv = questAdverbial ;
|
||||
IsThereNP = isThere ;
|
||||
|
||||
ImperVP = imperVerbPhrase ;
|
||||
|
||||
IndicPhrase = indicUtt ;
|
||||
QuestPhrase = interrogUtt ;
|
||||
ImperOne = imperUtterance singular ;
|
||||
ImperMany = imperUtterance plural ;
|
||||
|
||||
AdvS = advSentence ;
|
||||
|
||||
TwoS = twoSentence ;
|
||||
ConsS = consSentence ;
|
||||
ConjS = conjunctSentence ;
|
||||
ConjDS = conjunctDistrSentence ;
|
||||
|
||||
TwoAP = twoAdjPhrase ;
|
||||
ConsAP = consAdjPhrase ;
|
||||
ConjAP = conjunctAdjPhrase ;
|
||||
ConjDAP = conjunctDistrAdjPhrase ;
|
||||
|
||||
TwoNP = twoNounPhrase ;
|
||||
ConsNP = consNounPhrase ;
|
||||
ConjNP = conjunctNounPhrase ;
|
||||
ConjDNP = conjunctDistrNounPhrase ;
|
||||
|
||||
SubjS = subjunctSentence ;
|
||||
SubjImper = subjunctImperative ;
|
||||
SubjQu = subjunctQuestion ;
|
||||
SubjVP = subjunctVerbPhrase ;
|
||||
|
||||
PhrNP = useNounPhrase ;
|
||||
PhrOneCN = useCommonNounPhrase singular ;
|
||||
PhrManyCN = useCommonNounPhrase plural ;
|
||||
PhrIP ip = ip ;
|
||||
PhrIAdv ia = ia ;
|
||||
|
||||
OnePhr p = p ;
|
||||
ConsPhr = cc2 ;
|
||||
|
||||
} ;
|
||||
104
lib/resource/english/StructuralEng.gf
Normal file
104
lib/resource/english/StructuralEng.gf
Normal file
@@ -0,0 +1,104 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
--1 The Top-Level English Resource Grammar: Structural Words
|
||||
--
|
||||
-- Aarne Ranta 2002 -- 2003
|
||||
--
|
||||
concrete StructuralEng of Structural =
|
||||
CombinationsEng ** open Prelude, SyntaxEng in {
|
||||
lin
|
||||
INP = pronI ;
|
||||
ThouNP = pronYouSg ;
|
||||
HeNP = pronHe ;
|
||||
SheNP = pronShe ;
|
||||
ItNP = pronIt ;
|
||||
WeNumNP = pronWithNum pronWe ;
|
||||
YeNumNP = pronWithNum pronYouPl ;
|
||||
YouNP = pronYouSg ;
|
||||
TheyNP = pronThey ;
|
||||
|
||||
EveryDet = everyDet ;
|
||||
AllMassDet = mkDeterminer Sg "all" ; --- all the missing
|
||||
AllNumDet = mkDeterminerNum Pl "all" ;
|
||||
WhichDet = whichDet ;
|
||||
WhichNumDet = mkDeterminerNum Pl "which" ;
|
||||
MostsDet = mostDet ;
|
||||
MostDet = mkDeterminer Sg "most" ;
|
||||
SomeDet = mkDeterminer Sg "some" ;
|
||||
SomeNumDet = mkDeterminerNum Pl "some" ;
|
||||
AnyDet = mkDeterminer Sg "any" ;
|
||||
AnyNumDet = mkDeterminerNum Pl "any" ;
|
||||
NoDet = mkDeterminer Sg "no" ;
|
||||
NoNumDet = mkDeterminerNum Pl "no" ;
|
||||
ManyDet = mkDeterminer Pl "many" ;
|
||||
MuchDet = mkDeterminer Sg ["a lot of"] ; ---
|
||||
ThisDet = mkDeterminer Sg "this" ;
|
||||
TheseNumDet = mkDeterminerNum Pl "these" ;
|
||||
ThatDet = mkDeterminer Sg "that" ;
|
||||
ThoseNumDet = mkDeterminerNum Pl "those" ;
|
||||
|
||||
ThisNP = nameNounPhrase (nameReg "this") ;
|
||||
ThatNP = nameNounPhrase (nameReg "that") ;
|
||||
TheseNumNP n = nameNounPhrasePl {s = \\c => "these" ++ n.s ! c} ;
|
||||
ThoseNumNP n = nameNounPhrasePl {s = \\c => "those" ++ n.s ! c} ;
|
||||
|
||||
EverybodyNP = nameNounPhrase (nameReg "everybody") ;
|
||||
SomebodyNP = nameNounPhrase (nameReg "somebody") ;
|
||||
NobodyNP = nameNounPhrase (nameReg "nobody") ;
|
||||
EverythingNP = nameNounPhrase (nameReg "everything") ;
|
||||
SomethingNP = nameNounPhrase (nameReg "something") ;
|
||||
NothingNP = nameNounPhrase (nameReg "nothing") ;
|
||||
|
||||
CanVV = vvCan ;
|
||||
CanKnowVV = vvCan ;
|
||||
MustVV = vvMust ;
|
||||
WantVV = verbNoPart (regVerbP3 "want") ** {isAux = False} ;
|
||||
|
||||
HowIAdv = ss "how" ;
|
||||
WhenIAdv = ss "when" ;
|
||||
WhereIAdv = ss "where" ;
|
||||
WhyIAdv = ss "why" ;
|
||||
EverywhereNP = advPost "everywhere" ;
|
||||
SomewhereNP = advPost "somewhere" ;
|
||||
NowhereNP = advPost "nowhere" ;
|
||||
|
||||
AndConj = ss "and" ** {n = Pl} ;
|
||||
OrConj = ss "or" ** {n = Sg} ;
|
||||
BothAnd = sd2 "both" "and" ** {n = Pl} ;
|
||||
EitherOr = sd2 "either" "or" ** {n = Sg} ;
|
||||
NeitherNor = sd2 "neither" "nor" ** {n = Sg} ;
|
||||
IfSubj = ss "if" ;
|
||||
WhenSubj = ss "when" ;
|
||||
AlthoughSubj = ss "although" ;
|
||||
|
||||
PhrYes = ss "Yes." ;
|
||||
PhrNo = ss "No." ;
|
||||
|
||||
VeryAdv = ss "very" ;
|
||||
TooAdv = ss "too" ;
|
||||
AlmostAdv = ss "almost" ;
|
||||
QuiteAdv = ss "quite" ;
|
||||
OtherwiseAdv = ss "otherwise" ;
|
||||
ThereforeAdv = ss "therefore" ;
|
||||
|
||||
InPrep = ss "in" ;
|
||||
OnPrep = ss "on" ;
|
||||
ToPrep = ss "to" ;
|
||||
ThroughPrep = ss "through" ;
|
||||
AbovePrep = ss "above" ;
|
||||
UnderPrep = ss "under" ;
|
||||
InFrontPrep = ss ["in front of"] ;
|
||||
BehindPrep = ss "behind" ;
|
||||
BetweenPrep = ss "between" ;
|
||||
FromPrep = ss "from" ;
|
||||
BeforePrep = ss "before" ;
|
||||
DuringPrep = ss "during" ;
|
||||
AfterPrep = ss "after" ;
|
||||
WithPrep = ss "with" ;
|
||||
WithoutPrep = ss "without" ;
|
||||
ByMeansPrep = ss "by" ;
|
||||
PossessPrep = ss "of" ;
|
||||
PartPrep = ss "of" ;
|
||||
AgentPrep = ss "by" ;
|
||||
|
||||
}
|
||||
1096
lib/resource/english/SyntaxEng.gf
Normal file
1096
lib/resource/english/SyntaxEng.gf
Normal file
File diff suppressed because it is too large
Load Diff
104
lib/resource/english/TypesEng.gf
Normal file
104
lib/resource/english/TypesEng.gf
Normal file
@@ -0,0 +1,104 @@
|
||||
--1 English Word Classes and Morphological Parameters
|
||||
--
|
||||
-- This is a resource module for English morphology, defining the
|
||||
-- morphological parameters and word classes of English. It is aimed
|
||||
-- to be complete w.r.t. the description of word forms.
|
||||
-- However, it only includes those parameters that are needed for
|
||||
-- analysing individual words: such parameters are defined in syntax modules.
|
||||
--
|
||||
-- We use the language-independent prelude.
|
||||
|
||||
resource TypesEng = open Prelude in {
|
||||
|
||||
--
|
||||
--2 Enumerated parameter types
|
||||
--
|
||||
-- These types are the ones found in school grammars.
|
||||
-- Their parameter values are atomic.
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
Gender = NoHum | Hum ;
|
||||
Case = Nom | Gen ;
|
||||
Person = P1 | P2 | P3 ;
|
||||
Degree = Pos | Comp | Sup ;
|
||||
|
||||
-- For data abstraction, we define
|
||||
|
||||
oper
|
||||
singular = Sg ;
|
||||
plural = Pl ;
|
||||
|
||||
--2 Word classes and hierarchical parameter types
|
||||
--
|
||||
-- Real parameter types (i.e. ones on which words and phrases depend)
|
||||
-- are often hierarchical. The alternative would be cross-products of
|
||||
-- simple parameters, but this would usually overgenerate.
|
||||
--
|
||||
|
||||
--3 Common nouns
|
||||
--
|
||||
-- Common nouns are inflected in number and case.
|
||||
|
||||
CommonNoun : Type = {s : Number => Case => Str} ;
|
||||
|
||||
|
||||
--
|
||||
--3 Adjectives
|
||||
--
|
||||
-- The major division is between the comparison degrees, but it
|
||||
-- is also good to leave room for adjectives that cannon be compared.
|
||||
-- It is, however, productive to form an adverbial from any adjective.
|
||||
|
||||
param AForm = AAdj | AAdv ;
|
||||
|
||||
oper
|
||||
Adjective : Type = SS1 AForm ;
|
||||
AdjDegr = {s : Degree => AForm => Str} ;
|
||||
|
||||
--3 Verbs
|
||||
--
|
||||
-- We treat the full conjugation now.
|
||||
-- The present tense is made to depend on person, which correspond to forms
|
||||
-- in the singular; plural forms are uniformly equal to the 2nd person singular.
|
||||
|
||||
param
|
||||
VForm = InfImp | Indic Person | Pastt Number | PPart ;
|
||||
|
||||
oper
|
||||
VerbP3 : Type = {s : VForm => Str} ;
|
||||
|
||||
-- A full verb can moreover have a particle.
|
||||
|
||||
Particle : Type = Str ;
|
||||
Verb = VerbP3 ** {s1 : Particle} ;
|
||||
|
||||
--
|
||||
--3 Pronouns
|
||||
--
|
||||
-- For pronouns, we need four case forms: "I" - "me" - "my" - "mine".
|
||||
|
||||
param
|
||||
NPForm = NomP | AccP | GenP | GenSP ;
|
||||
|
||||
oper
|
||||
Pronoun : Type = {s : NPForm => Str ; n : Number ; p : Person} ;
|
||||
|
||||
-- Coercions between pronoun cases and ordinaty cases.
|
||||
|
||||
toCase : NPForm -> Case = \c -> case c of {GenP => Gen ; _ => Nom} ;
|
||||
toNPForm : Case -> NPForm = \c -> case c of {Gen => GenP ; _ => NomP} ; ---
|
||||
|
||||
--3 Proper names
|
||||
--
|
||||
-- Proper names only need two cases.
|
||||
|
||||
ProperName : Type = SS1 Case ;
|
||||
|
||||
--3 Relative pronouns
|
||||
--
|
||||
-- Relative pronouns are inflected in gender (human/nonhuman), number, and case.
|
||||
|
||||
RelPron : Type = {s : Gender => Number => NPForm => Str} ;
|
||||
} ;
|
||||
|
||||
@@ -35,7 +35,7 @@ lincat
|
||||
n : Number ; p : Person ; c : ClitType} ;
|
||||
PN = {s : Str ; g : Gender} ;
|
||||
Det = {s : Gender => Str ; n : Number} ;
|
||||
A1 = Adjective ;
|
||||
A = Adjective ;
|
||||
-- = {s : AForm => Str ; p : Bool} ;
|
||||
A2 = Adjective ** {s2 : Preposition ; c : CaseA} ;
|
||||
ADeg = {s : Degree => AForm => Str ; p : Bool} ;
|
||||
|
||||
@@ -5,14 +5,14 @@ incomplete concrete RulesRomance of Rules = CategoriesRomance **
|
||||
|
||||
lin
|
||||
UseN = noun2CommNounPhrase ;
|
||||
ModAdj = modCommNounPhrase ;
|
||||
ModAP = modCommNounPhrase ;
|
||||
ModGenOne = npGenDet singular ;
|
||||
ModGenNum = npGenDetNum ;
|
||||
UsePN = nameNounPhrase ;
|
||||
UseN2 = funAsCommNounPhrase ; -- [SyntaxFra.noun2CommNounPhrase]
|
||||
AppN2 = appFunComm ;
|
||||
AppN3 = appFun2 ;
|
||||
UseA1 = adj2adjPhrase ;
|
||||
UseA = adj2adjPhrase ;
|
||||
ComplA2 = complAdj ;
|
||||
PositADeg = positAdjPhrase ;
|
||||
ComparADeg = comparAdjPhrase ;
|
||||
|
||||
@@ -36,7 +36,7 @@ lincat
|
||||
-- g: PronGen ; anim : Animacy ; pron: Bool} ;
|
||||
PN = ProperName ;
|
||||
-- = {s : Case => Str ; g : Gender ; anim : Animacy} ;
|
||||
A1 = Adjective ;
|
||||
A = Adjective ;
|
||||
-- = {s : AdjForm => Str} ;
|
||||
A2 = AdjCompl ;
|
||||
-- = Adjective ** Complement ;
|
||||
|
||||
@@ -6,8 +6,8 @@ lin
|
||||
UsePN = nameNounPhrase ;
|
||||
ComplA2 = complAdj ;
|
||||
PredVP = predVerbPhrase ;
|
||||
UseA1 = adj2adjPhrase ;
|
||||
ModAdj = modCommNounPhrase ;
|
||||
UseA = adj2adjPhrase ;
|
||||
ModAP = modCommNounPhrase ;
|
||||
UseN = noun2CommNounPhrase ;
|
||||
ModGenOne = npGenDet Sg noNum ;
|
||||
ModGenNum = npGenDet Pl ;
|
||||
|
||||
@@ -41,7 +41,7 @@ lincat
|
||||
Num = {s : Case => Str} ;
|
||||
Prep = {s : Str} ;
|
||||
|
||||
A1 = Adjective ;
|
||||
A = Adjective ;
|
||||
-- = {s : AdjFormPos => Case => Str} ;
|
||||
A2 = Adjective ** {s2 : Preposition} ;
|
||||
ADeg = {s : AdjForm => Str} ;
|
||||
|
||||
@@ -2,14 +2,14 @@ concrete RulesSwe of Rules = CategoriesSwe ** open Prelude, SyntaxSwe in {
|
||||
|
||||
lin
|
||||
UseN = noun2CommNounPhrase ;
|
||||
ModAdj = modCommNounPhrase ;
|
||||
ModAP = modCommNounPhrase ;
|
||||
ModGenOne = npGenDet singular noNum ;
|
||||
ModGenNum = npGenDet plural ;
|
||||
UsePN = nameNounPhrase ;
|
||||
UseN2 = funAsCommNounPhrase ;
|
||||
AppN2 = appFunComm ;
|
||||
AppN3 = appFun2 ;
|
||||
UseA1 = adj2adjPhrase ;
|
||||
UseA = adj2adjPhrase ;
|
||||
ComplA2 = complAdj ;
|
||||
PositADeg = positAdjPhrase ;
|
||||
ComparADeg = comparAdjPhrase ;
|
||||
|
||||
Reference in New Issue
Block a user