1
0
forked from GitHub/gf-core

Working on with new resource API.

This commit is contained in:
aarne
2003-11-21 15:28:25 +00:00
parent 6d99debdff
commit 9cd2c273a2
12 changed files with 726 additions and 220 deletions

View File

@@ -3,10 +3,23 @@
-- Aarne Ranta 2002 -- 2003
--
-- Although concrete syntax differs a lot between different languages,
-- many structures can be found that are common, on a certain level
-- of abstraction. What we will present in the following is an abstract
-- syntax that has been successfully defined for English, Finnish, French, German,
-- Italian, Russian, and Swedish. It has been applied to define language
-- many structures can be treated as common, on the level
-- of abstraction that GF provides.
-- What we will present in the following is a linguistically oriented abstract
-- syntax that has been successfully defined for the following languages:
--
--* $Eng$lish
--* $Fin$nish
--* $Fre$nch
--* $Ger$man
--* $Ita$lian
--* $Rus$sian
--* $Swe$dish
--
-- The three-letter prefixes are used in file names all over the resource
-- grammar library; we refer to them commonly as $X$ below.
--!
-- The grammar has been applied to define language
-- fragments on technical or near-to-technical domains: database queries,
-- video recorder dialogue systems, software specifications, and a
-- health-related phrase book. Each new application helped to identify some
@@ -16,48 +29,64 @@
-- To use the resource in applications, you need the following
-- $cat$ and $fun$ rules in $oper$ form, completed by taking the
-- $lincat$ and $lin$ judgements of a particular language. This is done
-- by using the $reuse$ module with the desired concrete syntax of
-- $ResAbs$ as argument.
-- by using, instead of this module, the $reuse$ module which has the name
-- $ResourceX$
abstract Combinations = PredefAbs ** {
--!
--2 Categories
--
-- The categories of this resource grammar are mostly 'standard' categories
-- of linguistics. Their is no claim that they correspond to semantic categories
-- definable in type theory: to define such correspondences is the business
-- of applications grammars.
-- of applications grammars. In general, the correspondence between linguistic
-- and semantic categories is many-to-many.
--
-- Categories that may look special are $Adj2$, $Fun$, and $TV$. They are all
-- instances of endowing another category with a complement, which can be either
-- a direct object (whose case may vary) or a prepositional phrase. This, together
-- with the category $Adv$, removes the need of a category of
-- 'prepositional phrases', which is too language-dependent to make sense
-- on this level of abstraction.
-- a direct object (whose case may vary) or a prepositional phrase. Prepositional
-- phrases that are not complements belong to the category
-- $AdV$ of adverbials.
--
-- In each group below, some categories are *lexical* in the sense of only
-- containing atomic elements. These elements are not necessarily expressed by
-- one word in all languages; the essential thing is that they have no
-- constituents. Thus they have no productions in this part of the
-- resource grammar. The $ParadigmsX$ grammars provide ways of defining
-- lexical elements.
--
-- Lexical categories are listed before other categories
-- in each group and divided by an empty line.
abstract Combinations = PredefAbs ** {
--!
--3 Nouns and noun phrases
--
cat
N ; -- simple common noun, e.g. "car"
CN ; -- common noun phrase, e.g. "red car", "car that John owns"
NP ; -- noun phrase, e.g. "John", "all cars", "you"
PN ; -- proper name, e.g. "John", "New York"
Det ; -- determiner, e.g. "every", "all"
Fun ; -- function word, e.g. "mother (of)"
Fun2 ; -- two-place function, e.g. "flight (from) (to)"
CN ; -- common noun phrase, e.g. "red car", "car that John owns"
NP ; -- noun phrase, e.g. "John", "all cars", "you"
Det ; -- determiner, e.g. "every", "all"
Num ; -- numeral, e.g. "three", "879"
--!
--3 Adjectives and adjectival phrases
--
Adj1 ; -- one-place adjective, e.g. "even"
Adj2 ; -- two-place adjective, e.g. "divisible (by)"
AdjDeg ; -- degree adjective, e.g. "big/bigger/biggest"
AP ; -- adjective phrase, e.g. "divisible by two", "bigger than John"
-- The difference between $Adj1$ and $AdjDeg$ is that the former has no
-- comparison forms.
--!
--3 Verbs and verb phrases
--
@@ -65,33 +94,42 @@ cat
TV ; -- two-place verb, e.g. "love", "wait (for)", "switch on"
V3 ; -- three-place verb, e.g. "give", "prefer (stg) (to stg)"
VS ; -- sentence-compl. verb, e.g. "say", "prove"
--- VV ; -- verb-compl. verb, e.g. "can", "want"
VP ; -- verb phrase, e.g. "switch the light on"
VV ; -- verb-compl. verb, e.g. "can", "want"
VG ; -- verbal group, e.g. "switch the light on"
VP ; -- verb phrase, e.g. "switch the light on", "don't run"
--!
--3 Adverbials
--
-- This group has no lexical categories.
AdV ; -- adverbial e.g. "now", "in the house"
AdA ; -- ad-adjective e.g. "very"
AdS ; -- sentence adverbial e.g. "therefore", "otherwise"
Prep ; -- pre/postposition, case e.g. "after", Adessive
--!
--3 Sentences and relative clauses
--
-- This group has no lexical categories.
S ; -- sentence, e.g. "John walks"
Slash ; -- sentence without NP, e.g. "John waits for (...)"
RP ; -- relative pronoun, e.g. "which", "the mother of whom"
RC ; -- relative clause, e.g. "who walks", "that I wait for"
--!
--3 Questions and imperatives
--
-- This group has no lexical categories.
IP ; -- interrogative pronoun, e.g. "who", "whose mother", "which yellow car"
IAdv ; -- interrogative adverb., e.g. "when", "why"
Qu ; -- question, e.g. "who walks"
Imp ; -- imperative, e.g. "walk!"
--!
--3 Coordination and subordination
--
@@ -103,13 +141,15 @@ cat
ListAP ; -- list of adjectival phrases
ListNP ; -- list of noun phrases
--!
--3 Complete utterances
--
-- This group has no lexical categories.
Phr ; -- full phrase, e.g. "John walks.","Who walks?", "Wait for me!"
Text ; -- sequence of phrases e.g. "One is odd. Therefore, two is even."
--!
--2 Rules
--
-- This set of rules is minimal, in the sense of defining the simplest combinations
@@ -118,64 +158,78 @@ cat
-- access it through an intermediate library that defines more rules as
-- 'macros' for combinations of the ones below.
--!
--3 Nouns and noun phrases
--
fun
UseN : N -> CN ; -- "car"
ModAdj : AP -> CN -> CN ; -- "red car"
DetNP : Det -> CN -> NP ; -- "every car"
MassNP : CN -> NP ; -- "wine"
IndefOneNP : CN -> NP ; -- "a car", "cars"
IndefManyNP : Num -> CN -> NP ; -- "houses", "86 houses"
DefOneNP : CN -> NP ; -- "the car"
DefManyNP : Num -> CN -> NP ; -- "the cars", "the 86 cars"
ModGenOne : NP -> CN -> NP ; -- "John's car"
ModGenMany : Num -> NP -> CN -> NP ; -- "John's cars", "John's 86 cars"
UsePN : PN -> NP ; -- "John"
UseFun : Fun -> CN ; -- "successor"
AppFun : Fun -> NP -> CN ; -- "successor of zero"
AppFun2 : Fun2 -> NP -> Fun ; -- "flight from Paris"
CNthatS : CN -> S -> CN ; -- "idea that the Earth is flat"
UseInt : Int -> Num ; -- "32" --- assumes i > 1
NoNum : Num ; -- no numeral modifier
UseN : N -> CN ; -- "car"
UsePN : PN -> NP ; -- "John"
UseFun : Fun -> CN ; -- "successor"
UseInt : Int -> Num ; -- "32" --- assumes i > 1
ModAdj : AP -> CN -> CN ; -- "red car"
DetNP : Det -> CN -> NP ; -- "every car"
MassNP : CN -> NP ; -- "wine"
IndefOneNP : CN -> NP ; -- "a car", "cars"
IndefManyNP : Num -> CN -> NP ; -- "houses", "86 houses"
DefOneNP : CN -> NP ; -- "the car"
DefManyNP : Num -> CN -> NP ; -- "the cars", "the 86 cars"
ModGenOne : NP -> CN -> NP ; -- "John's car"
ModGenMany : Num -> NP -> CN -> NP ; -- "John's cars", "John's 86 cars"
AppFun : Fun -> NP -> CN ; -- "successor of zero"
AppFun2 : Fun2 -> NP -> Fun ; -- "flight from Paris"
CNthatS : CN -> S -> CN ; -- "idea that the Earth is flat"
NoNum : Num ; -- no numeral modifier
--!
--3 Adjectives and adjectival phrases
--
AdjP1 : Adj1 -> AP ; -- "red"
ComplAdj : Adj2 -> NP -> AP ; -- "divisible by two"
PositAdjP : AdjDeg -> AP ; -- "old"
ComparAdjP : AdjDeg -> NP -> AP ; -- "older than John"
SuperlNP : AdjDeg -> CN -> NP ; -- "the oldest man"
AdjP1 : Adj1 -> AP ; -- "red"
PositAdjP : AdjDeg -> AP ; -- "old"
ComplAdj : Adj2 -> NP -> AP ; -- "divisible by two"
ComparAdjP : AdjDeg -> NP -> AP ; -- "older than John"
SuperlNP : AdjDeg -> CN -> NP ; -- "the oldest man"
--!
--3 Verbs and verb phrases
--
-- The principal way of forming sentences ($S$) is by combining a noun phrase
-- with a verb phrase (the $PredVP$ rule below). In addition to this, verb
-- phrases have uses in relative clauses and questions. Verb phrases already
-- have (or have not) a negation, but they are formed from verbal groups
-- ($VG$), which have both positive and negative forms.
PosV, NegV : V -> VP ; -- "walk", "doesn't walk"
PosA, NegA : AP -> VP ; -- "is old", "isn't old"
PosCN, NegCN : CN -> VP ; -- "is a man", "isn't a man"
PosTV, NegTV : TV -> NP -> VP ; -- "sees John", "doesn't see John"
PosPassV, NegPassV : V -> VP ; -- "is seen", "is not seen"
PosNP, NegNP : NP -> VP ; -- "is John", "is not John"
PosAdV, NegAdV : AdV -> VP ; -- "is everywhere", "is not in France"
PosVS, NegVS : VS -> S -> VP ; -- "says that I run", "doesn't say..."
--- PosVV, NegVV : VV -> VP -> VP ; -- "can run", "can't run", "tries to run"
PosV3, NegV3 : V3 -> NP -> NP -> VP ; -- "prefers wine to beer"
VTrans : TV -> V ; -- "loves"
PredV : V -> VG ; -- "walk", "doesn't walk"
PredPassV : V -> VG ; -- "is seen", "is not seen"
PredTV : TV -> NP -> VG ; -- "sees John", "doesn't see John"
PredVS : VS -> S -> VG ; -- "says that I run", "doesn't say..."
PredVV : VV -> VG -> VG ; -- "can run", "can't run", "tries to run"
PredV3 : V3 -> NP -> NP -> VG ; -- "prefers wine to beer"
PredNP : NP -> VG ; -- "is John", "is not John"
PredAdV : AdV -> VG ; -- "is everywhere", "is not in France"
PredAP : AP -> VG ; -- "is old", "isn't old"
PredCN : CN -> VG ; -- "is a man", "isn't a man"
VTrans : TV -> V ; -- "loves"
PosVG,NegVG : VG -> VP ; --
--!
--3 Adverbials
--
-- Here is how complex adverbials can be formed and used.
AdjAdv : AP -> AdV ; -- "freely", "more consciously than you"
PrepNP : Prep -> NP -> AdV ; -- "in London", "after the war"
AdvVP : VP -> AdV -> VP ; -- "always walks", "walks in the park"
AdvCN : CN -> AdV -> CN ; -- "house in London", "house today"
AdvAP : AdA -> AP -> AP ; -- "very good"
AdjAdv : AP -> AdV ; -- "freely", "more consciously than you"
PrepNP : Prep -> NP -> AdV ; -- "in London", "after the war"
AdvVP : VP -> AdV -> VP ; -- "always walks", "walks in the park"
AdvCN : CN -> AdV -> CN ; -- "house in London", "house today"
AdvAP : AdA -> AP -> AP ; -- "very good"
--!
--3 Sentences and relative clauses
--
@@ -187,11 +241,12 @@ fun
IdRP : RP ; -- "which"
FunRP : Fun -> RP -> RP ; -- "the successor of which"
RelVP : RP -> VP -> RC ; -- "who walks"
RelVP : RP -> VP -> RC ; -- "who walks", "who doesn't walk"
RelSlash : RP -> Slash -> RC ; -- "that I wait for"/"for which I wait"
ModRC : CN -> RC -> CN ; -- "man who walks"
RelSuch : S -> RC ; -- "such that it is even"
--!
--3 Questions and imperatives
--
@@ -200,7 +255,7 @@ fun
FunIP : Fun -> IP -> IP ; -- "the mother of whom"
NounIPOne, NounIPMany : CN -> IP ; -- "which car", "which cars"
QuestVP : NP -> VP -> Qu ; -- "does John walk"
QuestVP : NP -> VP -> Qu; -- "does John walk"; "doesn't John walk"
IntVP : IP -> VP -> Qu ; -- "who walks"
IntSlash : IP -> Slash -> Qu ; -- "whom does John see"
QuestAdv : IAdv -> NP -> VP -> Qu ; -- "why do you walk"
@@ -215,6 +270,7 @@ fun
AdvS : AdS -> S -> Phr ; -- "Therefore, 2 is prime."
--!
--3 Coordination
--
-- We consider "n"-ary coordination, with "n" > 1. To this end, we have introduced
@@ -243,6 +299,7 @@ fun
TwoNP : NP -> NP -> ListNP ;
ConsNP : ListNP -> NP -> ListNP ;
--!
--3 Subordination
--
-- Subjunctions are different from conjunctions, but form
@@ -253,6 +310,7 @@ fun
SubjQu : Subj -> S -> Qu -> Qu ; -- "if you are new, who are you?"
SubjVP : VP -> Subj -> S -> VP ; -- "(a man who) sings when he runs"
--!
--2 One-word utterances
--
-- These are, more generally, *one-phrase utterances*. The list below
@@ -263,6 +321,7 @@ fun
PhrIP : IAdv -> Phr ; -- "Who?"
PhrIAdv : IAdv -> Phr ; -- "Why?"
--!
--2 Text formation
--
-- A text is a sequence of phrases. It is defined like a non-empty list.

View File

@@ -1,5 +1,7 @@
--2 Examples of structural words
--1 GF Resource Grammar API for Structural Words
--
-- AR 21/11/2003
--
-- Here we have some words belonging to closed classes and appearing
-- in all languages we have considered.
-- Sometimes they are not really meaningful, e.g. $TheyNP$ in French
@@ -8,35 +10,67 @@
abstract Structural = Combinations ** {
fun
--!
--2 Determiners and noun phrases
--
-- Many plural determiners can take a numeral modifier. So can the plural
-- pronouns "we" and "you".
EveryDet, WhichDet, AllDet, -- every, sg which, sg all
SomeDet, AnyDet, NoDet, -- sg some, any, no
MostDet, MostsDet, ManyDet, MuchDet : Det ; -- sg most, pl most, many, much
ThisDet, ThatDet : Det ; -- this, that
-- Many plural determiners can take a numeral modifier.
AllsDet, WhichsDet, -- pl all, which (86)
SomesDet, AnysDet, NosDet, -- pl some, any, no
TheseDet, ThoseDet : Num -> Det ; -- these, those (86)
ThisNP, ThatNP : NP ; -- this, that
TheseNP, ThoseNP : Num -> NP ; -- these, those (86)
INP, ThouNP, HeNP, SheNP, ItNP : NP ; -- personal pronouns in singular
WeNP, YeNP : Num -> NP ; -- these pronouns can take numeral
TheyNP : NP ; -- personal pronouns in plural
YouNP : NP ; -- the polite you
TheyNP : NP ; YouNP : NP ; -- they, the polite you
EverybodyNP, SomebodyNP, NobodyNP, -- everybody, somebody, nobody
EverythingNP, SomethingNP, NothingNP : NP ; -- everything, something, nothing
--- CanVV, CanKnowVV, MustVV : VV ; -- can (pouvoir/savoir), must
--- WantVV : VV ; -- want (to do)
--!
--2 Auxiliary verbs
--
-- Depending on language, all, some, or none of there verbs belong to
-- a separate class of *auxiliary* verbs. The list is incomplete.
CanVV, CanKnowVV, MustVV : VV ; -- can (pouvoir/savoir), must
WantVV : VV ; -- want (to do)
--!
--2 Adverbials
--
WhenIAdv,WhereIAdv,WhyIAdv,HowIAdv : IAdv ; -- when, where, why, how
EverywhereNP, SomewhereNP, NowhereNP : AdV ;-- everywhere, somewhere, nowhere
AndConj, OrConj : Conj ; -- and, or
BothAnd, EitherOr, NeitherNor : ConjD ; -- both-and, either-or, neither-nor
IfSubj, WhenSubj, AlthoughSubj : Subj ; -- if, when, although
PhrYes, PhrNo : Phr ; -- yes, no
EverywhereNP, SomewhereNP,NowhereNP : AdV ; -- everywhere, somewhere, nowhere
VeryAdv, TooAdv : AdA ; -- very, too
AlmostAdv, QuiteAdv : AdA ; -- almost, quite
OtherwiseAdv, ThereforeAdv : AdS ; -- therefore, otherwise
--!
--2 Conjunctions and subjunctions
--
AndConj, OrConj : Conj ; -- and, or
BothAnd, EitherOr, NeitherNor : ConjD ; -- both-and, either-or, neither-nor
IfSubj, WhenSubj, AlthoughSubj : Subj ; -- if, when, although
--!
--2 Prepositions
--
-- We have carefully chosen a set of semantic relations expressible
-- by prepositions in some languages, by cases or postpositions in
-- others. Complement uses of prepositions are not included, and
-- should be treated by the use of many-place verbs, adjectives, and
-- functions.
InPrep, OnPrep, ToPrep, FromPrep, -- spatial relations
ThroughPrep, AbovePrep, UnderPrep,
InFrontPrep, BehindPrep, BetweenPrep : Prep ;
@@ -44,4 +78,13 @@ fun
WithPrep, WithoutPrep, ByMeansPrep : Prep ; -- some other relations
PartPrep : Prep ; -- partitive "of" ("bottle of wine")
AgentPrep : Prep ; -- agent "by" in passive constructions
--!
--2 Affirmation and negation
--
-- The negative-positive (French "si", German "doch") is missing.
PhrYes, PhrNo : Phr ; -- yes, no
}

View File

@@ -1,26 +1,42 @@
-- added 19/11/2003
-- added 19/11/2003 -- 21/11
-- Combinations.gf
cat
Prep ; -- pre/postposition and/or case e.g.
Num ; -- numeral, e.g. "three", "879"
--- VV ; -- verb-compl. verb, e.g. "can", "want"
VV ; -- verb-compl. verb, e.g. "can", "want"
VG ; -- verbal group
fun
ThereIsCN : CN -> S ; -- "there is a bar", "there are bars"
ThereAreCN : Num -> CN -> S ; -- "there are 86 bars"
PrepNP : Prep -> NP -> AdV ; -- "in London", "after the war" (replace LocNP)
MassNP : CN -> NP ; -- "wine"
--- PosVV, NegVV : VV -> VP -> VP ; -- "can run", "can't run", "tries to run"
PosAdV, NegAdV : AdV -> VP ; -- "is everywhere", "is not in France"
PredAdV : AdV -> VP ; -- "is everywhere", "is not in France"
AdjAdv : AP -> AdV ; -- "freely", "more consciously than you"
IsThereCN, AreThereCN : CN -> Qu ;-- "is there a bar", "are there bars"
IsThereCN,AreThereCN : CN -> Qu ; -- "is there a bar", "are there bars"
PosVG,NegVG : VG -> VP ; --
-- merged PosX and NegX to PredX, for the following
PredV : V -> VG ; -- "walk", "doesn't walk"
PredPassV : V -> VG ; -- "is seen", "is not seen"
PredTV : TV -> NP -> VG ; -- "sees John", "doesn't see John"
PredVS : VS -> S -> VG ; -- "says that I run", "doesn't say..."
PredVV : VV -> VG -> VG ; -- "can run", "can't run", "tries to run"
PredV3 : V3 -> NP -> NP -> VG ; -- "prefers wine to beer"
PredNP : NP -> VG ; -- "is John", "is not John"
PredAdV : AdV -> VG ; -- "is everywhere", "is not in France"
PredAP : AP -> VG ; -- "is old", "isn't old"
PredCN : CN -> VG ; -- "is a man", "isn't a man"
VTrans : TV -> V ; -- "loves"
-- changed type signatures: added Num
IndefManyNP : Num -> CN -> NP ; -- "houses", "86 houses"
DefManyNP : Num -> CN -> NP ; -- "the cars", "the 86 cars"
ModGenMany : Num -> NP -> CN -> NP ; -- "John's cars", "John's 86 cars"
DefManyNP : Num -> CN -> NP ; -- "the cars", "the 86 cars"
ModGenMany : Num -> NP -> CN -> NP ; -- "John's cars", "John's 86 cars"
UseInt : Int -> Num ; -- "32" --- assumes i > 1
NoNum : Num ; -- no numeral modifier