mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
new structure of much in Rules
This commit is contained in:
11
lib/resource/README
Normal file
11
lib/resource/README
Normal file
@@ -0,0 +1,11 @@
|
||||
23/1/2005
|
||||
|
||||
Radically extended and restructured Categories and Rules
|
||||
|
||||
Implemented for Scandinavian languages only; more to come soon
|
||||
|
||||
Old abstract modules are temporarily found in oldabstract/
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ cat
|
||||
Cl ; -- clause (variable tense) e.g. "John walks"/"John walked"
|
||||
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"
|
||||
RCl ; -- relative clause, e.g. "who walks", "that I wait for"
|
||||
|
||||
--!
|
||||
--3 Questions and imperatives
|
||||
@@ -129,7 +129,7 @@ cat
|
||||
|
||||
IP ; -- interrogative pronoun, e.g. "who", "whose mother", "which yellow car"
|
||||
IAdv ; -- interrogative adverb., e.g. "when", "why"
|
||||
Qu ; -- question, e.g. "who walks"
|
||||
QCl ; -- question, e.g. "who walks"
|
||||
Imp ; -- imperative, e.g. "walk!"
|
||||
|
||||
--!
|
||||
@@ -153,6 +153,28 @@ cat
|
||||
Text ; -- sequence of phrases e.g. "One is odd. Therefore, two is even."
|
||||
|
||||
---- next
|
||||
|
||||
V3A ; -- paint the house red
|
||||
V3V ; -- ask John to come
|
||||
V3VSubj ; -- promise John to come
|
||||
V3VObj ; -- ask John to come
|
||||
V3S ; -- tell John that it is raining
|
||||
VQ ; -- ask who comes
|
||||
V3Q ; -- ask John who comes
|
||||
VA ; -- look yellow
|
||||
|
||||
V0 ; -- (it) rains
|
||||
|
||||
AS ; -- (it is) important that he comes
|
||||
AV ; -- difficult to play
|
||||
|
||||
-- NB: it is difficult to play the sonata
|
||||
-- vs. it (the sonata) is difficult to play
|
||||
|
||||
QS ; -- question with fixed tense and polarity
|
||||
RS ; -- relative clause with fixed tense and polarity
|
||||
|
||||
TP ; -- tense x polarity selector
|
||||
Tense ; -- (abstract) tense
|
||||
Ant ; -- (abstract) anteriority
|
||||
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ fun
|
||||
ComparADeg : ADeg -> NP -> AP ; -- "older than John"
|
||||
SuperlNP : ADeg -> CN -> NP ; -- "the oldest man"
|
||||
|
||||
---- AdjPart : V -> A ; -- "forgotten"
|
||||
|
||||
--!
|
||||
--3 Verbs and verb phrases
|
||||
@@ -67,7 +66,8 @@ fun
|
||||
PredV : V -> VG ; -- "walk", "doesn't walk"
|
||||
PredPassV : V -> VG ; -- "is seen", "is not seen"
|
||||
PredV2 : V2 -> NP -> VG ; -- "sees John", "doesn't see John"
|
||||
PredV3 : V3 -> NP -> NP -> VG ; -- "prefers wine to beer"
|
||||
--- PredV3 : V3 -> NP -> NP -> VG ; -- "prefers wine to beer"
|
||||
PredV3 : V3 -> NP -> V2 ; -- "prefers wine (to beer)"
|
||||
PredVS : VS -> S -> VG ; -- "says that I run", "doesn't say..."
|
||||
PredVV : VV -> VG -> VG ; -- "can run", "can't run", "tries to run"
|
||||
|
||||
@@ -78,7 +78,7 @@ fun
|
||||
PredCN : CN -> VG ; -- "is a man", "isn't a man"
|
||||
VTrans : V2 -> V ; -- "loves"
|
||||
|
||||
PosVG,NegVG : VG -> VP ; --
|
||||
--- PosVG,NegVG : VG -> VP ; --
|
||||
|
||||
PredVG : NP -> VG -> Cl ; -- preserves all pol/tense variation
|
||||
|
||||
@@ -99,17 +99,24 @@ fun
|
||||
--3 Sentences and relative clauses
|
||||
--
|
||||
|
||||
PredVP : NP -> VP -> S ; -- "John walks"
|
||||
PosSlashV2,NegSlashV2 : NP -> V2 -> Slash ; -- "John sees", "John doesn't see"
|
||||
OneVP : VP -> S ; -- "one walks"
|
||||
ThereNP : NP -> S ; -- "there is a bar","there are 86 bars"
|
||||
--- PredVP : NP -> VP -> S ; -- "John walks"
|
||||
--- PosSlashV2,NegSlashV2 : NP -> V2 -> Slash ; -- "John sees", "John doesn't see"
|
||||
SlashV2 : NP -> V2 -> Slash ; -- "John sees", "John doesn't see"
|
||||
--- OneVP : VP -> S ; -- "one walks"
|
||||
OneVG : VG -> Cl ; -- "one walks"
|
||||
--- ThereNP : NP -> S ; -- "there is a bar","there are 86 bars"
|
||||
ExistCN : CN -> Cl ; -- "there is a bar"
|
||||
ExistNumCN : Num -> CN -> Cl ; -- "there are (86) bars"
|
||||
|
||||
IdRP : RP ; -- "which"
|
||||
FunRP : N2 -> RP -> RP ; -- "the successor of which"
|
||||
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"
|
||||
--- RelVP : RP -> VP -> RCl ; -- "who walks", "who doesn't walk"
|
||||
RelVG : RP -> VG -> RCl ; -- "who walks", "who doesn't walk"
|
||||
RelSlash : RP -> Slash -> RCl ; -- "that I wait for"/"for which I wait"
|
||||
--- ModRC : CN -> RS -> CN ; -- "man who walks"
|
||||
ModRS : CN -> RS -> CN ; -- "man who walks"
|
||||
--- RelSuch : S -> RCl ; -- "such that it is even"
|
||||
RelCl : Cl -> RCl ; -- "such that it is even"
|
||||
|
||||
--!
|
||||
--3 Questions and imperatives
|
||||
@@ -121,16 +128,21 @@ fun
|
||||
NounIPOne, NounIPMany : CN -> IP ; -- "which car", "which cars"
|
||||
---- NounIPHowMany : CN -> IP ; -- "how many cars"
|
||||
|
||||
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"
|
||||
IsThereNP : NP -> Qu ; -- "is there a bar", "are there (86) bars"
|
||||
QuestVG : NP -> VG -> QCl ; -- "does John walk"; "doesn't John walk"
|
||||
--- IntVP : IP -> VP -> QCl ; -- "who walks"
|
||||
IntVG : IP -> VG -> QCl ; -- "who walks"
|
||||
IntSlash : IP -> Slash -> QCl ; -- "whom does John see"
|
||||
--- QuestAdv : IAdv -> NP -> VP -> QS ; -- "why do you walk"
|
||||
QuestAdv : IAdv -> NP -> VG -> QCl ; -- "why do you walk"
|
||||
--- IsThereNP : NP -> QS ; -- "is there a bar", "are there (86) bars"
|
||||
ExistQCl : CN -> QCl ; -- "is there a bar",
|
||||
ExistNumQCl : Num -> CN -> QCl ; -- "are there (86) bars"
|
||||
|
||||
ImperVP : VP -> Imp ; -- "be a man"
|
||||
|
||||
----rename these ??
|
||||
IndicPhrase : S -> Phr ; -- "I walk."
|
||||
QuestPhrase : Qu -> Phr ; -- "Do I walk?"
|
||||
QuestPhrase : QS -> Phr ; -- "Do I walk?"
|
||||
ImperOne, ImperMany : Imp -> Phr ; -- "Be a man!", "Be men!"
|
||||
|
||||
PrepS : PP -> AdS ; -- "in Sweden, (there are bears)"
|
||||
@@ -173,7 +185,8 @@ fun
|
||||
|
||||
SubjS : Subj -> S -> S -> S ; -- "if 2 is odd, 3 is even"
|
||||
SubjImper : Subj -> S -> Imp -> Imp ; -- "if it is hot, use a glove!"
|
||||
SubjQu : Subj -> S -> Qu -> Qu ; -- "if you are new, who are you?"
|
||||
--- SubjQu : Subj -> S -> QS -> QS ; -- "if you are new, who are you?"
|
||||
SubjQS : Subj -> S -> QS -> QS ; -- "if you are new, who are you?"
|
||||
SubjVP : VP -> Subj -> S -> VP ; -- "(a man who) sings when he runs"
|
||||
|
||||
--!
|
||||
@@ -195,5 +208,44 @@ fun
|
||||
OnePhr : Phr -> Text ;
|
||||
ConsPhr : Phr -> Text -> Text ;
|
||||
|
||||
--- next
|
||||
|
||||
PredVV2 : VV -> V2 -> V2 ; -- (which song do you) want to play
|
||||
AdjPart : V -> A ; -- forgotten
|
||||
ReflV2 : V2 -> VG ;
|
||||
|
||||
-- In these predications, the last argument gets its agreement
|
||||
-- features from the second, and cannot hence be made to produce
|
||||
-- $V3A$/$V3S$.
|
||||
|
||||
PredV3A : V3A -> NP -> AP -> VG ;
|
||||
PredV3VSubj : V3VSubj -> NP -> VG -> VG ;
|
||||
|
||||
--- In these three it would be possible, but hardly useful...
|
||||
|
||||
PredV3VObj : V3VObj -> NP -> VG -> VG ;
|
||||
PredV3S : V3S -> NP -> S -> VG ;
|
||||
PredV3Q : V3Q -> NP -> QS -> VG ;
|
||||
|
||||
|
||||
PredVQ : VQ -> QS -> VG ;
|
||||
PredVA : VA -> AP -> VG ;
|
||||
|
||||
UseCl : TP -> Cl -> S ;
|
||||
UseVG : TP -> VG -> VP ;
|
||||
UseRCl : TP -> RCl -> RS ;
|
||||
UseQCl : TP -> QCl -> QS ;
|
||||
|
||||
PosTP : Tense -> Ant -> TP ;
|
||||
NegTP : Tense -> Ant -> TP ;
|
||||
|
||||
TPresent : Tense ;
|
||||
TPast : Tense ;
|
||||
TFuture : Tense ;
|
||||
TConditional : Tense ;
|
||||
|
||||
ASimul : Ant ;
|
||||
AAnter : Ant ;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -14,5 +14,16 @@ fun
|
||||
Mother, Uncle : N2 ;
|
||||
Connection : N3 ;
|
||||
Well, Always : Adv ;
|
||||
John, Mary : PN ;
|
||||
John, Mary : PN ;
|
||||
|
||||
AlreadyAdv, NowAdv : Adv ; -- already, now
|
||||
Paint : V3A ;
|
||||
Green : ADeg ;
|
||||
Beg : V3VObj ;
|
||||
Promise : VV ;
|
||||
Promise2 : V3VSubj ;
|
||||
Wonder : VQ ;
|
||||
Ask : V3Q ;
|
||||
Tell : V3S ;
|
||||
Look : VA ;
|
||||
} ;
|
||||
|
||||
@@ -23,9 +23,11 @@ concrete StructuralDan of Structural =
|
||||
ThisNP = regNameNounPhrase ["det her"] NNeutr ;
|
||||
ThatNP = regNameNounPhrase ["det der"] NNeutr ;
|
||||
TheseNumNP n =
|
||||
{s = \\c => ["de her"] ++ n.s ! npCase c ; g = Neutr ; n = Pl} ;
|
||||
{s = \\c => ["de her"] ++ n.s ! npCase c ; g = Neutr ; n = Pl ; p
|
||||
= P3} ;
|
||||
ThoseNumNP n =
|
||||
{s = \\c => ["de der"] ++ n.s ! npCase c ; g = Neutr ; n = Pl} ;
|
||||
{s = \\c => ["de der"] ++ n.s ! npCase c ; g = Neutr ; n = Pl ; p
|
||||
= P3} ;
|
||||
|
||||
EveryDet = varjeDet ;
|
||||
AllMassDet = mkDeterminerSgGender2 "all" "alt" IndefP ;
|
||||
@@ -74,7 +76,7 @@ concrete StructuralDan of Structural =
|
||||
ThereforeAdv = ss "derfor" ;
|
||||
|
||||
EverybodyNP = let alla = table {Nom => "alle" ; Gen => "alles"} in
|
||||
{s = \\c => alla ! npCase c ; g = Utr ; n = Pl} ;
|
||||
{s = \\c => alla ! npCase c ; g = Utr ; n = Pl ; p = P3} ;
|
||||
SomebodyNP = nameNounPhrase (mkProperName "nogen" NUtr) ;
|
||||
NobodyNP = nameNounPhrase (mkProperName "ingen" NUtr) ;
|
||||
EverythingNP = nameNounPhrase (mkProperName "alt" NNeutr) ;
|
||||
|
||||
@@ -112,4 +112,15 @@ instance SyntaxDan of SyntaxScand = TypesDan **
|
||||
mkDeterminerSgGender3 : Str -> Str -> Str -> SpeciesP -> Determiner = \en,_,ett ->
|
||||
mkDeterminerSgGender (table {Utr => en ; Neutr => ett}) ;
|
||||
|
||||
adjPastPart : Verb -> Adjective = \verb -> {
|
||||
s = \\af,c => verb.s1 ++ verb.s ! VI (PtPret c) ---- af
|
||||
} ;
|
||||
|
||||
reflPron : Number -> Person -> Str = \n,p -> case <n,p> of {
|
||||
<Sg,P1> => "mig" ;
|
||||
<Sg,P2> => "mig" ;
|
||||
<Pl,P1> => "os" ;
|
||||
<Pl,P2> => "seg" ; --- ? dere ?
|
||||
_ => "seg"
|
||||
} ;
|
||||
}
|
||||
@@ -23,9 +23,11 @@ concrete StructuralNor of Structural =
|
||||
ThisNP = regNameNounPhrase ["dette"] NNeutr ;
|
||||
ThatNP = regNameNounPhrase ["det"] NNeutr ;
|
||||
TheseNumNP n =
|
||||
{s = \\c => ["disse"] ++ n.s ! npCase c ; g = Neutr ; n = Pl} ;
|
||||
{s = \\c => ["disse"] ++ n.s ! npCase c ; g = Neutr ; n = Pl ; p =
|
||||
P3} ;
|
||||
ThoseNumNP n =
|
||||
{s = \\c => ["de der"] ++ n.s ! npCase c ; g = Neutr ; n = Pl} ;
|
||||
{s = \\c => ["de der"] ++ n.s ! npCase c ; g = Neutr ; n = Pl ; p
|
||||
= P3} ;
|
||||
|
||||
EveryDet = varjeDet ;
|
||||
AllMassDet = mkDeterminerSgGender2 "all" "alt" IndefP ;
|
||||
@@ -74,7 +76,8 @@ concrete StructuralNor of Structural =
|
||||
ThereforeAdv = ss "derfor" ;
|
||||
|
||||
EverybodyNP = let alla = table {Nom => "alle" ; Gen => "alles"} in
|
||||
{s = \\c => alla ! npCase c ; g = Utr Masc ; n = Pl} ;
|
||||
{s = \\c => alla ! npCase c ; g = Utr Masc ; n = Pl
|
||||
; p = P3} ;
|
||||
SomebodyNP = nameNounPhrase (mkProperName "noen" (NUtr Masc)) ;
|
||||
NobodyNP = nameNounPhrase (mkProperName "ingen" (NUtr Masc)) ;
|
||||
EverythingNP = nameNounPhrase (mkProperName "alt" NNeutr) ;
|
||||
|
||||
@@ -112,4 +112,16 @@ instance SyntaxNor of SyntaxScand = TypesNor **
|
||||
mkDeterminerSgGender3 : Str -> Str -> Str -> SpeciesP -> Determiner = \en,ei,ett ->
|
||||
mkDeterminerSgGender (table {Utr Masc => en ; Utr NoMasc => ei ; Neutr => ett}) ;
|
||||
|
||||
adjPastPart : Verb -> Adjective = \verb -> {
|
||||
s = \\af,c => verb.s1 ++ verb.s ! VI (PtPret c) ---- af
|
||||
} ;
|
||||
|
||||
reflPron : Number -> Person -> Str = \n,p -> case <n,p> of {
|
||||
<Sg,P1> => "meg" ;
|
||||
<Sg,P2> => "meg" ;
|
||||
<Pl,P1> => "oss" ;
|
||||
<Pl,P2> => "jer" ;
|
||||
_ => "seg"
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
158
lib/resource/oldabstract/Categories.gf
Normal file
158
lib/resource/oldabstract/Categories.gf
Normal file
@@ -0,0 +1,158 @@
|
||||
--1 Abstract Syntax Categories for Multilingual Resource Grammar
|
||||
--
|
||||
-- Aarne Ranta 2002 -- 2004
|
||||
--
|
||||
-- Although concrete syntax differs a lot between different languages,
|
||||
-- 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
|
||||
-- missing structures in the resource and suggested some additions, but the
|
||||
-- number of required additions was usually small.
|
||||
--
|
||||
-- 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, instead of this module, the $reuse$ module which has the name
|
||||
-- $ResourceX$. It is located in the subdirectory
|
||||
-- $lib/resource/lang$ where $lang$ is the full name of the language.
|
||||
|
||||
|
||||
abstract Categories = 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. In general, the correspondence between linguistic
|
||||
-- and semantic categories is many-to-many.
|
||||
--
|
||||
-- Categories that may look special are $A2$, $N2$, and $V2$. 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. Prepositional
|
||||
-- phrases that are not complements belong to the category
|
||||
-- $Adv$ of adverbs.
|
||||
--
|
||||
-- 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.
|
||||
|
||||
--!
|
||||
--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"
|
||||
N2 ; -- function word, e.g. "mother (of)"
|
||||
N3 ; -- two-place function, e.g. "flight (from) (to)"
|
||||
|
||||
PN ; -- proper name, e.g. "John", "New York"
|
||||
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
|
||||
--
|
||||
|
||||
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 $A$ and $ADeg$ is that the former has no
|
||||
-- comparison forms.
|
||||
|
||||
--!
|
||||
--3 Verbs and verb phrases
|
||||
--
|
||||
|
||||
V ; -- one-place verb, e.g. "walk"
|
||||
V2 ; -- 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"
|
||||
|
||||
VG ; -- verbal group, e.g. "switch the light on"
|
||||
VP ; -- verb phrase, e.g. "switch the light on", "don't run"
|
||||
|
||||
--!
|
||||
--3 Adverbs and prepositions/cases
|
||||
--
|
||||
|
||||
Adv ; -- adverbial e.g. "now", "in the house"
|
||||
AdA ; -- ad-adjective e.g. "very"
|
||||
AdS ; -- sentence adverbial e.g. "therefore", "otherwise"
|
||||
PP ; -- prepositional phrase e.g. "in London"
|
||||
Prep ; -- pre/postposition, case e.g. "after", Adessive
|
||||
|
||||
--!
|
||||
--3 Sentences and relative clauses
|
||||
--
|
||||
-- This group has no lexical categories.
|
||||
|
||||
S ; -- sentence (fixed tense) e.g. "John walks", "John walked"
|
||||
Cl ; -- clause (variable tense) e.g. "John walks"/"John walked"
|
||||
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
|
||||
--
|
||||
|
||||
Conj ; -- conjunction, e.g. "and"
|
||||
ConjD ; -- distributed conj. e.g. "both - and"
|
||||
Subj ; -- subjunction, e.g. "if", "when"
|
||||
|
||||
ListS ; -- list of sentences
|
||||
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."
|
||||
|
||||
---- next
|
||||
V3A ; -- paint the house red
|
||||
V3V ; -- ask John to come
|
||||
}
|
||||
199
lib/resource/oldabstract/Rules.gf
Normal file
199
lib/resource/oldabstract/Rules.gf
Normal file
@@ -0,0 +1,199 @@
|
||||
--!
|
||||
--2 Rules
|
||||
--
|
||||
-- This set of rules is minimal, in the sense of defining the simplest combinations
|
||||
-- of categories and not having redundant rules.
|
||||
-- When the resource grammar is used as a library, it will often be useful to
|
||||
-- access it through an intermediate library that defines more rules as
|
||||
-- 'macros' for combinations of the ones below.
|
||||
|
||||
abstract Rules = Categories ** {
|
||||
|
||||
--!
|
||||
--3 Nouns and noun phrases
|
||||
--
|
||||
|
||||
fun
|
||||
UseN : N -> CN ; -- "car"
|
||||
UsePN : PN -> NP ; -- "John"
|
||||
|
||||
SymbPN : String -> PN ; -- "x"
|
||||
SymbCN : CN -> String -> CN ; -- "number x"
|
||||
IntCN : CN -> Int -> CN ; -- "number 53"
|
||||
|
||||
IndefOneNP : CN -> NP ; -- "a car", "cars"
|
||||
IndefNumNP : Num -> CN -> NP ; -- "houses", "86 houses"
|
||||
DefOneNP : CN -> NP ; -- "the car"
|
||||
DefNumNP : Num -> CN -> NP ; -- "the cars", "the 86 cars"
|
||||
|
||||
DetNP : Det -> CN -> NP ; -- "every car"
|
||||
MassNP : CN -> NP ; -- "wine"
|
||||
|
||||
AppN2 : N2 -> NP -> CN ; -- "successor of zero"
|
||||
AppN3 : N3 -> NP -> N2 ; -- "flight from Paris"
|
||||
UseN2 : N2 -> CN ; -- "successor"
|
||||
|
||||
ModAP : AP -> CN -> CN ; -- "red car"
|
||||
CNthatS : CN -> S -> CN ; -- "idea that the Earth is flat"
|
||||
|
||||
ModGenOne : NP -> CN -> NP ; -- "John's car"
|
||||
ModGenNum : Num -> NP -> CN -> NP ; -- "John's cars", "John's 86 cars"
|
||||
|
||||
UseInt : Int -> Num ; -- "32" --- assumes i > 1
|
||||
NoNum : Num ; -- no numeral modifier
|
||||
|
||||
--!
|
||||
--3 Adjectives and adjectival phrases
|
||||
--
|
||||
|
||||
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 -> A ; -- "forgotten"
|
||||
|
||||
--!
|
||||
--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.
|
||||
|
||||
PredV : V -> VG ; -- "walk", "doesn't walk"
|
||||
PredPassV : V -> VG ; -- "is seen", "is not seen"
|
||||
PredV2 : V2 -> NP -> VG ; -- "sees John", "doesn't see John"
|
||||
PredV3 : V3 -> NP -> NP -> VG ; -- "prefers wine to beer"
|
||||
PredVS : VS -> S -> VG ; -- "says that I run", "doesn't say..."
|
||||
PredVV : VV -> VG -> VG ; -- "can run", "can't run", "tries to run"
|
||||
|
||||
PredNP : NP -> VG ; -- "is John", "is not John"
|
||||
PredPP : PP -> VG ; -- "is in France", "is not in France"
|
||||
PredAP : AP -> VG ; -- "is old", "isn't old"
|
||||
PredSuperl : ADeg -> VG ; -- "is the oldest"
|
||||
PredCN : CN -> VG ; -- "is a man", "isn't a man"
|
||||
VTrans : V2 -> V ; -- "loves"
|
||||
|
||||
PosVG,NegVG : VG -> VP ; --
|
||||
|
||||
PredVG : NP -> VG -> Cl ; -- preserves all pol/tense variation
|
||||
|
||||
--!
|
||||
--3 Adverbs
|
||||
--
|
||||
-- Here is how complex adverbs can be formed and used.
|
||||
|
||||
AdjAdv : AP -> Adv ; -- "freely", "more consciously than you"
|
||||
AdvPP : PP -> Adv ; -- "in London", "after the war"
|
||||
PrepNP : Prep -> NP -> PP ; -- "in London", "after the war"
|
||||
|
||||
AdvVP : VP -> Adv -> VP ; -- "always walks", "walks in the park"
|
||||
AdvCN : CN -> PP -> CN ; -- "house in London"
|
||||
AdvAP : AdA -> AP -> AP ; -- "very good"
|
||||
|
||||
--!
|
||||
--3 Sentences and relative clauses
|
||||
--
|
||||
|
||||
PredVP : NP -> VP -> S ; -- "John walks"
|
||||
PosSlashV2,NegSlashV2 : NP -> V2 -> Slash ; -- "John sees", "John doesn't see"
|
||||
OneVP : VP -> S ; -- "one walks"
|
||||
ThereNP : NP -> S ; -- "there is a bar","there are 86 bars"
|
||||
|
||||
IdRP : RP ; -- "which"
|
||||
FunRP : N2 -> RP -> RP ; -- "the successor of which"
|
||||
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
|
||||
--
|
||||
|
||||
WhoOne, WhoMany : IP ; -- "who (is)", "who (are)"
|
||||
WhatOne, WhatMany : IP ; -- "what (is)", "what (are)"
|
||||
FunIP : N2 -> IP -> IP ; -- "the mother of whom"
|
||||
NounIPOne, NounIPMany : CN -> IP ; -- "which car", "which cars"
|
||||
---- NounIPHowMany : CN -> IP ; -- "how many cars"
|
||||
|
||||
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"
|
||||
IsThereNP : NP -> Qu ; -- "is there a bar", "are there (86) bars"
|
||||
|
||||
ImperVP : VP -> Imp ; -- "be a man"
|
||||
|
||||
IndicPhrase : S -> Phr ; -- "I walk."
|
||||
QuestPhrase : Qu -> Phr ; -- "Do I walk?"
|
||||
ImperOne, ImperMany : Imp -> Phr ; -- "Be a man!", "Be men!"
|
||||
|
||||
PrepS : PP -> AdS ; -- "in Sweden, (there are bears)"
|
||||
AdvS : AdS -> S -> Phr ; -- "Therefore, 2 is prime."
|
||||
|
||||
--!
|
||||
--3 Coordination
|
||||
--
|
||||
-- We consider "n"-ary coordination, with "n" > 1. To this end, we have introduced
|
||||
-- a *list category* $ListX$ for each category $X$ whose expressions we want to
|
||||
-- conjoin. Each list category has two constructors, the base case being $TwoX$.
|
||||
|
||||
-- We have not defined coordination of all possible categories here,
|
||||
-- since it can be tricky in many languages. For instance, $VP$ coordination
|
||||
-- is linguistically problematic in German because $VP$ is a discontinuous
|
||||
-- category.
|
||||
|
||||
ConjS : Conj -> ListS -> S ; -- "John walks and Mary runs"
|
||||
ConjAP : Conj -> ListAP -> AP ; -- "even and prime"
|
||||
ConjNP : Conj -> ListNP -> NP ; -- "John or Mary"
|
||||
|
||||
ConjDS : ConjD -> ListS -> S ; -- "either John walks or Mary runs"
|
||||
ConjDAP : ConjD -> ListAP -> AP ; -- "both even and prime"
|
||||
ConjDNP : ConjD -> ListNP -> NP ; -- "either John or Mary"
|
||||
|
||||
TwoS : S -> S -> ListS ;
|
||||
ConsS : ListS -> S -> ListS ;
|
||||
|
||||
TwoAP : AP -> AP -> ListAP ;
|
||||
ConsAP : ListAP -> AP -> ListAP ;
|
||||
|
||||
TwoNP : NP -> NP -> ListNP ;
|
||||
ConsNP : ListNP -> NP -> ListNP ;
|
||||
|
||||
--!
|
||||
--3 Subordination
|
||||
--
|
||||
-- Subjunctions are different from conjunctions, but form
|
||||
-- a uniform category among themselves.
|
||||
|
||||
SubjS : Subj -> S -> S -> S ; -- "if 2 is odd, 3 is even"
|
||||
SubjImper : Subj -> S -> Imp -> Imp ; -- "if it is hot, use a glove!"
|
||||
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
|
||||
-- is very incomplete.
|
||||
|
||||
PhrNP : NP -> Phr ; -- "Some man.", "John."
|
||||
PhrOneCN, PhrManyCN : CN -> Phr ; -- "A car.", "Cars."
|
||||
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.
|
||||
|
||||
OnePhr : Phr -> Text ;
|
||||
ConsPhr : Phr -> Text -> Text ;
|
||||
|
||||
} ;
|
||||
|
||||
18
lib/resource/oldabstract/TestResource.gf
Normal file
18
lib/resource/oldabstract/TestResource.gf
Normal file
@@ -0,0 +1,18 @@
|
||||
abstract TestResource = Rules, Structural ** {
|
||||
|
||||
-- a random sample of lexicon to test resource grammar with
|
||||
|
||||
fun
|
||||
Big, Happy, Small, Old, Young : ADeg ;
|
||||
American, Finnish : A ;
|
||||
Married : A2 ;
|
||||
Man, Woman, Car, House, Light, Bar, Bottle, Wine, Level : N ;
|
||||
Walk, Run : V ;
|
||||
Send, Wait, Love, Drink, SwitchOn, SwitchOff : V2 ;
|
||||
Give, Prefer : V3 ;
|
||||
Say, Prove : VS ;
|
||||
Mother, Uncle : N2 ;
|
||||
Connection : N3 ;
|
||||
Well, Always : Adv ;
|
||||
John, Mary : PN ;
|
||||
} ;
|
||||
@@ -12,7 +12,7 @@ lincat
|
||||
N = CommNoun ;
|
||||
-- = {s : Number => Species => Case => Str ; g : NounGender} ;
|
||||
NP = NounPhrase ;
|
||||
-- = {s : NPForm => Str ; g : Gender ; n : Number} ;
|
||||
-- = {s : NPForm => Str ; g : Gender ; n : Number ; p : Person} ;
|
||||
PN = {s : Case => Str ; g : NounGender} ;
|
||||
Det = {s : NounGender => Str ; n : Number ; b : SpeciesP} ;
|
||||
N2 = Function ;
|
||||
@@ -29,30 +29,44 @@ lincat
|
||||
|
||||
V = Verb ;
|
||||
-- = {s : VerbForm => Str ; s1 : Str} ;
|
||||
VG = {s : SForm => Str ; s2 : Bool => Str ; s3 : SForm => Gender => Number => Str} ;
|
||||
VP = {s : SForm => Str ; s2 : Str ; s3 : SForm => Gender => Number => Str} ;
|
||||
VG = {s : SForm => Str ; s2 : Bool => Str ;
|
||||
s3 : SForm => Gender => Number => Person => Str} ;
|
||||
VP = {s : Str ; s2 : Str ; s3 : Gender => Number => Person => Str} ;
|
||||
V2 = TransVerb ;
|
||||
-- = Verb ** {s2 : Preposition} ;
|
||||
V3 = TransVerb ** {s3 : Preposition} ;
|
||||
VS = Verb ;
|
||||
VV = Verb ** {isAux : Bool} ;
|
||||
V3A = DitransAdjVerb ;
|
||||
V3V = DitransVerbVerb ;
|
||||
|
||||
VS = Verb ;
|
||||
VQ = Verb ;
|
||||
VV = Verb ** {isAux : Bool} ;
|
||||
VA = Verb ;
|
||||
|
||||
V3S = TransVerb ;
|
||||
V3Q = TransVerb ;
|
||||
V3VObj = DitransVerbVerb ;
|
||||
V3VSubj = DitransVerbVerb ;
|
||||
V3A = DitransAdjVerb ;
|
||||
|
||||
TP = {s : Str ; b : Bool ; t : Tense ; a : Anteriority} ; --- the Str field is dummy
|
||||
Tense = {s : Str ; t : Tense} ;
|
||||
Ant = {s : Str ; a : Anteriority} ;
|
||||
|
||||
|
||||
Adv = Adverb ;
|
||||
-- = {s : Str ; isPost : Bool} ;
|
||||
PP = Adverb ;
|
||||
|
||||
S = Sentence ;
|
||||
-- = {s : Order => Str} ;
|
||||
-- = {s : Order => Str} ;
|
||||
Cl = Clause ;
|
||||
-- = {s : Bool => SForm => Order => Str} ;
|
||||
Slash = Sentence ** {s2 : Preposition} ;
|
||||
Slash = Clause ** {s2 : Preposition} ;
|
||||
RP = {s : RelCase => GenNum => Str ; g : RelGender} ;
|
||||
RC = {s : GenNum => Str} ;
|
||||
RS = {s : GenNum => Person => Str} ;
|
||||
RCl = {s : Bool => SForm => GenNum => Person => Str} ;
|
||||
IP = NounPhrase ;
|
||||
Qu = {s : QuestForm => Str} ;
|
||||
QS = {s : QuestForm => Str} ;
|
||||
QCl = {s : Bool => SForm => QuestForm => Str} ;
|
||||
Imp = {s : Number => Str} ;
|
||||
|
||||
Phr = {s : Str} ;
|
||||
@@ -62,5 +76,5 @@ lincat
|
||||
|
||||
ListS = {s1,s2 : Order => Str} ;
|
||||
ListAP = {s1,s2 : AdjFormPos => Case => Str ; p : Bool} ;
|
||||
ListNP = {s1,s2 : NPForm => Str ; g : Gender ; n : Number} ;
|
||||
ListNP = {s1,s2 : NPForm => Str ; g : Gender ; n : Number ; p : Person} ;
|
||||
}
|
||||
|
||||
@@ -41,10 +41,27 @@ lin
|
||||
|
||||
CNthatS = nounThatSentence ;
|
||||
|
||||
PredVP = predVerbPhrase ;
|
||||
PredVV2 = transVerbVerb ;
|
||||
AdjPart = adjPastPart ;
|
||||
|
||||
PosVG = predVerbGroup True ;
|
||||
NegVG = predVerbGroup False ;
|
||||
PredV3A = complDitransAdjVerb ;
|
||||
PredV3VSubj = complDitransVerbVerb False ;
|
||||
PredV3VObj = complDitransVerbVerb True ;
|
||||
PredV3S = complDitransSentVerb ;
|
||||
PredV3Q = complDitransQuestVerb ;
|
||||
PredVA = complAdjVerb ;
|
||||
|
||||
UseCl tp cl = {s = \\o => tp.s ++ cl.s ! tp.b ! ClFinite tp.t tp.a o} ;
|
||||
UseVG tp = predVerbGroup tp.b tp.t tp.a ;
|
||||
|
||||
PosTP t a = {s = t.s ++ a.s ; b = True ; t = t.t ; a = a.a} ;
|
||||
NegTP t a = {s = t.s ++ a.s ; b = False ; t = t.t ; a = a.a} ;
|
||||
TPresent = {s = [] ; t = Present} ;
|
||||
TPast = {s = [] ; t = Past} ;
|
||||
TFuture = {s = [] ; t = Future} ;
|
||||
TConditional = {s = [] ; t = Condit} ;
|
||||
ASimul = {s = [] ; a = Simul} ;
|
||||
AAnter = {s = [] ; a = Anter} ;
|
||||
|
||||
PredVG = predVerbGroupClause ;
|
||||
|
||||
@@ -55,9 +72,12 @@ lin
|
||||
PredV2 = complTransVerb ;
|
||||
PredV3 = complDitransVerb ;
|
||||
PredPassV = passVerb ;
|
||||
ReflV2 = reflTransVerb ;
|
||||
|
||||
PredNP = predNounPhrase ;
|
||||
PredPP = predAdverb ;
|
||||
PredVS = complSentVerb ;
|
||||
PredVQ = complQuestVerb ;
|
||||
PredVV = complVerbVerb ;
|
||||
VTrans = transAsVerb ;
|
||||
|
||||
@@ -68,20 +88,25 @@ lin
|
||||
AdvCN = advCommNounPhrase ;
|
||||
AdvAP = advAdjPhrase ;
|
||||
|
||||
ThereNP A = predVerbPhrase npDet
|
||||
(predVerbGroup True
|
||||
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas)) A)) ;
|
||||
ExistCN A = predVerbGroupClause npDet
|
||||
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas))
|
||||
(indefNounPhrase singular A)) ;
|
||||
ExistNumCN nu A = predVerbGroupClause npDet
|
||||
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas))
|
||||
(indefNounPhraseNum plural nu A)) ;
|
||||
|
||||
PosSlashV2 = slashTransVerb True ;
|
||||
NegSlashV2 = slashTransVerb False ;
|
||||
OneVP = predVerbPhrase npMan ;
|
||||
SlashV2 = slashTransVerb ;
|
||||
OneVG = predVerbGroupClause npMan ;
|
||||
|
||||
IdRP = identRelPron ;
|
||||
FunRP = funRelPron ;
|
||||
RelVP = relVerbPhrase ;
|
||||
RelVG = relVerbGroup ;
|
||||
RelSlash = relSlash ;
|
||||
ModRC = modRelClause ;
|
||||
RelSuch = relSuch ;
|
||||
ModRS = modRelClause ;
|
||||
RelCl = relSuch ;
|
||||
|
||||
UseRCl tp cl =
|
||||
{s = \\gn,p => tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a ! gn ! p} ;
|
||||
|
||||
WhoOne = intPronWho singular ;
|
||||
WhoMany = intPronWho plural ;
|
||||
@@ -91,13 +116,21 @@ lin
|
||||
NounIPOne = nounIntPron singular ;
|
||||
NounIPMany = nounIntPron plural ;
|
||||
|
||||
QuestVP = questVerbPhrase ;
|
||||
IntVP = intVerbPhrase ;
|
||||
QuestVG = questVerbPhrase ;
|
||||
IntVG = intVerbPhrase ;
|
||||
IntSlash = intSlash ;
|
||||
QuestAdv = questAdverbial ;
|
||||
IsThereNP A = questVerbPhrase npDet
|
||||
(predVerbGroup True
|
||||
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas)) A)) ;
|
||||
|
||||
ExistQCl A = questVerbPhrase npDet
|
||||
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas))
|
||||
(indefNounPhrase singular A)) ;
|
||||
ExistNumQCl nu A = questVerbPhrase npDet
|
||||
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas))
|
||||
(indefNounPhraseNum plural nu A)) ;
|
||||
|
||||
|
||||
UseQCl tp cl = {s = \\q => tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a ! q} ;
|
||||
|
||||
|
||||
ImperVP = imperVerbPhrase ;
|
||||
|
||||
@@ -126,7 +159,7 @@ lin
|
||||
|
||||
SubjS = subjunctSentence ;
|
||||
SubjImper = subjunctImperative ;
|
||||
SubjQu = subjunctQuestion ;
|
||||
SubjQS = subjunctQuestion ;
|
||||
SubjVP = subjunctVerbPhrase ;
|
||||
|
||||
PhrNP = useNounPhrase ;
|
||||
|
||||
@@ -73,7 +73,9 @@ oper
|
||||
npCase : NPForm -> Case = \c -> case c of {PGen _ => Gen ; _ => Nom} ;
|
||||
mkNPForm : Case -> NPForm = \c -> case c of {Gen => PGen APl ; _ => PNom} ;
|
||||
|
||||
NounPhrase : Type = {s : NPForm => Str ; g : Gender ; n : Number} ;
|
||||
NounPhrase : Type = {
|
||||
s : NPForm => Str ; g : Gender ; n : Number ; p : Person
|
||||
} ;
|
||||
|
||||
-- Proper names are a simple kind of noun phrases. However, we want to
|
||||
-- anticipate the rule that proper names can be modified by
|
||||
@@ -84,14 +86,14 @@ oper
|
||||
mkProperName : Str -> NounGender -> ProperName = \john,g ->
|
||||
{s = table {Nom => john ; Gen => john + "s"} ; g = g} ;
|
||||
|
||||
nameNounPhrase : ProperName -> NounPhrase =
|
||||
\john -> {s = table {c => john.s ! npCase c} ; g = genNoun john.g ; n = Sg} ;
|
||||
nameNounPhrase : ProperName -> NounPhrase = \john ->
|
||||
{s = table {c => john.s ! npCase c} ; g = genNoun john.g ; n = Sg ; p = P3} ;
|
||||
|
||||
regNameNounPhrase : Str -> NounGender -> NounPhrase = \john,g ->
|
||||
nameNounPhrase (mkProperName john g) ;
|
||||
|
||||
pronNounPhrase : ProPN -> NounPhrase = \jag ->
|
||||
{s = jag.s ; g = jag.h1 ; n = jag.h2} ;
|
||||
{s = jag.s ; g = jag.h1 ; n = jag.h2 ; p = jag.h3} ;
|
||||
|
||||
-- The following construction has to be refined for genitive forms:
|
||||
-- "vi tre", "oss tre" are OK, but "vår tres" is not.
|
||||
@@ -127,7 +129,7 @@ oper
|
||||
|
||||
detNounPhrase : Determiner -> CommNounPhrase -> NounPhrase = \en, man ->
|
||||
{s = table {c => en.s ! man.g ++ man.s ! en.n ! en.b ! npCase c} ;
|
||||
g = genNoun man.g ; n = en.n} ;
|
||||
g = genNoun man.g ; n = en.n ; p = P3} ;
|
||||
|
||||
-- The following macros are sufficient to define most determiners.
|
||||
-- All $SpeciesP$ values come into question:
|
||||
@@ -199,7 +201,8 @@ oper
|
||||
vin.s ! Pl ! DefP Indef ! npCase c
|
||||
} ;
|
||||
g = genNoun vin.g ;
|
||||
n = n
|
||||
n = n ;
|
||||
p = P3
|
||||
} ;
|
||||
|
||||
-- *Bare plural noun phrases* like "män", "goda vänner", are built without a
|
||||
@@ -210,7 +213,8 @@ oper
|
||||
plurDetNum : Numeral -> CommNounPhrase -> NounPhrase = \num,cn ->
|
||||
{s = \\c => num.s ! Nom ++ cn.s ! Pl ! IndefP ! npCase c ;
|
||||
g = genNoun cn.g ;
|
||||
n = Pl
|
||||
n = Pl ;
|
||||
p = P3
|
||||
} ;
|
||||
|
||||
-- Definite phrases in Swedish are special, since determiner may be absent
|
||||
@@ -338,7 +342,8 @@ oper
|
||||
yngst.s ! AF (Super SupWeak) Nom ++
|
||||
man.s ! Sg ! DefP superlSpecies ! npCase c ;
|
||||
g = genNoun man.g ;
|
||||
n = Sg
|
||||
n = Sg ;
|
||||
p = P3
|
||||
} ;
|
||||
|
||||
-- In Danish, however, "den yngste mand" - therefore a parametric species.
|
||||
@@ -468,22 +473,16 @@ oper
|
||||
-- verb phrases.
|
||||
|
||||
param
|
||||
Tense = Present | Past ;
|
||||
Tense = Present | Past | Future | Condit ;
|
||||
Anteriority = Simul | Anter ;
|
||||
SForm =
|
||||
VIndic Tense Anteriority
|
||||
| VFut Anteriority
|
||||
| VCondit Anteriority
|
||||
VFinite Tense Anteriority
|
||||
| VImperat
|
||||
| VInfinit Anteriority ;
|
||||
|
||||
oper
|
||||
verbSForm : Verbum -> Voice -> SForm -> {fin,inf : Str} = \se,vo,sf ->
|
||||
let
|
||||
tense : Tense -> Voice -> VFin = \t,v -> case t of {
|
||||
Present => Pres Ind v ;
|
||||
Past => Pret Ind v
|
||||
} ;
|
||||
simple : VerbForm -> {fin,inf : Str} = \v -> {
|
||||
fin = se.s ! v ;
|
||||
inf = []
|
||||
@@ -497,23 +496,24 @@ oper
|
||||
hasett : Voice -> Str = \v -> auxHa ++ sett v
|
||||
|
||||
in case sf of {
|
||||
VIndic t Simul => simple (VF (tense t vo)) ;
|
||||
VIndic Present Anter => compound auxHar (sett vo) ;
|
||||
VIndic Past Anter => compound auxHade (sett vo) ;
|
||||
VFut Simul => compound auxSka (see vo) ;
|
||||
VFut Anter => compound auxSka (hasett vo) ;
|
||||
VCondit Simul => compound auxSkulle (see vo) ;
|
||||
VCondit Anter => compound auxSkulle (hasett vo) ;
|
||||
VFinite Present Simul => simple (VF (Pres Ind vo)) ;
|
||||
VFinite Present Anter => compound auxHar (sett vo) ;
|
||||
VFinite Past Simul => simple (VF (Pret Ind vo)) ;
|
||||
VFinite Past Anter => compound auxHade (sett vo) ;
|
||||
VFinite Future Simul => compound auxSka (see vo) ;
|
||||
VFinite Future Anter => compound auxSka (hasett vo) ;
|
||||
VFinite Condit Simul => compound auxSkulle (see vo) ;
|
||||
VFinite Condit Anter => compound auxSkulle (hasett vo) ;
|
||||
VImperat => simple (VF Imper) ; --- no passive
|
||||
VInfinit Simul => simple (VI (Inf vo)) ;
|
||||
VInfinit Anter => compound auxHa (sett vo)
|
||||
} ;
|
||||
|
||||
useVerb : Verb -> (Gender => Number => Str) -> VerbGroup = \verb,arg ->
|
||||
useVerb : Verb -> (Gender => Number => Person => Str) -> VerbGroup = \verb,arg ->
|
||||
let aer = verbSForm verb Act in {
|
||||
s = \\sf => (aer sf).fin ;
|
||||
s2 = negation ;
|
||||
s3 = \\sf,g,n => (aer sf).inf ++ arg ! g ! n
|
||||
s3 = \\sf,g,n,p => (aer sf).inf ++ arg ! g ! n ! p
|
||||
} ;
|
||||
|
||||
-- Verb phrases are discontinuous: the parts of a verb phrase are
|
||||
@@ -522,28 +522,30 @@ oper
|
||||
-- to account for word order variations. No particle needs to be retained.
|
||||
|
||||
VerbPhrase : Type = {
|
||||
s : SForm => Str ;
|
||||
s : Str ;
|
||||
s2 : Str ;
|
||||
s3 : SForm => Gender => Number => Str
|
||||
s3 : Gender => Number => Person => Str
|
||||
} ;
|
||||
VerbGroup : Type = {
|
||||
s : SForm => Str ;
|
||||
s2 : Bool => Str ;
|
||||
s3 : SForm => Gender => Number => Str
|
||||
s3 : SForm => Gender => Number => Person => Str
|
||||
} ;
|
||||
|
||||
predVerbGroup : Bool -> VerbGroup -> VerbPhrase = \b,vg -> {
|
||||
s = vg.s ;
|
||||
predVerbGroup : Bool -> Tense -> Anteriority -> VerbGroup -> VerbPhrase = \b,t,a,vg -> {
|
||||
s = vg.s ! VFinite t a ;
|
||||
s2 = vg.s2 ! b ;
|
||||
s3 = vg.s3
|
||||
s3 = vg.s3 ! VFinite t a
|
||||
} ;
|
||||
|
||||
predVerbGroupTrue = predVerbGroup True Present Simul ; ---- temporary
|
||||
|
||||
-- A simple verb can be made into a verb phrase with an empty complement.
|
||||
-- There are two versions, depending on if we want to negate the verb.
|
||||
-- N.B. negation is *not* a function applicable to a verb phrase, since
|
||||
-- double negations with "inte" are not grammatical.
|
||||
|
||||
predVerb : Verb -> VerbGroup = \se -> useVerb se (\\_,_ => se.s1) ;
|
||||
predVerb : Verb -> VerbGroup = \se -> useVerb se (\\_,_,_ => se.s1) ;
|
||||
|
||||
negation : Bool => Str = \\b => if_then_Str b [] negInte ;
|
||||
|
||||
@@ -552,23 +554,23 @@ oper
|
||||
-- The third rule is overgenerating: "är varje man" has to be ruled out
|
||||
-- on semantic grounds.
|
||||
|
||||
vara : (Gender => Number => Str) -> VerbGroup =
|
||||
vara : (Gender => Number => Person => Str) -> VerbGroup =
|
||||
useVerb (verbVara ** {s1 = []}) ;
|
||||
|
||||
predAdjective : Adjective -> VerbGroup = \arg ->
|
||||
vara (\\g,n => arg.s ! predFormAdj g n ! Nom) ;
|
||||
vara (\\g,n,_ => arg.s ! predFormAdj g n ! Nom) ;
|
||||
|
||||
predFormAdj : Gender -> Number -> AdjFormPos = \g,n ->
|
||||
mkAdjForm Indef n (gen2nounGen g) ;
|
||||
|
||||
predCommNoun : CommNounPhrase -> VerbGroup = \man ->
|
||||
vara (\\_,n => indefNoun n man) ;
|
||||
vara (\\_,n,_ => indefNoun n man) ;
|
||||
|
||||
predNounPhrase : NounPhrase -> VerbGroup = \john ->
|
||||
vara (\\_,_ => john.s ! PNom) ;
|
||||
vara (\\_,_,_ => john.s ! PNom) ;
|
||||
|
||||
predAdverb : Adverb -> VerbGroup = \ute ->
|
||||
vara (\\_,_ => ute.s) ;
|
||||
vara (\\_,_,_ => ute.s) ;
|
||||
|
||||
--3 Transitive verbs
|
||||
--
|
||||
@@ -596,7 +598,7 @@ oper
|
||||
-- The rule for using transitive verbs is the complementization rule:
|
||||
|
||||
complTransVerb : TransVerb -> NounPhrase -> VerbGroup = \se,dig ->
|
||||
useVerb se (\\_,_ => se.s1 ++ se.s2 ++ dig.s ! PAcc) ;
|
||||
useVerb se (\\_,_,_ => se.s1 ++ se.s2 ++ dig.s ! PAcc) ;
|
||||
|
||||
-- Transitive verbs with accusative objects can be used passively.
|
||||
-- The function does not check that the verb is transitive.
|
||||
@@ -608,7 +610,7 @@ oper
|
||||
let ses = verbSForm se Pass in {
|
||||
s = \\sf => (ses sf).fin ;
|
||||
s2 = negation ;
|
||||
s3 = \\sf,g,n => (ses sf).inf ++ se.s1
|
||||
s3 = \\sf,g,n,_ => (ses sf).inf ++ se.s1
|
||||
} ;
|
||||
|
||||
-- Transitive verbs can be used elliptically as verbs. The semantics
|
||||
@@ -618,6 +620,11 @@ oper
|
||||
transAsVerb : TransVerb -> Verb = \love ->
|
||||
love ;
|
||||
|
||||
reflTransVerb : TransVerb -> VerbGroup = \se ->
|
||||
useVerb se (\\_,n,p => se.s1 ++ se.s2 ++ reflPron n p) ;
|
||||
|
||||
reflPron : Number -> Person -> Str ;
|
||||
|
||||
-- *Ditransitive verbs* are verbs with three argument places.
|
||||
-- We treat so far only the rule in which the ditransitive
|
||||
-- verb takes both complements to form a verb phrase.
|
||||
@@ -628,10 +635,15 @@ oper
|
||||
v ** {s2 = p1 ; s3 = p2} ;
|
||||
|
||||
complDitransVerb :
|
||||
DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup = \ge,dig,vin ->
|
||||
useVerb
|
||||
ge
|
||||
(\\_,_ => ge.s1 ++ ge.s2 ++ dig.s ! PAcc ++ ge.s3 ++ vin.s ! PAcc) ;
|
||||
DitransVerb -> NounPhrase -> TransVerb = \ge,dig ->
|
||||
{s = ge.s ;
|
||||
s1 = ge.s1 ++ ge.s2 ++ dig.s ! PAcc ;
|
||||
s2 = ge.s3
|
||||
} ;
|
||||
|
||||
--- useVerb
|
||||
--- ge
|
||||
--- (\\_,_ => ge.s1 ++ ge.s2 ++ dig.s ! PAcc ++ ge.s3 ++ vin.s ! PAcc) ;
|
||||
|
||||
-- Adjective-complement ditransitive verbs.
|
||||
|
||||
@@ -641,11 +653,17 @@ oper
|
||||
v ** {s2 = p1} ;
|
||||
|
||||
complDitransAdjVerb :
|
||||
DitransVerb -> NounPhrase -> AdjPhrase -> VerbGroup = \gor,dig,sur ->
|
||||
DitransAdjVerb -> NounPhrase -> AdjPhrase -> VerbGroup = \gor,dig,sur ->
|
||||
useVerb
|
||||
gor
|
||||
(\\_,_ => gor.s1 ++ gor.s2 ++ dig.s ! PAcc ++
|
||||
sur.s ! predFormAdj dig.g dig.n ! Nom) ;
|
||||
(\\_,_,_ => gor.s1 ++ gor.s2 ++ dig.s ! PAcc ++
|
||||
sur.s ! predFormAdj dig.g dig.n ! Nom) ;
|
||||
|
||||
complAdjVerb :
|
||||
Verb -> AdjPhrase -> VerbGroup = \seut,sur ->
|
||||
useVerb
|
||||
seut
|
||||
(\\g,n,_ => sur.s ! predFormAdj g n ! Nom ++ seut.s1) ;
|
||||
|
||||
--2 Adverbs
|
||||
--
|
||||
@@ -667,7 +685,7 @@ oper
|
||||
--- this unfortunately generates VP#2 ::= VP#2
|
||||
s = spelar.s ;
|
||||
s2 = (if_then_else Str postp [] bra.s) ++ spelar.s2 ;
|
||||
s3 = \\sf,g,n => spelar.s3 ! sf ! g ! n ++ (if_then_else Str postp bra.s [])
|
||||
s3 = \\g,n,p => spelar.s3 ! g ! n ! p ++ (if_then_else Str postp bra.s [])
|
||||
} ;
|
||||
|
||||
advAdjPhrase : SS -> AdjPhrase -> AdjPhrase = \mycket, dyr ->
|
||||
@@ -709,13 +727,13 @@ oper
|
||||
-- This is the traditional $S -> NP VP$ rule. It takes care of both
|
||||
-- word order and agreement.
|
||||
|
||||
----- obsolete
|
||||
predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence =
|
||||
\Jag, serdiginte ->
|
||||
let {
|
||||
jag = Jag.s ! PNom ;
|
||||
t = VIndic Present Simul ; ---- to be made parameter of S
|
||||
ser = serdiginte.s ! t ;
|
||||
dig = serdiginte.s3 ! t ! Jag.g ! Jag.n ;
|
||||
ser = serdiginte.s ;
|
||||
dig = serdiginte.s3 ! Jag.g ! Jag.n ! Jag.p ;
|
||||
inte = serdiginte.s2
|
||||
} in
|
||||
{s = table {
|
||||
@@ -727,32 +745,32 @@ oper
|
||||
|
||||
param
|
||||
ClForm =
|
||||
ClIndic Tense Anteriority Order
|
||||
| ClFut Anteriority Order
|
||||
| ClCondit Anteriority Order
|
||||
| ClInfinit Anteriority -- "naked infinitive" clauses
|
||||
ClFinite Tense Anteriority Order
|
||||
| ClInfinite Anteriority -- "naked infinitive" clauses
|
||||
;
|
||||
|
||||
ClTense = ClPresent | ClPast | ClFuture | ClPerfect ;
|
||||
|
||||
oper cl2s : ClForm -> {o : Order ; sf : SForm} = \c -> case c of {
|
||||
ClIndic t a o => {o = o ; sf = VIndic t a} ;
|
||||
ClFut a o => {o = o ; sf = VFut a} ;
|
||||
ClCondit a o => {o = o ; sf = VCondit a} ;
|
||||
ClInfinit a => {o = Sub ; sf = VInfinit a} -- "jag såg John inte hälsa"
|
||||
} ;
|
||||
oper
|
||||
cl2s : ClForm -> {o : Order ; sf : SForm} = \c -> case c of {
|
||||
ClFinite t a o => {o = o ; sf = VFinite t a} ;
|
||||
ClInfinite a => {o = Sub ; sf = VInfinit a} -- "jag såg John inte hälsa"
|
||||
} ;
|
||||
s2cl : SForm -> Order -> ClForm = \s,o -> case s of {
|
||||
VFinite t a => ClFinite t a o ;
|
||||
VInfinit a => ClInfinite a ;
|
||||
_ => ClInfinite Simul ---- ??
|
||||
} ;
|
||||
|
||||
Clause = {s : Bool => ClForm => Str} ;
|
||||
|
||||
predVerbGroupClause : NounPhrase -> VerbGroup -> Clause =
|
||||
\Jag, serdiginte -> {
|
||||
s = \\b,c => let {
|
||||
jag = Jag.s ! (case c of {ClInfinit _ => PAcc ; _ => PNom}) ;
|
||||
jag = Jag.s ! (case c of {ClInfinite _ => PAcc ; _ => PNom}) ;
|
||||
osf = cl2s c ;
|
||||
t = osf.sf ;
|
||||
o = osf.o ;
|
||||
ser = serdiginte.s ! t ;
|
||||
dig = serdiginte.s3 ! t ! Jag.g ! Jag.n ;
|
||||
dig = serdiginte.s3 ! t ! Jag.g ! Jag.n ! Jag.p ;
|
||||
inte = serdiginte.s2 ! b
|
||||
} in
|
||||
case o of {
|
||||
@@ -763,16 +781,6 @@ oper cl2s : ClForm -> {o : Order ; sf : SForm} = \c -> case c of {
|
||||
} ;
|
||||
|
||||
|
||||
clause2sentence : Bool -> ClTense -> Clause -> Sentence = \b,t,cl ->
|
||||
{s = \\o => cl.s ! b ! case t of {
|
||||
ClPresent => ClIndic Present Simul o ;
|
||||
ClPast => ClIndic Past Simul o ;
|
||||
ClFuture => ClFut Simul o ;
|
||||
ClPerfect => ClIndic Present Anter o
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
--3 Sentence-complement verbs
|
||||
--
|
||||
-- Sentence-complement verbs take sentences as complements.
|
||||
@@ -780,7 +788,20 @@ oper cl2s : ClForm -> {o : Order ; sf : SForm} = \c -> case c of {
|
||||
SentenceVerb : Type = Verb ;
|
||||
|
||||
complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \se,duler ->
|
||||
useVerb se (\\_,_ => se.s1 ++ optStr infinAtt ++ duler.s ! Main) ;
|
||||
useVerb se (\\_,_,_ => se.s1 ++ optStr infinAtt ++ duler.s ! Main) ;
|
||||
|
||||
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.s2 ++ honom.s ! PAcc ++ optStr infinAtt ++ duler.s ! Main) ;
|
||||
|
||||
complDitransQuestVerb : TransVerb -> NounPhrase -> QuestionSent -> VerbGroup =
|
||||
\sa,honom,omduler ->
|
||||
useVerb sa
|
||||
(\\_,_,_ => sa.s1 ++ sa.s2 ++ honom.s ! PAcc ++ omduler.s ! IndirQ) ;
|
||||
|
||||
--3 Verb-complement verbs
|
||||
--
|
||||
@@ -793,11 +814,11 @@ oper cl2s : ClForm -> {o : Order ; sf : SForm} = \c -> case c of {
|
||||
|
||||
complVerbVerb : VerbVerb -> VerbGroup -> VerbGroup = \vilja, simma ->
|
||||
useVerb vilja
|
||||
(\\g,n =>
|
||||
(\\g,n,p =>
|
||||
vilja.s1 ++
|
||||
if_then_Str vilja.isAux [] infinAtt ++
|
||||
simma.s ! VInfinit Simul ++ simma.s2 ! True ++ ---- Anter!
|
||||
simma.s3 ! VInfinit Simul ! g ! n) ;
|
||||
simma.s3 ! VInfinit Simul ! g ! n ! p) ;
|
||||
|
||||
transVerbVerb : VerbVerb -> TransVerb -> TransVerb = \vilja,hitta ->
|
||||
{s = vilja.s ;
|
||||
@@ -806,16 +827,20 @@ oper cl2s : ClForm -> {o : Order ; sf : SForm} = \c -> case c of {
|
||||
s2 = hitta.s2
|
||||
} ;
|
||||
|
||||
-- Notice agreement to object rather than subject:
|
||||
-- Notice agreement to object vs. subject:
|
||||
|
||||
DitransVerbVerb = TransVerb ** {part : Str} ;
|
||||
DitransVerbVerb = TransVerb ** {s3 : Str} ;
|
||||
|
||||
complDitransVerbVerb :
|
||||
DitransVerbVerb -> NounPhrase -> VerbGroup -> VerbGroup = \be,dig,simma ->
|
||||
Bool -> DitransVerbVerb -> NounPhrase -> VerbGroup -> VerbGroup =
|
||||
\obj,be,dig,simma ->
|
||||
useVerb be
|
||||
(\\g,n => be.s1 ++ be.s2 ++ dig.s ! PAcc ++ be.part ++
|
||||
(\\g,n,p => be.s1 ++ be.s2 ++ dig.s ! PAcc ++ be.s3 ++
|
||||
simma.s ! VInfinit Simul ++ simma.s2 ! True ++ ---- Anter!
|
||||
simma.s3 ! VInfinit Simul ! dig.g ! dig.n) ;
|
||||
if_then_Str obj
|
||||
(simma.s3 ! VInfinit Simul ! dig.g ! dig.n ! dig.p)
|
||||
(simma.s3 ! VInfinit Simul ! g ! n ! p)
|
||||
) ;
|
||||
|
||||
|
||||
--2 Sentences missing noun phrases
|
||||
@@ -828,24 +853,12 @@ oper cl2s : ClForm -> {o : Order ; sf : SForm} = \c -> case c of {
|
||||
-- Notice that the slash category has the same relation to sentences as
|
||||
-- transitive verbs have to verbs: it's like a *sentence taking a complement*.
|
||||
|
||||
SentenceSlashNounPhrase : Type = Sentence ** {s2 : Preposition} ;
|
||||
|
||||
slashTransVerb : Bool -> NounPhrase -> TransVerb -> SentenceSlashNounPhrase =
|
||||
\b, Jag, se ->
|
||||
let {
|
||||
jag = Jag.s ! PNom ;
|
||||
ser = se.s ! VF (Pres Ind Act) ; ---- other tenses
|
||||
inte = negation ! b ++ se.s1
|
||||
} in
|
||||
{s = table {
|
||||
Main => jag ++ ser ++ inte ;
|
||||
Inv => ser ++ jag ++ inte ;
|
||||
Sub => jag ++ inte ++ ser
|
||||
} ;
|
||||
s2 = se.s2
|
||||
} ;
|
||||
|
||||
ClauseSlashNounPhrase : Type = Clause ** {s2 : Preposition} ;
|
||||
|
||||
slashTransVerb : NounPhrase -> TransVerb -> ClauseSlashNounPhrase =
|
||||
\jag, se ->
|
||||
predVerbGroupClause jag (useVerb se (\\_,_,_ => se.s1)) ** {s2 = se.s2} ;
|
||||
|
||||
--2 Relative pronouns and relative clauses
|
||||
--
|
||||
-- Relative pronouns can be nominative, accusative, or genitive, and
|
||||
@@ -904,20 +917,21 @@ oper
|
||||
-- slash expressions ("som jag ser"). The latter has moreover the variation
|
||||
-- as for the place of the preposition ("som jag talar om" - "om vilken jag talar").
|
||||
|
||||
RelClause : Type = {s : GenNum => Str} ;
|
||||
RelClause : Type = {s : Bool => SForm => GenNum => Person => Str} ;
|
||||
RelSent : Type = {s : GenNum => Person => Str} ;
|
||||
|
||||
relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \som,sover ->
|
||||
{s = \\gn =>
|
||||
som.s ! RNom ! gn ++ sover.s2 ++ sover.s ! VIndic Present Simul
|
||||
---- Past and Anter !
|
||||
++
|
||||
sover.s3 ! VIndic Present Simul ! mkGenderRel som.g (genGN gn) ! numGN gn
|
||||
relVerbGroup : RelPron -> VerbGroup -> RelClause = \som,sover ->
|
||||
{s = \\b,sf,gn,p =>
|
||||
som.s ! RNom ! gn ++ sover.s2 ! b ++ sover.s ! sf ++
|
||||
sover.s3 ! sf ! mkGenderRel som.g (genGN gn) ! numGN gn ! p
|
||||
} ;
|
||||
|
||||
relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause = \som,jagTalar ->
|
||||
{s = \\gn =>
|
||||
let {jagtalar = jagTalar.s ! Sub ; om = jagTalar.s2} in
|
||||
variants {
|
||||
relSlash : RelPron -> ClauseSlashNounPhrase -> RelClause = \som,jagTalar ->
|
||||
{s = \\b,sf,gn,p =>
|
||||
let
|
||||
jagtalar = jagTalar.s ! b ! s2cl sf Sub ;
|
||||
om = jagTalar.s2
|
||||
in variants {
|
||||
som.s ! RAcc ! gn ++ jagtalar ++ om ;
|
||||
om ++ som.s ! RPrep ! gn ++ jagtalar
|
||||
}
|
||||
@@ -926,15 +940,16 @@ oper
|
||||
-- A 'degenerate' relative clause is the one often used in mathematics, e.g.
|
||||
-- "tal x sådant att x är primt".
|
||||
|
||||
relSuch : Sentence -> RelClause = \A ->
|
||||
{s = \\g => pronSådan ! g ++ infinAtt ++ A.s ! Sub} ;
|
||||
relSuch : Clause -> RelClause = \A ->
|
||||
{s = \\b,sf,g,p => pronSådan ! g ++ infinAtt ++ A.s ! b ! s2cl sf Sub} ;
|
||||
|
||||
-- The main use of relative clauses is to modify common nouns.
|
||||
-- The result is a common noun, out of which noun phrases can be formed
|
||||
-- by determiners.
|
||||
|
||||
modRelClause : CommNounPhrase -> RelClause -> CommNounPhrase = \man,somsover ->
|
||||
{s = \\n,b,c => man.s ! n ! b ! c ++ somsover.s ! gNum (genNoun man.g) n ;
|
||||
modRelClause : CommNounPhrase -> RelSent -> CommNounPhrase = \man,somsover ->
|
||||
{s = \\n,b,c =>
|
||||
man.s ! n ! b ! c ++ somsover.s ! gNum (genNoun man.g) n ! P3 ;
|
||||
g = man.g ;
|
||||
p = False
|
||||
} ;
|
||||
@@ -943,13 +958,14 @@ oper
|
||||
-- construction "den man som sover" in this way, but only "mannen som sover".
|
||||
-- Thus we need an extra rule:
|
||||
|
||||
detRelClause : Number -> CommNounPhrase -> RelClause -> NounPhrase =
|
||||
detRelClause : Number -> CommNounPhrase -> RelSent -> NounPhrase =
|
||||
\n,man,somsover ->
|
||||
{s = \\c => let {gn = gNum (genNoun man.g) n} in
|
||||
artDef ! True ! gn ++
|
||||
man.s ! n ! DefP Indef ! npCase c ++ somsover.s ! gn ;
|
||||
man.s ! n ! DefP Indef ! npCase c ++ somsover.s ! gn ! P3;
|
||||
g = genNoun man.g ;
|
||||
n = n
|
||||
n = n ;
|
||||
p = P3
|
||||
} ;
|
||||
|
||||
|
||||
@@ -979,7 +995,8 @@ oper
|
||||
_ => pronVem
|
||||
} ;
|
||||
g = utrum ;
|
||||
n = num
|
||||
n = num ;
|
||||
p = P3
|
||||
} ;
|
||||
|
||||
intPronWhat : Number -> IntPron = \num -> {
|
||||
@@ -988,7 +1005,8 @@ oper
|
||||
_ => pronVad
|
||||
} ;
|
||||
n = num ;
|
||||
g = Neutr
|
||||
g = Neutr ;
|
||||
p = P3
|
||||
} ;
|
||||
|
||||
--2 Utterances
|
||||
@@ -1006,7 +1024,7 @@ oper
|
||||
Utterance = SS ;
|
||||
|
||||
indicUtt : Sentence -> Utterance = \x -> postfixSS "." (defaultSentence x) ;
|
||||
interrogUtt : Question -> Utterance = \x -> postfixSS "?" (defaultQuestion x) ;
|
||||
interrogUtt : {s : QuestForm => Str} -> Utterance = \x -> postfixSS "?" (defaultQuestion x) ;
|
||||
|
||||
|
||||
--2 Questions
|
||||
@@ -1018,7 +1036,8 @@ param
|
||||
QuestForm = DirQ | IndirQ ;
|
||||
|
||||
oper
|
||||
Question = SS1 QuestForm ;
|
||||
Question = {s : Bool => SForm => QuestForm => Str} ;
|
||||
QuestionSent = {s : QuestForm => Str} ;
|
||||
|
||||
--3 Yes-no questions
|
||||
--
|
||||
@@ -1028,16 +1047,19 @@ oper
|
||||
-- rule, $questVerbPhrase'$. The only difference is if "om" appears
|
||||
-- in the indirect form.
|
||||
|
||||
questVerbPhrase : NounPhrase -> VerbPhrase -> Question =
|
||||
questVerbPhrase : NounPhrase -> VerbGroup -> Question =
|
||||
questVerbPhrase' False ;
|
||||
|
||||
questVerbPhrase' : Bool -> NounPhrase -> VerbPhrase -> Question =
|
||||
questVerbPhrase' : Bool -> NounPhrase -> VerbGroup -> Question =
|
||||
\adv,du,sover ->
|
||||
let {dusover = (predVerbPhrase du sover).s} in
|
||||
{s = table {
|
||||
DirQ => dusover ! Inv ;
|
||||
IndirQ => (if_then_else Str adv [] conjOm) ++ dusover ! Sub
|
||||
}
|
||||
{s = \\b,sf =>
|
||||
let
|
||||
dusover : Order => Str = \\o => (predVerbGroupClause du sover).s ! b ! s2cl sf o
|
||||
in
|
||||
table {
|
||||
DirQ => dusover ! Inv ;
|
||||
IndirQ => (if_then_else Str adv [] conjOm) ++ dusover ! Sub
|
||||
}
|
||||
} ;
|
||||
|
||||
--3 Wh-questions
|
||||
@@ -1045,29 +1067,35 @@ oper
|
||||
-- Wh-questions are of two kinds: ones that are like $NP - VP$ sentences,
|
||||
-- others that are line $S/NP - NP$ sentences.
|
||||
|
||||
intVerbPhrase : IntPron -> VerbPhrase -> Question = \vem,sover ->
|
||||
let {vemsom : NounPhrase =
|
||||
{s = \\c => vem.s ! c ++ "som" ; g = vem.g ; n = vem.n}
|
||||
} in
|
||||
{s = table {
|
||||
DirQ => (predVerbPhrase vem sover).s ! Main ;
|
||||
IndirQ => (predVerbPhrase vemsom sover).s ! Sub
|
||||
}
|
||||
intVerbPhrase : IntPron -> VerbGroup -> Question = \vem,sover ->
|
||||
let
|
||||
vemsom : NounPhrase =
|
||||
{s = \\c => vem.s ! c ++ "som" ; g = vem.g ; n = vem.n ; p = P3}
|
||||
in
|
||||
{s = \\b,sf =>
|
||||
table {
|
||||
DirQ => (predVerbGroupClause vem sover).s ! b ! s2cl sf Main ;
|
||||
IndirQ => (predVerbGroupClause vemsom sover).s ! b ! s2cl sf Sub
|
||||
}
|
||||
} ;
|
||||
|
||||
intSlash : IntPron -> SentenceSlashNounPhrase -> Question = \Vem, jagTalar ->
|
||||
let {
|
||||
intSlash : IntPron -> ClauseSlashNounPhrase -> Question = \Vem, jagTalar ->
|
||||
let
|
||||
vem = Vem.s ! PAcc ;
|
||||
jagtalar = jagTalar.s ! Sub ;
|
||||
talarjag = jagTalar.s ! Inv ;
|
||||
om = jagTalar.s2
|
||||
} in
|
||||
{s = table {
|
||||
DirQ => variants {
|
||||
in
|
||||
{s = \\b,sf =>
|
||||
let
|
||||
cf = s2cl sf ;
|
||||
talarjag = jagTalar.s ! b ! cf Inv ;
|
||||
jagtalar = jagTalar.s ! b ! cf Sub
|
||||
in
|
||||
table {
|
||||
DirQ => variants {
|
||||
vem ++ talarjag ++ om ;
|
||||
om ++ vem ++ talarjag
|
||||
} ;
|
||||
IndirQ => variants {
|
||||
IndirQ => variants {
|
||||
vem ++ jagtalar ++ om ;
|
||||
om ++ vem ++ jagtalar
|
||||
}
|
||||
@@ -1091,10 +1119,9 @@ oper
|
||||
-- A question adverbial can be applied to anything, and whether this makes
|
||||
-- sense is a semantic question.
|
||||
|
||||
questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question =
|
||||
questAdverbial : IntAdverb -> NounPhrase -> VerbGroup -> Question =
|
||||
\hur, du, mår ->
|
||||
{s = \\q => hur.s ++ (questVerbPhrase' True du mår).s ! q} ;
|
||||
|
||||
{s = \\b,sf,q => hur.s ++ (questVerbPhrase' True du mår).s ! b ! sf ! q} ;
|
||||
|
||||
--2 Imperatives
|
||||
--
|
||||
@@ -1103,7 +1130,7 @@ oper
|
||||
Imperative = SS1 Number ;
|
||||
|
||||
imperVerbPhrase : VerbPhrase -> Imperative = \titta ->
|
||||
{s = \\n => titta.s ! VImperat ++ titta.s2 ++ titta.s3 ! VImperat ! utrum ! n} ;
|
||||
{s = \\n => titta.s ++ titta.s2 ++ titta.s3 ! utrum ! n ! P2} ;
|
||||
|
||||
imperUtterance : Number -> Imperative -> Utterance = \n,I ->
|
||||
ss (I.s ! n ++ "!") ;
|
||||
@@ -1198,23 +1225,26 @@ oper
|
||||
-- or plural if any of the components is, depending on the conjunction.
|
||||
-- The gender is neuter if any of the components is.
|
||||
|
||||
ListNounPhrase : Type = {s1,s2 : NPForm => Str ; g : Gender ; n : Number} ;
|
||||
ListNounPhrase : Type = {s1,s2 : NPForm => Str ; g : Gender ; n : Number ; p : Person} ;
|
||||
|
||||
twoNounPhrase : (_,_ : NounPhrase) -> ListNounPhrase = \x,y ->
|
||||
CO.twoTable NPForm x y ** {n = conjNumber x.n y.n ; g = conjGender x.g y.g} ;
|
||||
CO.twoTable NPForm x y **
|
||||
{n = conjNumber x.n y.n ; g = conjGender x.g y.g ; p = conjPerson x.p y.p} ;
|
||||
|
||||
consNounPhrase : ListNounPhrase -> NounPhrase -> ListNounPhrase = \xs,x ->
|
||||
CO.consTable NPForm CO.comma xs x **
|
||||
{n = conjNumber xs.n x.n ; g = conjGender xs.g x.g} ;
|
||||
{n = conjNumber xs.n x.n ; g = conjGender xs.g x.g ; p = conjPerson xs.p x.p} ;
|
||||
|
||||
conjunctNounPhrase : Conjunction -> ListNounPhrase -> NounPhrase = \c,xs ->
|
||||
CO.conjunctTable NPForm c xs ** {n = conjNumber c.n xs.n ; g = xs.g} ;
|
||||
CO.conjunctTable NPForm c xs **
|
||||
{n = conjNumber c.n xs.n ; g = xs.g ; p = xs.p} ;
|
||||
|
||||
conjunctDistrNounPhrase : ConjunctionDistr -> ListNounPhrase -> NounPhrase =
|
||||
\c,xs ->
|
||||
CO.conjunctDistrTable NPForm c xs ** {n = conjNumber c.n xs.n ; g = xs.g} ;
|
||||
CO.conjunctDistrTable NPForm c xs **
|
||||
{n = conjNumber c.n xs.n ; g = xs.g ; p = xs.p} ;
|
||||
|
||||
-- We hve to define a calculus of numbers of genders. For numbers,
|
||||
-- We have to define a calculus of numbers of genders. For numbers,
|
||||
-- it is like the conjunction with $Pl$ corresponding to $False$. For genders,
|
||||
-- $Neutr$ corresponds to $False$.
|
||||
|
||||
@@ -1223,6 +1253,14 @@ oper
|
||||
_ => Pl
|
||||
} ;
|
||||
|
||||
conjPerson : Person -> Person -> Person = \m,n -> case <m,n> of {
|
||||
<P3,P3> => P3 ;
|
||||
<P3,P2> => P2 ;
|
||||
<P2,P3> => P2 ;
|
||||
<P2,P2> => P2 ;
|
||||
_ => P1
|
||||
} ;
|
||||
|
||||
conjGender : Gender -> Gender -> Gender ;
|
||||
|
||||
|
||||
@@ -1251,7 +1289,7 @@ oper
|
||||
\if, A, B ->
|
||||
{s = \\n => subjunctVariants if A (B.s ! n)} ;
|
||||
|
||||
subjunctQuestion : Subjunction -> Sentence -> Question -> Question = \if, A, B ->
|
||||
subjunctQuestion : Subjunction -> Sentence -> QuestionSent -> QuestionSent = \if, A, B ->
|
||||
{s = \\q => subjunctVariants if A (B.s ! q)} ;
|
||||
|
||||
subjunctVariants : Subjunction -> Sentence -> Str -> Str = \if,A,B ->
|
||||
@@ -1280,7 +1318,7 @@ oper
|
||||
defaultNounPhrase : NounPhrase -> SS = \john ->
|
||||
ss (john.s ! PNom) ;
|
||||
|
||||
defaultQuestion : Question -> SS = \whoareyou ->
|
||||
defaultQuestion : {s : QuestForm => Str} -> SS = \whoareyou ->
|
||||
ss (whoareyou.s ! DirQ) ;
|
||||
|
||||
defaultSentence : Sentence -> Utterance = \x -> ss (x.s ! Main) ;
|
||||
|
||||
@@ -17,15 +17,16 @@ concrete StructuralSwe of Structural =
|
||||
TheyNP = pronNounPhrase de_38 ;
|
||||
TheyFemNP = pronNounPhrase de_38 ;
|
||||
|
||||
YouNP = let {ni = pronNounPhrase ni_37 } in {s = ni.s ; g = ni.g ; n = Sg} ;
|
||||
YouNP = let {ni = pronNounPhrase ni_37 } in {
|
||||
s = ni.s ; g = ni.g ; n = Sg ; p = P2} ; ---- gives wrong refl
|
||||
|
||||
ItNP = pronNounPhrase det_40 ; ----
|
||||
ThisNP = regNameNounPhrase ["det här"] NNeutr ;
|
||||
ThatNP = regNameNounPhrase ["det där"] NNeutr ;
|
||||
TheseNumNP n =
|
||||
{s = \\c => ["de här"] ++ n.s ! npCase c ; g = Neutr ; n = Pl} ;
|
||||
{s = \\c => ["de här"] ++ n.s ! npCase c ; g = Neutr ; n = Pl ; p = P3} ;
|
||||
ThoseNumNP n =
|
||||
{s = \\c => ["de där"] ++ n.s ! npCase c ; g = Neutr ; n = Pl} ;
|
||||
{s = \\c => ["de där"] ++ n.s ! npCase c ; g = Neutr ; n = Pl ; p = P3} ;
|
||||
|
||||
EveryDet = varjeDet ;
|
||||
AllMassDet = mkDeterminerSgGender2 "all" "allt" IndefP ;
|
||||
@@ -74,7 +75,7 @@ concrete StructuralSwe of Structural =
|
||||
ThereforeAdv = ss "därför" ;
|
||||
|
||||
EverybodyNP = let alla = table {Nom => "alla" ; Gen => "allas"} in
|
||||
{s = \\c => alla ! npCase c ; g = Utr ; n = Pl} ;
|
||||
{s = \\c => alla ! npCase c ; g = Utr ; n = Pl ; p = P3} ;
|
||||
SomebodyNP = nameNounPhrase (mkProperName "någon" (NUtr Masc)) ;
|
||||
NobodyNP = nameNounPhrase (mkProperName "ingen" (NUtr Masc)) ;
|
||||
EverythingNP = nameNounPhrase (mkProperName "allting" NNeutr) ;
|
||||
|
||||
@@ -121,4 +121,12 @@ instance SyntaxSwe of SyntaxScand = TypesSwe **
|
||||
adjPastPart : Verb -> Adjective = \verb -> {
|
||||
s = \\af,c => verb.s1 ++ verb.s ! VI (PtPret af c) --- på slagen
|
||||
} ;
|
||||
|
||||
reflPron : Number -> Person -> Str = \n,p -> case <n,p> of {
|
||||
<Sg,P1> => "mig" ;
|
||||
<Sg,P2> => "mig" ;
|
||||
<Pl,P1> => "oss" ;
|
||||
<Pl,P2> => "er" ;
|
||||
_ => "sig"
|
||||
} ;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
--# -path=.:../scandinavian:../abstract:../../prelude
|
||||
|
||||
concrete TestResourceSwe of TestResource = RulesSwe, StructuralSwe ** open MorphoSwe, SyntaxSwe in {
|
||||
concrete TestResourceSwe of TestResource = RulesSwe, StructuralSwe **
|
||||
open Prelude, MorphoSwe, SyntaxSwe in {
|
||||
|
||||
flags startcat=Phr ; lexer=text ; unlexer=text ;
|
||||
|
||||
@@ -48,4 +49,18 @@ lin
|
||||
|
||||
John = mkProperName "Johan" (NUtr Masc) ;
|
||||
Mary = mkProperName "Maria" (NUtr NoMasc) ;
|
||||
|
||||
--- next
|
||||
AlreadyAdv = advPre "redan" ;
|
||||
NowAdv = advPre "now" ;
|
||||
|
||||
Paint = extTransVerb (vNopart (vTala "mål")) [] ;
|
||||
Green = aFin "grön" ;
|
||||
Beg = extTransVerb (mkVerbPart "be" "ber" "be" "bad" "bett" "bedd" []) [] ** {s3 = "att"} ;
|
||||
Promise = extTransVerb (vNopart (vTala "lov")) [] ** {isAux = False} ;
|
||||
Promise2 = extTransVerb (vNopart (vTala "lov")) [] ** {s3 = "att"} ;
|
||||
Wonder = extTransVerb (vNopart (vTala "undr")) [] ;
|
||||
Ask = extTransVerb (vNopart (vTala "fråg")) [] ;
|
||||
Tell = extTransVerb (vNopart (vTala "berätt")) [] ;
|
||||
Look = extTransVerb (mkVerbPart "se" "ser" "se" "såg" "sett" "sedd" "ut") [] ;
|
||||
} ;
|
||||
|
||||
48
lib/resource/swedish/sag-missing.txt
Normal file
48
lib/resource/swedish/sag-missing.txt
Normal file
@@ -0,0 +1,48 @@
|
||||
+ vi lovade Per att följa med
|
||||
|
||||
- att meditera ägnar han nästan allsin tid nuförtiden
|
||||
|
||||
+ hon har vunnit stora priser igen
|
||||
|
||||
? han blev anklagad för att ha förfalskat en namnteckning
|
||||
|
||||
+ de undrar om det blit något biobesök ikväll
|
||||
|
||||
+ vi kan nog gissa varifrån föroreningarna kommer
|
||||
|
||||
+ hon har inte meddelat mig hur hon tänker göra
|
||||
|
||||
- jag såg nog vad/så/vilka fina rosor du hade
|
||||
|
||||
- jag läser vilka böcker han än skriver
|
||||
|
||||
- han kan skaffa dig vad för slags bil du än vill ha
|
||||
|
||||
- de tycker om när det är mörkt
|
||||
|
||||
- jag avskyr när han röker här inne
|
||||
|
||||
- (?) vi skulle uppskatta om du kom
|
||||
|
||||
- sedan sa hon stillsamt: när kommer du tillbaka
|
||||
|
||||
+ de ansåg oss ha svikit överenskommelsen
|
||||
|
||||
+ vi såg dem försvinna
|
||||
|
||||
+ han lät oss inte dansa
|
||||
|
||||
? det gick honom väl
|
||||
|
||||
? det hände mig något hemskt
|
||||
|
||||
- han hittade en bräda och sågade itu
|
||||
|
||||
- jag köpte en pizza och åt på lunchen
|
||||
|
||||
- jag ska strax betala er (vad jag är skyldig) "bitransitiva med bara ett objekt"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user