diff options
| author | bjorn <bjorn@bringert.net> | 2008-08-14 07:58:04 +0000 |
|---|---|---|
| committer | bjorn <bjorn@bringert.net> | 2008-08-14 07:58:04 +0000 |
| commit | 77270a010a0b453e9a84c3e62db7cfd22e49d55d (patch) | |
| tree | d17682a545d6ac1e68ff49b8c20964182794baf7 /grammars/resource | |
| parent | 0bbb906141711767678f82b15a7b43e65e0b5bd6 (diff) | |
Remove the grammars directory. It was full of old grammars that don't compile these days. See the old source distributions if you want them.
Diffstat (limited to 'grammars/resource')
83 files changed, 0 insertions, 19804 deletions
diff --git a/grammars/resource/abstract/Database.gf b/grammars/resource/abstract/Database.gf deleted file mode 100644 index d261e3e11..000000000 --- a/grammars/resource/abstract/Database.gf +++ /dev/null @@ -1,36 +0,0 @@ -abstract Database = { - -flags startcat=Query ; - -cat - Query ; Phras ; Statement ; Question ; - Noun ; Subject ; Value ; Property ; Relation ; Comparison ; Name ; - Feature ; - -fun - LongForm : Phras -> Query ; - ShortForm : Phras -> Query ; - - WhichAre : Noun -> Property -> Phras ; - IsThere : Noun -> Phras ; - AreThere : Noun -> Phras ; - IsIt : Subject -> Property -> Phras ; - WhatIs : Value -> Phras ; - - MoreThan : Comparison -> Subject -> Property ; - TheMost : Comparison -> Noun -> Value ; - Relatively : Comparison -> Noun -> Property ; - - RelatedTo : Relation -> Subject -> Property ; - - Individual : Name -> Subject ; - AllN : Noun -> Subject ; - Any : Noun -> Subject ; - MostN : Noun -> Subject ; - EveryN : Noun -> Subject ; - - FeatureOf : Feature -> Subject -> Subject ; - ValueOf : Feature -> Name -> Value ; - - WithProperty : Noun -> Property -> Noun ; -} ; diff --git a/grammars/resource/abstract/PredefAbs.gf b/grammars/resource/abstract/PredefAbs.gf deleted file mode 100644 index ccd214fd4..000000000 --- a/grammars/resource/abstract/PredefAbs.gf +++ /dev/null @@ -1,4 +0,0 @@ -abstract PredefAbs = { - cat String ; Int ; -} ; - diff --git a/grammars/resource/abstract/ResAbs.gf b/grammars/resource/abstract/ResAbs.gf deleted file mode 100644 index 7828e51ac..000000000 --- a/grammars/resource/abstract/ResAbs.gf +++ /dev/null @@ -1,275 +0,0 @@ ---1 Abstract Syntax for Multilingual Resource Grammar --- --- 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 --- 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 them 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 the $reuse$ module with the desired concrete syntax of --- $ResAbs$ as argument. - - ---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. --- --- 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. --- - -abstract ResAbs = { - ---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)" - ---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" - ---3 Verbs and verb phrases --- - - V ; -- one-place verb, e.g. "walk" - 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" - VP ; -- verb phrase, e.g. "switch the light on" - ---3 Adverbials --- - - AdV ; -- adverbial e.g. "now", "in the house" - AdA ; -- ad-adjective e.g. "very" - AdS ; -- sentence adverbial e.g. "therefore", "otherwise" - ---3 Sentences and relative clauses --- - - 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 --- - - 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 --- - - 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 --- 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. - ---3 Nouns and noun phrases --- - -fun - UseN : N -> CN ; -- "car" - ModAdj : AP -> CN -> CN ; -- "red car" - DetNP : Det -> CN -> NP ; -- "every car" - IndefOneNP, IndefManyNP : CN -> NP ; -- "a car", "cars" - DefOneNP, DefManyNP : CN -> NP ; -- "the car", "the cars" - ModGenOne, ModGenMany : NP -> CN -> NP ; -- "John's car", "John's 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" - ---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" - ---3 Verbs and verb phrases --- - - 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" - PosVS, NegVS : VS -> S -> VP ; -- "says that I run", "doesn't say..." - PosV3, NegV3 : V3 -> NP -> NP -> VP ; -- "prefers wine to beer" - VTrans : TV -> V ; -- "loves" - ---3 Adverbials --- - - AdvVP : VP -> AdV -> VP ; -- "always walks", "walks in the park" - LocNP : NP -> AdV ; -- "in London" - AdvCN : CN -> AdV -> CN ; -- "house in London", "house today" - - AdvAP : AdA -> AP -> AP ; -- "very good" - - ---3 Sentences and relative clauses --- - - PredVP : NP -> VP -> S ; -- "John walks" - PosSlashTV, NegSlashTV : NP -> TV -> Slash ; -- "John sees", "John doesn's see" - OneVP : VP -> S ; -- "one walks" - - IdRP : RP ; -- "which" - FunRP : Fun -> RP -> RP ; -- "the successor of which" - RelVP : RP -> VP -> RC ; -- "who walks" - 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 : Fun -> IP -> IP ; -- "the mother of whom" - NounIPOne, NounIPMany : CN -> IP ; -- "which car", "which cars" - - QuestVP : NP -> VP -> Qu ; -- "does 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" - - 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!" - - 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 ; - ---2 Examples of structural words --- --- 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 --- should really be replaced by masculine and feminine variants. - - EveryDet, AllDet, WhichDet, MostDet : Det ; -- every, all, which, most - INP, ThouNP, HeNP, SheNP, ItNP : NP ; -- personal pronouns in singular - WeNP, YeNP, TheyNP : NP ; -- personal pronouns in plural - YouNP : NP ; -- the polite you - WhenIAdv,WhereIAdv,WhyIAdv,HowIAdv : IAdv ; -- when, where, why, how - AndConj, OrConj : Conj ; -- and, or - BothAnd, EitherOr, NeitherNor : ConjD ; -- both-and, either-or, neither-nor - IfSubj, WhenSubj : Subj ; -- if, when - PhrYes, PhrNo : Phr ; -- yes, no - VeryAdv, TooAdv : AdA ; -- very, too - OtherwiseAdv, ThereforeAdv : AdS ; -- therefore, otherwise -} ; - diff --git a/grammars/resource/abstract/Restaurant.gf b/grammars/resource/abstract/Restaurant.gf deleted file mode 100644 index 5c4ae4681..000000000 --- a/grammars/resource/abstract/Restaurant.gf +++ /dev/null @@ -1,15 +0,0 @@ -abstract Restaurant = Database ** { - -fun - Restaurant, Bar : Noun ; - French, Italian, Indian, Japanese : Property ; - address, phone, priceLevel : Feature ; - Cheap, Expensive : Comparison ; - - WhoRecommend : Name -> Phras ; - WhoHellRecommend : Name -> Phras ; - - --- examples of restaurant names - LucasCarton : Name ; -} ; diff --git a/grammars/resource/abstract/TestAbs.gf b/grammars/resource/abstract/TestAbs.gf deleted file mode 100644 index 9605fd561..000000000 --- a/grammars/resource/abstract/TestAbs.gf +++ /dev/null @@ -1,18 +0,0 @@ -abstract TestAbs = ResAbs ** { - --- a random sample of lexicon to test resource grammar with - -fun - Big, Small, Old, Young : AdjDeg ; - American, Finnish : Adj1 ; - Married : Adj2 ; - Man, Woman, Car, House, Light : N ; - Walk, Run : V ; - Send, Wait, Love, SwitchOn, SwitchOff : TV ; - Give, Prefer : V3 ; - Say, Prove : VS ; - Mother, Uncle : Fun ; - Connection : Fun2 ; - Well, Always : AdV ; - John, Mary : PN ; -} ; diff --git a/grammars/resource/english/DatabaseEng.gf b/grammars/resource/english/DatabaseEng.gf deleted file mode 100644 index 927434d9a..000000000 --- a/grammars/resource/english/DatabaseEng.gf +++ /dev/null @@ -1,51 +0,0 @@ -concrete DatabaseEng of Database = open Prelude,Syntax,English,Predication,Paradigms,DatabaseEngRes in { - -flags lexer=text ; unlexer=text ; - -lincat - Phras = SS1 Bool ; -- long or short form - Subject = NP ; - Noun = CN ; - Property = AP ; - Comparison = AdjDeg ; - Relation = Adj2 ; - Feature = Fun ; - Value = NP ; - Name = PN ; - -lin - LongForm sent = ss (sent.s ! True ++ "?") ; - ShortForm sent = ss (sent.s ! False ++ "?") ; - - WhichAre A B = mkSent (defaultQuestion (IntVP (NounIPMany A) (PosA B))) - (defaultNounPhrase (IndefManyNP (ModAdj B A))) ; - - IsIt Q A = mkSentSame (defaultQuestion (QuestVP Q (PosA A))) ; - - MoreThan = ComparAdjP ; - TheMost = SuperlNP ; - Relatively C _ = PositAdjP C ; - - RelatedTo = ComplAdj ; - - FeatureOf = appFun1 ; - ValueOf F V = appFun1 F (UsePN V) ; - - WithProperty A B = ModAdj B A ; - - Individual = UsePN ; - - AllN = DetNP AllDet ; - MostN = DetNP MostDet ; - EveryN = DetNP EveryDet ; - --- only these are language-dependent - - Any n = detNounPhrase anyPlDet n ** {lock_NP = <>} ; --- - - IsThere A = mkSentPrel ["is there"] (defaultNounPhrase (IndefOneNP A)) ; - AreThere A = mkSentPrel ["are there"] (defaultNounPhrase (IndefManyNP A)) ; - - WhatIs V = mkSentPrel ["what is"] (defaultNounPhrase V) ; - -} ; diff --git a/grammars/resource/english/DatabaseEngRes.gf b/grammars/resource/english/DatabaseEngRes.gf deleted file mode 100644 index e00501a47..000000000 --- a/grammars/resource/english/DatabaseEngRes.gf +++ /dev/null @@ -1,11 +0,0 @@ -resource DatabaseEngRes = open Prelude in { -oper - mkSent : SS -> SS -> SS1 Bool = \long, short -> - {s = table {b => if_then_else Str b long.s short.s}} ; - - mkSentPrel : Str -> SS -> SS1 Bool = \prel, matter -> - mkSent (ss (prel ++ matter.s)) matter ; - - mkSentSame : SS -> SS1 Bool = \s -> - mkSent s s ; -} ; diff --git a/grammars/resource/english/English.gf b/grammars/resource/english/English.gf deleted file mode 100644 index 6a3d4b9f6..000000000 --- a/grammars/resource/english/English.gf +++ /dev/null @@ -1,3 +0,0 @@ ---# -path=.:../abstract:../../prelude - -resource English = reuse ResEng ; diff --git a/grammars/resource/english/Morpho.gf b/grammars/resource/english/Morpho.gf deleted file mode 100644 index bd6ac1ca1..000000000 --- a/grammars/resource/english/Morpho.gf +++ /dev/null @@ -1,167 +0,0 @@ ---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 Morpho = Types ** open Prelude 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'") ; - ---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 --- --- For the comparison of adjectives, three forms are needed in the worst case. - - mkAdjDegr : (_,_,_ : Str) -> AdjDegr = \good,better,best -> - {s = table {Pos => good ; Comp => better ; Sup => best}} ; - - adjDegrReg : Str -> AdjDegr = \long -> - mkAdjDegr long (long + "er") (long + "est") ; - - adjDegrY : Str -> AdjDegr = \lovel -> - mkAdjDegr (lovel + "y") (lovel + "ier") (lovel + "iest") ; - --- Many adjectives are 'inflected' by adding a comparison word. - - adjDegrLong : Str -> AdjDegr = \ridiculous -> - mkAdjDegr ridiculous ("more" ++ ridiculous) ("most" ++ ridiculous) ; - --- simple adjectives are just strings - - simpleAdj : Str -> Adjective = ss ; - ---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 ; - Past _ => 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") ; - - 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" ; - Past Sg => "was" ; - Past 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) ; -} ; - diff --git a/grammars/resource/english/Paradigms.gf b/grammars/resource/english/Paradigms.gf deleted file mode 100644 index d13179338..000000000 --- a/grammars/resource/english/Paradigms.gf +++ /dev/null @@ -1,243 +0,0 @@ ---# -path=.:../abstract:../../prelude - ---1 English Lexical Paradigms --- --- Aarne Ranta 2003 --- --- This is an API to the user of the resource grammar --- for adding lexical items. It give shortcuts for forming --- expressions of basic categories: nouns, adjectives, verbs. --- --- Closed categories (determiners, pronouns, conjunctions) are --- accessed through the resource syntax API, $resource.Abs.gf$. --- --- The main difference with $MorphoEng.gf$ is that the types --- referred to are compiled resource grammar types. We have moreover --- had the design principle of always having existing forms as string --- arguments of the paradigms, not stems. --- --- The following modules are presupposed: - -resource Paradigms = open (Predef=Predef), Prelude, Syntax, English in { - ---2 Parameters --- --- To abstract over gender names, we define the following identifiers. - -oper - human : Gender ; - nonhuman : Gender ; - --- To abstract over number names, we define the following. - - singular : Number ; - plural : Number ; - - ---2 Nouns - --- Worst case: give all four forms and the semantic gender. --- In practice the worst case is just: give singular and plural nominative. - -oper - mkN : (man,men,man's,men's : Str) -> Gender -> N ; - nMan : (man,men : Str) -> Gender -> N ; - --- Regular nouns, nouns ending with "s", "y", or "o", and nouns with the same --- plural form as the singular. - - nReg : Str -> Gender -> N ; -- dog, dogs - nKiss : Str -> Gender -> N ; -- kiss, kisses - nFly : Str -> Gender -> N ; -- fly, flies - nHero : Str -> Gender -> N ; -- hero, heroes (= nKiss !) - nSheep : Str -> Gender -> N ; -- sheep, sheep - --- These use general heuristics, that recognizes the last letter. *N.B* it --- does not get right with "boy", "rush", since it only looks at one letter. - - nHuman : Str -> N ; -- gambler/actress/nanny - nNonhuman : Str -> N ; -- dog/kiss/fly - --- Nouns used as functions need a preposition. The most common is "of". - - mkFun : N -> Preposition -> Fun ; - - funHuman : Str -> Fun ; -- the father/mistress/daddy of - funNonhuman : Str -> Fun ; -- the successor/address/copy of - --- Proper names, with their regular genitive. - - pnReg : (John : Str) -> PN ; -- John, John's - --- The most common cases on the top level havee shortcuts. --- The regular "y"/"s" variation is taken into account in $CN$. - - cnNonhuman : Str -> CN ; - cnHuman : Str -> CN ; - npReg : Str -> NP ; - --- In some cases, you may want to make a complex $CN$ into a function. - - mkFunCN : CN -> Preposition -> Fun ; - funOfCN : CN -> Fun ; - ---2 Adjectives - --- Non-comparison one-place adjectives just have one form. - - mkAdj1 : (even : Str) -> Adj1 ; - --- Two-place adjectives need a preposition as second argument. - - mkAdj2 : (divisible, by : Str) -> Adj2 ; - --- Comparison adjectives have three forms. The common irregular --- cases are ones ending with "y" and a consonant that is duplicated. - - mkAdjDeg : (good,better,best : Str) -> AdjDeg ; - - aReg : (long : Str) -> AdjDeg ; -- long, longer, longest - aHappy : (happy : Str) -> AdjDeg ; -- happy, happier, happiest - aFat : (fat : Str) -> AdjDeg ; -- fat, fatter, fattest - aRidiculous : (ridiculous : Str) -> AdjDeg ; -- -/more/most ridiculous - --- On top level, there are adjectival phrases. The most common case is --- just to use a one-place adjective. - - apReg : Str -> AP ; - - ---2 Verbs --- --- The fragment now has all verb forms, except the gerund/present participle. --- Except for "be", the worst case needs four forms: the infinitive and --- the third person singular present, the past indicative, and the past participle. - - mkV : (go, goes, went, gone : Str) -> V ; - - vReg : (walk : Str) -> V ; -- walk, walks - vKiss : (kiss : Str) -> V ; -- kiss, kisses - vFly : (fly : Str) -> V ; -- fly, flies - vGo : (go : Str) -> V ; -- go, goes (= vKiss !) - --- This generic function recognizes the special cases where the last --- character is "y", "s", or "z". It is not right for "finish" and "convey". - - vGen : Str -> V ; -- walk/kiss/fly - --- The verbs "be" and "have" are special. - - vBe : V ; - vHave : V ; - --- Verbs with a particle. - - vPart : (go, goes, went, gone, up : Str) -> V ; - vPartReg : (get, up : Str) -> V ; - --- Two-place verbs, and the special case with direct object. --- Notice that a particle can already be included in $V$. - - mkTV : V -> Str -> TV ; -- look for, kill - - tvGen : (look, for : Str) -> TV ; -- look for, talk about - tvDir : V -> TV ; -- switch off - tvGenDir : (kill : Str) -> TV ; -- kill - --- Regular two-place verbs with a particle. - - tvPartReg : Str -> Str -> Str -> TV ; -- get, along, with - --- The definitions should not bother the user of the API. So they are --- hidden from the document. ---. - - human = Hum ; - nonhuman = NoHum ; - -- singular defined in types.Eng - -- plural defined in types.Eng - - nominative = Nom ; - - mkN = \man,men,man's,men's,g -> - mkNoun man men man's men's ** {g = g ; lock_N = <>} ; - nReg a g = addGenN nounReg a g ; - nKiss n g = addGenN nounS n g ; - nFly = \fly -> addGenN nounY (Predef.tk 1 fly) ; - nMan = \man,men -> mkN man men (man + "'s") (men + "'s") ; - nHero = nKiss ; - nSheep = \sheep -> nMan sheep sheep ; - - nHuman = \s -> nGen s Hum ; - nNonhuman = \s -> nGen s NoHum ; - - nGen : Str -> Gender -> N = \fly,g -> let { - fl = Predef.tk 1 fly ; - y = Predef.dp 1 fly ; - eqy = ifTok (Str -> Gender -> N) y - } in - eqy "y" nFly ( - eqy "s" nKiss ( - eqy "z" nKiss ( - nReg))) fly g ; - - mkFun = \n,p -> n ** {lock_Fun = <> ; s2 = p} ; - funNonhuman = \s -> mkFun (nNonhuman s) "of" ; - funHuman = \s -> mkFun (nHuman s) "of" ; - - pnReg n = nameReg n ** {lock_PN = <>} ; - - cnNonhuman = \s -> UseN (nGen s nonhuman) ; - cnHuman = \s -> UseN (nGen s human) ; - npReg = \s -> UsePN (pnReg s) ; - - mkFunCN = \n,p -> n ** {lock_Fun = <> ; s2 = p} ; - funOfCN = \n -> mkFunCN n "of" ; - - addGenN : (Str -> CommonNoun) -> Str -> Gender -> N = \f -> - \s,g -> f s ** {g = g ; lock_N = <>} ; - - mkAdj1 a = simpleAdj a ** {lock_Adj1 = <>} ; - mkAdj2 = \s,p -> simpleAdj s ** {s2 = p} ** {lock_Adj2 = <>} ; - mkAdjDeg a b c = mkAdjDegr a b c ** {lock_AdjDeg = <>} ; - aReg a = adjDegrReg a ** {lock_AdjDeg = <>} ; - aHappy = \happy -> adjDegrY (Predef.tk 1 happy) ** {lock_AdjDeg = <>} ; - aFat = \fat -> let {fatt = fat + Predef.dp 1 fat} in - mkAdjDeg fat (fatt + "er") (fatt + "est") ; - aRidiculous a = adjDegrLong a ** {lock_AdjDeg = <>} ; - apReg = \s -> AdjP1 (mkAdj1 s) ; - - mkV = \go,goes,went,gone -> verbNoPart (mkVerbP3 go goes went gone) ** - {lock_V = <>} ; - vReg = \walk -> mkV walk (walk + "s") (walk + "ed") (walk + "ed") ; - vKiss = \kiss -> mkV kiss (kiss + "es") (kiss + "ed") (kiss + "ed") ; - vFly = \cry -> let {cr = Predef.tk 1 cry} in - mkV cry (cr + "ies") (cr + "ied") (cr + "ied") ; - vGo = vKiss ; - - vGen = \fly -> let { - fl = Predef.tk 1 fly ; - y = Predef.dp 1 fly ; - eqy = ifTok (Str -> V) y - } in - eqy "y" vFly ( - eqy "s" vKiss ( - eqy "z" vKiss ( - vReg))) fly ; - - vPart = \go, goes, went, gone, up -> - verbPart (mkVerbP3 go goes went gone) up ** {lock_V = <>} ; - vPartReg = \get, up -> - verbPart (regVerbP3 get) up ** {lock_V = <>} ; - - mkTV = \v,p -> v ** {lock_TV = <> ; s3 = p} ; - tvPartReg = \get, along, to -> mkTV (vPartReg get along) to ; - - vBe = verbBe ** {s1 = [] ; lock_V = <>} ; - vHave = verbP3Have ** {s1 = [] ; lock_V = <>} ; - - tvGen = \s,p -> mkTV (vGen s) p ; - tvDir = \v -> mkTV v [] ; - tvGenDir = \s -> tvDir (vGen s) ; - -} ; diff --git a/grammars/resource/english/Predication.gf b/grammars/resource/english/Predication.gf deleted file mode 100644 index 4285a8e24..000000000 --- a/grammars/resource/english/Predication.gf +++ /dev/null @@ -1,83 +0,0 @@ - ---1 A Small Predication Library --- --- (c) Aarne Ranta 2003 under Gnu GPL. --- --- This library is built on a language-independent API of --- resource grammars. It has a common part, the type signatures --- (defined here), and language-dependent parts. The user of --- the library should only have to look at the type signatures. - -resource Predication = open English in { - --- We first define a set of predication patterns. - -oper - predV1 : V -> NP -> S ; -- one-place verb: "John walks" - predV2 : TV -> NP -> NP -> S ; -- two-place verb: "John loves Mary" - predVColl : V -> NP -> NP -> S ; -- collective verb: "John and Mary fight" - predA1 : Adj1 -> NP -> S ; -- one-place adjective: "John is old" - predA2 : Adj2 -> NP -> NP -> S ; -- two-place adj: "John is married to Mary" - predAComp : AdjDeg -> NP -> NP -> S ; -- compar adj: "John is older than Mary" - predAColl : Adj1 -> NP -> NP -> S ; -- collective adj: "John and Mary are married" - predN1 : N -> NP -> S ; -- one-place noun: "John is a man" - predN2 : Fun -> NP -> NP -> S ; -- two-place noun: "John is a lover of Mary" - predNColl : N -> NP -> NP -> S ; -- collective noun: "John and Mary are lovers" - --- Individual-valued function applications. - - appFun1 : Fun -> NP -> NP ; -- one-place function: "the successor of x" - appFunColl : Fun -> NP -> NP -> NP ; -- collective function: "the sum of x and y" - --- Families of types, expressed by common nouns depending on arguments. - - appFam1 : Fun -> NP -> CN ; -- one-place family: "divisor of x" - appFamColl : Fun -> NP -> NP -> CN ; -- collective family: "path between x and y" - --- Type constructor, similar to a family except that the argument is a type. - - constrTyp1 : Fun -> CN -> CN ; - --- Logical connectives on two sentences. - - conjS : S -> S -> S ; - disjS : S -> S -> S ; - implS : S -> S -> S ; - --- As an auxiliary, we need two-place conjunction of names ("John and Mary"), --- used in collective predication. - - conjNP : NP -> NP -> NP ; - - ------------------------------ - ----- what follows should be an implementation of the preceding - -oper - predV1 = \F, x -> PredVP x (PosV F) ; - predV2 = \F, x, y -> PredVP x (PosTV F y) ; - predVColl = \F, x, y -> PredVP (conjNP x y) (PosV F) ; - predA1 = \F, x -> PredVP x (PosA (AdjP1 F)) ; - predA2 = \F, x, y -> PredVP x (PosA (ComplAdj F y)) ; - predAComp = \F, x, y -> PredVP x (PosA (ComparAdjP F y)) ; - predAColl = \F, x, y -> PredVP (conjNP x y) (PosA (AdjP1 F)) ; - predN1 = \F, x -> PredVP x (PosCN (UseN F)) ; - predN2 = \F, x, y -> PredVP x (PosCN (AppFun F y)) ; - predNColl = \F, x, y -> PredVP (conjNP x y) (PosCN (UseN F)) ; - - appFun1 = \f, x -> DefOneNP (AppFun f x) ; - appFunColl = \f, x, y -> DefOneNP (AppFun f (conjNP x y)) ; - - appFam1 = \F, x -> AppFun F x ; - appFamColl = \F, x, y -> AppFun F (conjNP x y) ; - - conjS = \A, B -> ConjS AndConj (TwoS A B) ; - disjS = \A, B -> ConjS OrConj (TwoS A B) ; - implS = \A, B -> SubjS IfSubj A B ; - - constrTyp1 = \F, A -> AppFun F (IndefManyNP A) ; - - conjNP = \x, y -> ConjNP AndConj (TwoNP x y) ; - -} ; diff --git a/grammars/resource/english/ResEng.gf b/grammars/resource/english/ResEng.gf deleted file mode 100644 index 6ae9c7fb3..000000000 --- a/grammars/resource/english/ResEng.gf +++ /dev/null @@ -1,223 +0,0 @@ ---# -path=.:../abstract:../../prelude - ---1 The Top-Level English Resource Grammar --- --- 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 ResEng of ResAbs = open Prelude, Syntax 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} ; - - Adj1 = Adjective ; - -- = {s : Str} - Adj2 = Adjective ** {s2 : Preposition} ; - AdjDeg = {s : Degree => Str} ; - AP = Adjective ** {p : Bool} ; - - V = Verb ; - -- = {s : VForm => Str ; s1 : Particle} - VP = {s : VForm => Str ; s2 : Number => Str ; isAux : Bool} ; - TV = TransVerb ; - -- = Verb ** {s3 : Preposition} ; - V3 = TransVerb ** {s4 : Preposition} ; - VS = Verb ; - - 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 : Str ; s2 : Str ; p : Bool} ; - ListNP = {s1,s2 : NPForm => Str ; n : Number ; p : Person} ; - ---. - -lin - UseN = noun2CommNounPhrase ; - ModAdj = modCommNounPhrase ; - ModGenOne = npGenDet singular ; - ModGenMany = 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 ; - IndefManyNP = indefNounPhrase plural ; - DefOneNP = defNounPhrase singular ; - DefManyNP = defNounPhrase plural ; - - CNthatS = nounThatSentence ; - - PredVP = predVerbPhrase ; - PosV = predVerb True ; - NegV = predVerb False ; - PosA = predAdjective True ; - NegA = predAdjective False ; - PosCN = predCommNoun True ; - NegCN = predCommNoun False ; - PosTV = complTransVerb True ; - NegTV = complTransVerb False ; - PosV3 = complDitransVerb True ; - NegV3 = complDitransVerb False ; - PosPassV = passVerb True ; - NegPassV = passVerb False ; - PosNP = predNounPhrase True ; - NegNP = predNounPhrase False ; - PosVS = complSentVerb True ; - NegVS = complSentVerb False ; - VTrans = transAsVerb ; - - AdvVP = adVerbPhrase ; - LocNP = locativeNounPhrase ; - AdvCN = advCommNounPhrase ; - AdvAP = advAdjPhrase ; - - PosSlashTV = slashTransVerb True ; - NegSlashTV = slashTransVerb False ; - OneVP = predVerbPhrase (nameNounPhrase (nameReg "one")) ; - - 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 ; - - ImperVP = imperVerbPhrase ; - - IndicPhrase = indicUtt ; - QuestPhrase = interrogUtt ; - ImperOne = imperUtterance singular ; - ImperMany = imperUtterance plural ; - - AdvS = advSentence ; - -lin - 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 ; - - INP = pronI ; - ThouNP = pronYouSg ; - HeNP = pronHe ; - SheNP = pronShe ; - ItNP = pronIt ; - WeNP = pronWe ; - YeNP = pronYouPl ; - YouNP = pronYouSg ; - TheyNP = pronThey ; - - EveryDet = everyDet ; - AllDet = allDet ; - WhichDet = whichDet ; - MostDet = mostDet ; - - HowIAdv = ss "how" ; - WhenIAdv = ss "when" ; - WhereIAdv = ss "where" ; - WhyIAdv = ss "why" ; - - 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" ; - - PhrYes = ss "Yes." ; - PhrNo = ss "No." ; - - VeryAdv = ss "very" ; - TooAdv = ss "too" ; - OtherwiseAdv = ss "otherwise" ; - ThereforeAdv = ss "therefore" ; - -} ; diff --git a/grammars/resource/english/RestaurantEng.gf b/grammars/resource/english/RestaurantEng.gf deleted file mode 100644 index 69905ee32..000000000 --- a/grammars/resource/english/RestaurantEng.gf +++ /dev/null @@ -1,27 +0,0 @@ ---# -path=.:../abstract:../../prelude - -concrete RestaurantEng of Restaurant = - DatabaseEng ** open Prelude,Paradigms,DatabaseEngRes in { - -lin - Restaurant = cnNonhuman "restaurant" ; - Bar = cnNonhuman "bar" ; - French = apReg "French" ; - Italian = apReg "Italian" ; - Indian = apReg "Indian" ; - Japanese = apReg "Japanese" ; - - address = funNonhuman "address" ; - phone = funNonhuman ["number"] ; --- phone - priceLevel = funNonhuman ["level"] ; --- price - - Cheap = aReg "cheap" ; - Expensive = aRidiculous "expensive" ; - - WhoRecommend rest = mkSentSame (ss (["who recommended"] ++ rest.s ! nominative)) ; - WhoHellRecommend rest = - mkSentSame (ss (["who the hell recommended"] ++ rest.s ! nominative)) ; - - LucasCarton = pnReg ["Lucas Carton"] ; - -} ; diff --git a/grammars/resource/english/Syntax.gf b/grammars/resource/english/Syntax.gf deleted file mode 100644 index 07f4c7358..000000000 --- a/grammars/resource/english/Syntax.gf +++ /dev/null @@ -1,924 +0,0 @@ ---1 A Small English Resource Syntax --- --- Aarne Ranta 2002 --- --- This resource grammar contains definitions needed to construct --- indicative, interrogative, and imperative sentences in English. --- --- The following files are presupposed: - -resource Syntax = Morpho ** open Prelude, (CO = Coordination) in { - ---2 Common Nouns --- --- Simple common nouns are defined as the type $CommNoun$ in $morpho.Deu.gf$. - ---3 Common noun phrases - --- To the common nouns of morphology, --- we add natural gender (human/nonhuman) which is needed in syntactic --- combinations (e.g. "man who runs" - "program which runs"). - -oper - CommNoun = CommonNoun ** {g : Gender} ; - - CommNounPhrase = CommNoun ; - - noun2CommNounPhrase : CommNoun -> CommNounPhrase = \man -> - man ; - - cnGen : CommonNoun -> Gender -> CommNoun = \cn,g -> - cn ** {g = g} ; - - cnHum : CommonNoun -> CommNoun = \cn -> - cnGen cn Hum ; - cnNoHum : CommonNoun -> CommNoun = \cn -> - cnGen cn NoHum ; - ---2 Noun phrases --- --- The worst case is pronouns, which have inflection in the possessive forms. --- Proper names are a special case. - - NounPhrase : Type = Pronoun ; - - nameNounPhrase : ProperName -> NounPhrase = \john -> - {s = \\c => john.s ! toCase c ; n = Sg ; p = P3} ; - ---2 Determiners --- --- Determiners are inflected according to the nouns they determine. --- The determiner is not inflected. - Determiner : Type = {s : Str ; n : Number} ; - - detNounPhrase : Determiner -> CommNounPhrase -> NounPhrase = \every, man -> - {s = \\c => every.s ++ man.s ! every.n ! toCase c ; - n = every.n ; - p = P3 - } ; - - mkDeterminer : Number -> Str -> Determiner = \n,det -> - {s = det ; - n = n - } ; - - everyDet = mkDeterminer Sg "every" ; - allDet = mkDeterminer Pl "all" ; - mostDet = mkDeterminer Pl "most" ; - aDet = mkDeterminer Sg artIndef ; - plDet = mkDeterminer Pl [] ; - theSgDet = mkDeterminer Sg "the" ; - thePlDet = mkDeterminer Pl "the" ; - anySgDet = mkDeterminer Sg "any" ; - anyPlDet = mkDeterminer Pl "any" ; - - whichSgDet = mkDeterminer Sg "which" ; - whichPlDet = mkDeterminer Pl "which" ; - - whichDet = whichSgDet ; --- API - - indefNoun : Number -> CommNoun -> Str = \n,man -> - (indefNounPhrase n man).s ! NomP ; - - indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,man -> - {s = \\c => case n of { - Sg => artIndef ++ man.s ! n ! toCase c ; - Pl => man.s ! n ! toCase c - } ; - n = n ; p = P3 - } ; - - defNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,car -> - {s = \\c => artDef ++ car.s ! n ! toCase c ; n = n ; p = P3} ; - --- Genitives of noun phrases can be used like determiners, to build noun phrases. --- The number argument makes the difference between "my house" - "my houses". --- --- We have the variation "the car of John / the car of John's / John's car" - - npGenDet : Number -> NounPhrase -> CommNounPhrase -> NounPhrase = - \n,john,car -> - {s = \\c => variants { - artDef ++ car.s ! n ! Nom ++ "of" ++ john.s ! GenSP ; - john.s ! GenP ++ car.s ! n ! toCase c - } ; - n = n ; - p = P3 - } ; - --- *Bare plural noun phrases* like "men", "good cars", are built without a --- determiner word. - - plurDet : CommNounPhrase -> NounPhrase = \cn -> - {s = \\c => cn.s ! plural ! toCase c ; - p = P3 ; - n = Pl - } ; - --- Constructions like "the idea that two is even" are formed at the --- first place as common nouns, so that one can also have "a suggestion that...". - - nounThatSentence : CommNounPhrase -> Sentence -> CommNounPhrase = \idea,x -> - {s = \\n,c => idea.s ! n ! c ++ "that" ++ x.s ; - g = idea.g - } ; - - ---2 Adjectives --- --- Adjectival phrases have a parameter $p$ telling if they are prefixed ($True$) or --- postfixed (complex APs). - - AdjPhrase : Type = Adjective ** {p : Bool} ; - - adj2adjPhrase : Adjective -> AdjPhrase = \new -> new ** {p = True} ; - - simpleAdjPhrase : Str -> AdjPhrase = \French -> - adj2adjPhrase (simpleAdj French) ; - - ---3 Comparison adjectives --- --- Each of the comparison forms has a characteristic use: --- --- Positive forms are used alone, as adjectival phrases ("big"). - - positAdjPhrase : AdjDegr -> AdjPhrase = \big -> - adj2adjPhrase (ss (big.s ! Pos)) ; - --- Comparative forms are used with an object of comparison, as --- adjectival phrases ("bigger then you"). - - comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \big, you -> - {s = big.s ! Comp ++ "than" ++ you.s ! NomP ; - p = False - } ; - --- Superlative forms are used with a modified noun, picking out the --- maximal representative of a domain ("the biggest house"). - - superlNounPhrase : AdjDegr -> CommNoun -> NounPhrase = \big, house -> - {s = \\c => "the" ++ big.s ! Sup ++ house.s ! Sg ! toCase c ; - n = Sg ; - p = P3 - } ; - - ---3 Two-place adjectives --- --- A two-place adjective is an adjective with a preposition used before --- the complement. - - Preposition = Str ; - - AdjCompl = Adjective ** {s2 : Preposition} ; - - complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \related,john -> - {s = related.s ++ related.s2 ++ john.s ! AccP ; - p = False - } ; - - ---3 Modification of common nouns --- --- The two main functions of adjective are in predication ("John is old") --- and in modification ("an old man"). Predication will be defined --- later, in the chapter on verbs. --- --- Modification must pay attention to pre- and post-noun --- adjectives: "big car"/"car bigger than X" - - modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase = \big, car -> - {s = \\n => if_then_else (Case => Str) big.p - (\\c => big.s ++ car.s ! n ! c) - (table {Nom => car.s ! n ! Nom ++ big.s ; Gen => variants {}}) ; - g = car.g - } ; - - ---2 Function expressions - --- A function expression is a common noun together with the --- preposition prefixed to its argument ("mother of x"). --- The type is analogous to two-place adjectives and transitive verbs. - - Function = CommNounPhrase ** {s2 : Preposition} ; - --- The application of a function gives, in the first place, a common noun: --- "mother/mothers of John". From this, other rules of the resource grammar --- give noun phrases, such as "the mother of John", "the mothers of John", --- "the mothers of John and Mary", and "the mother of John and Mary" (the --- latter two corresponding to distributive and collective functions, --- respectively). Semantics will eventually tell when each --- of the readings is meaningful. - - appFunComm : Function -> NounPhrase -> CommNounPhrase = \mother,john -> - {s = \\n => table { - Gen => nonExist ; --- ? - _ => mother.s ! n ! Nom ++ mother.s2 ++ john.s ! GenSP - } ; - g = mother.g - } ; - --- It is possible to use a function word as a common noun; the semantics is --- often existential or indexical. - - funAsCommNounPhrase : Function -> CommNounPhrase = - noun2CommNounPhrase ; - --- The following is an aggregate corresponding to the original function application --- producing "John's mother" and "the mother of John". It does not appear in the --- resource grammar API any longer. - - appFun : Bool -> Function -> NounPhrase -> NounPhrase = \coll, mother,john -> - let {n = john.n ; nf = if_then_else Number coll Sg n} in - variants { - defNounPhrase nf (appFunComm mother john) ; - npGenDet nf john mother - } ; - --- The commonest case is functions with the preposition "of". - - funOf : CommNoun -> Function = \mother -> - mother ** {s2 = "of"} ; - - funOfReg : Str -> Gender -> Function = \mother,g -> - funOf (nounReg mother ** {g = g}) ; - --- Two-place functions add one argument place. - - Function2 = Function ** {s3 : Preposition} ; - --- There application starts by filling the first place. - - appFun2 : Function2 -> NounPhrase -> Function = \train, paris -> - {s = \\n,c => train.s ! n ! c ++ train.s2 ++ paris.s ! AccP ; - g = train.g ; - s2 = train.s3 - } ; - - ---2 Verbs --- ---3 Verb phrases --- --- Verb phrases are discontinuous: the two parts of a verb phrase are --- (s) an inflected verb, (s2) infinitive and complement. --- For instance: "doesn't" - "walk" ; "isn't" - "old" ; "is" - "a man" --- There's also a parameter telling if the verb is an auxiliary: --- this is needed in question. - - VerbPhrase = VerbP3 ** {s2 : Number => Str ; isAux : Bool} ; - --- From the inflection table, we selecting the finite form as function --- of person and number: - - indicVerb : VerbP3 -> Person -> Number -> Str = \v,p,n -> case n of { - Sg => v.s ! Indic p ; - Pl => v.s ! Indic P2 - } ; - --- 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 "don't" are not grammatical. - - predVerb : Bool -> Verb -> VerbPhrase = \b,walk -> - if_then_else VerbPhrase b - {s = \\v => walk.s ! v ++ walk.s1 ; - s2 = \\_ => [] ; - isAux = False - } - {s = \\v => contractNot (verbP3Do.s ! v) ; - s2 = \\_ => walk.s ! InfImp ++ walk.s1 ; - isAux = True - } ; - --- Sometimes we want to extract the verb part of a verb phrase. - - verbOfPhrase : VerbPhrase -> VerbP3 = \v -> {s = v.s} ; - --- Verb phrases can also be formed from adjectives ("is old"), --- common nouns ("is a man"), and noun phrases ("ist John"). --- The third rule is overgenerating: "is every man" has to be ruled out --- on semantic grounds. - - predAdjective : Bool -> Adjective -> VerbPhrase = \b,old -> - {s = beOrNotBe b ; - s2 = \\_ => old.s ; - isAux = True - } ; - - predCommNoun : Bool -> CommNoun -> VerbPhrase = \b,man -> - {s = beOrNotBe b ; - s2 = \\n => indefNoun n man ; - isAux = True - } ; - - predNounPhrase : Bool -> NounPhrase -> VerbPhrase = \b,john -> - {s = beOrNotBe b ; - s2 = \\_ => john.s ! NomP ; - isAux = True - } ; - --- We use an auxiliary giving all forms of "be". - - beOrNotBe : Bool -> (VForm => Str) = \b -> - if_then_else (VForm => Str) b - verbBe.s - (table { - InfImp => contractNot "do" ++ "be" ; - Indic P1 => "am" ++ "not" ; - v => contractNot (verbBe.s ! v) - }) ; - ---3 Transitive verbs --- --- Transitive verbs are verbs with a preposition for the complement, --- in analogy with two-place adjectives and functions. --- One might prefer to use the term "2-place verb", since --- "transitive" traditionally means that the inherent preposition is empty. --- Such a verb is one with a *direct object*. - - TransVerb : Type = Verb ** {s3 : Preposition} ; - --- The rule for using transitive verbs is the complementization rule. --- Particles produce free variation: before or after the complement --- ("I switch on the TV" / "I switch the TV on"). - - complTransVerb : Bool -> TransVerb -> NounPhrase -> VerbPhrase = - \b,lookat,john -> - let {lookatjohn = bothWays lookat.s1 (lookat.s3 ++ john.s ! AccP)} in - if_then_else VerbPhrase b - {s = lookat.s ; - s2 = \\_ => lookatjohn ; - isAux = False} - {s = \\v => contractNot (verbP3Do.s ! v) ; - s2 = \\_ => lookat.s ! InfImp ++ lookatjohn ; - isAux = True} ; - - --- Verbs that take direct object and a particle: - mkTransVerbPart : VerbP3 -> Str -> TransVerb = \turn,off -> - {s = turn.s ; s1 = off ; s3 = []} ; - --- Verbs that take prepositional object, no particle: - mkTransVerb : VerbP3 -> Str -> TransVerb = \wait,for -> - {s = wait.s ; s1 = [] ; s3 = for} ; - --- Verbs that take direct object, no particle: - mkTransVerbDir : VerbP3 -> TransVerb = \love -> - mkTransVerbPart love [] ; - --- Transitive verbs with accusative objects can be used passively. --- The function does not check that the verb is transitive. --- Therefore, the function can also be used for "he is swum", etc. --- The syntax is the same as for adjectival predication. - - passVerb : Bool -> Verb -> VerbPhrase = \b,love -> - predAdjective b (adj2adjPhrase (ss (love.s ! PPart))) ; - --- Transitive verbs can be used elliptically as verbs. The semantics --- is left to applications. The definition is trivial, due to record --- subtyping. - - transAsVerb : TransVerb -> Verb = \love -> - love ; - --- *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. - - DitransVerb = TransVerb ** {s4 : Preposition} ; - - mkDitransVerb : Verb -> Preposition -> Preposition -> DitransVerb = \v,p1,p2 -> - v ** {s3 = p1 ; s4 = p2} ; - - complDitransVerb : - Bool -> DitransVerb -> NounPhrase -> NounPhrase -> VerbPhrase = - \b,give,you,beer -> - let { - youbeer = give.s1 ++ give.s3 ++ you.s ! AccP ++ give.s4 ++ beer.s ! AccP - } in - if_then_else VerbPhrase b - {s = give.s ; - s2 = \\_ => youbeer ; - isAux = False - } - {s = \\v => contractNot (verbP3Do.s ! v) ; - s2 = \\_ => give.s ! InfImp ++ youbeer ; - isAux = True - } ; - - ---2 Adverbials --- --- Adverbials are not inflected (we ignore comparison, and treat --- compared adverbials as separate expressions; this could be done another way). --- We distinguish between post- and pre-verbal adverbs. - - Adverb : Type = SS ** {p : Bool} ; - - advPre : Str -> Adverb = \seldom -> ss seldom ** {p = False} ; - advPost : Str -> Adverb = \well -> ss well ** {p = True} ; - --- N.B. this rule generates the cyclic parsing rule $VP#2 ::= VP#2$ --- and cannot thus be parsed. - - adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \sings, well -> - let {postp = orB well.p sings.isAux} in - { - s = \\v => (if_then_else Str postp [] well.s) ++ sings.s ! v ; - s2 = \\n => sings.s2 ! n ++ (if_then_else Str postp well.s []) ; - isAux = sings.isAux - } ; - - advAdjPhrase : SS -> AdjPhrase -> AdjPhrase = \very, good -> - {s = very.s ++ good.s ; - p = good.p - } ; - --- Adverbials are typically generated by prefixing prepositions. --- The rule for creating locative noun phrases by the preposition "in" --- is a little shaky, since other prepositions may be preferred ("on", "at"). - - prepPhrase : Preposition -> NounPhrase -> Adverb = \on, it -> - advPost (on ++ it.s ! AccP) ; - - locativeNounPhrase : NounPhrase -> Adverb = - prepPhrase "in" ; - --- This is a source of the "mann with a telescope" ambiguity, and may produce --- strange things, like "cars always" (while "cars today" is OK). --- Semantics will have to make finer distinctions among adverbials. --- --- N.B. the genitive case created in this way would not make sense. - - advCommNounPhrase : CommNounPhrase -> Adverb -> CommNounPhrase = \car,today -> - {s = \\n => table { - Nom => car.s ! n ! Nom ++ today.s ; - Gen => nonExist - } ; - g = car.g - } ; - - ---2 Sentences --- --- Sentences are not inflected in this fragment of English without tense. - - Sentence : Type = SS ; - --- This is the traditional $S -> NP VP$ rule. It takes care of --- agreement between subject and verb. Recall that the VP may already --- contain negation. - - predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence = \john,walks -> - ss (john.s ! NomP ++ indicVerb (verbOfPhrase walks) john.p john.n ++ - walks.s2 ! john.n) ; - - --- This is a macro for simultaneous predication and complementization. - - predTransVerb : Bool -> NounPhrase -> TransVerb -> NounPhrase -> Sentence = - \b,you,see,john -> - predVerbPhrase you (complTransVerb b see john) ; - - ---3 Sentence-complement verbs --- --- Sentence-complement verbs take sentences as complements. - - SentenceVerb : Type = Verb ; - --- To generate "says that John walks" / "doesn't say that John walks": - - complSentVerb : Bool -> SentenceVerb -> Sentence -> VerbPhrase = - \b,say,johnruns -> - let {thatjohnruns = optStr "that" ++ johnruns.s} in - if_then_else VerbPhrase b - {s = say.s ; - s2 = \\_ => thatjohnruns ; - isAux = False} - {s = \\v => contractNot (verbP3Do.s ! v) ; - s2 = \\_ => say.s ! InfImp ++ thatjohnruns ; - isAux = True} ; - - ---2 Sentences missing noun phrases --- --- This is one instance of Gazdar's *slash categories*, corresponding to his --- $S/NP$. --- We cannot have - nor would we want to have - a productive slash-category former. --- Perhaps a handful more will be needed. --- --- Notice that the slash category has a similar relation to sentences as --- transitive verbs have to verbs: it's like a *sentence taking a complement*. --- However, we need something more to distinguish its use in direct questions: --- not just "you see" but ("whom") "do you see". --- --- The particle always follows the verb, but the preposition can fly: --- "whom you make it up with" / "with whom you make it up". - - SentenceSlashNounPhrase = {s : Bool => Str ; s2 : Preposition} ; - - slashTransVerb : Bool -> NounPhrase -> TransVerb -> SentenceSlashNounPhrase = - \b,You,lookat -> - let {you = You.s ! NomP ; - looks = indicVerb {s = lookat.s} You.p You.n ; - look = lookat.s ! InfImp ; - do = indicVerb verbP3Do You.p You.n ; - dont = contractNot do ; - up = lookat.s1 - } in - {s = table { - True => if_then_else Str b do dont ++ you ++ look ++ up ; - False => you ++ if_then_else Str b looks (dont ++ look) ++ up - } ; - s2 = lookat.s3 - } ; - - ---2 Relative pronouns and relative clauses --- --- As described in $types.Eng.gf$, relative pronouns are inflected in --- gender (human/nonhuman), number, and case. --- --- We get the simple relative pronoun ("who"/"which"/"whom"/"whose"/"that"/$""$) --- from $morpho.Eng.gf$. - - identRelPron : RelPron = relPron ; - - funRelPron : Function -> RelPron -> RelPron = \mother,which -> - {s = \\g,n,c => "the" ++ mother.s ! n ! Nom ++ - mother.s2 ++ which.s ! g ! n ! GenSP - } ; - --- Relative clauses can be formed from both verb phrases ("who walks") and --- slash expressions ("whom you see", "on which you sit" / "that you sit on"). - - RelClause : Type = {s : Gender => Number => Str} ; - - relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \who,walks -> - {s = \\g, n => who.s ! g ! n ! NomP ++ - indicVerb (verbOfPhrase walks) P3 n ++ walks.s2 ! n - } ; - - relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause = \who,yousee -> - {s = \\g,n => - let {youSee = yousee.s ! False} in - variants { - who.s ! g ! n ! AccP ++ youSee ++ yousee.s2 ; - yousee.s2 ++ who.s ! g ! n ! GenSP ++ youSee - } - } ; - --- A 'degenerate' relative clause is the one often used in mathematics, e.g. --- "number x such that x is even". - - relSuch : Sentence -> RelClause = \A -> - {s = \\_,_ => "such" ++ "that" ++ A.s} ; - --- 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. No comma is used before these relative clause. - - modRelClause : CommNounPhrase -> RelClause -> CommNounPhrase = \man,whoruns -> - {s = \\n,c => man.s ! n ! c ++ whoruns.s ! man.g ! n ; - g = man.g - } ; - - ---2 Interrogative pronouns --- --- If relative pronouns are adjective-like, interrogative pronouns are --- noun-phrase-like. - - IntPron : Type = {s : NPForm => Str ; n : Number} ; - --- In analogy with relative pronouns, we have a rule for applying a function --- to a relative pronoun to create a new one. - - funIntPron : Function -> IntPron -> IntPron = \mother,which -> - {s = \\c => "the" ++ mother.s ! which.n ! Nom ++ mother.s2 ++ which.s ! GenSP ; - n = which.n - } ; - --- There is a variety of simple interrogative pronouns: --- "which house", "who", "what". - - nounIntPron : Number -> CommNounPhrase -> IntPron = \n, car -> - {s = \\c => "which" ++ car.s ! n ! toCase c ; - n = n - } ; - - intPronWho : Number -> IntPron = \num -> { - s = table { - NomP => "who" ; - AccP => variants {"who" ; "whom"} ; - GenP => "whose" ; - GenSP => "whom" - } ; - n = num - } ; - - intPronWhat : Number -> IntPron = \num -> { - s = table { - GenP => "what's" ; - _ => "what" - } ; - n = num - } ; - - ---2 Utterances - --- By utterances we mean whole phrases, such as --- 'can be used as moves in a language game': indicatives, questions, imperative, --- and one-word utterances. The rules are far from complete. --- --- N.B. we have not included rules for texts, which we find we cannot say much --- about on this level. In semantically rich GF grammars, texts, dialogues, etc, --- will of course play an important role as categories not reducible to utterances. --- An example is proof texts, whose semantics show a dependence between premises --- and conclusions. Another example is intersentential anaphora. - - Utterance = SS ; - - indicUtt : Sentence -> Utterance = \x -> ss (x.s ++ ".") ; - interrogUtt : Question -> Utterance = \x -> ss (x.s ! DirQ ++ "?") ; - - ---2 Questions --- --- Questions are either direct ("are you happy") or indirect --- ("if/whether you are happy"). - -param - QuestForm = DirQ | IndirQ ; - -oper - Question = SS1 QuestForm ; - ---3 Yes-no questions --- --- Yes-no questions are used both independently --- ("does John walk" / "if John walks") --- and after interrogative adverbials --- ("why does John walk" / "why John walks"). --- --- It is economical to handle with all these cases by the one --- rule, $questVerbPhrase'$. The word ("ob" / "whether") never appears --- if there is an adverbial. - - questVerbPhrase : NounPhrase -> VerbPhrase -> Question = - questVerbPhrase' False ; - - questVerbPhrase' : Bool -> NounPhrase -> VerbPhrase -> Question = - \adv,john,walk -> - {s = table { - DirQ => if_then_else Str walk.isAux - (indicVerb (verbOfPhrase walk) john.p john.n ++ - john.s ! NomP ++ walk.s2 ! john.n) - (indicVerb verbP3Do john.p john.n ++ - john.s ! NomP ++ walk.s ! InfImp ++ walk.s2 ! john.n) ; - IndirQ => if_then_else Str adv [] (variants {"if" ; "whether"}) ++ - (predVerbPhrase john walk).s - } - } ; - - - ---3 Wh-questions --- --- 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 = \who,walk -> - {s = \\_ => who.s ! NomP ++ indicVerb (verbOfPhrase walk) P3 who.n ++ - walk.s2 ! who.n - } ; - - intSlash : IntPron -> SentenceSlashNounPhrase -> Question = \who,yousee -> - {s = \\q => - let {youSee = case q of { - DirQ => yousee.s ! True ; - IndirQ => yousee.s ! False - } - } in - variants { - who.s ! AccP ++ youSee ++ yousee.s2 ; - yousee.s2 ++ who.s ! GenSP ++ youSee - } - } ; - ---3 Interrogative adverbials --- --- These adverbials will be defined in the lexicon: they include --- "when", "where", "how", "why", etc, which are all invariant one-word --- expressions. In addition, they can be formed by adding prepositions --- to interrogative pronouns, in the same way as adverbials are formed --- from noun phrases. - - IntAdverb = SS ; - - prepIntAdverb : Preposition -> IntPron -> IntAdverb = \at, whom -> - ss (at ++ whom.s ! AccP) ; - --- A question adverbial can be applied to anything, and whether this makes --- sense is a semantic question. - - questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question = - \why, you, walk -> - {s = \\q => why.s ++ (questVerbPhrase' True you walk).s ! q} ; - - ---2 Imperatives --- --- We only consider second-person imperatives. - - Imperative = SS1 Number ; - - imperVerbPhrase : VerbPhrase -> Imperative = \walk -> - {s = \\n => walk.s ! InfImp ++ walk.s2 ! n} ; - - imperUtterance : Number -> Imperative -> Utterance = \n,I -> - ss (I.s ! n ++ "!") ; - ---2 Sentence adverbials --- --- This class covers adverbials such as "otherwise", "therefore", which are prefixed --- to a sentence to form a phrase. - - advSentence : SS -> Sentence -> Utterance = \hence,itiseven -> - ss (hence.s ++ itiseven.s ++ ".") ; - - ---2 Coordination --- --- Coordination is to some extent orthogonal to the rest of syntax, and --- has been treated in a generic way in the module $CO$ in the file --- $coordination.gf$. The overall structure is independent of category, --- but there can be differences in parameter dependencies. --- ---3 Conjunctions --- --- Coordinated phrases are built by using conjunctions, which are either --- simple ("and", "or") or distributed ("both - and", "either - or"). --- --- The conjunction has an inherent number, which is used when conjoining --- noun phrases: "John and Mary are..." vs. "John or Mary is..."; in the --- case of "or", the result is however plural if any of the disjuncts is. - - Conjunction = CO.Conjunction ** {n : Number} ; - ConjunctionDistr = CO.ConjunctionDistr ** {n : Number} ; - ---3 Coordinating sentences --- --- We need a category of lists of sentences. It is a discontinuous --- category, the parts corresponding to 'init' and 'last' segments --- (rather than 'head' and 'tail', because we have to keep track of the slot between --- the last two elements of the list). A list has at least two elements. - - ListSentence : Type = SD2 ; - - twoSentence : (_,_ : Sentence) -> ListSentence = CO.twoSS ; - - consSentence : ListSentence -> Sentence -> ListSentence = - CO.consSS CO.comma ; - --- To coordinate a list of sentences by a simple conjunction, we place --- it between the last two elements; commas are put in the other slots, --- e.g. "du rauchst, er trinkt und ich esse". - - conjunctSentence : Conjunction -> ListSentence -> Sentence = \c,xs -> - ss (CO.conjunctX c xs) ; - --- To coordinate a list of sentences by a distributed conjunction, we place --- the first part (e.g. "either") in front of the first element, the second --- part ("or") between the last two elements, and commas in the other slots. --- For sentences this is really not used. - - conjunctDistrSentence : ConjunctionDistr -> ListSentence -> Sentence = - \c,xs -> - ss (CO.conjunctDistrX c xs) ; - ---3 Coordinating adjective phrases --- --- The structure is the same as for sentences. The result is a prefix adjective --- if and only if all elements are prefix. - - ListAdjPhrase : Type = SD2 ** {p : Bool} ; - - twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y -> - CO.twoStr x.s y.s ** {p = andB x.p y.p} ; - - consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x -> - CO.consStr CO.comma xs x.s ** {p = andB xs.p x.p} ; - - conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs -> - ss (CO.conjunctX c xs) ** {p = xs.p} ; - - conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase = - \c,xs -> - ss (CO.conjunctDistrX c xs) ** {p = xs.p} ; - - ---3 Coordinating noun phrases --- --- The structure is the same as for sentences. The result is either always plural --- or plural if any of the components is, depending on the conjunction. - - ListNounPhrase : Type = {s1,s2 : NPForm => Str ; n : Number ; p : Person} ; - - twoNounPhrase : (_,_ : NounPhrase) -> ListNounPhrase = \x,y -> - CO.twoTable NPForm x y ** {n = conjNumber x.n y.n ; 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 ; p = conjPerson xs.p x.p} ; - - conjunctNounPhrase : Conjunction -> ListNounPhrase -> NounPhrase = \c,xs -> - CO.conjunctTable NPForm c xs ** {n = conjNumber c.n xs.n ; p = xs.p} ; - - conjunctDistrNounPhrase : ConjunctionDistr -> ListNounPhrase -> NounPhrase = - \c,xs -> - CO.conjunctDistrTable NPForm c xs ** {n = conjNumber c.n xs.n ; p = xs.p} ; - --- We have to define a calculus of numbers of persons. For numbers, --- it is like the conjunction with $Pl$ corresponding to $False$. - - conjNumber : Number -> Number -> Number = \m,n -> case <m,n> of { - <Sg,Sg> => Sg ; - _ => Pl - } ; - --- For persons, we let the latter argument win ("either you or I am absent" --- but "either I or you are absent"). This is not quite clear. - - conjPerson : Person -> Person -> Person = \_,p -> - p ; - - - ---2 Subjunction --- --- Subjunctions ("when", "if", etc) --- are a different way to combine sentences than conjunctions. --- The main clause can be a sentences, an imperatives, or a question, --- but the subjoined clause must be a sentence. --- --- There are uniformly two variant word orders, e.g. --- "if you smoke I get angry" --- and "I get angry if you smoke". - - Subjunction = SS ; - - subjunctSentence : Subjunction -> Sentence -> Sentence -> Sentence = - \if, A, B -> - ss (subjunctVariants if A.s B.s) ; - - subjunctImperative : Subjunction -> Sentence -> Imperative -> Imperative = - \if, A, B -> - {s = \\n => subjunctVariants if A.s (B.s ! n)} ; - - subjunctQuestion : Subjunction -> Sentence -> Question -> Question = - \if, A, B -> - {s = \\q => subjunctVariants if A.s (B.s ! q)} ; - - subjunctVariants : Subjunction -> Str -> Str -> Str = \if,A,B -> - variants {if.s ++ A ++ "," ++ B ; B ++ "," ++ if.s ++ A} ; - - subjunctVerbPhrase : VerbPhrase -> Subjunction -> Sentence -> VerbPhrase = - \V, if, A -> - adVerbPhrase V (advPost (if.s ++ A.s)) ; - ---2 One-word utterances --- --- An utterance can consist of one phrase of almost any category, --- the limiting case being one-word utterances. These --- utterances are often (but not always) in what can be called the --- default form of a category, e.g. the nominative. --- This list is far from exhaustive. - - useNounPhrase : NounPhrase -> Utterance = \john -> - postfixSS "." (defaultNounPhrase john) ; - - useCommonNounPhrase : Number -> CommNounPhrase -> Utterance = \n,car -> - useNounPhrase (indefNounPhrase n car) ; - - useRegularName : SS -> NounPhrase = \john -> - nameNounPhrase (nameReg john.s) ; - --- Here are some default forms. - - defaultNounPhrase : NounPhrase -> SS = \john -> - ss (john.s ! NomP) ; - - defaultQuestion : Question -> SS = \whoareyou -> - ss (whoareyou.s ! DirQ) ; - - defaultSentence : Sentence -> Utterance = \x -> - x ; - -} ; diff --git a/grammars/resource/english/TestEng.gf b/grammars/resource/english/TestEng.gf deleted file mode 100644 index 5515cc9de..000000000 --- a/grammars/resource/english/TestEng.gf +++ /dev/null @@ -1,46 +0,0 @@ --- use this path to read the grammar from the same directory ---# -path=.:../abstract:../../prelude - -concrete TestEng of TestAbs = ResEng ** open Syntax in { - -flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ; - --- a random sample from the lexicon - -lin - Big = mkAdjDegr "big" "bigger" "biggest"; - Small = adjDegrReg "small" ; - Old = adjDegrReg "old" ; - Young = adjDegrReg "young" ; - American = simpleAdj "American" ; - Finnish = simpleAdj "Finnish" ; - Married = simpleAdj "married" ** {s2 = "to"} ; - Man = cnHum (mkNoun "man" "men" "man's" "men's") ; - Woman = cnHum (mkNoun "woman" "women" "woman's" "women's") ; - Car = cnNoHum (nounReg "car") ; - House = cnNoHum (nounReg "house") ; - Light = cnNoHum (nounReg "light") ; - Walk = verbNoPart (regVerbP3 "walk") ; - Run = verbNoPart (mkVerb "run" "ran" "run") ; - Say = verbNoPart (mkVerb "say" "said" "said") ; - Prove = verbNoPart (regVerbP3 "prove") ; - Send = mkTransVerbDir (verbNoPart (mkVerb "send" "sent" "sent")) ; - Love = mkTransVerbDir (verbNoPart (verbP3e "love")) ; - Wait = mkTransVerb (verbNoPart (regVerbP3 "wait")) "for" ; - Give = mkDitransVerb (verbNoPart (mkVerb "give" "gave" "given")) [] [] ; - Prefer = mkDitransVerb - (verbNoPart (mkVerb "prefer" "preferred" "preferred")) [] "to" ; - Mother = funOfReg "mother" Hum ; - Uncle = funOfReg "uncle" Hum ; - Connection = cnNoHum (nounReg "connection") ** {s2 = "from" ; s3 = "to"} ; - - Always = advPre "always" ; - Well = advPost "well" ; - - SwitchOn = mkTransVerbPart (verbP3s "switch") "on" ; - SwitchOff = mkTransVerbPart (verbP3s "switch") "off" ; - - John = nameReg "John" ; - Mary = nameReg "Mary" ; - -} ; diff --git a/grammars/resource/english/Types.gf b/grammars/resource/english/Types.gf deleted file mode 100644 index ad96db43b..000000000 --- a/grammars/resource/english/Types.gf +++ /dev/null @@ -1,101 +0,0 @@ ---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 Types = 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. --- Such adjectives are simply strings. - - Adjective : Type = SS ; - AdjDegr = SS1 Degree ; - ---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 | Past Number | PPart ; - -oper - VerbP3 : Type = SS1 VForm ; - --- 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} ; -} ; - diff --git a/grammars/resource/finnish/Finnish.gf b/grammars/resource/finnish/Finnish.gf deleted file mode 100644 index b756afe96..000000000 --- a/grammars/resource/finnish/Finnish.gf +++ /dev/null @@ -1,3 +0,0 @@ ---# -path=.:../abstract:../../prelude - -resource Finnish = reuse ResFin ; diff --git a/grammars/resource/finnish/MorphoFin.gf b/grammars/resource/finnish/MorphoFin.gf deleted file mode 100644 index 5d0ebc1ee..000000000 --- a/grammars/resource/finnish/MorphoFin.gf +++ /dev/null @@ -1,688 +0,0 @@ ---1 A Simple Finnish 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 $TypesFin.gf$. - -resource MorphoFin = TypesFin ** open (Predef = Predef), Prelude in { - ---2 Nouns --- - -oper - --- worst-case macro - - mkSubst : Str -> (_,_,_,_,_,_,_,_,_,_ : Str) -> CommonNoun = - \a,vesi,vede,vete,vetta,veteen,vetii,vesii,vesien,vesia,vesiin -> - {s = table { - NCase Sg Nom => vesi ; - NCase Sg Gen => vede + "n" ; - NCase Sg Part => vetta ; - NCase Sg Transl => vede + "ksi" ; - NCase Sg Ess => vete + ("n" + a) ; - NCase Sg Iness => vede + ("ss" + a) ; - NCase Sg Elat => vede + ("st" + a) ; - NCase Sg Illat => veteen ; - NCase Sg Adess => vede + ("ll" + a) ; - NCase Sg Ablat => vede + ("lt" + a) ; - NCase Sg Allat => vede + "lle" ; - - NCase Pl Nom => vede + "t" ; - NCase Pl Gen => vesien ; - NCase Pl Part => vesia ; - NCase Pl Transl => vesii + "ksi" ; - NCase Pl Ess => vetii + ("n" + a) ; - NCase Pl Iness => vesii + ("ss" + a) ; - NCase Pl Elat => vesii + ("st" + a) ; - NCase Pl Illat => vesiin ; - NCase Pl Adess => vesii + ("ll" + a) ; - NCase Pl Ablat => vesii + ("lt" + a) ; - NCase Pl Allat => vesii + "lle" ; - - NPossNom => vete ; - NPossGenPl => Predef.tk 1 vesien ; - NPossTransl Sg => vede + "kse" ; - NPossTransl Pl => vesii + "kse" ; - NPossIllat Sg => Predef.tk 1 veteen ; - NPossIllat Pl => Predef.tk 1 vesiin - } - } ; - --- A user-friendly variant takes existing forms and infers the vowel harmony. - - mkNoun : (_,_,_,_,_,_,_,_,_,_ : Str) -> CommonNoun = - \talo,talon,talona,taloa,taloon,taloina,taloissa,talojen,taloja,taloihin -> - mkSubst (ifTok Str (Predef.dp 1 talona) "a" "a" "ä") - talo (Predef.tk 1 talon) (Predef.tk 2 talona) taloa taloon - (Predef.tk 2 taloina) (Predef.tk 3 taloissa) talojen taloja taloihin ; - --- Here some useful special cases; more will be given in $paradigms.Fin.gf$. --- --- Nouns with partitive "a"/"ä" ; --- to account for grade and vowel alternation, three forms are usually enough --- Examples: "talo", "kukko", "huippu", "koira", "kukka", "syylä",... - - sKukko : (_,_,_ : Str) -> CommonNoun = \kukko,kukon,kukkoja -> - let { - o = Predef.dp 1 kukko ; - a = Predef.dp 1 kukkoja ; - kukkoj = Predef.tk 1 kukkoja ; - i = Predef.dp 1 kukkoj ; - ifi = ifTok Str i "i" ; - kukkoi = ifi kukkoj (Predef.tk 1 kukkoj) ; - e = Predef.dp 1 kukkoi ; - kukoi = Predef.tk 2 kukon + Predef.dp 1 kukkoi - } - in - mkSubst a - kukko - (Predef.tk 1 kukon) - kukko - (kukko + a) - (kukko + o + "n") - (kukkoi + ifi "" "i") - (kukoi + ifi "" "i") - (ifTok Str e "e" (Predef.tk 1 kukkoi + "ien") (kukkoi + ifi "en" "jen")) - kukkoja - (kukkoi + ifi "in" "ihin") ; - --- The special case with no alternations: the vowel harmony is inferred from the --- last letter - which must be one of "o", "u", "ö", "y". - - sTalo : Str -> CommonNoun = \talo -> - let {a = getHarmony (Predef.dp 1 talo)} in - sKukko talo (talo + "n") (talo + ("j" + a)) ; - --- Loan words ending in consonants are actually similar to words like --- "malli"/"mallin"/"malleja", with the exception that the "i" is not attached --- to the singular nominative. - - sLinux : Str -> CommonNoun = \linuxia -> - let { - linux = Predef.tk 2 linuxia ; - a = getHarmony (Predef.dp 1 linuxia) ; - linuxi = linux + "i" - } in - mkSubst a - linux - linuxi - linuxi - (linuxi + a) - (linuxi + "in") - (linux + "ei") - (linux + "ei") - (linux + "ien") - (linux + "eja") - (linux + "eihin") ; - --- Nouns of at least 3 syllables ending with "a" or "ä", like "peruna", "rytinä". - - sPeruna : Str -> CommonNoun = \peruna -> - let { - a = Predef.dp 1 peruna ; - perun = Predef.tk 1 peruna ; - perunoi = perun + (ifTok Str a "a" "o" "ö" + "i") - } - in - mkSubst a - peruna - peruna - peruna - (peruna + a) - (peruna + a + "n") - perunoi - perunoi - (perunoi + "den") - (perunoi + ("t" + a)) - (perunoi + "hin") ; - --- Surpraisingly, making the test for the partitive, this not only covers --- "rae", "perhe", "savuke", but also "rengas", "lyhyt" (except $Sg Illat$), etc. - - sRae : (_,_ : Str) -> CommonNoun = \rae,rakeena -> - let { - a = Predef.dp 1 rakeena ; - rakee = Predef.tk 2 rakeena ; - rakei = Predef.tk 1 rakee + "i" ; - raet = rae + (ifTok Str (Predef.dp 1 rae) "e" "t" []) - } - in - mkSubst a - rae - rakee - rakee - (raet + ("t" + a)) - (rakee + "seen") - rakei - rakei - (rakei + "den") - (rakei + ("t" + a)) - (rakei + "siin") ; - - sSusi : (_,_,_ : Str) -> CommonNoun = \susi,suden,sutena -> - let { - a = Predef.dp 1 sutena ; - sude = Predef.tk 1 suden ; - sute = Predef.tk 2 sutena - } - in - mkSubst a - susi - sude - sute - (Predef.tk 1 sute + ("t" + a)) - (sute + "en") - susi - susi - (susi + "en") - (susi + a) - (susi + "in") ; - - sPuu : Str -> CommonNoun = \puu -> - let { - u = Predef.dp 1 puu ; - a = getHarmony u ; - pu = Predef.tk 1 puu ; - pui = pu + "i" - } - in - mkSubst a - puu - puu - puu - (puu + ("t" + a)) - (puu + ("h" + u + "n")) - pui - pui - (pui + "den") - (pui + ("t" + a)) - (pui + "hin") ; - - sSuo : Str -> CommonNoun = \suo -> - let { - o = Predef.dp 1 suo ; - a = getHarmony o ; - soi = Predef.tk 2 suo + (o + "i") - } - in - mkSubst a - suo - suo - suo - (suo + ("t" + a)) - (suo + ("h" + o + "n")) - soi - soi - (soi + "den") - (soi + ("t" + a)) - (soi + "hin") ; - --- Here in fact it is handy to use the partitive form as the only stem. - - sNainen : Str -> CommonNoun = \naista -> - let { - nainen = Predef.tk 3 naista + "nen" ; - nais = Predef.tk 2 naista ; - naise = nais + "e" ; - naisi = nais + "i" ; - a = Predef.dp 1 naista - } - in - mkSubst a - nainen - naise - naise - (nais + ("t" + a)) - (nais + "een") - naisi - naisi - (nais + "ten") - (nais + ("i" + a)) - (nais + "iin") ; - --- The following covers: "tilaus", "kaulin", "paimen", "laidun", "sammal", --- "kyynel" (excep $Sg Iness$ for the last two?). - - sTilaus : (_,_ : Str) -> CommonNoun = \tilaus, tilauksena -> - let { - tilauks = Predef.tk 3 tilauksena ; - tilaukse = tilauks + "e" ; - tilauksi = tilauks + "i" ; - a = Predef.dp 1 tilauksena - } - in - mkSubst a - tilaus - tilaukse - tilaukse - (tilaus + ("t" + a)) - (tilauks + "een") - tilauksi - tilauksi - (tilaus + "ten") - (tilauks + ("i" + a)) - (tilauks + "iin") ; - --- Some words have the three grades ("rakkaus","rakkauden","rakkautena"), which --- are however derivable from the stem. - - sRakkaus : Str -> CommonNoun = \rakkaus -> - let { - rakkau = Predef.tk 1 rakkaus ; - rakkaut = rakkau + "t" ; - rakkaute = rakkau + "te" ; - rakkaude = rakkau + "de" ; - rakkauksi = rakkau + "ksi" ; - u = Predef.dp 1 rakkau ; - a = ifTok Str u "u" "a" "ä" - } - in - mkSubst a - rakkaus - rakkaude - rakkaute - (rakkaut + ("t" + a)) - (rakkaut + "een") - rakkauksi - rakkauksi - (rakkauksi + "en") - (rakkauksi + a) - (rakkauksi + "in") ; - --- The following covers nouns like "nauris" and adjectives like "kallis", "tyyris". - - sNauris : (_ : Str) -> CommonNoun = \naurista -> - let { - a = Predef.dp 1 naurista ; - nauris = Predef.tk 2 naurista ; - nauri = Predef.tk 3 naurista ; - naurii = nauri + "i" - } - in - mkSubst a - nauris - naurii - naurii - (nauris + ("t" + a)) - (naurii + "seen") - naurii - naurii - (naurii + "den") - (naurii + ("t" + a)) - (naurii + "siin") ; - --- The following two are used for adjective comparison. - - sSuurempi : Str -> CommonNoun = \suurempaa -> - let { - a = Predef.dp 1 suurempaa ; - suure = Predef.tk 4 suurempaa ; - suurempi = suure + "mpi" ; - suurempa = suure + ("mp" + a) ; - suuremm = suure + "mm" - } - in - mkSubst a - suurempi - (suuremm + a) - suurempa - (suurempa + a) - (suurempa + (a + "n")) - suurempi - (suuremm + "i") - (suurempi + "en") - (suurempi + a) - (suurempi + "in") ; - - sSuurin : Str -> CommonNoun = \suurinta -> - let { - a = Predef.dp 1 suurinta ; - suuri = Predef.tk 3 suurinta ; - suurin = suuri + "n" ; - suurimma = suuri + ("mm" + a) ; - suurimpa = suuri + ("mp" + a) ; - suurimpi = suuri + "mpi" ; - suurimmi = suuri + "mmi" - } - in - mkSubst a - suurin - suurimma - suurimpa - (suurin + ("t" + a)) - (suurimpa + (a + "n")) - suurimpi - suurimmi - (suurimpi + "en") - (suurimpi + a) - (suurimpi + "in") ; - --- This auxiliary resolves vowel harmony from a given letter. - -getHarmony : Str -> Str = \u -> - ifTok Str u "a" "a" ( - ifTok Str u "o" "a" ( - ifTok Str u "u" "a" "ä")) ; - - --- We could use an extension of the following for grade alternation, but we don't; --- in general, *whether there is* grade alternation must be given in the lexicon --- anyway (cf. "auto" - "auton", not "audon"). - - weakGrade : Str -> Str = \kukko -> - let { - ku = Predef.tk 3 kukko ; - kk = Predef.tk 1 (Predef.dp 3 kukko) ; - o = Predef.dp 1 kukko ; - ifkk = ifTok Str kk ; - k = - ifkk "kk" "k" ( - ifkk "pp" "p" ( - ifkk "tt" "t" ( - ifkk "nt" "nn" ( - ifkk "mp" "mm" ( - ifkk "rt" "rr" ( - ifkk "lt" "ll" ( - kk))))))) - } - in ku + k + o ; - - ---3 Proper names --- --- Proper names are similar to common nouns in the singular. - - mkProperName : CommonNoun -> ProperName = \jussi -> - {s = \\c => jussi.s ! NCase Sg c} ; - ---2 Pronouns --- --- Here we define personal and relative pronouns. - - mkPronoun : (_,_,_,_,_ : Str) -> Number -> Person -> Pronoun = - \mina, minun, minua, minuna, minuun, n, p -> - let { - minu = Predef.tk 2 minuna ; - a = Predef.dp 1 minuna - } in - {s = table { - PCase Nom => mina ; - PCase Gen => minun ; - PCase Part => minua ; - PCase Transl => minu + "ksi" ; - PCase Ess => minuna ; - PCase Iness => minu + ("ss" + a) ; - PCase Elat => minu + ("st" + a) ; - PCase Illat => minuun ; - PCase Adess => minu + ("ll" + a) ; - PCase Ablat => minu + ("lt" + a) ; - PCase Allat => minu + "lle" ; - PAcc => Predef.tk 1 minun + "t" - } ; - n = n ; p = p} ; - - pronMina = mkPronoun "minä" "minun" "minua" "minuna" "minuun" Sg P1 ; - pronSina = mkPronoun "sinä" "sinun" "sinua" "sinuna" "sinuun" Sg P2 ; - pronHan = mkPronoun "hän" "hänen" "häntä" "hänenä" "häneen" Sg P3 ; - pronMe = mkPronoun "me" "meidän" "meitä" "meinä" "meihin" Pl P1 ; - pronTe = mkPronoun "te" "teidän" "teitä" "teinä" "teihin" Pl P2 ; - pronHe = mkPronoun "he" "heidän" "heitä" "heinä" "heihin" Pl P3 ; - pronNe = mkPronoun "ne" "niiden" "niitä" "niinä" "niihin" Pl P3 ; - --- The non-human pronoun "se" ('it') is even more irregular, --- Its accusative cases do not --- have a special form with "t", but have the normal genitive/nominative variation. --- We use the type $ProperName$ for "se", because of the accusative but also --- because the person and number are as for proper names. - - pronSe : ProperName = { - s = table { - Nom => "se" ; - Gen => "sen" ; - Part => "sitä" ; - Transl => "siksi" ; - Ess => "sinä" ; - Iness => "siinä" ; - Elat => "siitä" ; - Illat => "siihen" ; - Adess => "sillä" ; - Ablat => "siltä" ; - Allat => "sille" - } ; - } ; - --- The possessive suffixes will be needed in syntax. It will show up --- as a separate word ("auto &+ ni"), which needs unlexing. Unlexing also --- has to fix the vowel harmony in cases like "äiti &+ nsä". - - suff : Str -> Str = \ni -> BIND ++ ni ; - - possSuffix : Number => Person => Str = \\n,p => - suff (case <n,p> of { - <Sg,P1> => "ni" ; - <Sg,P2> => "si" ; - <Sg,P3> => "nsa" ; - <Pl,P1> => "mme" ; - <Pl,P2> => "nne" ; - <Pl,P3> => "nsa" - } ) ; - --- The relative pronoun, "joka", is inflected in case and number, --- like common nouns, but it does not take possessive suffixes. --- The inflextion shows a surprising similarity with "suo". - - relPron : RelPron = - let {jo = sSuo "jo"} in {s = - table { - Sg => table { - Nom => "joka" ; - Gen => "jonka" ; - c => jo.s ! NCase Sg c - } ; - Pl => table { - Nom => "jotka" ; - c => "j" + (jo.s ! NCase Pl c) - } - } - } ; - - mikaInt : Number => Case => Str = - let { - mi = sSuo "mi" - } in - table { - Sg => table { - Nom => "mikä" ; - Gen => "minkä" ; - c => mi.s ! NCase Sg c - } ; - Pl => table { - Nom => "mitkä" ; - Gen => "mittenkä" ; - c => mi.s ! NCase Sg c - } - } ; - - kukaInt : Number => Case => Str = - let { - ku = sRae "kuka" "kenenä" ; - ket = sRae "kuka" "keinä"} in - table { - Sg => table { - Nom => "kuka" ; - Part => "ketä" ; - Illat => "keneen" ; - c => ku.s ! NCase Sg c - } ; - Pl => table { - Nom => "ketkä" ; - Illat => "keihin" ; - c => ket.s ! NCase Pl c - } - } ; - -caseTable : Number -> CommonNoun -> Case => Str = \n,cn -> - \\c => cn.s ! NCase n c ; - - ---2 Adjectives --- --- For the comparison of adjectives, three noun declensions --- are needed in the worst case. - - mkAdjDegr : (_,_,_ : CommonNoun) -> AdjDegr = \hyva,parempi,paras -> - {s = table { - Pos => hyva.s ; - Comp => parempi.s ; - Sup => paras.s - } - } ; - --- However, it is usually enough to give the positive declension and --- the characteristic forms of comparative and superlative. - - regAdjDegr : CommonNoun -> Str -> Str -> AdjDegr = \kiva, kivempaa, kivinta -> - mkAdjDegr kiva (sSuurempi kivempaa) (sSuurin kivinta) ; - - ---3 Verbs --- - - mkVerb : (_,_,_,_,_,_ : Str) -> Verb = - \tulla,tulen,tulee,tulevat,tulkaa,tullaan -> - let { - tule = Predef.tk 1 tulen ; - a = Predef.dp 1 tulkaa - } in - {s = table { - Inf => tulla ; - Ind Sg P1 => tulen ; - Ind Sg P2 => tule + "t" ; - Ind Sg P3 => tulee ; - Ind Pl P1 => tule + "mme" ; - Ind Pl P2 => tule + "tte" ; - Ind Pl P3 => tulevat ; - Imper Sg => tule ; - Imper Pl => tulkaa ; - ImpNegPl => Predef.tk 2 tulkaa + (ifTok Str a "a" "o" "ö") ; - Pass True => tullaan ; - Pass False => Predef.tk 2 tullaan - } - } ; - --- For "sanoa", "valua", "kysyä". - - vSanoa : Str -> Verb = \sanoa -> - let { - a = Predef.dp 1 sanoa ; - sano = Predef.tk 1 sanoa ; - o = Predef.dp 1 sano - } in - mkVerb - sanoa - (sano + "n") - (sano + o) - (sano + (("v" + a) + "t")) - (sano + (("k" + a) + a)) - (sano + ((("t" + a) + a) + "n")) ; - --- For "ottaa", "käyttää", "löytää", "huoltaa", "hiihtää", "siirtää". - - vOttaa : (_,_ : Str) -> Verb = \ottaa,otan -> - let { - a = Predef.dp 1 ottaa ; - ota = Predef.tk 1 otan ; - otta = Predef.tk 1 ottaa ; - ote = Predef.tk 1 ota + "e" - } in - mkVerb - ottaa - (ota + "n") - ottaa - (otta + (("v" + a) + "t")) - (otta + (("k" + a) + a)) - (ote + ((("t" + a) + a) + "n")) ; - --- For "poistaa", "ryystää". - - vPoistaa : Str -> Verb = \poistaa -> - vOttaa poistaa (Predef.tk 1 poistaa + "n") ; - --- For "juosta", "piestä", "nousta", "rangaista", "kävellä", "surra", "panna". - - vJuosta : (_,_ : Str) -> Verb = \juosta,juoksen -> - let { - a = Predef.dp 1 juosta ; - juokse = Predef.tk 1 juoksen ; - juos = Predef.tk 2 juosta - } in - mkVerb - juosta - juoksen - (juokse + "e") - (juokse + (("v" + a) + "t")) - (juos + (("k" + a) + a)) - (juosta + (a + "n")) ; - --- For "juoda", "syödä". - - vJuoda : Str -> Verb = \juoda -> - let { - a = Predef.dp 1 juoda ; - juo = Predef.tk 2 juoda - } in - mkVerb - juoda - (juo + "n") - juo - (juo + (("v" + a) + "t")) - (juo + (("k" + a) + a)) - (juoda + (a + "n")) ; - - - verbOlla : Verb = mkVerb "olla" "olen" "on" "ovat" "olkaa" "ollaan" ; - --- The negating operator "ei" is actually a verb, which has present --- active indicative and imperative forms, but no infinitive. - - verbEi : Verb = - let {ei = mkVerb nonExist "en" "ei" "eivät" "älkää" "ei"} in - {s = table { - Ind Pl P3 => "eivät" ; - v => ei.s ! v - } - } ; - - ---2 Some structural words - - kuinConj = "kuin" ; - - conjEtta = "että" ; - advSiten = "siten" ; - - mikakukaInt : Gender => Number => Case => Str = - table { - NonHuman => mikaInt ; - Human => kukaInt - } ; - - kaikkiPron : Case => Str = - let {kaiket = caseTable Pl (sKukko "kaikki" "kaiken" "kaikkia")} in - table { - Nom => "kaikki" ; - c => kaiket ! c - } ; - - stopPunct = "." ; - commaPunct = "," ; - questPunct = "?" ; - exclPunct = "!" ; - - koPart = suff "ko" ; - -} ; diff --git a/grammars/resource/finnish/ParadigmsFin.gf b/grammars/resource/finnish/ParadigmsFin.gf deleted file mode 100644 index a970c4d85..000000000 --- a/grammars/resource/finnish/ParadigmsFin.gf +++ /dev/null @@ -1,260 +0,0 @@ ---1 Finnish Lexical Paradigms --- --- Aarne Ranta 2003 --- --- This is an API to the user of the resource grammar --- for adding lexical items. It give shortcuts for forming --- expressions of basic categories: nouns, adjectives, verbs. --- --- Closed categories (determiners, pronouns, conjunctions) are --- accessed through the resource syntax API, $resource.Abs.gf$. --- --- The main difference with $morpho.Fin.gf$ is that the types --- referred to are compiled resource grammar types. We have moreover --- had the design principle of always having existing forms as string --- arguments of the paradigms, not stems. --- --- This is the path to read the grammar from the same directory. ---# -path=.:../abstract:../../prelude --- --- The following modules are presupposed: - -resource ParadigmsFin = open (Predef=Predef), Prelude, SyntaxFin, Finnish in { - ---2 Parameters --- --- To abstract over gender, number, and (some) case names, --- we define the following identifiers. - -oper - human : Gender ; - nonhuman : Gender ; - - -- singular : Number ; - -- singular : Number ; - - nominative : Case ; - genitive : Case ; - partitive : Case ; - inessive : Case ; - elative : Case ; - illative : Case ; - adessive : Case ; - ablative : Case ; - allative : Case ; - ---2 Nouns - --- Worst case: give ten forms and the semantic gender. --- In practice just a couple of forms are needed, to define the different --- stems, vowel alternation, and vowel harmony. - -oper - mkN : (talo,talon,talona,taloa,taloon,taloina,taloissa,talojen,taloja,taloihin - : Str) -> Gender -> N ; - --- Nouns with partitive "a"/"ä" are a large group. --- To determine for grade and vowel alternation, three forms are usually needed: --- singular nominative and genitive, and plural partitive. --- Examples: "talo", "kukko", "huippu", "koira", "kukka", "syylä", "särki"... - - nKukko : (kukko,kukon,kukkoja : Str) -> Gender -> N ; - --- A special case are nouns with no alternations: --- the vowel harmony is inferred from the last letter, --- which must be one of "o", "u", "ö", "y". - - nTalo : (talo : Str) -> Gender -> N ; - --- Foreign words ending in consonants are actually similar to words like --- "malli"/"mallin"/"malleja", with the exception that the "i" is not attached --- to the singular nominative. Examples: "linux", "savett", "screen". --- The singular partitive form is used to get the vowel harmony. (N.B. more than --- 1-syllabic words ending in "n" would have variant plural genitive and --- partitive forms, like "sultanien"/"sultaneiden", which are not covered.) - - nLinux : (linuxia : Str) -> Gender -> N ; - --- Nouns of at least 3 syllables ending with "a" or "ä", like "peruna", "tavara", --- "rytinä". - - nPeruna : (peruna : Str) -> Gender -> N ; - --- The following paradigm covers both nouns ending in an aspirated "e", such as --- "rae", "perhe", "savuke", and also many ones ending in a consonant --- ("rengas", "kätkyt"). The singular nominative and essive are given. - - nRae : (rae, rakeena : Str) -> Gender -> N ; - --- The following covers nouns with partitive "ta"/"tä", such as --- "susi", "vesi", "pieni". To get all stems and the vowel harmony, it takes --- the singular nominative, genitive, and essive. - - nSusi : (susi,suden,sutta : Str) -> Gender -> N ; - --- Nouns ending with a long vowel, such as "puu", "pää", "pii", "leikkuu", --- are inflected according to the following. - - nPuu : (puu : Str) -> Gender -> N ; - --- One-syllable diphthong nouns, such as "suo", "tie", "työ", are inflected by --- the following. - - nSuo : (suo : Str) -> Gender -> N ; - --- Many adjectives but also nouns have the nominative ending "nen" which in other --- cases becomes "s": "nainen", "ihminen", "keltainen". --- To capture the vowel harmony, we use the partitive form as the argument. - - nNainen : (naista : Str) -> Gender -> N ; - --- The following covers some nouns ending with a consonant, e.g. --- "tilaus", "kaulin", "paimen", "laidun". - - nTilaus : (tilaus,tilauksena : Str) -> Gender -> N ; - --- The following covers nouns like "nauris" and adjectives like "kallis", "tyyris". --- The partitive form is taken to get the vowel harmony. - - nNauris : (naurista : Str) -> Gender -> N ; - --- Separately-written compound nouns, like "sambal oelek", "Urho Kekkonen", --- have only their last part inflected. - - nComp : Str -> N -> N ; - --- Nouns used as functions need a case, of which by far the commonest is --- the genitive. - - mkFun : N -> Case -> Fun ; - fGen : N -> Fun ; - --- Proper names can be formed by using declensions for nouns. - - mkPN : N -> PN ; - - ---2 Adjectives - --- Non-comparison one-place adjectives are just like nouns. - - mkAdj1 : N -> Adj1 ; - --- Two-place adjectives need a case for the second argument. - - mkAdj2 : N -> Case -> Adj2 ; - --- Comparison adjectives have three forms. The comparative and the superlative --- are always inflected in the same way, so the nominative of them is actually --- enough (except for the superlative "paras" of "hyvä"). - - mkAdjDeg : (kiva : N) -> (kivempaa,kivinta : Str) -> AdjDeg ; - - ---2 Verbs --- --- The fragment only has present tense so far, but in all persons. --- The worst case needs five forms, as shown in the following. - - mkV : (tulla,tulen,tulee,tulevat,tulkaa,tullaan : Str) -> V ; - --- A simple special case is the one with just one stem and no grade alternation. --- It covers e.g. "sanoa", "valua", "kysyä". - - vValua : (valua : Str) -> V ; - --- With two forms, the following function covers a variety of verbs, such as --- "ottaa", "käyttää", "löytää", "huoltaa", "hiihtää", "siirtää". - - vKattaa : (kattaa, katan : Str) -> V ; - --- When grade alternation is not present, just a one-form special case is needed --- ("poistaa", "ryystää"). - - vOstaa : (ostaa : Str) -> V ; - --- The following covers --- "juosta", "piestä", "nousta", "rangaista", "kävellä", "surra", "panna". - - vNousta : (nousta, nousen : Str) -> V ; - --- This is for one-syllable diphthong verbs like "juoda", "syödä". - - vTuoda : (tuoda : Str) -> V ; - --- The verbs "be" and the negative auxiliary are special. - - vOlla : V ; - vEi : V ; - --- Two-place verbs need a case, and can have a pre- or postposition. --- At least one of the latter is empty, $[]$. - - mkTV : V -> Case -> (prep,postp : Str) -> TV ; - --- If both are empty, the following special function can be used. - - tvCase : V -> Case -> TV ; - --- Verbs with a direct (accusative) object --- are special, since their complement case is finally decided in syntax. - - tvDir : V -> TV ; - --- The definitions should not bother the user of the API. So they are --- hidden from the document. ---. - -- singular defined in types.Fin - -- plural defined in types.Fin - - human = Human ; - nonhuman = NonHuman ; - - nominative = Nom ; - genitive = Gen ; - partitive = Part ; - inessive = Iness ; - elative = Elat ; - illative = Illat ; - adessive = Adess ; - ablative = Ablat ; - allative = Allat ; - - mkN = \a,b,c,d,e,f,g,h,i,j,k -> - mkNoun a b c d e f g h i j ** {g = k ; lock_N = <>} ; - - nKukko = \a,b,c,g -> sKukko a b c ** {g = g ; lock_N = <>} ; - nTalo = \a,g -> sTalo a ** {g = g ; lock_N = <>} ; - nLinux = \a,g -> sLinux a ** {g = g ; lock_N = <>} ; - nPeruna = \a,g -> sPeruna a ** {g = g ; lock_N = <>} ; - nRae = \a,b,g -> sRae a b ** {g = g ; lock_N = <>} ; - nSusi = \a,b,c,g -> sSusi a b c ** {g = g ; lock_N = <>} ; - nPuu = \a,g -> sPuu a ** {g = g ; lock_N = <>} ; - nSuo = \a,g -> sSuo a ** {g = g ; lock_N = <>} ; - nNainen = \a,g -> sNainen a ** {g = g ; lock_N = <>} ; - nTilaus = \a,b,g -> sTilaus a b ** {g = g ; lock_N = <>} ; - nNauris = \a,g -> sNauris a ** {g = g ; lock_N = <>} ; - - - nComp = \s,n -> {s = \\c => s ++ n.s ! c ; g = n.g ; lock_N = <>} ; - mkFun = \n,c -> n2n n ** {c = NPCase c ; lock_Fun = <>} ; - fGen = \n -> mkFun n genitive ; - mkPN n = mkProperName n ** {lock_PN = <>} ; - - mkAdj1 = \x -> {s = x.s ; lock_Adj1 = <>} ; - mkAdj2 = \x,c -> mkAdj1 x ** {c = NPCase c ; lock_Adj2 = <>} ; - mkAdjDeg x y z = regAdjDegr x y z ** {lock_AdjDeg = <>} ; - - mkV a b c d e f = mkVerb a b c d e f ** {lock_V = <>} ; - vValua v = vSanoa v ** {lock_V = <>} ; - vKattaa v u = vOttaa v u ** {lock_V = <>} ; - vOstaa v = vPoistaa v ** {lock_V = <>} ; - vNousta v u = vJuosta v u ** {lock_V = <>} ; - vTuoda v = vJuoda v ** {lock_V = <>} ; - vOlla = verbOlla ** {lock_V = <>} ; - vEi = verbEi ** {lock_V = <>} ; - - mkTV = \v,c,p,o -> v ** {s3 = p ; s4 = o ; c = c ; lock_TV = <>} ; - tvCase = \v,c -> mkTV v c [] [] ; - tvDir v = mkTransVerbDir v ** {lock_TV = <>} ; -} ; diff --git a/grammars/resource/finnish/ResFin.gf b/grammars/resource/finnish/ResFin.gf deleted file mode 100644 index d29eb7195..000000000 --- a/grammars/resource/finnish/ResFin.gf +++ /dev/null @@ -1,222 +0,0 @@ ---1 The Top-Level Finnish Resource Grammar --- --- Aarne Ranta 2002 -- 2003 --- --- This is the Finnish concrete syntax of the multilingual resource --- grammar. Most of the work is done in the file $syntax.Fin.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 $TypesFin.gf$. - -concrete ResFin of ResAbs = open Prelude, SyntaxFin in { - -flags - startcat=Phr ; - lexer=unglue ; - unlexer=glue ; - -lincat - N = CommNoun ; - -- = {s : NForm => Str ; g : Gender} - CN = CommNounPhrase ; - NP = {s : NPForm => Str ; n : Number ; p : NPPerson} ; - PN = {s : Case => Str} ; - Det = {s : Gender => Case => Str ; n : Number} ; - Fun = Function ; - -- = CommNounPhrase ** {c : NPForm} ; - Fun2 = Function ** {c2 : NPForm} ; - - Adj1 = Adjective ; - -- = CommonNoun - Adj2 = Adjective ** {c : NPForm} ; - AdjDeg = {s : Degree => NForm => Str} ; - AP = {s : AdjPos => Number => Case => Str} ; - - V = Verb ; - -- = {s : VForm => Str} - VP = Verb ** {s2 : VForm => Str ; c : ComplCase} ; - TV = TransVerb ; - -- = Verb ** {s3, s4 : Str ; c : ComplCase} ; - V3 = TransVerb ** {s5, s6 : Str ; c2 : ComplCase} ; - VS = Verb ; - - AdV = {s : Str} ; - - S = Sentence ; - -- = {s : Str} ; - Slash = Sentence ** {s2 : Str ; c : Case} ; - - RP = {s : Number => Case => Str} ; - RC = {s : Number => Str} ; - - IP = {s : NPForm => Str ; n : Number} ; - Qu = {s : Str} ; - Imp = {s : Number => Str} ; - Phr = {s : Str} ; - - Conj = {s : Str ; n : Number} ; - ConjD = {s1 : Str ; s2 : Str ; n : Number} ; - - ListS = {s1 : Str ; s2 : Str} ; - ListAP = {s1,s2 : AdjPos => Number => Case => Str} ; - ListNP = {s1,s2 : NPForm => Str ; n : Number ; p : NPPerson} ; - ---. - -lin - UseN = noun2CommNounPhrase ; - ModAdj = modCommNounPhrase ; - ModGenOne = npGenDet singular ; - ModGenMany = 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 ; - IndefManyNP = indefNounPhrase plural ; - DefOneNP = defNounPhrase singular ; - DefManyNP = defNounPhrase plural ; - - CNthatS = nounThatSentence ; - - PredVP = predVerbPhrase ; - PosV = predVerb True ; - NegV = predVerb False ; - PosA = predAdjective True ; - NegA = predAdjective False ; - PosCN = predCommNoun True ; - NegCN = predCommNoun False ; - PosTV = complTransVerb True ; - NegTV = complTransVerb False ; - PosV3 = complDitransVerb True ; - NegV3 = complDitransVerb False ; - PosPassV = passVerb True ; - NegPassV = passVerb False ; - PosNP = predNounPhrase True ; - NegNP = predNounPhrase False ; - PosVS = complSentVerb True ; - NegVS = complSentVerb False ; - VTrans = transAsVerb ; - - AdvVP = adVerbPhrase ; - LocNP = locativeNounPhrase ; - AdvCN = advCommNounPhrase ; - AdvAP = advAdjPhrase ; - - PosSlashTV = slashTransVerb True ; - NegSlashTV = slashTransVerb False ; - OneVP = passPredVerbPhrase ; - - 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 ; - - ImperVP = imperVerbPhrase ; - - IndicPhrase = indicUtt ; - QuestPhrase = interrogUtt ; - ImperOne = imperUtterance singular ; - ImperMany = imperUtterance plural ; - - AdvS = advSentence ; - -lin - 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 ; - -lin - INP = pronNounPhrase pronMina ; - ThouNP = pronNounPhrase pronSina ; - HeNP = pronNounPhrase pronHan ; - SheNP = pronNounPhrase pronHan ; - ItNP = nameNounPhrase pronSe ; - WeNP = pronNounPhrase pronMe ; - YeNP = pronNounPhrase pronTe ; - YouNP = pronNounPhrase pronTe ; - TheyNP = pronNounPhrase pronHe ; --- ne - - EveryDet = jokainenDet ; - AllDet = kaikkiDet ; - WhichDet = mikaDet ; - MostDet = useimmatDet ; - - HowIAdv = ss "kuinka" ; - WhenIAdv = ss "koska" ; - WhereIAdv = ss "missä" ; - WhyIAdv = ss "miksi" ; - - AndConj = ss "ja" ** {n = Pl} ; - OrConj = ss "tai" ** {n = Sg} ; - BothAnd = sd2 "sekä" "että" ** {n = Pl} ; - EitherOr = sd2 "joko" "tai" ** {n = Sg} ; - NeitherNor = sd2 "ei" "eikä" ** {n = Sg} ; - IfSubj = ss "jos" ; - WhenSubj = ss "kun" ; - - PhrYes = ss ("Kyllä" ++ stopPunct) ; - PhrNo = ss ("Ei" ++ stopPunct) ; - - VeryAdv = ss "hyvin" ; - TooAdv = ss "liian" ; - OtherwiseAdv = ss "muuten" ; - ThereforeAdv = ss "siksi" ; - -} ; diff --git a/grammars/resource/finnish/SyntaxFin.gf b/grammars/resource/finnish/SyntaxFin.gf deleted file mode 100644 index 1f7af543b..000000000 --- a/grammars/resource/finnish/SyntaxFin.gf +++ /dev/null @@ -1,1028 +0,0 @@ ---1 A Small Finnish Resource Syntax --- --- Aarne Ranta 2003 --- --- This resource grammar contains definitions needed to construct --- indicative, interrogative, and imperative sentences in Finnish. --- --- The following files are presupposed: - -resource SyntaxFin = MorphoFin ** open Prelude, (CO = Coordination) in { - ---2 Common Nouns --- --- Simple common nouns are defined as the type $CommNoun$ in $MorphoFin$. - ---3 Common noun phrases - --- In Finnish, common noun phrases behave like simple common nouns, except that --- we need a kind of a *gender* parameter telling if the noun is human or not. --- This parameter regulates determiners such as "joku"/"jokin" ('some') and --- "kuka"/"mikä" ('which'). --- --- A subtle reason forces us to distinguish the parameters of common noun phrases --- from those of morphological common nouns: the parameter value $NPossNom$ is --- syntactically applicable to each of $Sg Nom$, $Pl Nom$, $Sg Gen$. In morphology, --- these forms are always the same ("autoni"), but with complex common nouns, we --- have three different forms: "iso autoni", "isot autoni", "ison autoni". - -oper - CommNoun = {s : NForm => Str ; g : Gender} ; - - CommNounPhrase = {s : Bool => Number => Case => Str ; g : Gender} ; - - noun2CommNounPhrase : CommNoun -> CommNounPhrase = \man -> - useCN man ** {g = man.g} ; - - n2n = noun2CommNounPhrase ; - - useCN : CommonNoun -> {s : Bool => Number => Case => Str} = \auto -> - {s = table { - True => \\n,c => case <n,c> of { - <_, Nom> => auto.s ! NPossNom ; - <Sg,Gen> => auto.s ! NPossNom ; - <Pl,Gen> => auto.s ! NPossGenPl ; - <_,Transl> => auto.s ! NPossTransl n ; - <_,Illat> => auto.s ! NPossIllat n ; - _ => auto.s ! NCase n c - } ; - False => \\n,c => auto.s ! NCase n c - } - } ; - - cnNoHum : CommonNoun -> CommNoun = \cn -> cn ** {g = NonHuman} ; - cnHum : CommonNoun -> CommNoun = \cn -> cn ** {g = Human} ; - ---2 Noun phrases --- --- Two forms of *virtual accusative* are needed for nouns in singular, --- the nominative and the genitive one ("ostan talon"/"osta talo"). --- For nouns in plural, only a nominative accusative exist. Pronouns --- have a uniform, special accusative form ("minut", etc). - -param - NPForm = NPCase Case | NPAccNom | NPAccGen ; - --- The *person* of a noun phrase is also special, to steer the use of --- possessive suffixes. It expresses a distinction between pronominal and --- non-pronominal noun phrases. The pronominal ones impose possessive suffixes --- in genitival constructions ("minun taloni", "hänen talonsa"), the non-pronominal --- ones don't ("Jussin talo"). As for verbal agreement, non-pronominal noun --- phrases are third-person. - - NPPerson = NP3 | NPP Person ; - -oper - np2Person : NPPerson -> Person = \n -> case n of { - NP3 => P3 ; - NPP p => p - } ; - -oper - npForm2Case : Number -> NPForm -> Case = \n,f -> case f of { - NPCase c => c ; - NPAccNom => Nom ; - NPAccGen => case n of { - Sg => Gen ; - Pl => Nom - } - } ; - - npForm2PForm : NPForm -> PForm = \f -> case f of { - NPCase c => PCase c ; - _ => PAcc - } ; - - NounPhrase : Type = {s : NPForm => Str ; n : Number ; p : NPPerson} ; - - nameNounPhrase : ProperName -> NounPhrase = \jussi -> - {s = \\f => jussi.s ! npForm2Case Sg f ; n = Sg ; p = NP3} ; - - singularNounPhrase : CommNounPhrase -> NounPhrase = \cn -> - {s = \\f => cn.s ! False ! Sg ! (npForm2Case Sg f) ; n = Sg ; p = NP3} ; - - pluralNounPhrase : CommNounPhrase -> NounPhrase = \cn -> - {s = \\f => cn.s ! False ! Pl ! (npForm2Case Pl f) ; n = Pl ; p = NP3} ; - - pronNounPhrase : Pronoun -> NounPhrase = \pron -> - {s = \\f => pron.s ! npForm2PForm f ; n = pron.n ; p = NPP pron.p} ; - --- *Partitive noun phrases* use the partitive instead of the nominative --- and accusative forms. - - npForm2CasePart : NPForm -> Case = \f -> case f of { - NPCase Nom => Part ; - NPCase c => c ; - _ => Part - } ; - - partNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n, cn -> - {s = \\f => cn.s ! False ! n ! (npForm2CasePart f) ; n = n ; p = NP3} ; - - - ---2 Determiners --- --- Most determiners are inflected like nouns. They have an inherent number --- that is given to the noun that is being determined. - - Determiner : Type = {s : Gender => Case => Str ; n : Number} ; - - detNounPhrase : Determiner -> CommNounPhrase -> NounPhrase = \joku, mies -> - {s = \\f => let {c = npForm2Case joku.n f} in - joku.s ! mies.g ! c ++ mies.s ! False ! joku.n ! c ; - n = joku.n ; - p = NP3 - } ; - - mkDeterminerGen : Number -> (_,_ : Case => Str) -> Determiner = \n,mika,kuka -> - {s = table { - NonHuman => mika ; - Human => kuka - } ; - n = n - } ; - - mkDeterminer : Number -> (Case => Str) -> Determiner = \n,kaikki -> - mkDeterminerGen n kaikki kaikki ; - - jokainenDet = mkDeterminer Sg (caseTable Sg (sNainen "jokaista")) ; - kaikkiDet = mkDeterminer Pl kaikkiPron ; - useimmatDet = mkDeterminer Pl (caseTable Pl (sSuurin "useinta")) ; - mikaDet = mkDeterminerGen Sg (mikaInt ! Sg) (kukaInt ! Sg) ; - mitkaDet = mkDeterminerGen Pl (mikaInt ! Pl) (kukaInt ! Pl) ; - - indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,mies -> - case n of { - Sg => singularNounPhrase mies ; - Pl => partNounPhrase plural mies - } ; - - defNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,mies -> - case n of { - Sg => singularNounPhrase mies ; - Pl => pluralNounPhrase mies - } ; - - --- Genitives of noun phrases can be used like determiners, to build noun phrases. --- The number argument makes the difference between "Jussin talo" - "Jussin talot". --- The NP person of the 'owner' decides if there is a possessive suffix. - - npGenDet : Number -> NounPhrase -> CommNounPhrase -> NounPhrase = \n,jussi,talo -> - {s = \\c => jussi.s ! NPCase Gen ++ - ifPossSuffix talo jussi.p jussi.n (npForm2Case n c) ; - n = n ; - p = NP3 - } ; - - ifPossSuffix : CommNounPhrase -> NPPerson -> Number -> Case -> Str = - \talo,np,n,c -> case np of { - NP3 => talo.s ! False ! n ! c ; - NPP p => talo.s ! True ! n ! c ++ possSuffix ! n ! p - } ; - --- *Bare plural noun phrases*, like "koivut" in "koivut ovat valkoisia", --- are similar to definite plurals. - - plurDet : CommNounPhrase -> NounPhrase = pluralNounPhrase ; - --- Constructions like "huomio että kaksi on parillinen" are formed at the --- first place as common nouns, so that one can also have --- "kaikki ehdotukset että...". - - nounThatSentence : CommNounPhrase -> Sentence -> CommNounPhrase = \idea,x -> - {s = \\p,n,c => idea.s ! p ! n ! c ++ "että" ++ x.s ; - g = idea.g - } ; - ---2 Adjectives --- --- Adjectival phrases are used either as attributes or in predicative position. --- In the attributive position, all cases occur; in the predicative position, only --- the nominative, partitive, translative, and essive - but we ignore this --- restriction for simplicity. The important thing with the parameter is to --- regulate the word order of complex adjectival phrases: cf. predicative --- "(kuusi on) jaollinen kolmella" vs. attributive "kolmella jaollinen (luku)". --- In comparatives, the whole construction is affected: "suurempi kuin kolme" --- vs. "kolmea suurempi". (Actually, in the predicative position, the two --- are in free variation, the distinguished one being the normal choice: --- "kuusi on kolmella jaollinen" is possible, but not quite neutral.) - -param - AdjPos = APred | AAttr ; - -oper - AdjPhrase : Type = {s : AdjPos => Number => Case => Str} ; - - adj2adjPhrase : Adjective -> AdjPhrase = \uusi -> - {s = \\_,n,c => uusi.s ! NCase n c} ; - - ---3 Comparison adjectives --- --- Each of the comparison forms has a characteristic use: --- --- Positive forms are used alone, as adjectival phrases ("iso"). - - positAdjPhrase : AdjDegr -> AdjPhrase = \iso -> - adj2adjPhrase {s = iso.s ! Pos} ; - --- Comparative forms are used with an object of comparison, as --- adjectival phrases ("isompi kuin te"/"teitä isompi"). - - comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \iso, te -> - {s = let {teitaisompi : Number => Case => Str = - \\n,c => te.s ! NPCase Part ++ iso.s ! Comp ! NCase n c} in - table { - APred => variants { - \\n,c => iso.s ! Comp ! NCase n c ++ kuinConj ++ te.s ! NPCase Nom ; - teitaisompi - } ; - AAttr => teitaisompi - } - } ; - --- Superlative forms are used with a modified noun, picking out the --- maximal representative of a domain ("isoin talo"). - - superlNounPhrase : AdjDegr -> CommNounPhrase -> NounPhrase = \iso,talo -> - {s = \\np => let {c = npForm2Case Sg np} in - iso.s ! Sup ! NCase Sg c ++ talo.s ! False ! Sg ! c ; - n = Sg ; - p = NP3 - } ; - ---3 Two-place adjectives --- --- A two-place adjective is an adjective with a case used after (or before) --- the complement. The case can be the genitival accusative, which is different --- in the singular and the plural ("rajan ylittävä"/"rajat ylittävä"). --- The order of the adjective and its argument depends on the case: the local --- cases favour Adj + Noun in the predicative position ("hyvä painissa", --- "tyytyväinen vaalitulokseen", "jaollinen kolmella"), which is not a possible --- order for the accusative case. - - AdjCompl = Adjective ** {c : NPForm} ; - - complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \hyva,paini -> - let { - hyvat : Number => Case => Str = \\n,c => hyva.s ! NCase n c ; - painissa : Str = paini.s ! hyva.c - } - in - {s = table { - AAttr => \\n,c => painissa ++ hyvat ! n ! c ; - APred => \\n,c => if_then_else Str - (isLocalNPForm hyva.c) - (variants { - hyvat ! n ! c ++ painissa ; - painissa ++ hyvat ! n ! c - } - ) - (painissa ++ hyvat ! n ! c) - } - } ; - - isLocalNPForm : NPForm -> Bool = \c -> case c of { - NPCase Iness => True ; - NPCase Elat => True ; - NPCase Illat => True ; - NPCase Adess => True ; - NPCase Ablat => True ; - NPCase Allat => True ; - _ => False - } ; - - ---3 Modification of common nouns --- --- The two main functions of adjective are in predication ("Jussi on iso") --- and in modification ("iso mies"). Predication will be defined --- later, in the chapter on verbs. --- --- Modification uses the attributive form of an adjectival phrase. --- The adjective always comes before the noun. The possessive suffix is --- given to the noun. - - modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase = \iso,mies -> - {s = \\p,n,c => iso.s ! AAttr ! n ! c ++ mies.s ! p ! n ! c ; - g = mies.g - } ; - ---2 Function expressions - --- A function expression is a common noun together with the --- case taken by its argument ("x'n vaimo"). --- The type is analogous to two-place adjectives and transitive verbs; --- but here the genitive is by far the commonest case. The possessive suffix --- is then needed with pronominal arguments. - - Function = CommNounPhrase ** {c : NPForm} ; - --- The application of a function gives, in the first place, a common noun: --- "Jussi vaimo/vaimot". From this, other rules of the resource grammar --- give noun phrases, such as "Jussi vaimo", "Jussin vaimot", --- "Jussin ja Marin äidit", and "Jussin ja Marin äiti" (the --- latter two corresponding to distributive and collective functions, --- respectively). Semantics will eventually tell when each --- of the readings is meaningful. - - appFunComm : Function -> NounPhrase -> CommNounPhrase = \vaimo, jussi -> - {s = \\p,n,c => case vaimo.c of { - NPCase Gen => jussi.s ! NPCase Gen ++ - ifPossSuffix vaimo jussi.p jussi.n c ; - h => vaimo.s ! False ! n ! c ++ jussi.s ! h - } ; - g = vaimo.g - } ; - --- Notice the switched word order in other cases than the genitive, e.g. --- "veli Jussille". --- --- It is possible to use a function word as a common noun; the semantics is --- often existential or indexical. - - funAsCommNounPhrase : Function -> CommNounPhrase = \x -> x ; - --- The following is an aggregate corresponding to function application --- producing "John's mother" and "the mother of John". It does not appear in the --- resource grammar API as a primitive. - - appFun : Bool -> Function -> NounPhrase -> NounPhrase = \coll, vaimo,jussi -> - let {n = jussi.n ; nf = if_then_else Number coll Sg n} in - npGenDet nf jussi vaimo ; - --- The commonest case is functions with the genitive case. - - funGen : CommNounPhrase -> Function = \vaimo -> - vaimo ** {c = NPCase Gen} ; - --- Two-place functions add one argument place. - - Function2 = Function ** {c2 : NPForm} ; - --- There application starts by filling the first place. - - appFun2 : Function2 -> NounPhrase -> Function = \juna, turku -> - {s = \\p,n,c => juna.s ! False ! n ! c ++ turku.s ! juna.c ; - g = juna.g ; - c = juna.c2 - } ; - - ---2 Verbs --- ---3 Verb phrases --- --- Verb phrases are discontinuous: the two parts of a verb phrase are --- (s) an inflected verb, (s2) a complement. --- For instance: "on" - "kaunis" ; "ei" - "ole kaunis" ; "sisältää" - "rikkiä". --- Moreover, a subject case is needed, because of passive and 'have' verb --- phrases ("minä uin" ; "minut valitaan" ; "minua odotetaan" ; "minulla on jano"). - - VerbPhrase = Verb ** {s2 : VForm => Str ; c : ComplCase} ; - --- The normal subject case is the nominative. - - nomVerbPhrase : (Verb ** {s2 : VForm => Str}) -> VerbPhrase = \v -> - v ** {c = CCase Nom} ; - --- From the inflection table, we select the finite form as function --- of person and number: - - indicVerb : Verb -> Person -> Number -> Str = \v,p,n -> - v.s ! Ind n p ; - --- A simple verb can be made into a verb phrase with an empty complement, e.g. --- "ui" - []. --- There are two versions, depending on if we want to negate the verb. --- In the negated form, the negative verb "ei" becomes the verb, and the --- complement is a special infinite form of the verb (usually similar to the --- 2nd person singular imperative): "ei" - "ui". --- --- N.B. negation is *not* a function applicable to a verb phrase, since --- double negations with "ei" are not grammatical. - - predVerb : Bool -> Verb -> VerbPhrase = \b,walk -> - let { - noCompl : {s2 : VForm => Str} = {s2 = \\_ => []} ; - infCompl : {s2 : VForm => Str} = {s2 = table { - Imper Pl => walk.s ! ImpNegPl ; - _ => walk.s ! vFormNeg - } - } - } - in - if_then_else VerbPhrase b - (nomVerbPhrase (walk ** noCompl)) - (nomVerbPhrase (verbEi ** infCompl)) ; - --- (N.B. local definitions workaround for poor type inference in GF 1.2). - --- Sometimes we want to extract the verb part of a verb phrase. Not strictly --- necessary since this is a consequence of record subtyping. - - verbOfPhrase : VerbPhrase -> Verb = \v -> {s = v.s} ; - --- Verb phrases can also be formed from adjectives ("on vanha"), --- common nouns ("on mies"), and noun phrases ("on Jussi"). --- The third rule is overgenerating: "on jokainen mies" has to be ruled out --- on semantic grounds. --- --- For adjectives and common nouns, notice the case difference in the complement --- depending on number: "on kaunis" - "ovat kauniita". We ignore the forms --- "on kaunista", used with mass terms, and "ovat kauniit", used in --- constructions of the "plurale tantum" kind. The adjective rule can be defined --- in terms of the common noun rule. - - predAdjective : Bool -> AdjPhrase -> VerbPhrase = \b,iso -> - let {isot : CommNounPhrase = {s = \\_ => iso.s ! APred ; g = NonHuman}} - in predCommNoun b isot ; - - predCommNoun : Bool -> CommNounPhrase -> VerbPhrase = \b,mies -> - let { - miehia : VForm => Str = \\v => case vform2number v of { - Sg => mies.s ! False ! Sg ! Nom ; - Pl => mies.s ! False ! Pl ! Part - } ; - olemiehia : VForm => Str = - \\v => verbOlla.s ! vFormNeg ++ miehia ! v - } - in if_then_else VerbPhrase b - (nomVerbPhrase (verbOlla ** {s2 = miehia})) - (nomVerbPhrase (verbEi ** {s2 = olemiehia})) ; - - predNounPhrase : Bool -> NounPhrase -> VerbPhrase = \b,jussi -> - let {jussia : Bool => Number => Case => Str = \\_,_,_ => jussi.s ! NPCase Nom} - in predCommNoun b {s = jussia ; g = Human} ; --- gender does not matter - - ---3 Transitive verbs --- --- Transitive verbs are verbs with a case and, possibly, a preposition --- or a postposition for the complement, --- in analogy with two-place adjectives and functions. --- One might prefer to use the term "2-place verb", since --- "transitive" traditionally means that the inherent preposition is empty. --- Such a verb is one with a *direct object*. - -param - ComplCase = CCase Case | CAcc ; - -oper - TransVerb : Type = Verb ** {s3, s4 : Str ; c : ComplCase} ; - --- The rule for using transitive verbs is the complementization rule. --- --- N.B. One or both of the pre- and postposition are empty. - - complTransVerb : Bool -> TransVerb -> NounPhrase -> VerbPhrase = \b,ostaa,talo -> - let { - ostan = predVerb b ostaa ; - talon : VForm => Str = \\v => - ostaa.s3 ++ talo.s ! complementCase b ostaa.c v ++ ostaa.s4 - } - in nomVerbPhrase { - s = ostan.s ; - s2 = \\v => ostan.s2 ! v ++ talon ! v - } ; - --- N.B. If the case is accusative, it becomes partitive in negated verb phrases. --- The choice between the nominative and genitive accusatives depends on the verb --- form. - - complementCase : Bool -> ComplCase -> VForm -> NPForm = \b,c,v -> case c of { - CCase k => NPCase k ; - CAcc => case b of { - True => case v of { - Inf => NPAccNom ; - Ind _ _ => NPAccGen ; - Imper _ => NPAccNom ; - ImpNegPl => NPCase Part ; - Pass True => NPAccNom ; - Pass False => NPCase Part - } ; - _ => NPCase Part - } - } ; - --- Verbs that take their object with a case other than the accusative, --- without pre- or postposition: - - mkTransVerbCase : Verb -> Case -> TransVerb = \nauraa,c -> - nauraa ** {s3 = [] ; s4 = [] ; c = CCase c} ; - --- Verbs that take direct object with the accusative: - - mkTransVerbDir : Verb -> TransVerb = \ostaa -> - ostaa ** {s3 = [] ; s4 = [] ; c = CAcc} ; - --- Most two-place verbs can be used passively; the object case need not be --- the accusative, and it becomes the subject case in the passive sentence. - - passTransVerb : Bool -> TransVerb -> VerbPhrase = \b,tavata -> - {s = \\_ => if_then_else Str b (tavata.s ! Pass b) "ei" ; - s2 = \\_ => if_then_else Str b [] (tavata.s ! Pass b) ; - c = tavata.c - } ; - --- The API function does not demand that the verb is two-place. --- Therefore, we can only give it the accusative case, as default. - - passVerb : Bool -> Verb -> VerbPhrase = \b,uida -> - passTransVerb b (mkTransVerbDir uida) ; - --- Transitive verbs can be used elliptically as verbs. The semantics --- is left to applications. The definition is trivial, due to record --- subtyping. - - transAsVerb : TransVerb -> Verb = \juoda -> - juoda ; - --- The 'real' Finnish passive is unpersonal, equivalent to the --- "man" construction in German. It is formed by inflecting the --- bare verb phrase in passive, and putting the complement before --- the verb ("auttaa minua" - "minua autetaan"). - - passPredVerbPhrase : VerbPhrase -> Sentence = \auttaaminua -> - let {p = Pass True} in - {s = auttaaminua.s2 ! p ++ auttaaminua.s ! p} ; - --- *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. - - DitransVerb = TransVerb ** {s5, s6 : Str ; c2 : ComplCase} ; - - complDitransVerb : - Bool -> DitransVerb -> NounPhrase -> NounPhrase -> VerbPhrase = - \b,ostaa,talo,me -> - let { - ostan = predVerb b ostaa ; - talon : VForm => Str = \\v => - ostaa.s3 ++ talo.s ! complementCase b ostaa.c v ++ ostaa.s4 ; - meille : VForm => Str = \\v => - ostaa.s5 ++ me.s ! complementCase b ostaa.c2 v ++ ostaa.s6 - } - in nomVerbPhrase { - s = ostan.s ; - s2 = \\v => ostan.s2 ! v ++ talon ! v ++ meille ! v - } ; - - ---2 Adverbials --- --- Adverbials are not inflected (we ignore comparison, and treat --- compared adverbials as separate expressions; this could be done another way). - - Adverb : Type = SS ; - --- This rule adds the adverbial as a prefix or a suffix to the complement, --- in free variation. - - adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \laulaa, hyvin -> - {s = laulaa.s ; - s2 = \\v => bothWays (laulaa.s2 ! v) hyvin.s ; - c = laulaa.c - } ; - - advAdjPhrase : Adverb -> AdjPhrase -> AdjPhrase = \liian, iso -> - {s = \\p,n,c => liian.s ++ iso.s ! p ! n ! c - } ; - --- Adverbials are typically generated by case, prepositions, or postpositions. --- The rule for creating locative noun phrases by the inessive case --- is a shaky, since the adessive is often required. - - prepPhrase : Str -> Case -> NounPhrase -> Adverb = \ennen,c,talvi -> - ss (ennen ++ talvi.s ! NPCase c) ; - - postpPhrase : Str -> Case -> NounPhrase -> Adverb = \aikana,c,talvi -> - ss (talvi.s ! NPCase c ++ aikana) ; - - caseAdv : Case -> NounPhrase -> Adverb = prepPhrase [] ; - - locativeNounPhrase : NounPhrase -> Adverb = \np -> --- caseAdv Iness ; - ss (np.s ! NPCase Iness) ; - --- This is a source of the "mann with a telescope" ambiguity, and may produce --- strange things, like "autot aina" (while "autot tänään" is OK). --- Semantics will have to make finer distinctions among adverbials. - - advCommNounPhrase : CommNounPhrase -> Adverb -> CommNounPhrase = \auto,nyt -> - {s = \\b,n,c => auto.s ! b ! n ! c ++ nyt.s ; - g = auto.g - } ; - ---2 Sentences --- --- Sentences are not inflected in this fragment of Finnish without tense. - - Sentence : Type = SS ; - --- This is the traditional $S -> NP VP$ rule. It takes care of --- agreement between subject and verb. Recall that the VP may already --- contain negation. - - predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence = \jussi,uida -> - let { - p = np2Person jussi.p ; - c = complementCase True uida.c Inf --- True,Inf don't matter here - } - in - ss (jussi.s ! c ++ uida.s ! Ind jussi.n p ++ uida.s2 ! Ind jussi.n p) ; - --- This is a macro for simultaneous predication and complementization. - - predTransVerb : Bool -> NounPhrase -> TransVerb -> NounPhrase -> Sentence = - \b,you,see,john -> - predVerbPhrase you (complTransVerb b see john) ; - ---3 Sentence-complement verbs --- --- Sentence-complement verbs take sentences as complements. - - SentenceVerb : Type = Verb ; - --- To generate "sanoo että Jussi ui" / "ei sano että Jussi ui" - - complSentVerb : Bool -> SentenceVerb -> Sentence -> VerbPhrase = - \b,sanoa,jussiui -> - let { - sanon = predVerb b sanoa - } - in nomVerbPhrase { - s = sanon.s ; - s2 = \\v => sanon.s2 ! v ++ conjEtta ++ jussiui.s - } ; - - ---2 Sentences missing noun phrases --- --- This is one instance of Gazdar's *slash categories*, corresponding to his --- $S/NP$. --- We cannot have - nor would we want to have - a productive slash-category former. --- Perhaps a handful more will be needed. --- --- Notice that the slash category has a similar relation to sentences as --- transitive verbs have to verbs: it's like a *sentence taking a complement*. --- --- Interestingly, the distinction between prepositions and postpositions --- neutralizes: even prepositions are attached after relative and interrogative --- pronouns: "jota ennen" cf. "ennen talvea". Otherwise, the category and --- the rules are very similar to transitive verbs. Notice that the case gets --- fixed by the Boolean parameter and the subject. - - SentenceSlashNounPhrase = Sentence ** {s2 : Str ; c : Case} ; - - slashTransVerb : Bool -> NounPhrase -> TransVerb -> SentenceSlashNounPhrase = - \b,jussi,ostaa -> - predVerbPhrase jussi (predVerb b ostaa) ** { - s2 = ostaa.s3 ++ ostaa.s4 ; - c = npForm2Case jussi.n - (complementCase b ostaa.c (Ind jussi.n (np2Person jussi.p))) - } ; - ---2 Relative pronouns and relative clauses --- --- As described in $types.Fin.gf$, relative pronouns are inflected like --- common nouns, in number and case. --- --- We get the simple relative pronoun "joka" from $morpho.Fin.gf$. - - identRelPron : RelPron = relPron ; - - funRelPron : Function -> RelPron -> RelPron = \vaimo, joka -> - {s = \\n,c => joka.s ! n ! npForm2Case n vaimo.c ++ vaimo.s ! False ! n ! c} ; - --- Relative clauses can be formed from both verb phrases ("joka ui") and --- slash expressions ("jonka sinä näet", "jonka kautta sinä käyt"). - - RelClause : Type = {s : Number => Str} ; - - relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \joka,ui -> - {s = \\n => joka.s ! n ! npForm2Case n (complementCase True ui.c Inf) ++ - ui.s ! Ind n P3 ++ ui.s2 ! Ind n P3} ; - - relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause = \joka,saat -> - {s = \\n => joka.s ! n ! saat.c ++ saat.s2 ++ saat.s} ; - --- A 'degenerate' relative clause is the one often used in mathematics, e.g. --- "luku x siten että x on parillinen". - - relSuch : Sentence -> RelClause = \A -> - {s = \\_ => advSiten ++ conjEtta ++ A.s} ; - --- N.B. the construction "sellainen että" is not possible with the present --- typing of the relative clause, since it should also be inflected in --- case. Ordinary relative clauses have a fixed case. --- --- 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. We use no comma before these relative clauses, even though --- conservative standard Finnish does. - - modRelClause : CommNounPhrase -> RelClause -> CommNounPhrase = \mies,jokaui -> - {s = \\b,n,c => mies.s ! b ! n ! c ++ jokaui.s ! n ; - g = mies.g - } ; - --- N.B: the possessive suffix, if attached here, comes to wrong place! Solution: --- make $CommNounPhrase$ discontinuos. - - ---2 Interrogative pronouns --- --- If relative pronouns are like common nouns (and adjectives), --- interrogative pronouns are like noun phrases, having a fixed number. --- They also need to handle an NP-like accusative case. But person is --- not needed, since it is uniformly $NP3$. - - IntPron : Type = {s : NPForm => Str ; n : Number} ; - --- In analogy with relative pronouns, we have a rule for applying a function --- to a relative pronoun to create a new one. - - funIntPron : Function -> IntPron -> IntPron = \vaimo,kuka -> - {s = \\c => kuka.s ! vaimo.c ++ - vaimo.s ! False ! kuka.n ! npForm2Case kuka.n c ; - n = kuka.n - } ; - --- There is a variety of simple interrogative pronouns: --- "mikä talo" / "kuka mies", "kuka", "mikä". The construction with a noun --- is the reason why nouns in Finnish need a gender. - - nounIntPron : Number -> CommNounPhrase -> IntPron = \n, talo -> - {s = \\c => let {nc = npForm2Case n c} in - mikakukaInt ! talo.g ! n ! nc ++ talo.s ! False ! n ! nc ; - n = n - } ; - - intPronWho : Number -> IntPron = \num -> { - s = \\c => mikakukaInt ! Human ! num ! (npForm2Case num c) ; - n = num - } ; - - intPronWhat : Number -> IntPron = \num -> { - s = \\c => mikakukaInt ! NonHuman ! num ! (npForm2Case num c) ; - n = num - } ; - - ---2 Utterances - --- By utterances we mean complete phrases, such as --- 'can be used as moves in a language game': indicatives, questions, imperative, --- and one-word utterances. The rules are far from complete. --- --- N.B. we have not included rules for texts, which we find we cannot say much --- about on this level. In semantically rich GF grammars, texts, dialogues, etc, --- will of course play an important role as categories not reducible to utterances. --- An example is proof texts, whose semantics show a dependence between premises --- and conclusions. Another example is intersentential anaphora. - - Utterance = SS ; - - indicUtt : Sentence -> Utterance = \x -> ss (x.s ++ stopPunct) ; - interrogUtt : Question -> Utterance = \x -> ss (x.s ++ questPunct) ; - - ---2 Questions --- --- Questions are either direct or indirect, but the forms in Finnish are --- always identical. So we don't need a $QuestForm$ parameter as in other languages. - -oper - Question = SS ; - ---3 Yes-no questions --- --- Yes-no questions are formed by inversed predication, with the clitic "ko" / "kö" --- particle attached to the verb part of the verb phrase. - - questVerbPhrase : NounPhrase -> VerbPhrase -> Question = \jussi,ui -> - let {np = Ind jussi.n (np2Person jussi.p)} in - ss (ui.s ! np ++ koPart ++ jussi.s ! complementCase True ui.c Inf ++ ui.s2 ! np); - - ---3 Wh-questions --- --- Wh-questions are of two kinds: ones that are like $NP - VP$ sentences --- ("kuka ui?") others that are line $S/NP - NP$ sentences ("kenet sinä tapaat?"). - - intVerbPhrase : IntPron -> VerbPhrase -> Question = \kuka,ui -> - predVerbPhrase (kuka ** {p = NP3}) ui ; - - intSlash : IntPron -> SentenceSlashNounPhrase -> Question = \kuka,tapaat -> - ss (kuka.s ! NPCase tapaat.c ++ tapaat.s2 ++ tapaat.s) ; - - ---3 Interrogative adverbials --- --- These adverbials will be defined in the lexicon: they include --- "koska", "missä", "kuinka", "miksi", etc, which are all invariant one-word --- expressions. In addition, they can be formed by adding cases and postpositions --- to interrogative pronouns, in the same way as adverbials are formed --- from noun phrases; notice that even prepositions are used as postpositions --- when attached to interrogative pronouns. - - IntAdverb = SS ; - - prepIntAdverb : Str -> Case -> IntPron -> IntAdverb = \ennen,c,kuka -> - ss (kuka.s ! NPCase c ++ ennen) ; - --- A question adverbial can be applied to anything, and whether this makes --- sense is a semantic question. The syntax is very simple: just prefix the --- adverbial to the predication. - - questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question = - \miksi, jussi, ui -> - cc2 miksi (predVerbPhrase jussi ui) ; - ---2 Imperatives --- --- We only consider second-person imperatives. - - Imperative = SS1 Number ; - - imperVerbPhrase : VerbPhrase -> Imperative = \ui -> - {s = \\n => ui.s ! Imper n ++ ui.s2 ! Imper n} ; - - imperUtterance : Number -> Imperative -> Utterance = \n,I -> - ss (I.s ! n ++ exclPunct) ; - ---2 Sentence adverbials --- --- This class covers adverbials such as "muuten", "siksi", which are prefixed --- to a sentence to form a phrase. - - advSentence : Adverb -> Sentence -> Utterance = \siksi,sataa -> - ss (siksi.s ++ sataa.s ++ ".") ; - - ---2 Coordination --- --- Coordination is to some extent orthogonal to the rest of syntax, and --- has been treated in a generic way in the module $CO$ in the file --- $coordination.gf$. The overall structure is independent of category, --- but there can be differences in parameter dependencies. --- ---3 Conjunctions --- --- Coordinated phrases are built by using conjunctions, which are either --- simple ("ja", "tai") or distributed ("sekä - että", "joko - tai"). --- --- The conjunction has an inherent number, which is used when conjoining --- noun phrases: "Jussi ja Mari ovat..." vs. "Jussi tai Mari on..."; in the --- case of "tai", the result is however plural if any of the disjuncts is. - - Conjunction = CO.Conjunction ** {n : Number} ; - ConjunctionDistr = CO.ConjunctionDistr ** {n : Number} ; - ---3 Coordinating sentences --- --- We need a category of lists of sentences. It is a discontinuous --- category, the parts corresponding to 'init' and 'last' segments --- (rather than 'head' and 'tail', because we have to keep track of the slot between --- the last two elements of the list). A list has at least two elements. - - ListSentence : Type = SD2 ; - - twoSentence : (_,_ : Sentence) -> ListSentence = CO.twoSS ; - - consSentence : ListSentence -> Sentence -> ListSentence = - CO.consSS CO.comma ; - --- To coordinate a list of sentences by a simple conjunction, we place --- it between the last two elements; commas are put in the other slots, --- e.g. "du rauchst, er trinkt und ich esse". - - conjunctSentence : Conjunction -> ListSentence -> Sentence = \c,xs -> - ss (CO.conjunctX c xs) ; - --- To coordinate a list of sentences by a distributed conjunction, we place --- the first part (e.g. "either") in front of the first element, the second --- part ("or") between the last two elements, and commas in the other slots. --- For sentences this is really not used. - - conjunctDistrSentence : ConjunctionDistr -> ListSentence -> Sentence = - \c,xs -> - ss (CO.conjunctDistrX c xs) ; - - ---3 Coordinating adjective phrases --- --- The structure is the same as for sentences. Parameters are passed to components. - - ListAdjPhrase : Type = - {s1,s2 : AdjPos => Number => Case => Str} ; - - twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y -> - CO.twoTable3 AdjPos Number Case x y ; - - consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x -> - CO.consTable3 AdjPos Number Case CO.comma xs x ; - - conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs -> - CO.conjunctTable3 AdjPos Number Case c xs ; - - conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase = \c,xs -> - CO.conjunctDistrTable3 AdjPos Number Case c xs ; - - ---3 Coordinating noun phrases --- --- The structure is the same as for sentences. The result is either always plural --- or plural if any of the components is, depending on the conjunction. - - ListNounPhrase : Type = {s1,s2 : NPForm => Str ; n : Number ; p : NPPerson} ; - - twoNounPhrase : (_,_ : NounPhrase) -> ListNounPhrase = \x,y -> - CO.twoTable NPForm x y ** {n = conjNumber x.n y.n ; 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 ; p = conjPerson xs.p x.p} ; - - conjunctNounPhrase : Conjunction -> ListNounPhrase -> NounPhrase = \c,xs -> - CO.conjunctTable NPForm c xs ** {n = conjNumber c.n xs.n ; p = xs.p} ; - - conjunctDistrNounPhrase : ConjunctionDistr -> ListNounPhrase -> NounPhrase = - \c,xs -> - CO.conjunctDistrTable NPForm c xs ** {n = conjNumber c.n xs.n ; p = xs.p} ; - --- We have to define a calculus of numbers of persons. For numbers, --- it is like the conjunction with $Pl$ corresponding to $False$. - - conjNumber : Number -> Number -> Number = \m,n -> case <m,n> of { - <Sg,Sg> => Sg ; - _ => Pl - } ; - --- For persons, we let the latter argument win ("either you or I am absent" --- but "either I or you are absent"). This is not quite clear. - - conjPerson : NPPerson -> NPPerson -> NPPerson = \_,p -> - p ; - - - ---2 Subjunction --- --- Subjunctions ("kun", "jos", etc) --- are a different way to combine sentences than conjunctions. --- The main clause can be a sentences, an imperatives, or a question, --- but the subjoined clause must be a sentence. --- --- There are uniformly two variant word orders, e.g. --- "jos poltat minä suutun" --- and "minä suutun jos poltat". - - Subjunction = SS ; - - subjunctSentence : Subjunction -> Sentence -> Sentence -> Sentence = - \if, A, B -> - ss (subjunctVariants if A.s B.s) ; - - subjunctImperative : Subjunction -> Sentence -> Imperative -> Imperative = - \if, A, B -> - {s = \\n => subjunctVariants if A.s (B.s ! n)} ; - - subjunctQuestion : Subjunction -> Sentence -> Question -> Question = - \if, A, B -> - {s = subjunctVariants if A.s B.s} ; - - subjunctVariants : Subjunction -> Str -> Str -> Str = \if,A,B -> - variants {if.s ++ A ++ commaPunct ++ B ; B ++ commaPunct ++ if.s ++ A} ; - - subjunctVerbPhrase : VerbPhrase -> Subjunction -> Sentence -> VerbPhrase = - \V, if, A -> - adVerbPhrase V (ss (if.s ++ A.s)) ; - ---2 One-word utterances --- --- An utterance can consist of one phrase of almost any category, --- the limiting case being one-word utterances. These --- utterances are often (but not always) in what can be called the --- default form of a category, e.g. the nominative. --- This list is far from exhaustive. - - useNounPhrase : NounPhrase -> Utterance = \john -> - postfixSS stopPunct (defaultNounPhrase john) ; - - useCommonNounPhrase : Number -> CommNounPhrase -> Utterance = \n,car -> - useNounPhrase (indefNounPhrase n car) ; - --- Here are some default forms. - - defaultNounPhrase : NounPhrase -> SS = \john -> - ss (john.s ! NPCase Nom) ; - - defaultQuestion : Question -> SS = \whoareyou -> - whoareyou ; - - defaultSentence : Sentence -> Utterance = \x -> - x ; -} ; diff --git a/grammars/resource/finnish/TestFin.gf b/grammars/resource/finnish/TestFin.gf deleted file mode 100644 index 5de29ffa8..000000000 --- a/grammars/resource/finnish/TestFin.gf +++ /dev/null @@ -1,54 +0,0 @@ --- use this path to read the grammar from the same directory ---# -path=.:../abstract:../../prelude - -concrete TestFin of TestAbs = ResFin ** open Prelude, SyntaxFin in { - -flags startcat=Phr ; lexer=unglue ; unlexer=glue ; - --- a random sample from the lexicon - -lin - Big = regAdjDegr (sTalo "iso") "isompaa" "isointa" ; - Small = regAdjDegr (sSusi "pieni" "pienen" "pienenä") "pienempää" "pienintä" ; - Old = regAdjDegr (sKukko "vanha" "vanhan" "vanhoja") "vanhempaa" "vanhinta" ; - Young = regAdjDegr (sSusi "nuori" "nuoren" "nuorena") "nuorempaa" "nuorinta" ; - American = sNainen "amerikkalaista" ; - Finnish = sNainen "suomalaista" ; - - Married = sKukko "vihitty" "vihityn" "vihittyjä" ** {c = NPCase Illat} ; - --- naimisissa ! - - Man = cnHum (mkNoun "mies" "miehen" "miehenä" "miestä" "mieheen" "miehinä" - "miehissä" "miesten" "miehiä" "miehiin") ; - Woman = cnHum (sNainen "naista") ; - Car = cnNoHum (sTalo "auto") ; - House = cnNoHum (sTalo "talo") ; - Light = cnNoHum (sTalo "valo") ; - - Walk = vJuosta "kävellä" "kävelen" ; - Run = vJuosta "juosta" "juoksen" ; - Say = vSanoa "sanoa" ; - Prove = vPoistaa "todistaa" ; - Send = mkTransVerbDir (vOttaa "lähettää" "lähetän") ; - Love = mkTransVerbCase (vPoistaa "rakastaa") Part ; - Wait = mkTransVerbCase (vOttaa "odottaa" "odotan") Part ; - Give = mkTransVerbDir (vOttaa "antaa" "annan") ** - {s5 = [] ; s6 = [] ; c2 = CCase Allat} ; - Prefer = mkTransVerbDir (vOttaa "asettaa" "asetan") ** - {s5 = [] ; s6 = "edelle" ; c2 = CCase Gen} ; --- pitää paremp(a/i)na - - Mother = funGen (n2n (cnHum (sKukko "äiti" "äidin" "äitejä"))) ; - Uncle = funGen (n2n (cnHum (sKukko "setä" "sedän" "setiä"))) ; --- eno! - Connection = n2n (cnNoHum (sRakkaus "yhteys")) ** - {c = NPCase Elat ; c2 = NPCase Illat} ; --- Tampereelle ! - - Always = ss "aina" ; - Well = ss "hyvin" ; - - SwitchOn = mkTransVerbDir (vOttaa "sytyttää" "sytytän") ; - SwitchOff = mkTransVerbDir (vOttaa "sammuttaa" "sammutan") ; - - John = mkProperName (sKukko "Jussi" "Jussin" "Jusseja") ; - Mary = mkProperName (sKukko "Mari" "Marin" "Mareja") ; - -} ; diff --git a/grammars/resource/finnish/TypesFin.gf b/grammars/resource/finnish/TypesFin.gf deleted file mode 100644 index 86d0645fb..000000000 --- a/grammars/resource/finnish/TypesFin.gf +++ /dev/null @@ -1,126 +0,0 @@ ---1 Finnish Word Classes and Morphological Parameters --- --- This is a resource module for Finnish morphology, defining the --- morphological parameters and word classes of Finnish. 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 TypesFin = open Prelude in { - --- ---2 Enumerated parameter types --- --- These types are the ones found in school grammars. --- Their parameter values are atomic. We omit three of the cases, not --- occurring in the resource syntax. The accusative cases are only --- defined in syntax; in morphology, there is a special accusative for --- pronouns. - -param - Number = Sg | Pl ; - Case = Nom | Gen | Part | Transl | Ess - | Iness | Elat | Illat | Adess | Ablat | Allat ; - Person = P1 | P2 | P3 ; - Degree = Pos | Comp | Sup ; - Gender = NonHuman | Human ; - --- 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 noun case. In noun case, we include --- forms used in connection with possessive suffixes. - -param - NForm = NCase Number Case - | NPossNom | NPossGenPl | NPossTransl Number | NPossIllat Number ; - -oper - CommonNoun : Type = {s : NForm => Str} ; - - useNForm : NForm -> (Number => Case => Str) -> Str = \nf,f -> case nf of { - NCase n c => f ! n ! c ; - NPossNom => f ! Sg ! Nom ; ---- "iso autoni"; also "isot autoni" etc - NPossGenPl => f ! Pl ! Gen ; - NPossTransl n => f ! n ! Transl ; - NPossIllat n => f ! n ! Illat - } ; - - --- ---3 Adjectives --- --- The major division is between the comparison degrees, but it --- is also good to leave room for adjectives that cannon be compared. --- Such adjectives are like common nouns. - - Adjective : Type = CommonNoun ; - AdjDegr : Type = {s : Degree => NForm => Str} ; - ---3 Verbs --- --- We limit the grammar so far to verbs in the infinitive, second-person --- imperative, and present tense indicative active and passive. --- A special form is needed for --- the negated plural imperative. - -param - VForm = - Inf - | Ind Number Person - | Imper Number - | ImpNegPl - | Pass Bool - ; - -oper - Verb : Type = SS1 VForm ; - - vFormNeg = Imper Sg ; - - vform2number : VForm -> Number = \v -> case v of { - Ind n _ => n ; - Imper n => n ; - ImpNegPl => Pl ; - _ => Sg --- - } ; - --- ---3 Pronouns --- --- For pronouns, we need the noun case forms, plus an accusative. - -param - PForm = PCase Case | PAcc ; - -oper - Pronoun : Type = {s : PForm => Str ; n : Number ; p : Person} ; - ---3 Proper names --- --- Proper names only need case forms. - - ProperName : Type = SS1 Case ; - - ---3 Relative pronouns --- --- Relative pronouns are inflected like nouns, except for possessive suffixes. - - RelPron : Type = {s : Number => Case => Str} ; - -} ; diff --git a/grammars/resource/french/MorphoFra.gf b/grammars/resource/french/MorphoFra.gf deleted file mode 100644 index 4b3c8ff2b..000000000 --- a/grammars/resource/french/MorphoFra.gf +++ /dev/null @@ -1,1231 +0,0 @@ ---# -path=.:../romance:../../prelude - ---1 A Simple French Resource Morphology --- --- Aarne Ranta 2002--2003 --- --- This resource morphology contains definitions needed in the resource --- syntax. It moreover contains the most usual inflectional patterns. --- The patterns for verbs contain the complete "Bescherelle" conjugation --- tables. --- --- We use the parameter types and word classes defined in $types.Fra.gf$. - -resource MorphoFra = open (Predef=Predef), Prelude, TypesFra in { - - ---3 Front vowels --- --- In verb conjugation, we will need the concept of frontal vowel. - -oper - voyelleFront : Strs = strs {"e" ; "i" ; "y" ; "é" ; "è"} ; - preVoyelleFront : (_,_ : Str) -> Str = \t,u -> pre {t ; u / voyelleFront} ; - - ---2 Nouns --- --- The following macro is useful for creating the forms of number-dependent --- tables, such as common nouns. - - numForms : Str -> Str -> Number => Str = \bon,bons -> - table {Sg => bon ; Pl => bons} ; - --- For example, the regular noun forms are defined as follows: - - nomReg : Str -> Number => Str = \bu -> numForms bu (bu + "s") ; - --- Common nouns are inflected in number and have an inherent gender. - - mkCNom : (Number => Str) -> Gender -> CNom = \mecmecs,gen -> - {s = mecmecs ; g = gen} ; - - mkCNomIrreg : Str -> Str -> Gender -> CNom = \mec,mecs -> - mkCNom (numForms mec mecs) ; - - mkCNomReg : Str -> Gender -> CNom = \mec -> - mkCNom (nomReg mec) ; - - mkCNomNiveau : Str -> Gender -> CNom = \niveau -> - mkCNomIrreg niveau (niveau + "x") ; - - mkCNomCheval : Str -> Gender -> CNom = \cheval -> - let {cheva = Predef.tk 1 cheval} in - mkCNomIrreg cheval (cheva + "ux") ; - - mkCNomInvar : Str -> Gender -> CNom = \cas -> - mkCNomIrreg cas cas ; - - - --- The definite article has quite some variation: three parameters and --- elision. This is the simples definition we have been able to find. - - artDef : Gender -> Number -> Case -> Str = \g,n,c -> artDefTable ! g ! n ! c ; - - artDefTable : Gender => Number => Case => Str = \\g,n,c => case <g,n,c> of { - <Masc,Sg, Nom> => elisLe ; - <Masc,Sg, Gen> => pre {"du" ; ["de l'"] / voyelle} ; - <Masc,Sg, Dat> => pre {"au" ; ["à l'"] / voyelle} ; - <Masc,Sg, Acc> => elisLe ; - <Fem, Sg, _ > => prepCase c ++ elisLa ; - <_, Pl, Gen> => "des" ; - <_, Pl, Dat> => "aux" ; - <_, Pl, _ > => "les" - } ; - - ---2 Adjectives --- --- Adjectives are conveniently seen as gender-dependent nouns. --- Here are some patterns. First one that describes the worst case. - - mkAdj : (_,_,_ : Str) -> Adj = \vieux,vieuxs,vieille -> - {s = table { - Masc => numForms vieux vieuxs ; - Fem => nomReg vieille - } - } ; - --- Then the regular and invariant patterns. - - adjReg : Str -> Gender => Number => Str = \bu -> table { - Masc => nomReg bu ; - Fem => nomReg (bu + "e") - } ; - - adjInvar : Str -> Gender => Number => Str = \bien -> - \\_,_ => bien ; - --- Adjectives themselves are records. Here the most common cases: - - adjGrand : Str -> Adj = \grand -> - {s = adjReg grand} ; - - adjHeureux : Str -> Adj = \heureux -> - let {heureu = Predef.tk 1 heureux} in - mkAdj heureux heureu (heureu+"se") ; - - adjJeune : Str -> Adj = \jeune -> - mkAdj jeune (jeune+"s") jeune ; - - adjIndien : Str -> Adj = \indien -> - mkAdj indien (indien+"s") (indien+"ne") ; - - adjFrancais : Str -> Adj = \francais -> - mkAdj francais francais (francais+"e") ; - - adjCher : Str -> Adj = \cher -> - let {ch = Predef.tk 2 cher} in - mkAdj cher (cher + "s") (ch + "ère") ; - - - ---2 Personal pronouns --- --- All the eight personal pronouns can be built by the following macro. --- The use of "en" as atonic genitive is debatable. - - mkPronoun : (_,_,_,_,_,_,_ : Str) -> - PronGen -> Number -> Person -> ClitType -> Pronoun = - \il,le,lui,Lui,son,sa,ses,g,n,p,c -> - {s = table { - Ton x => prepCase x ++ Lui ; - Aton Nom => il ; - Aton Acc => le ; - Aton Gen => "en" ; --- hmm - Aton Dat => lui ; - Poss Sg Masc => son ; - Poss Sg Fem => sa ; - Poss Pl _ => ses - } ; - g = g ; - n = n ; - p = p ; - c = c - } ; - - elisPoss : Str -> Str = \s -> - pre {s + "a" ; s + "on" / voyelle} ; - - pronJe = mkPronoun - (elision "j") - (elision "m") - (elision "m") - "moi" - "mon" (elisPoss "m") "mes" - PNoGen -- gender cannot be known from pronoun alone - Sg - P1 - Clit1 ; - - pronTu = mkPronoun - "tu" - (elision "t") - (elision "t") - "toi" - "ton" (elisPoss "t") "tes" - PNoGen - Sg - P2 - Clit1 ; - - pronIl = mkPronoun - "il" - (elision "l") - "lui" - "lui" - "son" (elisPoss "s") "ses" - (PGen Masc) - Sg - P3 - Clit2 ; - - pronElle = mkPronoun - "elle" - elisLa - "lui" - "elle" - "son" (elisPoss "s") "ses" - (PGen Fem) - Sg - P3 - Clit2 ; - - pronNous = mkPronoun - "nous" - "nous" - "nous" - "nous" - "notre" "notre" "nos" - PNoGen - Pl - P1 - Clit3 ; - - pronVous = mkPronoun - "vous" - "vous" - "vous" - "vous" - "votre" "votre" "vos" - PNoGen - Pl --- depends! - P2 - Clit3 ; - - pronIls = mkPronoun - "ils" - "les" - "leur" - "eux" - "leur" "leur" "leurs" - (PGen Masc) - Pl - P3 - Clit1 ; - - pronElles = mkPronoun - "elles" - "les" - "leur" - "elles" - "leur" "leur" "leurs" - (PGen Fem) - Pl - P3 - Clit1 ; - ---2 Reflexive pronouns --- --- It is simply a function depending on number and person. - - pronRefl : Number -> Person -> Str = \n,p -> case <n,p> of { - <Sg,P1> => elision "m" ; - <Sg,P2> => elision "t" ; - <_, P3> => elision "s" ; - <Pl,P1> => "nous" ; - <Pl,P2> => "vous" - } ; - - - --- The composable pronoun "lequel" is inflected by varying the definite --- article and the determiner "quel" in the expected way. - - lequelPron : Gender -> Number -> Case -> Str = \g,n,c -> - artDef g n c + quelPron g n ; - - ---2 Determiners --- --- Determiners, traditionally called indefinite pronouns, are inflected --- in gender and number. It is usually enough to give the two singular --- forms to form the plurals. - - pronForms : Str -> Str -> Gender -> Number -> Str = \tel,telle,g,n -> case g of { - Masc => nomReg tel ! n ; - Fem => nomReg telle ! n - } ; - - quelPron : Gender -> Number -> Str = pronForms "quel" "quelle" ; - - telPron : Gender -> Number -> Str = pronForms "tel" "telle" ; - - toutPron : Gender -> Number -> Str = \g,n -> case g of { - Masc => numForms "tout" "tous" ! n ; - Fem => nomReg "toutee" ! n - } ; - --- The following macro generates the phrases "est-ce que", "est-ce qu'", --- and "est-ce qui" (the last one used e.g. in "qu'est-ce qui"). - - estCeQue : Case -> Str = \c -> - "est-ce" ++ case c of { - Nom => "qui" ; - Acc => elisQue ; - _ => nonExist --- dont? - } ; - - ---2 Verbs --- ---3 The present tense --- --- We first define some macros for the special case of present tense. --- --- The verb "être" is often used in syntax. - - verbEtre = verbPres (conjÊtre "être") ; - --- We very often form the verb stem by dropping out the infinitive ending. - - troncVerb : Tok -> Tok = Predef.tk 2 ; - - - ---3 Affixes --- --- It is convenient to have sets of affixes as data objects. - - Affixe : Type = Person => Str ; - - lesAffixes : (_,_,_ : Str) -> Affixe = \x,y,z -> table { - P1 => x ; - P2 => y ; - P3 => z - } ; - --- Much of variation can be described in terms of affix sets: - - affixSgE : Affixe = lesAffixes "e" "es" "e" ; - - affixSgS : Affixe = lesAffixes "s" "s" "t" ; - - affixSgSsansT : Affixe = lesAffixes "s" "s" [] ; - - affixSgX : Affixe = lesAffixes "x" "x" "t" ; - - affixPlOns : Affixe = lesAffixes "ons" "ez" "ent" ; - - affixSgAi : Affixe = lesAffixes "ai" "as" "a" ; - - affixSgAis : Affixe = \\p => "ai" + affixSgS ! p ; - - affixPlIons : Affixe = table { - P3 => "aient" ; - p => "i" + affixPlOns ! p - } ; - --- Often affix sets come in pairs, for the singular and the plural. - - affixImparf : Number => Affixe = table { - Sg => affixSgAis ; - Pl => affixPlIons - } ; - - affixFutur : Number => Affixe = table { - Sg => affixSgAi ; - Pl => table { - P3 => "ont" ; - p => affixPlOns ! p - } - } ; - - affixSPres : Number => Affixe = table { - Sg => affixSgE ; - Pl => table { - P3 => "ent" ; - p => affixPlIons ! p - } - } ; - - affixPlMes : (_,_ : Str) -> Affixe = - \è, â -> lesAffixes (â + "mes") (â + "tes") (è + "rent") ; - - affixPasseAi : Number => Affixe = table { - Sg => affixSgAi ; - Pl => affixPlMes "è" "â" - } ; - - affixPasseS : (i,î : Str) -> Number => Affixe = \i,î -> table { - Sg => table {p => i + affixSgS ! p} ; - Pl => affixPlMes i î - } ; - - affixSImparfSse : (i,î : Str) -> Number => Affixe = \i,î -> table { - Sg => table { - P3 => î + "t" ; - p => i + "ss" + affixSgE ! p - } ; - Pl => table {p => i + "ss" + affixSPres ! Pl ! p} - } ; - - AffixPasse : Type = {ps : Number => Affixe ; si : Number => Affixe} ; - - affixPasse : (_,_ : Str) -> AffixPasse = \i, î -> - {ps = affixPasseS i î ; si = affixSImparfSse i î} ; - - affixPasseA : AffixPasse = {ps = affixPasseAi ; si = affixSImparfSse "a" "â"} ; - - affixPasseI : AffixPasse = affixPasse "i" "î" ; - - affixPasseU : AffixPasse = affixPasse "u" "û" ; - - affixPasseNonExist : AffixPasse = - let {aff : Number => Affixe = - table {_ => lesAffixes nonExist nonExist nonExist}} in - {ps = aff ; si = aff} ; - - affixImper : NumPersI => Str = table { - SgP2 => "e" ; - PlP1 => "ons" ; - PlP2 => "ez" - } ; - - formesPresAi : (v,all : Str) -> Number => Affixe = \v,all -> table { - Sg => \\p => v + affixSgAi ! p ; - Pl => table { - P3 => v + "ont" ; - p => all + affixPlOns ! p - } - } ; - ---3 Macros for the complete conjugation type --- --- The type $VForm$ has 55 forms, as defined in $types.Fra.gf$. --- The worst-case macro takes 11 stems and two affix sets. --- (We will actually never need all of these at the same time.) - - Verbe : Type = VForm => Str ; - - verbAffixes : - (a,b,c,d,e,f,g,h,i,j,k : Str) -> Affixe -> AffixPasse -> Verbe = - \tien, ten, tienn, t, tiendr, soi, soy, soie, tenu, tenus, tenir -> - \affpres, affpasse -> - table { - Inf => tenir ; - Indic Pres Sg p => tien + affpres ! p ; - Indic Pres Pl P3 => tienn + affixPlOns ! P3 ; - Indic Pres Pl p => ten + affixPlOns ! p ; - Indic Imparf n p => ten + affixImparf ! n ! p ; - Indic Passe n p => t + affpasse.ps ! n ! p ; - Indic Futur n p => tiendr + affixFutur ! n ! p ; - Cond n p => tiendr + affixImparf ! n ! p ; - Subjo SPres Sg p => soi + affixSPres ! Sg ! p ; - Subjo SPres Pl P3 => soi + "ent" ; - Subjo SPres Pl p => soy + affixSPres ! Pl ! p ; - Subjo SImparf n p => t + affpasse.si ! n ! p ; - Imper SgP2 => soie ; - Imper p => soy + affixImper ! p ; - Part PPres => ten + "ant" ; - Part (PPasse Masc Sg) => tenu ; - Part (PPasse Fem Sg) => tenu + "e" ; - Part (PPasse Masc Pl) => tenus ; - Part (PPasse Fem Pl) => tenu + "es" - } ; - --- Almost always seven stems are more than enough. - - verbHabituel : - (a,b,c,d,e,f,g : Str) -> Affixe -> AffixPasse -> Verbe = - \tien, ten, tienn, t, tiendr, tenu, tenir -> - \affpres, affpasse -> - verbAffixes tien ten tienn t tiendr tienn ten - (tien + affpres ! P1) tenu (tenu+"s") tenir affpres affpasse ; - ---3 The first conjugation --- --- There is quite some phonologically explained variation in the first conjugation. --- The worst case has three different stems. - - auxConj1 : Str -> Str -> Str -> Verbe = \jet, jett, jeter -> - verbHabituel jett jet jett jet jeter (jet+"é") (jet+"er") affixSgE affixPasseA ; - - conj1aimer : Str -> Verbe = \aimer -> - let {aim = troncVerb aimer} in - auxConj1 aim aim aimer ; - - conj1céder : Str -> Verbe = \céder -> - let { - ced = troncVerb céder ; - d = Predef.dp 1 ced ; - c = Predef.tk 2 ced ; - cèd = c + "è" + "d" ; - céd = c + "é" + "d" - } - in auxConj1 céd cèd céder ; - - conj1jeter : Str -> Verbe = \jeter -> - let { - jet = troncVerb jeter ; - jett = jet + Predef.dp 1 jet - } - in auxConj1 jet jett (jett + "er") ; - - conj1placer : Str -> Verbe = \placer -> - let { - pla = Predef.tk 3 placer ; - plac = preVoyelleFront (pla+"ç") (pla+"c") - } in - auxConj1 plac plac placer ; - - conj1manger : Str -> Verbe = \manger -> - let { - mang = Predef.tk 2 manger ; - mange = preVoyelleFront (mang+"e") mang - } in - auxConj1 mange mange manger ; - - conj1assiéger : Str -> Verbe = \assiéger -> - let {assi = Predef.tk 4 assiéger} in - auxConj1 (preVoyelleFront (assi+"ége") (assi+"ég")) (assi+"èg") assiéger ; - - conj1payer : Str -> Verbe = \payer -> - let {pa = Predef.tk 3 payer} in - auxConj1 (pa + "y") (pa + "i") (pa + "ier") ; - - conj1envoyer : Str -> Verbe = \envoyer -> - let {renv = Predef.tk 4 envoyer} in - auxConj1 (renv + "oy") (renv + "oi") (renv + "err") ; - - ---3 The second conjugation --- --- There are just two different cases. - - conj2finir : Str -> Verbe = \finir -> - let { - fin = troncVerb finir ; - fini = fin + "i" ; - finiss = fin + "iss" - } in - verbHabituel fini finiss finiss fin finir fini finir affixSgS affixPasseI ; - - conj2haïr : Str -> Verbe = \haïr -> - let {ha = troncVerb haïr ; - hai = ha + "i" ; - haï = ha + "ï" ; - haiss = ha + "ïss" - } in - verbHabituel hai haiss haiss ha haïr haï haïr affixSgS (affixPasse "ï" "ï") ; - - ---3 The third conjugation --- --- This group is very heterogeneous. Most verbs have "re" in the infinitive, --- but the first example does not! - - conj3tenir : Str -> Verbe = \tenir -> - let {t = Predef.tk 4 tenir} in - verbHabituel - (t+"ien") (t+"en") (t+"ienn") t (t+"iendr") (t+"enu") tenir - affixSgS (affixPasse "in" "în") ; - --- Many verbs have "is" in the past participle. But there is so much variation --- that the worst-case macro needs seven forms. - - auxConj3is : (_,_,_,_,_,_,_ : Str) -> Verbe = - \quier, quér, quièr, qu, querr, quis, quiss -> - verbAffixes - quier quér quièr qu querr quièr quér - (quier + "s") quis quiss (quér + "ir") affixSgS affixPasseI ; - - auxConj3ir : (_,_,_ : Str) -> Verbe = \sen, sent, i -> - auxConj3is sen sent sent sent (sent+"ir") (sent+i) (sent+i+"s") ; - - conj3quérir : Str -> Verbe = \quérir -> - let {qu = Predef.tk 4 quérir} in - auxConj3is (qu+"ier") (qu+"ér") (qu+"ièr") qu (qu+"err") (qu+"is") (qu+"is") ; - - conj3sentir : Str -> Verbe = \sentir -> - let { - sent = troncVerb sentir ; - sen = Predef.tk 1 sent - } in - auxConj3ir sen sent "i" ; - - conj3vêtir : Str -> Verbe = \vêtir -> - let { - s = Predef.tk 5 vêtir ; - vet = auxConj3ir "vêt" "vêt" "u" - } in - table { - Indic Pres Sg P3 => s + "vêt" ; - p => s + vet ! p - }; - - auxConj3vrir : (_,_,_ : Str) -> Verbe = \ouvr, i, ouvert -> - verbAffixes - ouvr ouvr ouvr ouvr (ouvr + i + "r") ouvr ouvr - (ouvr + "e") ouvert (ouvert + "s") (ouvr + "ir") affixSgE affixPasseI ; - - conj3couvrir : Str -> Verbe = \couvrir -> - let {couv = Predef.tk 3 couvrir} in - auxConj3vrir (couv+"r") "i" (couv+"ert") ; - - conj3cueillir : Str -> Verbe = \cueillir -> - let {cueill = troncVerb cueillir} in - auxConj3vrir cueill "e" (cueill + "i") ; - - conj3assaillir : Str -> Verbe = \assaillir -> - let {assaill = troncVerb assaillir} in - auxConj3vrir assaill "i" (assaill + "i") ; - --- The verb "faillir" has lots of alternatives forms. - - conj3faillir : Str -> Verbe = \faillir -> - let { - fa = Predef.tk 5 faillir ; - faudr = fa + "udr" ; - tfa = conj3assaillir faillir - } in - table { - Indic Pres Sg p => fa + "u" + affixSgX ! p ; - Subjo SPres n p => fa + variants {"illiss" ; "ill"} + affixSPres ! n ! p ; - - Indic Futur n p => variants {tfa ! Indic Futur n p ; faudr + affixFutur ! n ! p} ; - Cond n p => variants {tfa ! Cond n p ; faudr + affixImparf ! n ! p} ; - - Imper _ => nonExist ; - p => tfa ! p - }; - - conj3bouillir : Str -> Verbe = \bouillir -> - let { - bou = Predef.tk 5 bouillir ; - tbou = conj3assaillir bouillir - } in - table { - Indic Pres Sg p => bou + affixSgS ! p ; - Imper SgP2 => bou + "s" ; - p => tbou ! p - }; - --- Notice that here we don't need another conjugation, as Bescherelle does. - - conj3dormir : Str -> Verbe = conj3sentir ; - --- The verbs "mourir" and "courir" have much in common, except the first two --- persons in the present indicative singular, and the past participles. - - auxConj3ourir : (_,_,_ : Str) -> Verbe = \meur, mour, mort -> - verbAffixes - meur mour meur mour (mour + "r") meur mour - (meur + "s") mort (mort + "s") (mour + "ir") affixSgS affixPasseU ; - - conj3courir : Str -> Verbe = \courir -> - let {cour = troncVerb courir} in - auxConj3ourir cour cour (cour + "u") ; - - conj3mourir : Str -> Verbe = \mourir -> - let {m = Predef.tk 5 mourir} in - auxConj3ourir (m + "eur") (m + "our") (m + "ort") ; - --- A little auxiliary to cover "fuir" and "ouïr". --- *N.B.* some alternative forms for "ouïr" are still missing. - - auxConj3ui : AffixPasse -> (_,_,_ : Str) -> Verbe = \affpasse, o, ou, ouï -> - let {oi : Str = o + "i" ; oy : Str = o + "y" ; ouïr : Str = ouï + "r"} in - verbHabituel oi oy oi ou ouïr ouï ouïr affixSgS affpasse ; - - conj3fuir : Str -> Verbe = \fuir -> - let {fu = troncVerb fuir} in - auxConj3ui affixPasseI fu fu (fu + "i") ; - - conj3ouïr : Str -> Verbe = \ouir -> - let {o = Predef.tk 3 ouir} in - auxConj3ui (affixPasse "ï" "ï") o (o + "u") (o + "uï") ; - --- The verb "gésir" lacks many forms. - - conj3gésir : Str -> Verbe = \gésir -> - let {g = Predef.tk 4 gésir} in - table { - Inf => g + "ésir" ; - Indic Pres Sg p => g + lesAffixes "is" "is" "ît" ! p ; - Indic Pres Pl p => g + "is" + affixPlOns ! p ; - Indic Imparf n p => g + "is" + affixImparf ! n ! p ; - Part PPres => g + "isant" ; - _ => nonExist - } ; - --- Here is an auxiliary for a large, and heterogeneous, group of verbs whose --- infinitive ends in "oir". It has two special cases, depending on the ending --- of the first two persions in the present indicative singular. - - auxConj3oir : Affixe -> AffixPasse -> (_,_,_,_,_,_,_,_ : Str) -> Verbe = - \affpres, affpasse -> - \peu, pouv, peuv, p, pourr, veuill, voul, v -> - let {pu : Str = p + "u"} in - verbAffixes - peu pouv peuv p pourr veuill voul (peu+affpres!P1) pu (pu+"s") (v+"oir") - affpres affpasse ; - - auxConj3usX : (_,_,_,_,_,_,_,_ : Str) -> Verbe = - auxConj3oir affixSgX affixPasseU ; - auxConj3usS : (_,_,_,_,_,_,_,_ : Str) -> Verbe = - auxConj3oir affixSgS affixPasseU ; - - conj3cevoir : Str -> Verbe = \cevoir -> - let {re = Predef.tk 6 cevoir} in - auxConj3usS (re+"çoi") (re+"cev") (re+"çoiv") (re+"ç") - (re+"cevr") (re+"çoiv") (re+"cev") (re+"cev") ; - - conj3voir : Str -> Verbe = \voir -> - let { - v = Predef.tk 3 voir ; - voi = v + "oi" - } in - auxConj3oir - affixSgS affixPasseI voi (v + "oy") voi v (v + "err") voi (v + "oy") v ; - - conj3pourvoir : Str -> Verbe = \pourvoir -> - let { - pourv = Predef.tk 3 pourvoir ; - pourvoi = pourv + "oi" ; - pourvoy = pourv + "oy" - } in - auxConj3usS pourvoi pourvoy pourvoi pourv pourvoir pourvoi pourvoy pourv ; - - conj3savoir : Str -> Verbe = \savoir -> - let { - s = Predef.tk 5 savoir ; - tsavoir = auxConj3usS "ai" "av" "av" "" "aur" "ach" "ach" "av" - } in - table { - Imper p => s + "ach" + affixImper ! p ; - Part PPres => s + "achant" ; - p => s + tsavoir ! p - } ; - - conj3devoir : Str -> Verbe = \devoir -> - let { - s = Predef.tk 6 devoir ; - tdevoir = auxConj3usS "doi" "dev" "doiv" "d" "devr" "doiv" "dev" "dev" - } in - table { - Part (PPasse Masc Sg) => s + "dû" ; - p => s + tdevoir ! p - } ; - - conj3pouvoir : Str -> Verbe = \pouvoir -> - let { - p = Predef.tk 6 pouvoir ; - tpouvoir = auxConj3usX "eu" "ouv" "euv" "" "ourr" "uiss" "uiss" "ouv" - } in - table { - Indic Pres Sg P1 => p + variants {"eux" ; "uis"} ; - t => p + tpouvoir ! t - } ; - - conj3mouvoir : Str -> Verbe = \mouvoir -> - let { - s = Predef.tk 7 mouvoir ; - mu = adjReg "mû" ; - tmouvoir = auxConj3usS "meu" "mouv" "meuv" "m" "mouvr" "meuv" "mouv" "mouv" - } in - table { - Part (PPasse g n) => s + mu ! g ! n ; - p => s + tmouvoir ! p - } ; - - auxConj3seul3sg : (_,_,_,_,_ : Str) -> Verbe = - \faut, fall, pl, faudr, faill -> table { - Inf => fall + "oir" ; - Indic Pres Sg P3 => faut ; - Indic Imparf Sg P3 => fall + "ait" ; - Indic Passe Sg P3 => pl + "ut" ; - Indic Futur Sg P3 => faudr + "a" ; - Cond Sg P3 => faudr + "ait" ; - Subjo SPres Sg P3 => faill + "e" ; - Subjo SImparf Sg P3 => pl + "ût" ; - Part PPres => fall + "ant" ; - Part (PPasse g n) => adjReg (pl + "u") ! g ! n ; - _ => nonExist - } ; - - conj3pleuvoir : Str -> Verbe = \pleuvoir -> - let { - pleuv = Predef.tk 3 pleuvoir ; - pl = Predef.tk 3 pleuv - } in - auxConj3seul3sg (pl + "eut") pleuv pl (pleuv + "r") pleuv ; - - conj3falloir : Str -> Verbe = \falloir -> - let { - fa = Predef.tk 5 falloir ; - fau = fa + "u" ; - fall = Predef.tk 3 falloir - } in - auxConj3seul3sg (fau + "t") fall fall (fau + "dr") (fa + "ill") ; - - conj3valoir : Str -> Verbe = \valoir -> - let { - va = Predef.tk 4 valoir ; - val = va + "l" - } in - auxConj3usX (va + "u") val val val (va + "udr") (va + "ill") val val ; - - conj3vouloir : Str -> Verbe = \vouloir -> - let { - v = Predef.tk 6 vouloir ; - vo = v + "o" ; - voul = vo + "ul" ; - veul = v + "eul" - } in - auxConj3usX (v + "eu") voul veul voul (vo + "udr") (v + "euill") voul voul ; - --- The following two are both "asseoir" in the Bescherelle, which however --- points out that the latter conjugation has an infinitive form without "e" --- since the orthographic rectifications of 1990. - - conj3asseoir : Str -> Verbe = \asseoir -> - let { - ass = Predef.tk 4 asseoir ; - tasseoir = auxConj3is "ied" "ey" "ey" "" "iér" "is" "is" - } in - table { - Inf => ass + "eoir" ; - Indic Pres Sg P3 => ass + "ied" ; - t => ass + tasseoir ! t - } ; - - conj3assoir : Str -> Verbe = \assoir -> - let { - ass = Predef.tk 3 assoir ; - tassoir = auxConj3is "oi" "oy" "oi" "" "oir" "is" "is" - } in - table { - Inf => ass + variants {"oir" ; "eoir"} ; - t => ass + tassoir ! t - } ; - - conj3seoir : Str -> Verbe = \seoir -> - let { - s = Predef.tk 4 seoir ; - tseoir = conj3asseoir seoir - } in - table { - Indic Pres Pl P3 => s + "iéent" ; - Indic _ _ P1 => nonExist ; - Indic _ _ P2 => nonExist ; - Indic Passe _ _ => nonExist ; - Cond _ P1 => nonExist ; - Cond _ P2 => nonExist ; - Subjo SPres Sg P3 => s + "iée" ; - Subjo SPres Pl P3 => s + "iéent" ; - Subjo _ _ _ => nonExist ; - Imper _ => nonExist ; - Part PPres => s + "éant" ; - t => tseoir ! t - } ; - --- Here we don't need a new conjugation. - - conj3messeoir : Str -> Verbe = \messeoir -> - let {tmesseoir = conj3seoir messeoir} in - table { - Part (PPasse _ _) => nonExist ; - p => tmesseoir ! p - } ; - - conj3surseoir : Str -> Verbe = \surseoir -> - let { - surs = Predef.tk 4 surseoir ; - tsurseoir = auxConj3is "oi" "oy" "oi" "" "eoir" "is" "is" - } in - table { - Inf => surseoir ; - t => surs + tsurseoir ! t - } ; - --- Here we interpolate and include the imperfect and subjunctive forms, --- which Bescherelle leaves out. - - conj3choir : Str -> Verbe = \choir -> - let { - ch = Predef.tk 3 choir ; - tchoir = auxConj3usS "oi" "oy" "oi" "" (variants {"oir" ; "err"}) "oi" "oy" "" - } in - \\p => ch + tchoir ! p ; - - conj3échoir : Str -> Verbe = \échoir -> - let {techoir = conj3choir échoir} in - table { - Indic _ _ P1 => nonExist ; - Indic _ _ P2 => nonExist ; - Indic Pres Pl P3 => Predef.tk 3 échoir + variants {"oient" ; "éent"} ; - Subjo _ _ P1 => nonExist ; - Subjo _ _ P2 => nonExist ; - Cond _ P1 => nonExist ; - Cond _ P2 => nonExist ; - Imper _ => nonExist ; - Part PPres => Predef.tk 3 échoir + "éant" ; - t => techoir ! t - } ; - --- Verbs with the infinitive ending "re" are a major group within the third --- conjugation. The worst-case macro takes 2 sets of affixes and 7 stems. - - auxConj3re : Affixe -> AffixPasse -> (_,_,_,_,_,_,_ : Str) -> Verbe = - \affpr, affp -> \prend, pren, prenn, pr, prendr, pris, priss -> - verbAffixes prend pren prenn pr prendr prenn pren - (prend + affpr ! P1) pris priss (prendr + "e") affpr affp ; - - auxConj3tre : (_,_ : Str) -> Verbe = \bat, batt -> - auxConj3re affixSgSsansT affixPasseI - bat batt batt batt (batt + "r") (batt + "u") (batt + "us") ; - - conj3rendre : Str -> Verbe = \rendre -> - let {rend = troncVerb rendre} in - auxConj3tre rend rend ; - - conj3battre : Str -> Verbe = \battre -> - let {bat = Predef.tk 3 battre} in - auxConj3tre bat (bat + "t") ; - - conj3prendre : Str -> Verbe = \prendre -> - let {pr = Predef.tk 5 prendre} in - auxConj3re - affixSgSsansT affixPasseI (pr + "end") (pr + "en") - (pr + "enn") pr (pr + "endr") (pr + "is") (pr + "is") ; - - conj3mettre : Str -> Verbe = \mettre -> - let {m = Predef.tk 5 mettre ; met = m + "et"} in - auxConj3re - affixSgSsansT affixPasseI met (met + "t") - (met + "t") m (met + "tr") (m + "is") (m + "is") ; - - conj3peindre : Str -> Verbe = \peindre -> - let {pe = Predef.tk 5 peindre ; peign = pe + "ign"} in - auxConj3re - affixSgS affixPasseI - (pe + "in") peign peign peign (pe + "indr") (pe + "int") (pe + "ints") ; - --- We don't need a separate conjugation for "joindre" and "craindre". - - conj3joindre = conj3peindre ; - - conj3craindre = conj3peindre ; - - conj3vaincre : Str -> Verbe = \vaincre -> - let { - vainc = troncVerb vaincre ; - vainqu = Predef.tk 1 vainc + "qu" - } in - auxConj3re - affixSgSsansT affixPasseI - vainc vainqu vainqu vainqu (vainc + "r") (vainc + "u") (vainc + "us") ; - - conj3traire : Str -> Verbe = \traire -> - let { - tra = Predef.tk 3 traire ; - trai = tra + "i" ; - tray = tra + "y" - } in - auxConj3re - affixSgS affixPasseNonExist - trai tray trai [] (trai + "r") (trai + "t") (trai + "ts") ; - --- The verb "faire" has a great many irregularities. Following Bescherelle, --- we have left out the plural 2nd person variant "faisez", which is a --- 'grossier barbarisme'. - - conj3faire : Str -> Verbe = \faire -> - let { - fai = troncVerb faire ; - fais = fai + "s" ; - f = Predef.tk 2 fai ; - tfaire = auxConj3re - affixSgS affixPasseI - fai fais (f + "ass") f (f + "er") (fai + "t") (fai + "ts") - } in - table { - Inf => faire ; - Indic Pres Pl P2 => fai + "tes" ; - Indic Pres Pl P3 => f + "ont" ; - Subjo SPres Pl p => f + "ass" + affixSPres ! Pl ! p ; - Imper PlP2 => fai + "tes" ; - t => tfaire ! t - } ; - - auxConj3oire : (_,_,_,_ : Str) -> Verbe = \boi, buv, boiv, b -> - auxConj3re - affixSgS affixPasseU boi buv boiv b (boi + "r") (b + "u") (b + "us") ; - - auxConj3ît : Verbe -> Str -> Verbe = \conj,plaît -> - table { - Indic Pres Sg P3 => plaît ; - t => conj ! t - } ; - - conj3plaire : Str -> Verbe = \plaire -> - let { - pl = Predef.tk 4 plaire ; - tplaire = auxConj3oire (pl + "ai") (pl + "ais") (pl + "ais") pl - } in - auxConj3ît tplaire (pl + "aît") ; - - conj3connaître : Str -> Verbe = \connaître -> - let { - conn = Predef.tk 5 connaître ; - connaiss = conn + "aiss" ; - tconnaitre = - auxConj3re - affixSgS affixPasseU (conn + "ai") connaiss connaiss - conn (conn + "aîtr") (conn + "u") (conn + "us") - } in - auxConj3ît tconnaitre (conn + "aît") ; - - conj3naître : Str -> Verbe = \naître -> - let { - n = Predef.tk 5 naître ; - tnaitre = auxConj3re - affixSgS affixPasseI - (n + "ai") (n + "aiss") (n + "aiss") (n + "aqu") - (n + "aîtr") (n + "é") (n + "és") - } in - auxConj3ît tnaitre (n + "aît") ; - --- The conjugation of "paître" is defective in a curious way, especially --- if compared with "repaître". According to Bescherelle, the invariable --- past participle is only used as a term of "fauconnerie" (one would expect it --- to be defective rather than invariable). - - conj3paître : Str -> Verbe = \paître -> - let {tpaitre = conj3connaître paître} in - table { - Indic Passe _ _ => nonExist ; - Subjo SImparf _ _ => nonExist ; - Part (PPasse _ _) => Predef.tk 5 paître + "u" ; - p => tpaitre ! p - } ; - - conj3repaître = conj3connaître ; - - conj3croître : Str -> Verbe = \croître -> - let {cr = Predef.tk 5 croître} in - auxConj3re - affixSgS (affixPasse "û" "û") (cr + "oî") (cr + "oiss") - (cr + "oiss") cr (cr + "oîtr") (cr + "û") (cr + "ûs") ; - - conj3croire : Str -> Verbe = \croire -> - let {cr = Predef.tk 4 croire} in - auxConj3oire (cr + "oi") (cr + "oy") (cr + "oi") cr ; - - conj3boire : Str -> Verbe = \boire -> - let {b = Predef.tk 4 boire} in - auxConj3oire (b + "oi") (b + "uv") (b + "oiv") b ; - --- The verb "clore" shows a systematic absence of past forms, --- including the imperfect indicative. What is more capricious, is the absence --- of the plural first and second persons in the present indicative and --- the imperative. - - conj3clore : Str -> Verbe = \clore -> - let { - clo = troncVerb clore ; - clos = clo + "s" ; - tclore = auxConj3re - affixSgS affixPasseNonExist clo clos clos - nonExist (clo + "r") clos clos - } in - table { - Indic Pres Sg P3 => Predef.tk 1 clo + "ôt" ; - Indic Pres Pl P1 => nonExist ; - Indic Pres Pl P2 => nonExist ; - Indic Imparf _ _ => nonExist ; - Imper PlP1 => nonExist ; - Imper PlP2 => nonExist ; - t => tclore ! t - } ; - - conj3conclure : Str -> Verbe = \conclure -> - let { - conclu = troncVerb conclure ; - concl = Predef.tk 1 conclu - } in - auxConj3re - affixSgS affixPasseU - conclu conclu conclu concl (conclu + "r") conclu (conclu + "s") ; - - conj3absoudre : Str -> Verbe = \absoudre -> - let { - abso = Predef.tk 4 absoudre ; - tabsoudre = conj3résoudre absoudre - } in - table { - Indic Passe _ _ => nonExist ; - Subjo SImparf _ _ => nonExist ; - Part (PPasse Masc _) => abso + "us" ; - Part (PPasse Fem n) => nomReg (abso + "ute") ! n ; - p => tabsoudre ! p - } ; - - conj3résoudre : Str -> Verbe = \résoudre -> - let {reso = Predef.tk 4 résoudre} in - auxConj3re - affixSgS affixPasseU (reso + "u") (reso + "lv") (reso + "lv") - (reso + "l") (reso + "udr") (reso + "lu") (reso + "lus") ; - - conj3coudre : Str -> Verbe = \coudre -> - let { - cou = Predef.tk 3 coudre ; - cous = cou + "s" - } in - auxConj3re - affixSgSsansT affixPasseI - (cou +"d") cous cous cous (cou + "dr") (cous + "u") (cous + "us") ; - - conj3moudre : Str -> Verbe = \moudre -> - let { - mou = Predef.tk 3 moudre ; - moul = mou + "l" - } in - auxConj3re - affixSgSsansT affixPasseU - (mou + "d") moul moul moul (mou + "dr") (moul + "u") (moul + "us") ; - - conj3suivre : Str -> Verbe = \suivre -> - let { - suiv = troncVerb suivre ; - sui = Predef.tk 1 suiv ; - suivi = suiv + "i" - } in - auxConj3re - affixSgS affixPasseI sui suiv suiv suiv (suiv + "r") suivi (suivi+"s") ; - - conj3vivre : Str -> Verbe = \vivre -> - let { - viv = troncVerb vivre ; - vi = Predef.tk 1 viv ; - véc = Predef.tk 1 vi + "éc" - } in - auxConj3re - affixSgS affixPasseU vi viv viv véc (viv + "r") (véc + "u") (véc + "us") ; - - conj3lire : Str -> Verbe = \lire -> - let { - li = troncVerb lire ; - lis = li + "s" ; - l = Predef.tk 1 li - } in - auxConj3re affixSgS affixPasseU li lis lis l (li + "r") (l + "u") (l + "us") ; - - conj3dire : Str -> Verbe = \dire -> - let { - di = troncVerb dire ; - dis = di + "s" ; - dit = di + "t" ; - d = Predef.tk 1 di ; - tdire = auxConj3re - affixSgS affixPasseI di dis dis d (di + "r") dit (dit+"s") - } in - table { - Indic Pres Pl P2 => di + "tes" ; - Imper PlP2 => di + "tes" ; - t => tdire ! t - } ; - - conj3rire : Str -> Verbe = \rire -> - let { - ri = troncVerb rire ; - r = Predef.tk 1 ri - } in - auxConj3re affixSgS affixPasseI ri ri ri r (ri + "r") ri (ri+"s") ; - - auxConj3scrire : (_,_,_,_: Str) -> Verbe = \ecri, ecriv, ecrivi, ecrit -> - auxConj3re - affixSgS affixPasseI ecri ecriv ecriv ecrivi (ecri + "r") ecrit (ecrit+"s") ; - - conj3écrire : Str -> Verbe = \écrire -> - let {écri = troncVerb écrire} in - auxConj3scrire écri (écri + "v") (écri + "v") (écri + "t") ; - - conj3confire : Str -> Verbe = \confire -> - let {confi = troncVerb confire} in - auxConj3scrire confi (confi + "s") (Predef.tk 1 confi) (confi + "t") ; - - conj3cuire : Str -> Verbe = \cuire -> - let {cui = troncVerb cuire} in - auxConj3scrire cui (cui + "s") (cui + "s") (cui + "t") ; - - ---3 Very irregular verbs --- --- Here we cannot do even with the 'worst case macro'. - - conj3aller : Str -> Verbe = \aller -> - let { - s = Predef.tk 5 aller ; - pres = formesPresAi "v" "all" ; - taller = verbHabituel - "all" "all" "aill" "all" "ir" "allé" "aller" - affixSgS affixPasseA - } in - table { - Indic Pres Sg P1 => s + "vais" ; - Indic Pres n p => s + pres ! n ! p ; - Indic Imparf n p => s + "all" + affixImparf ! n ! p ; - Imper SgP2 => s + "va" ; - t => s + taller ! t - } ; - - conjÊtre : Str -> Verbe = \etre -> - let { - s = Predef.tk 4 etre ; - sg = lesAffixes "suis" "es" "est" ; - pl = lesAffixes "sommes" "êtes" "sont" ; - tetre = verbHabituel - "soi" "soy" "soi" "f" "ser" "été" "être" affixSgS affixPasseU - } in - table { - Indic Pres Sg p => s + sg ! p ; - Indic Pres Pl p => s + pl ! p ; - Indic Imparf n p => s + "ét" + affixImparf ! n ! p ; - Subjo SPres Sg p => s + "soi" + affixSgS ! p ; - Subjo SPres Pl P3 => s + "soient" ; - Subjo SPres Pl p => s + "soy" + affixPlOns ! p ; - Part PPres => s + "étant" ; - t => s + tetre ! t - } ; - - conjAvoir : Str -> Verbe = \avoir -> - let { - s = Predef.tk 5 avoir ; - pres = formesPresAi [] "av" ; - tavoir = verbHabituel - "ai" "ay" "ai" "e" "aur" "eu" "avoir" affixSgS affixPasseU - } in - table { - Indic Pres n p => s + pres ! n ! p ; - Indic Imparf n p => s + "av" + affixImparf ! n ! p ; - Subjo SPres Sg P3 => s + "ait" ; - Subjo SPres Pl P3 => s + "aient" ; - Subjo SPres Pl p => s + "ay" + affixPlOns ! p ; - Imper SgP2 => s + "aie" ; - t => s + tavoir ! t - } ; - -} diff --git a/grammars/resource/french/ResFra.gf b/grammars/resource/french/ResFra.gf deleted file mode 100644 index a80729c66..000000000 --- a/grammars/resource/french/ResFra.gf +++ /dev/null @@ -1,3 +0,0 @@ ---# -path=.:../romance:../abstract:../../prelude - -concrete ResFra of ResAbs = ResRomance with (SyntaxRomance=SyntaxFra) ; diff --git a/grammars/resource/french/SyntaxFra.gf b/grammars/resource/french/SyntaxFra.gf deleted file mode 100644 index 925d48b20..000000000 --- a/grammars/resource/french/SyntaxFra.gf +++ /dev/null @@ -1,295 +0,0 @@ ---# -path=.:../romance:../../prelude - -instance SyntaxFra of SyntaxRomance = TypesFra ** open Prelude, (CO=Coordination), MorphoFra in { - -oper - nameNounPhrase = \jean -> - normalNounPhrase - (\\c => prepCase c ++ jean.s) - jean.g - Sg ; - - chaqueDet = mkDeterminer1 Sg "chaque" ; - tousDet = mkDeterminer Pl ["tous les"] ["toutes les"] ; - plupartDet = mkDeterminer1 Pl ["la plupart des"] ; - unDet = mkDeterminer Sg "un" "une" ; - plDet = mkDeterminer1 Pl "des" ; --- - - quelDet = mkDeterminer Sg "quel" "quelle" ; - quelsDet = mkDeterminer Pl "quels" "quelles" ; - - npGenPoss = \n,ton,mec -> - \\c => prepCase c ++ ton.s ! Poss n mec.g ++ mec.s ! n ; - - mkAdjReg : Str -> Bool -> Adjective = \adj,p -> - mkAdjective (adjGrand adj) p ; - - comparConj = elisQue ; - - mkAdjDegrReg : Str -> Bool -> AdjDegr = \adj,p -> - mkAdjDegrLong (adjGrand adj) p ; - --- The commonest case for functions is common noun + "de". - - funDe : CommNounPhrase -> Function = \mere -> - mere ** complementCas genitive ; - --- Chains of "dont" - "dont" do not arise. - - funRelPron : Function -> RelPron -> RelPron = \mere,lequel -> - {s = table { - RComplex g n c => variants { - case mere.c of { --- - Gen => lequel.s ! RSimple Gen ++ - artDef mere.g n c ++ mere.s ! n ; - _ => nonExist} ; - artDef mere.g n c ++ mere.s ! n ++ - mere.s2 ++ lequel.s ! RComplex g n mere.c - } ; - _ => nonExist - } ; - g = RG mere.g - } ; - - --- Verbs - - negVerb = \va -> elisNe ++ va ++ "pas" ; - - copula = \b -> (etreNetre b).s ; - - isTransVerbClit = \v -> case v.c of { - Acc => True ; - _ => False --- hmmm - } ; - --- The "ne - pas" negation. - - posNeg = \b,v,c -> - if_then_else Str b - (v ++ c) - (elisNe ++ v ++ "pas" ++ c) ; --- exception: infinitive! - --- Exampe: 'to be or not to be'. - - etreNetre : Bool -> VerbPres = \b -> - {s = \\w => posNeg b (verbEtre.s ! w) []} ; ---- v reveals a BUG in refresh - - locativeNounPhrase = \jean -> - {s = "dans" ++ jean.s ! Ton Acc} ; - - embedConj = elisQue ; - --- Relative pronouns - - identRelPron = { - s = table { - RSimple c => relPronForms ! c ; - RComplex g n c => composRelPron g n c - } ; - g = RNoGen - } ; - - suchPron = telPron ; - - composRelPron = lequelPron ; - - allRelForms = \lequel,g,n,c -> - variants { - lequel.s ! RSimple c ; - lequel.s ! RComplex g n c - } ; - --- Interrogative pronouns - - nounIntPron = \n, mec -> - {s = \\c => prepCase c ++ quelPron mec.g n ++ mec.s ! n ; - g = mec.g ; - n = n - } ; - - intPronWho = \num -> { - s = \\c => prepCase c ++ "qui" ; - g = Masc ; --- can we decide this? - n = num - } ; - - intPronWhat = \num -> { - s = table { - Gen => ["de quoi"] ; - Acc => ["à quoi"] ; - c => elisQue - } ; - g = Masc ; --- can we decide this? - n = num - } ; - --- Questions - - questVerbPhrase = \jean,dort -> - {s = table { - DirQ => optStr (estCeQue Acc) ++ (predVerbPhrase jean dort).s ! Ind ; - IndirQ => elisSi ++ (predVerbPhrase jean dort).s ! Ind - } - } ; - - intVerbPhrase = \qui, dort -> - {s = table { - DirQ => qui.s ! Nom ++ optStr (estCeQue Nom) ++ - dort.s ! qui.g ! VFin Ind qui.n P3 ; - IndirQ => "ce" ++ qui.s ! Nom ++ dort.s ! qui.g ! VFin Ind qui.n P3 - } - } ; - - intSlash = \Qui, Tuvois -> - let {qui = Tuvois.s2 ++ Qui.s ! Tuvois.c ; tuvois = Tuvois.s ! Ind} in - {s = table { - DirQ => qui ++ optStr (estCeQue Acc) ++ tuvois ; - IndirQ => ifCe Tuvois.c ++ qui ++ tuvois - } - } ; - --- An auxiliary to distinguish between --- "je ne sais pas" ("ce qui dort" / "ce que tu veux" / "à qui tu penses"). - - ifCe : Case -> Str = \c -> case c of { - Nom => "ce" ; - Acc => "ce" ; - _ => [] - } ; - - questAdverbial = \quand, jean, dort -> - let {jeandort = (predVerbPhrase jean dort).s ! Ind} in - {s = table { - DirQ => quand.s ++ optStr (estCeQue Acc) ++ jeandort ; - IndirQ => quand.s ++ jeandort - } - } ; - ------ moved from Morpho - ---2 Articles --- --- A macro for defining gender-dependent tables will be useful. --- Its first application is in the indefinite article. --- --- Notice that the plural genitive is special: "de femmes". - - genForms : Str -> Str -> Gender => Str = \bon,bonne -> - table {Masc => bon ; Fem => bonne} ; - - artIndef = \g,n,c -> case <n,c> of { - <Sg,_> => prepCase c ++ genForms "un" "une" ! g ; - <Pl,Gen> => elisDe ; - _ => prepCase c ++ "des" - } ; - - artDef = \g,n,c -> artDefTable ! g ! n ! c ; - - pronJe = mkPronoun - (elision "j") - (elision "m") - (elision "m") - "moi" - "mon" (elisPoss "m") "mes" - PNoGen -- gender cannot be known from pronoun alone - Sg - P1 - Clit1 ; - - pronTu = mkPronoun - "tu" - (elision "t") - (elision "t") - "toi" - "ton" (elisPoss "t") "tes" - PNoGen - Sg - P2 - Clit1 ; - - pronIl = mkPronoun - "il" - (elision "l") - "lui" - "lui" - "son" (elisPoss "s") "ses" - (PGen Masc) - Sg - P3 - Clit2 ; - - pronElle = mkPronoun - "elle" - elisLa - "lui" - "elle" - "son" (elisPoss "s") "ses" - (PGen Fem) - Sg - P3 - Clit2 ; - - pronNous = mkPronoun - "nous" - "nous" - "nous" - "nous" - "notre" "notre" "nos" - PNoGen - Pl - P1 - Clit3 ; - - pronVous = mkPronoun - "vous" - "vous" - "vous" - "vous" - "votre" "votre" "vos" - PNoGen - Pl --- depends! - P2 - Clit3 ; - - pronIls = mkPronoun - "ils" - "les" - "leur" - "eux" - "leur" "leur" "leurs" - (PGen Masc) - Pl - P3 - Clit1 ; - - pronElles = mkPronoun - "elles" - "les" - "leur" - "elles" - "leur" "leur" "leurs" - (PGen Fem) - Pl - P3 - Clit1 ; - --- moved from ResFra - - commentAdv = ss "comment" ; - quandAdv = ss "quand" ; - ouAdv = ss "où" ; - pourquoiAdv = ss "pourquoi" ; - - etConj = ss "et" ** {n = Pl} ; - ouConj = ss "ou" ** {n = Sg} ; - etetConj = sd2 "et" "et" ** {n = Pl} ; - ououConj = sd2 "ou" "ou" ** {n = Sg} ; - niniConj = sd2 "ni" "ni" ** {n = Sg} ; --- requires ne ! - siSubj = ss elisSi ; - quandSubj = ss "quand" ; - - ouiPhr = ss ["Oui ."] ; - nonPhr = ss ["Non ."] ; --- and also Si! - -} diff --git a/grammars/resource/french/TestFra.gf b/grammars/resource/french/TestFra.gf deleted file mode 100644 index 7193a6d5c..000000000 --- a/grammars/resource/french/TestFra.gf +++ /dev/null @@ -1,34 +0,0 @@ ---# -path=.:../romance:../abstract:../../prelude - -concrete TestFra of TestAbs = ResFra ** open Prelude, TypesFra, MorphoFra, SyntaxFra in { - -flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ; - -lin - Big = mkAdjDegrReg "grand" adjPre ; - Small = mkAdjDegrReg "petit" adjPre ; - Old = mkAdjDegrLong (mkAdj "vieux" "vieux" "vieille") adjPre ; - Young = mkAdjDegrLong (adjJeune "jeune") adjPre ; - Man = mkCNomReg "homme" Masc ; - Woman = mkCNomReg "femme" Fem ; - Car = mkCNomReg "voiture" Fem ; - Light = mkCNomReg "lumière" Fem ; - House = mkCNomReg "maison" Fem ; - Walk = verbPres (conj1aimer "marcher") ; - Run = verbPres (conj3courir "courir") ; - Send = mkTransVerbDir (verbPres (conj1envoyer "envoyer")) ; - Love = mkTransVerbDir (verbPres (conj1aimer "aimer")) ; - Wait = mkTransVerbDir (verbPres (conj3rendre "attendre")) ; - Say = verbSent (verbPres (conj3dire "dire")) Ind Ind ; - Prove = verbSent (verbPres (conj1aimer "démontrer")) Ind Ind ; - SwitchOn = mkTransVerbDir (verbPres (conj1aimer "allumer")) ; - SwitchOff = mkTransVerbDir (verbPres (conj3peindre "éteindre")) ; - Mother = funDe (mkCNomReg "mère" Fem) ; - Uncle = funDe (mkCNomReg "oncle" Masc) ; - - Well = ss "bien" ; - Always = ss "toujours" ; - - John = mkProperName "Jean" Masc ; - Mary = mkProperName "Marie" Fem ; -} diff --git a/grammars/resource/french/TypesFra.gf b/grammars/resource/french/TypesFra.gf deleted file mode 100644 index 71c12a437..000000000 --- a/grammars/resource/french/TypesFra.gf +++ /dev/null @@ -1,160 +0,0 @@ ---1 French Word Classes and Morphological Parameters --- --- This is a resource module for Italian morphology, defining the --- morphological parameters and word classes of Italian. --- The morphology is so far only --- complete w.r.t. the syntax part of the resource grammar. --- It does not include those parameters that are not needed for --- analysing individual words: such parameters are defined in syntax modules. - -instance TypesFra of TypesRomance = { - --- Now we can give values to the abstract types. - -param - Case = Nom | Acc | Gen | Dat ; -- corresp. to prepositions de and à - - NPForm = Ton Case | Aton Case | Poss Number Gender ; - -oper - CaseA = Case ; - NPFormA = NPForm ; - - nominative = Nom ; - accusative = Acc ; - genitive = Gen ; - dative = Dat ; - - stressed = Ton ; - unstressed = Aton ; - -------------------------- move this somewhere else! ---2 Some phonology --- ---3 Elision --- --- The phonological rule of *elision* can be defined as follows in GF. --- There is one thing that is not treated properly: the "h aspiré", --- which is not separated orthographically from the "h muet". --- Our definition works correctly only for the "h muet". - -oper - voyelle : Strs = strs { - "a" ; "â" ; "à" ; "e" ; "ê" ; "é" ; "è" ; - "h" ; - "i" ; "î" ; "o" ; "ô" ; "u" ; "û" ; "y" - } ; - - elision : Str -> Str = \d -> d + pre {"e" ; "'" / voyelle} ; - --- The following morphemes are the most common uses of elision. - - elisDe = elision "d" ; - elisLa = pre {"la" ; "l'" / voyelle} ; - elisLe = elision "l" ; - elisNe = elision "n" ; - elisQue = elision "qu" ; - --- The subjunction "si" has a special kind of elision. The rule is --- only approximatively correct, for "si" is not really elided before --- the string "il" in general, but before the pronouns "il" and "ils". - - elisSi = pre {"si" ; "s'" / strs {"il"}} ; - - ---2 Prepositions --- --- The type $Cas$ in $types.Fra.gf$ has the dative and genitive --- cases, which are relevant for pronouns and the definite article, --- but which are otherwise expressed by prepositions. - - prepCase = \c -> case c of { - Nom => [] ; - Acc => [] ; - Gen => elisDe ; - Dat => "à" - } ; - ---2 Relative pronouns --- --- The simple (atonic) relative pronoun shows genuine variation in all of the --- cases. - - relPronForms = table { - Nom => "qui" ; Gen => "dont" ; Dat => ["à qui"] ; Acc => elisQue - } ; - --- Usually the comparison forms are built by prefixing the word --- "plus". The definite article needed in the superlative is provided in --- $syntax.Fra.gf$. - - adjCompLong : Adj -> AdjComp = \cher -> - mkAdjComp - cher.s - (\\g,n => "plus" ++ cher.s ! g ! n) ; - --- Comparative adjectives are only sometimes formed morphologically --- (actually: by different morphemes). - - mkAdjComp : (_,_ : Gender => Number => Str) -> AdjComp = - \bon, meilleur -> - {s = table {Pos => bon ; _ => meilleur}} ; - ------------------------------- - --- Their inflection tables has tonic and atonic forms, as well as --- the possessive forms, which are inflected like determiners. --- --- Example: "lui, de lui, à lui" - "il,le,lui" - "son,sa,ses". - --- --- Examples of each: "Jean" ; "je"/"te" ; "il"/"elle"/"ils"/"elles" ; "nous"/"vous". - --- The following coercions are useful: - -oper - pform2case = \p -> case p of { - Ton x => x ; - Aton x => x ; - Poss _ _ => Gen - } ; - - case2pform = \c -> case c of { - Nom => Aton Nom ; - Acc => Aton Acc ; - _ => Ton c - } ; - --- Relative pronouns: the case-dependent parameter type. - - param RelForm = RSimple Case | RComplex Gender Number Case ; - - oper RelFormA = RelForm ; - --- Verbs: conversion from full verbs to present-tense verbs. - - verbPres = \aller -> {s = table { - VInfin => aller ! Inf ; - VFin Ind n p => aller ! Indic Pres n p ; - VFin Sub n p => aller ! Subjo SPres n p ; - VImper np => aller ! Imper np - }} ; - --- The full conjunction is a table on $VForm$: - -param - Temps = Pres | Imparf | Passe | Futur ; - TSubj = SPres | SImparf ; - TPart = PPres | PPasse Gender Number ; - VForm = Inf - | Indic Temps Number Person - | Cond Number Person - | Subjo TSubj Number Person - | Imper NumPersI - | Part TPart ; - --- This is the full verb type. - -oper - Verbum : Type = VForm => Str ; -} diff --git a/grammars/resource/german/DatabaseDeu.gf b/grammars/resource/german/DatabaseDeu.gf deleted file mode 100644 index b5f41969d..000000000 --- a/grammars/resource/german/DatabaseDeu.gf +++ /dev/null @@ -1,54 +0,0 @@ ---# -path=.:../abstract:../../prelude - -concrete DatabaseDeu of Database = - open Prelude,Syntax,Deutsch,Predication,Paradigms,DatabaseRes in { - -flags lexer=text ; unlexer=text ; - -lincat - Phras = SS1 Bool ; -- long or short form - Subject = NP ; - Noun = CN ; - Property = AP ; - Comparison = AdjDeg ; - Relation = Adj2 ; - Feature = Fun ; - Value = NP ; - Name = PN ; - -lin - LongForm sent = ss (sent.s ! True ++ "?") ; - ShortForm sent = ss (sent.s ! False ++ "?") ; - - WhichAre A B = mkSent (defaultQuestion (IntVP (NounIPMany A) (PosA B))) - (defaultNounPhrase (IndefManyNP (ModAdj B A))) ; - - IsIt Q A = mkSentSame (defaultQuestion (QuestVP Q (PosA A))) ; - - MoreThan = ComparAdjP ; - TheMost = SuperlNP ; - Relatively C _ = PositAdjP C ; - - RelatedTo = ComplAdj ; - - FeatureOf = appFun1 ; - ValueOf F V = appFun1 F (UsePN V) ; - - WithProperty A B = ModAdj B A ; - - Individual n = nameNounPhrase n ** {lock_NP = <>} ; - - AllN = DetNP AllDet ; - MostN = DetNP MostDet ; - EveryN = DetNP EveryDet ; - --- only these are language-dependent - - Any n = detNounPhrase einDet n ** {lock_NP = <>} ; - - IsThere A = mkSentPrel ["gibt es"] (defaultNounPhrase (IndefOneNP A)) ; - AreThere A = mkSentPrel ["gibt es"] (defaultNounPhrase (IndefManyNP A)) ; - - WhatIs V = mkSentPrel ["was ist"] (defaultNounPhrase V) ; - -} ; diff --git a/grammars/resource/german/DatabaseRes.gf b/grammars/resource/german/DatabaseRes.gf deleted file mode 100644 index 57bac16ac..000000000 --- a/grammars/resource/german/DatabaseRes.gf +++ /dev/null @@ -1,11 +0,0 @@ -resource DatabaseRes = open Prelude in { -oper - mkSent : SS -> SS -> SS1 Bool = \long, short -> - {s = table {b => if_then_else Str b long.s short.s}} ; - - mkSentPrel : Str -> SS -> SS1 Bool = \prel, matter -> - mkSent (ss (prel ++ matter.s)) matter ; - - mkSentSame : SS -> SS1 Bool = \s -> - mkSent s s ; -} ; diff --git a/grammars/resource/german/Deutsch.gf b/grammars/resource/german/Deutsch.gf deleted file mode 100644 index 4a91ad219..000000000 --- a/grammars/resource/german/Deutsch.gf +++ /dev/null @@ -1 +0,0 @@ -resource Deutsch = reuse ResDeu ; diff --git a/grammars/resource/german/Logical.gf b/grammars/resource/german/Logical.gf deleted file mode 100644 index b6d3b524b..000000000 --- a/grammars/resource/german/Logical.gf +++ /dev/null @@ -1,26 +0,0 @@ ---# -path=.:../abstract:../../prelude - --- Slightly ad hoc and formal negation and connectives. - -resource Logical = Predication ** open Deutsch, Paradigms in { - - oper - negS : S -> S ; -- es ist nicht der Fall, dass S - univS : CN -> S -> S ; -- für alle CNs gilt es, dass S - existS : CN -> S -> S ; -- es gibt ein CN derart, dass S - existManyS : CN -> S -> S ; -- es gibt CNs derart, dass S ---. - - negS = \A -> - PredVP ItNP (NegNP (DefOneNP (CNthatS (UseN (nRaum "Fall" "Fälle")) A))) ; - univS = \A,B -> - PredVP ItNP - (AdvVP (PosVS (mkV "gelten" "gilt" "gelte" "gegolten" ** {lock_VS = <>}) B) - (mkPP accusative "für" (DetNP AllDet A))) ; - existS = \A,B -> - PredVP ItNP (PosTV (tvDir (mkV "geben" "gibt" "gib" "gegeben")) - (IndefOneNP (ModRC A (RelSuch B)))) ; - existManyS = \A,B -> - PredVP ItNP (PosTV (tvDir (mkV "geben" "gibt" "gib" "gegeben")) - (IndefManyNP (ModRC A (RelSuch B)))) ; -} ; diff --git a/grammars/resource/german/Morpho.gf b/grammars/resource/german/Morpho.gf deleted file mode 100644 index f62c2fcf5..000000000 --- a/grammars/resource/german/Morpho.gf +++ /dev/null @@ -1,398 +0,0 @@ ---1 A Simple German 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.Deu.gf$. - -resource Morpho = Types ** open (Predef=Predef), Prelude in { - ---2 Nouns --- --- For conciseness and abstraction, we define a method for --- generating a case-dependent table from a list of four forms. - -oper - caselist : (_,_,_,_ : Str) -> Case => Str = \n,a,d,g -> table { - Nom => n ; Acc => a ; Dat => d ; Gen => g} ; - --- The *worst-case macro* for common nouns needs six forms: all plural forms --- are always the same except for the dative. - - mkNoun : (_,_,_,_,_,_ : Str) -> Gender -> CommNoun = - \mann, mannen, manne, mannes, männer, männern, g -> {s = table { - Sg => caselist mann mannen manne mannes ; - Pl => caselist männer männer männern männer - } ; g = g} ; - --- But we never need all the six forms at the same time. Often --- we need just two, three, or four forms. - - mkNoun4 : (_,_,_,_ : Str) -> Gender -> CommNoun = \kuh,kuhes,kühe,kühen -> - mkNoun kuh kuh kuh kuhes kühe kühen ; - - mkNoun3 : (_,_,_ : Str) -> Gender -> CommNoun = \kuh,kühe,kühen -> - mkNoun kuh kuh kuh kuh kühe kühen ; - - mkNoun2n : (_,_ : Str) -> Gender -> CommNoun = \zahl, zahlen -> - mkNoun3 zahl zahlen zahlen ; - - mkNoun2es : (_,_ : Str) -> Gender -> CommNoun = \wort, wörter -> - mkNoun wort wort wort (wort + "es") wörter (wörter + "n") ; - - mkNoun2s : (_,_ : Str) -> Gender -> CommNoun = \vater, väter -> - mkNoun vater vater vater (vater + "s") väter (väter + "n") ; - - mkNoun2ses : (_,_ : Str) -> Gender -> CommNoun = \wort,wörter -> - mkNoun wort wort wort (wort + variants {"es" ; "s"}) wörter (wörter + "n") ; - --- Here are the school grammar declensions with their commonest variations. --- Unfortunately we cannot define *Umlaut* in GF, but have to give two forms. --- --- First declension, with plural "en"/"n", including weak masculins: - - declN1 : Str -> CommNoun = \zahl -> - mkNoun2n zahl (zahl + "en") Fem ; - - declN1e : Str -> CommNoun = \stufe -> - mkNoun2n stufe (stufe + "n") Fem ; - - declN1M : Str -> CommNoun = \junge -> let {jungen = junge + "n"} in - mkNoun junge jungen jungen jungen jungen jungen Masc ; - - declN1eM : Str -> CommNoun = \soldat -> let {soldaten = soldat + "en"} in - mkNoun soldat soldaten soldaten soldaten soldaten soldaten Masc ; - --- Second declension, with plural "e": - - declN2 : Str -> CommNoun = \punkt -> - mkNoun2es punkt (punkt+"e") Masc ; - - declN2i : Str -> CommNoun = \onkel -> - mkNoun2s onkel onkel Masc ; - - declN2u : (_,_ : Str) -> CommNoun = \raum,räume -> - mkNoun2es raum räume Masc ; - - declN2uF : (_,_ : Str) -> CommNoun = \kuh,kühe -> - mkNoun3 kuh kühe (kühe + "n") Fem ; - --- Third declension, with plural "er": - - declN3 : Str -> CommNoun = \punkt -> - mkNoun2es punkt (punkt+"er") Neut ; - - declN3u : (_,_ : Str) -> CommNoun = \buch,bücher -> - mkNoun2ses buch bücher Neut ; - - declN3uS : (_,_ : Str) -> CommNoun = \haus,häuser -> - mkNoun2es haus häuser Neut ; - --- Plural with "s": - - declNs : Str -> CommNoun = \restaurant -> - mkNoun3 restaurant (restaurant+"s") (restaurant+"s") Neut ; - - ---2 Pronouns --- --- Here we define personal and relative pronouns. --- All personal pronouns, except "ihr", conform to the simple --- pattern $mkPronPers$. - - ProPN = {s : NPForm => Str ; n : Number ; p : Person} ; - - mkPronPers : (_,_,_,_,_ : Str) -> Number -> Person -> ProPN = - \ich,mich,mir,meines,mein,n,p -> { - s = table { - NPCase c => caselist ich mich mir meines ! c ; - NPPoss gn c => mein + pronEnding ! gn ! c - } ; - n = n ; - p = p - } ; - - pronEnding : GenNum => Case => Str = table { - GSg Masc => caselist "" "en" "em" "es" ; - GSg Fem => caselist "e" "e" "er" "er" ; - GSg Neut => caselist "" "" "em" "es" ; - GPl => caselist "e" "e" "en" "er" - } ; - - pronIch = mkPronPers "ich" "mich" "mir" "meines" "mein" Sg P1 ; - pronDu = mkPronPers "du" "dich" "dir" "deines" "dein" Sg P2 ; - pronEr = mkPronPers "er" "ihn" "ihm" "seines" "sein" Sg P3 ; - pronSie = mkPronPers "sie" "sie" "ihr" "ihres" "ihr" Sg P3 ; - pronEs = mkPronPers "es" "es" "ihm" "seines" "sein" Sg P3 ; - pronWir = mkPronPers "wir" "uns" "uns" "unser" "unser" Pl P1 ; - - pronSiePl = mkPronPers "sie" "sie" "ihnen" "ihrer" "ihr" Pl P3 ; - pronSSie = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Pl P3 ; --- - --- We still have wrong agreement with the complement of the polite "Sie": --- it is in plural, like the verb, although it should be in singular. - --- The peculiarity with "ihr" is the presence of "e" in forms without an ending. - - pronIhr = - {s = table { - NPPoss (GSg Masc) Nom => "euer" ; - NPPoss (GSg Neut) Nom => "euer" ; - NPPoss (GSg Neut) Acc => "euer" ; - pf => (mkPronPers "ihr" "euch" "euch" "euer" "eur" Pl P2).s ! pf - } ; - n = Pl ; - p = P2 - } ; - --- Relative pronouns are like the definite article, except in the genitive and --- the plural dative. The function $artDef$ will be defined right below. - - RelPron : Type = {s : GenNum => Case => Str} ; - - relPron : RelPron = {s = \\gn,c => - case <gn,c> of { - <GSg Fem,Gen> => "deren" ; - <GSg g,Gen> => "dessen" ; - <GPl,Dat> => "denen" ; - <GPl,Gen> => "deren" ; - _ => artDef ! gn ! c - } - } ; - - ---2 Articles --- --- Here are all forms the indefinite and definite article. --- The indefinite article is like a large class of pronouns. --- The definite article is more peculiar; we don't try to --- subsume it to any general rule. - - artIndef : Gender => Case => Str = \\g,c => "ein" + pronEnding ! GSg g ! c ; - - artDef : GenNum => Case => Str = table { - GSg Masc => caselist "der" "den" "dem" "des" ; - GSg Fem => caselist "die" "die" "der" "der" ; - GSg Neut => caselist "das" "das" "dem" "des" ; - GPl => caselist "die" "die" "den" "der" - } ; - - ---2 Adjectives --- --- As explained in $types.Deu.gf$, it --- would be superfluous to use the cross product of gender and number, --- since there is no gender distinction in the plural. But it is handy to have --- a function that constructs gender-number complexes. - - gNumber : Gender -> Number -> GenNum = \g,n -> - case n of { - Sg => GSg g ; - Pl => GPl - } ; - --- It's also handy to have a function that finds out the number from such a complex. - - numGenNum : GenNum -> Number = \gn -> - case gn of { - GSg _ => Sg ; - GPl => Pl - } ; - --- This function costructs parameters in the complex type of adjective forms. - - aMod : Adjf -> Gender -> Number -> Case -> AForm = \a,g,n,c -> - AMod a (gNumber g n) c ; - --- The worst-case macro for adjectives (positive degree) only needs --- two forms. - - mkAdjective : (_,_ : Str) -> Adjective = \böse,bös -> {s = table { - APred => böse ; - AMod Strong (GSg Masc) c => - caselist (bös+"er") (bös+"en") (bös+"em") (bös+"es") ! c ; - AMod Strong (GSg Fem) c => - caselist (bös+"e") (bös+"e") (bös+"er") (bös+"er") ! c ; - AMod Strong (GSg Neut) c => - caselist (bös+"es") (bös+"es") (bös+"em") (bös+"es") ! c ; - AMod Strong GPl c => - caselist (bös+"e") (bös+"e") (bös+"en") (bös+"er") ! c ; - AMod Weak (GSg g) c => case <g,c> of { - <_,Nom> => bös+"e" ; - <Masc,Acc> => bös+"en" ; - <_,Acc> => bös+"e" ; - _ => bös+"en" } ; - AMod Weak GPl c => bös+"en" - }} ; - --- Here are some classes of adjectives: - - adjReg : Str -> Adjective = \gut -> mkAdjective gut gut ; - adjE : Str -> Adjective = \bös -> mkAdjective (bös+"e") bös ; - adjEr : Str -> Adjective = \teu -> mkAdjective (teu+"er") (teu+"r") ; - adjInvar : Str -> Adjective = \prima -> {s = table {_ => prima}} ; - --- The first three classes can be recognized from the end of the word, depending --- on if it is "e", "er", or something else. - - adjGen : Str -> Adjective = \gut -> let { - er = Predef.dp 2 gut ; - teu = Predef.tk 2 gut ; - e = Predef.dp 1 gut ; - bös = Predef.tk 1 gut - } in - ifTok Adjective er "er" (adjEr teu) ( - ifTok Adjective e "e" (adjE bös) ( - (adjReg gut))) ; - - --- The comparison of adjectives needs three adjectives in the worst case. - - mkAdjComp : (_,_,_ : Adjective) -> AdjComp = \gut,besser,best -> - {s = table {Pos => gut.s ; Comp => besser.s ; Sup => best.s}} ; - --- It can be done by just three strings, if each of the comparison --- forms taken separately is a regular adjective. - - adjCompReg3 : (_,_,_ : Str) -> AdjComp = \gut,besser,best -> - mkAdjComp (adjReg gut) (adjReg besser) (adjReg best) ; - --- If also the comparison forms are regular, one string is enough. - - adjCompReg : Str -> AdjComp = \billig -> - adjCompReg3 billig (billig+"er") (billig+"st") ; - - ---2 Verbs --- --- We limit ourselves to verbs in present tense infinitive, indicative, --- and imperative, and past participle. Other forms will be introduced later. --- --- The worst-case macro needs three forms: the infinitive, the third person --- singular indicative, and the second person singular imperative. --- We take care of the special cases "ten", "sen", "ln", "rn". --- --- A famous law about Germanic languages says that plural first and third person --- are similar. - - mkVerbum : (_,_,_,_ : Str) -> Verbum = \geben, gib, gb, gegeben -> - let { - en = Predef.dp 2 geben ; - geb = ifTok Tok (Predef.tk 1 en) "e" (Predef.tk 2 geben)(Predef.tk 1 geben) ; - gebt = ifTok Tok (Predef.dp 1 geb) "t" (geb + "et") (geb + "t") ; - gibst = ifTok Tok (Predef.dp 1 gib) "s" (gib + "t") (gib + "st") ; - gegebener = (adjReg gegeben).s - } in table { - VInf => geben ; - VInd Sg P1 => geb + "e" ; - VInd Sg P2 => gibst ; - VInd Sg P3 => gib + "t" ; - VInd Pl P2 => gebt ; - VInd Pl _ => geben ; -- the famous law - VImp Sg => gb ; - VImp Pl => gebt ; - VPart a => gegebener ! a - } ; - --- Regular verbs: - - regVerb : Str -> Verbum = \legen -> - let {lege = ifTok Tok (Predef.dp 3 legen) "ten" (Predef.tk 1 legen) ( - ifTok Tok (Predef.dp 2 legen) "en" (Predef.tk 2 legen) ( - Predef.tk 1 legen))} in - mkVerbum legen lege lege ("ge" + (lege + "t")) ; - --- Verbs ending with "t"; now recognized in $mkVerbum$. - - verbWarten : Str -> Verbum = regVerb ; - --- Verbs with Umlaut in the second and third person singular and imperative: - - verbSehen : Str -> Str -> Str -> Verbum = \sehen, sieht, gesehen -> - let {sieh = Predef.tk 1 sieht} in mkVerbum sehen sieh sieh gesehen ; - --- Verbs with Umlaut in the second and third person singular but not imperative: - - verbLaufen : Str -> Str -> Str -> Verbum = \laufen, läuft, gelaufen -> - let {läuf = Predef.tk 1 läuft ; laufe = Predef.tk 1 laufen} - in mkVerbum laufen läuf laufe gelaufen ; - --- The verb "be": - - verbumSein : Verbum = let { - gewesen = (adjReg "gewesen").s - } in - table { - VInf => "sein" ; - VInd Sg P1 => "bin" ; - VInd Sg P2 => "bist" ; - VInd Sg P3 => "ist" ; - VInd Pl P2 => "seid" ; - VInd Pl _ => "sind" ; - VImp Sg => "sei" ; - VImp Pl => "seiet" ; - VPart a => gewesen ! a - } ; - --- The verb "have": - - verbumHaben : Verbum = let { - haben = (regVerb "haben") - } in - table { - VInd Sg P2 => "hast" ; - VInd Sg P3 => "hat" ; - v => haben ! v - } ; - --- The verb "become", used as the passive auxiliary: - - verbumWerden : Verbum = let { - werden = regVerb "werden" ; - geworden = (adjReg "geworden").s - } in - table { - VInd Sg P2 => "wirst" ; - VInd Sg P3 => "wird" ; - VPart a => geworden ! a ; - v => werden ! v - } ; - --- A *full verb* ($Verb$) consists of the inflection forms ($Verbum$) and --- a *particle* (e.g. "aus-sehen"). Simple verbs are the ones that have no --- such particle. - - mkVerb : Verbum -> Particle -> Verb = \v,p -> {s = v ; s2 = p} ; - - mkVerbSimple : Verbum -> Verb = \v -> mkVerb v [] ; - - verbSein = mkVerbSimple verbumSein ; - verbHaben = mkVerbSimple verbumHaben ; - verbWerden = mkVerbSimple verbumWerden ; - -{- - -- tests for optimizer - verbumSein2 : Verbum = - table { - VInf => "sein" ; - VInd Sg P1 => "bin" ; - VInd Sg P2 => "bist" ; - VInd Sg P3 => "ist" ; - VInd Pl P2 => "seid" ; - VInd Pl _ => "sind" ; - VImp Sg => "sei" ; - VImp Pl => "seiet" ; - VPart a => (adjReg "gewesen").s ! a - } ; - - verbumHaben2 : Verbum = - table { - VInd Sg P2 => "hast" ; - VInd Sg P3 => "hat" ; - v => regVerb "haben" ! v - } ; --} - -} ; diff --git a/grammars/resource/german/Paradigms.gf b/grammars/resource/german/Paradigms.gf deleted file mode 100644 index 1bfeb3fe6..000000000 --- a/grammars/resource/german/Paradigms.gf +++ /dev/null @@ -1,310 +0,0 @@ ---# -path=.:../abstract:../../prelude - ---1 German Lexical Paradigms --- --- Aarne Ranta 2003 --- --- This is an API to the user of the resource grammar --- for adding lexical items. It give shortcuts for forming --- expressions of basic categories: nouns, adjectives, verbs. --- --- Closed categories (determiners, pronouns, conjunctions) are --- accessed through the resource syntax API, $resource.Abs.gf$. --- --- The main difference with $morpho.Deu.gf$ is that the types --- referred to are compiled resource grammar types. We have moreover --- had the design principle of always having existing forms as string --- arguments of the paradigms, not stems. --- --- The following modules are presupposed: - -resource Paradigms = open (Predef=Predef), Prelude, (Morpho=Morpho), Syntax, Deutsch in { - - ---2 Parameters --- --- To abstract over gender names, we define the following identifiers. - -oper - masculine : Gender ; - feminine : Gender ; - neuter : Gender ; - --- To abstract over case names, we define the following. - - nominative : Case ; - accusative : Case ; - dative : Case ; - genitive : Case ; - --- To abstract over number names, we define the following. - - singular : Number ; - plural : Number ; - - ---2 Nouns - --- Worst case: give all four singular forms, two plural forms (others + dative), --- and the gender. - - mkN : (_,_,_,_,_,_ : Str) -> Gender -> N ; - -- mann, mann, manne, mannes, männer, männern - --- Often it is enough with singular and plural nominatives, and singular --- genitive. The plural dative --- is computed by the heuristic that it is the same as the nominative this --- ends with "n" or "s", otherwise "n" is added. - - nGen : Str -> Str -> Str -> Gender -> N ; -- punkt,punktes,punkt - --- Here are some common patterns. Singular nominative or two nominatives are needed. --- Two forms are needed in case of Umlaut, which would be complicated to define. --- For the same reason, we have separate patterns for multisyllable stems. --- --- The weak masculine pattern $nSoldat$ avoids duplicating the final "e". - - nRaum : (_,_ : Str) -> N ; -- Raum, (Raumes,) Räume (masc) - nTisch : Str -> N ; -- Tisch, (Tisches, Tische) (masc) - nVater : (_,_ : Str) -> N ; -- Vater, (Vaters,) Väter (masc) - nFehler : Str -> N ; -- Fehler, (fehlers, Fehler) (masc) - nSoldat : Str -> N ; -- Soldat (, Soldaten) ; Kunde (, Kunden) (masc) - --- Neuter patterns. - - nBuch : (_,_ : Str) -> N ; -- Buch, (Buches, Bücher) (neut) - nMesser : Str -> N ; -- Messer, (Messers, Messer) (neut) - nAuto : Str -> N ; -- Auto, (Autos, Autos) (neut) - --- Feminine patterns. Duplicated "e" is avoided in $nFrau$. - - nHand : (_,_ : Str) -> N ; -- Hand, Hände; Mutter, Mütter (fem) - nFrau : Str -> N ; -- Frau (, Frauen) ; Wiese (, Wiesen) (fem) - - --- Nouns used as functions need a preposition. The most common is "von". - - mkFun : N -> Preposition -> Case -> Fun ; - funVon : N -> Fun ; - --- Proper names, with their possibly --- irregular genitive. The regular genitive is "s", omitted after "s". - - mkPN : (karolus, karoli : Str) -> PN ; -- karolus, karoli - pnReg : (Johann : Str) -> PN ; -- Johann, Johanns ; Johannes, Johannes - --- On the top level, it is maybe $CN$ that is used rather than $N$, and --- $NP$ rather than $PN$. - - mkCN : N -> CN ; - mkNP : (karolus,karoli : Str) -> NP ; - - npReg : Str -> NP ; -- Johann, Johanns - --- In some cases, you may want to make a complex $CN$ into a function. - - mkFunCN : CN -> Preposition -> Case -> Fun ; - funVonCN : CN -> Fun ; - - ---2 Adjectives - --- Non-comparison one-place adjectives need two forms in the worst case: --- the one in predication and the one before the ending "e". - - mkAdj1 : (teuer,teur : Str) -> Adj1 ; - --- Invariable adjective are a special case. - - adjInvar : Str -> Adj1 ; -- prima - --- The following heuristic recognizes the the end of the word, and builds --- the second form depending on if it is "e", "er", or something else. --- N.B. a contraction is made with "er", which works for "teuer" but not --- for "bitter". - - adjGen : Str -> Adj1 ; -- gut; teuer; böse - --- Two-place adjectives need a preposition and a case as extra arguments. - - mkAdj2 : Adj1 -> Str -> Case -> Adj2 ; -- teilbar, durch, acc - --- Comparison adjectives may need three adjective, corresponding to the --- three comparison forms. - - mkAdjDeg : (gut,besser,best : Adj1) -> AdjDeg ; - --- In many cases, each of these adjectives is itself regular. Then we only --- need three strings. Notice that contraction with "er" is not performed --- ("bessere", not "bessre"). - - aDeg3 : (gut,besser,best : Str) -> AdjDeg ; - --- In the completely regular case, the comparison forms are constructed by --- the endings "er" and "st". - - aReg : Str -> AdjDeg ; -- billig, billiger, billigst - --- The past participle of a verb can be used as an adjective. - - aPastPart : V -> Adj1 ; -- gefangen - --- On top level, there are adjectival phrases. The most common case is --- just to use a one-place adjective. The variation in $adjGen$ is taken --- into account. - - apReg : Str -> AP ; - - ---2 Verbs --- --- The fragment only has present tense so far, but in all persons. --- It also has the infinitive and the past participles. --- The worst case macro needs four forms: : the infinitive and --- the third person singular (where Umlaut may occur), the singular imperative, --- and the past participle. --- --- The function recognizes if the stem ends with "s" or "t" and performs the --- appropriate contractions. - - mkV : (_,_,_,_ : Str) -> V ; -- geben, gibt, gib, gegeben - --- Regular verbs are those where no Umlaut occurs. - - vReg : Str -> V ; -- kommen - --- The verbs 'be' and 'have' are special. - - vSein : V ; - vHaben : V ; - --- Verbs with a detachable particle, with regular ones as a special case. - - vPart : (_,_,_,_,_ : Str) -> V ; -- sehen, sieht, sieh, gesehen, aus - vPartReg : (_,_ : Str) -> V ; -- bringen, um - --- Two-place verbs, and the special case with direct object. Notice that --- a particle can be included in a $V$. - - mkTV : V -> Str -> Case -> TV ; -- hören, zu, dative - - tvReg : Str -> Str -> Case -> TV ; -- hören, zu, dative - tvDir : V -> TV ; -- umbringen - tvDirReg : Str -> TV ; -- lieben - --- Three-place verbs require two prepositions and cases. - - mkV3 : V -> Str -> Case -> Str -> Case -> V3 ; -- geben,[],dative,[],accusative - - ---2 Adverbials --- --- Adverbials for modifying verbs, adjectives, and sentences can be formed --- from strings. - - mkAdV : Str -> AdV ; - mkAdA : Str -> AdA ; - mkAdS : Str -> AdS ; - --- Prepositional phrases are another productive form of adverbials. - - mkPP : Case -> Str -> NP -> AdV ; - --- The definitions should not bother the user of the API. So they are --- hidden from the document. ---. - - - masculine = Masc ; - feminine = Fem ; - neuter = Neut ; - nominative = Nom ; - accusative = Acc ; - dative = Dat ; - genitive = Gen ; - -- singular defined in Types - -- plural defined in Types - - mkN a b c d e f g = mkNoun a b c d e f g ** {lock_N = <>} ; - - nGen = \punkt, punktes, punkte, g -> let { - e = Predef.dp 1 punkte ; - eqy = ifTok N e ; - noN = mkNoun4 punkt punktes punkte punkte g ** {lock_N = <>} - } in - eqy "n" noN ( - eqy "s" noN ( - mkNoun4 punkt punktes punkte (punkte+"n") g ** {lock_N = <>})) ; - - nRaum = \raum, räume -> nGen raum (raum + "es") räume masculine ; - nTisch = \tisch -> - mkNoun4 tisch (tisch + "es") (tisch + "e") (tisch +"en") masculine ** - {lock_N = <>}; - nVater = \vater, väter -> nGen vater (vater + "s") väter masculine ; - nFehler = \fehler -> nVater fehler fehler ; - - nSoldat = \soldat -> let { - e = Predef.dp 1 soldat ; - soldaten = ifTok Tok e "e" (soldat + "n") (soldat + "en") - } in - mkN soldat soldaten soldaten soldaten soldaten soldaten masculine ; - - nBuch = \buch, bücher -> nGen buch (buch + "es") bücher neuter ; - nMesser = \messer -> nGen messer (messer + "s") messer neuter ; - nAuto = \auto -> let {autos = auto + "s"} in - mkNoun4 auto autos autos autos neuter ** {lock_N = <>} ; - - nHand = \hand, hände -> nGen hand hand hände feminine ; - - nFrau = \frau -> let { - e = Predef.dp 1 frau ; - frauen = ifTok Tok e "e" (frau + "n") (frau + "en") - } in - mkN frau frau frau frau frauen frauen feminine ; - - mkFun n = mkFunCN (UseN n) ; - funVon n = funVonCN (UseN n) ; - - mkPN = \karolus, karoli -> - {s = table {Gen => karoli ; _ => karolus} ; lock_PN = <>} ; - pnReg = \horst -> - mkPN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) ; - - mkCN = UseN ; - mkNP = \x,y -> UsePN (mkPN x y) ; - npReg = \s -> UsePN (pnReg s) ; - - mkFunCN n p c = mkFunC n p c ** {lock_Fun = <>} ; - funVonCN n = funVonC n ** {lock_Fun = <>} ; - - mkAdj1 x y = mkAdjective x y ** {lock_Adj1 = <>} ; - adjInvar a = Morpho.adjInvar a ** {lock_Adj1 = <>} ; - adjGen a = Morpho.adjGen a ** {lock_Adj1 = <>} ; - mkAdj2 = \a,p,c -> a ** {s2 = p ; c = c ; lock_Adj2 = <>} ; - - mkAdjDeg a b c = mkAdjComp a b c ** {lock_AdjDeg = <>} ; - aDeg3 a b c = adjCompReg3 a b c ** {lock_AdjDeg = <>} ; - aReg a = adjCompReg a ** {lock_AdjDeg = <>} ; - aPastPart = \v -> {s = table AForm {a => v.s ! VPart a} ; lock_Adj1 = <>} ; - apReg = \s -> AdjP1 (adjGen s) ; - - mkV = \sehen, sieht, sieh, gesehen -> - mkVerbSimple (mkVerbum sehen (Predef.tk 1 sieht) sieh gesehen) ** {lock_V = <>} ; - vReg = \s -> mkVerbSimple (regVerb s) ** {lock_V = <>} ; - vSein = verbSein ** {lock_V = <>} ; - vHaben = verbHaben ** {lock_V = <>} ; - vPart = \sehen, sieht, sieh, gesehen, aus -> - mkVerb (mkVerbum sehen sieht sieh gesehen) aus ** {lock_V = <>} ; - vPartReg = \sehen, aus -> mkVerb (regVerb sehen) aus ** {lock_V = <>} ; - - mkTV v p c = mkTransVerb v p c ** {lock_TV = <>} ; - tvReg = \hören, zu, dat -> mkTV (vReg hören) zu dat ; - tvDir = \v -> mkTV v [] accusative ; - tvDirReg = \v -> tvReg v [] accusative ; - mkV3 v s c t d = mkDitransVerb v s c t d ** {lock_V3 = <>} ; - - mkAdV a = ss a ** {lock_AdV = <>} ; - mkPP x y z = prepPhrase x y z ** {lock_AdV = <>}; - mkAdA a = ss a ** {lock_AdA = <>} ; - mkAdS a = ss a ** {lock_AdS = <>} ; -} ; diff --git a/grammars/resource/german/Predication.gf b/grammars/resource/german/Predication.gf deleted file mode 100644 index 37572b4c1..000000000 --- a/grammars/resource/german/Predication.gf +++ /dev/null @@ -1,96 +0,0 @@ ---# -path=.:../abstract:../../prelude - ---1 A Small Predication Library --- --- (c) Aarne Ranta 2003 under Gnu GPL. --- --- This library is built on a language-independent API of --- resource grammars. It has a common part, the type signatures --- (defined here), and language-dependent parts. The user of --- the library should only have to look at the type signatures. - -resource Predication = open Deutsch in { - --- We first define a set of predication patterns. - -oper - predV1 : V -> NP -> S ; -- one-place verb: "John walks" - predV2 : TV -> NP -> NP -> S ; -- two-place verb: "John loves Mary" - predV3 : TV -> NP -> NP -> NP -> S ; -- three-place verb: "John gives Mary beer" - predVColl : V -> NP -> NP -> S ; -- collective verb: "John and Mary fight" - predA1 : Adj1 -> NP -> S ; -- one-place adjective: "John is old" - predA2 : Adj2 -> NP -> NP -> S ; -- two-place adj: "John is married to Mary" - predAComp : AdjDeg -> NP -> NP -> S ; -- compar adj: "John is older than Mary" - predAColl : Adj1 -> NP -> NP -> S ; -- collect adj: "John and Mary are married" - predN1 : N -> NP -> S ; -- one-place noun: "John is a man" - predN2 : Fun -> NP -> NP -> S ; -- two-place noun: "John is a lover of Mary" - predNColl : N -> NP -> NP -> S ; -- collect noun: "John and Mary are lovers" - --- Individual-valued function applications. - - appFun1 : Fun -> NP -> NP ; -- one-place function: "the successor of x" - appFun2 : Fun2 -> NP -> NP -> NP ; -- two-place function: "the line from x to y" - appFunColl : Fun -> NP -> NP -> NP ; -- collective function: "the sum of x and y" - --- Families of types, expressed by common nouns depending on arguments. - - appFam1 : Fun -> NP -> CN ; -- one-place family: "divisor of x" - appFam2 : Fun2 -> NP -> NP -> CN ; -- two-place family: "line from x to y" - appFamColl : Fun -> NP -> NP -> CN ; -- collective family: "path between x and y" - --- Type constructor, similar to a family except that the argument is a type. - - constrTyp1 : Fun -> CN -> CN ; - --- Logical connectives on two sentences. - - conjS : S -> S -> S ; -- A and B - disjS : S -> S -> S ; -- A or B - implS : S -> S -> S ; -- if A, B - --- A variant of implication. - - ifThenS : S -> S -> S ; -- if A, then B - --- As an auxiliary, we need two-place conjunction of names ("John and Mary"), --- used in collective predication. - - conjNP : NP -> NP -> NP ; - - ------------------------------ - ----- what follows should be an implementation of the preceding - -oper - predV1 = \F, x -> PredVP x (PosV F) ; - predV2 = \F, x, y -> PredVP x (PosTV F y) ; - predVColl = \F, x, y -> PredVP (conjNP x y) (PosV F) ; - predA1 = \F, x -> PredVP x (PosA (AdjP1 F)) ; - predA2 = \F, x, y -> PredVP x (PosA (ComplAdj F y)) ; - predAComp = \F, x, y -> PredVP x (PosA (ComparAdjP F y)) ; - predAColl = \F, x, y -> PredVP (conjNP x y) (PosA (AdjP1 F)) ; - predN1 = \F, x -> PredVP x (PosCN (UseN F)) ; - predN2 = \F, x, y -> PredVP x (PosCN (AppFun F y)) ; - predNColl = \F, x, y -> PredVP (conjNP x y) (PosCN (UseN F)) ; - - appFun1 = \f, x -> DefOneNP (AppFun f x) ; - appFun2 = \f, x, y -> DefOneNP (AppFun (AppFun2 f x) y) ; - appFunColl = \f, x, y -> DefOneNP (AppFun f (conjNP x y)) ; - - appFam1 = \F, x -> AppFun F x ; - appFam2 = \F, x, y -> AppFun (AppFun2 F x) y ; - appFamColl = \F, x, y -> AppFun F (conjNP x y) ; - - conjS = \A, B -> ConjS AndConj (TwoS A B) ; - disjS = \A, B -> ConjS OrConj (TwoS A B) ; - implS = \A, B -> SubjS IfSubj A B ; - - ifThenS = \A,B -> - SubjS IfSubj A {s = \\o => "then" ++ B.s ! o ; lock_S = <>} ; --- not in Res - - constrTyp1 = \F, A -> AppFun F (IndefManyNP A) ; - - conjNP = \x, y -> ConjNP AndConj (TwoNP x y) ; - -} ; diff --git a/grammars/resource/german/ResDeu.gf b/grammars/resource/german/ResDeu.gf deleted file mode 100644 index 8a602e305..000000000 --- a/grammars/resource/german/ResDeu.gf +++ /dev/null @@ -1,223 +0,0 @@ ---1 The Top-Level German Resource Grammar --- --- Aarne Ranta 2002 -- 2003 --- --- This is the German concrete syntax of the multilingual resource --- grammar. Most of the work is done in the file $syntax.Deu.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 $Types.gf$. - -concrete ResDeu of ResAbs = open Prelude, Syntax in { - -flags - startcat=Phr ; - parser=chart ; - -lincat - CN = CommNounPhrase ; - -- = {s : Adjf => Number => Case => Str ; g : Gender} ; - N = CommNoun ; - -- = {s : Number => Case => Str ; g : Gender} ; - NP = NounPhrase ; - -- = {s : NPForm => Str ; n : Number ; p : Person ; pro : Bool} ; - PN = ProperName ; - -- = {s : Case => Str} ; - Det = {s : Gender => Case => Str ; n : Number ; a : Adjf} ; - Fun = Function ; - -- = CommNounPhrase ** {s2 : Preposition ; c : Case} ; - Fun2 = Function ** {s3 : Preposition ; c2 : Case} ; - - Adj1 = Adjective ; - -- = {s : AForm => Str} ; - Adj2 = Adjective ** {s2 : Preposition ; c : Case} ; - AdjDeg = {s : Degree => AForm => Str} ; - AP = Adjective ** {p : Bool} ; - - V = Verb ; - -- = {s : VForm => Str ; s2 : Particle} ; - VP = Verb ** {s3 : Number => Str ; s4 : Str} ; - TV = TransVerb ; - -- = Verb ** {s3 : Preposition ; c : Case} ; - V3 = TransVerb ** {s4 : Preposition ; c2 : Case} ; - VS = Verb ; - AdV = {s : Str} ; - - S = Sentence ; - -- = {s : Order => Str} ; - Slash = Sentence ** {s2 : Preposition ; c : Case} ; - - RP = {s : GenNum => Case => Str} ; - RC = {s : GenNum => Str} ; - - IP = ProperName ** {n : Number} ; - Qu = {s : QuestForm => Str} ; - Imp = {s : Number => Str} ; - Phr = {s : Str} ; - Text = {s : Str} ; - - Conj = {s : Str ; n : Number} ; - ConjD = {s1,s2 : Str ; n : Number} ; - - ListS = {s1,s2 : Order => Str} ; - ListAP = {s1,s2 : AForm => Str ; p : Bool} ; - ListNP = {s1,s2 : NPForm => Str ; n : Number ; p : Person ; pro : Bool} ; - ---. - -lin - UseN = noun2CommNounPhrase ; - ModAdj = modCommNounPhrase ; - ModGenOne = npGenDet singular ; - ModGenMany = 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 ; - IndefManyNP = indefNounPhrase plural ; - DefOneNP = defNounPhrase singular ; - DefManyNP = defNounPhrase plural ; - - CNthatS = nounThatSentence ; - - PredVP = predVerbPhrase ; - PosV = predVerb True ; - NegV = predVerb False ; - PosA = predAdjective True ; - NegA = predAdjective False ; - PosCN = predCommNoun True ; - NegCN = predCommNoun False ; - PosTV = complTransVerb True ; - NegTV = complTransVerb False ; - PosPassV = passVerb True ; - NegPassV = passVerb False ; - PosNP = predNounPhrase True ; - NegNP = predNounPhrase False ; - PosVS = complSentVerb True ; - NegVS = complSentVerb False ; - PosV3 = complDitransVerb True ; - NegV3 = complDitransVerb False ; - VTrans = transAsVerb ; - - AdvVP = adVerbPhrase ; - LocNP = locativeNounPhrase ; - AdvCN = advCommNounPhrase ; - AdvAP = advAdjPhrase ; - - PosSlashTV = slashTransVerb True ; - NegSlashTV = slashTransVerb False ; - OneVP = predVerbPhrase (nameNounPhrase {s = \\_ => "man"}) ; - - 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 ; - - ImperVP = imperVerbPhrase ; - - IndicPhrase = indicUtt ; - QuestPhrase = interrogUtt ; - ImperOne = imperUtterance singular ; - ImperMany = imperUtterance plural ; - - AdvS = advSentence ; - -lin - 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 ; - - INP = pronNounPhrase pronIch ; - ThouNP = pronNounPhrase pronDu ; - HeNP = pronNounPhrase pronEr ; - SheNP = pronNounPhrase pronSie ; - ItNP = pronNounPhrase pronEs ; - WeNP = pronNounPhrase pronWir ; - YeNP = pronNounPhrase pronIhr ; - TheyNP = pronNounPhrase pronSiePl ; - - YouNP = pronNounPhrase pronSSie ; - - EveryDet = jederDet ; - AllDet = alleDet ; - WhichDet = welcherDet ; - MostDet = meistDet ; - - HowIAdv = ss "wie" ; - WhenIAdv = ss "wann" ; - WhereIAdv = ss "war" ; - WhyIAdv = ss "warum" ; - - AndConj = ss "und" ** {n = Pl} ; - OrConj = ss "oder" ** {n = Sg} ; - BothAnd = sd2 "sowohl" ["als auch"] ** {n = Pl} ; - EitherOr = sd2 "entweder" "oder" ** {n = Sg} ; - NeitherNor = sd2 "weder" "noch" ** {n = Sg} ; - IfSubj = ss "wenn" ; - WhenSubj = ss "wenn" ; - - PhrYes = ss ["Ja ."] ; - PhrNo = ss ["Nein ."] ; - - VeryAdv = ss "sehr" ; - TooAdv = ss "zu" ; - OtherwiseAdv = ss "sonst" ; - ThereforeAdv = ss "deshalb" ; -} ; diff --git a/grammars/resource/german/RestaurantDeu.gf b/grammars/resource/german/RestaurantDeu.gf deleted file mode 100644 index 8517533b1..000000000 --- a/grammars/resource/german/RestaurantDeu.gf +++ /dev/null @@ -1,26 +0,0 @@ ---# -path=.:../abstract:../../prelude - -concrete RestaurantDeu of Restaurant = - DatabaseDeu ** open Prelude,Paradigms,Deutsch,DatabaseRes in { - -lin - Restaurant = UseN (nAuto "Restaurant") ; - Bar = UseN (nAuto "Bar") ; --- ?? - French = apReg "Französisch" ; - Italian = apReg "Italienisch" ; - Indian = apReg "Indisch" ; - Japanese = apReg "Japanisch" ; - - address = funVon (nFrau "Adresse") ; - phone = funVon (nFrau "Rufnummer") ; --- - priceLevel = funVon (nFrau "Preisstufe") ; - - Cheap = aReg "billig" ; - Expensive = aDeg3 "teuer" "teurer" "teurest" ; - - WhoRecommend rest = mkSentSame (ss2 ["wer empfiehlt"] (rest.s ! accusative)) ; - WhoHellRecommend rest = - mkSentSame (ss2 ["wer zum Teufel empfiehlt"] (rest.s ! accusative)) ; - - LucasCarton = mkPN ["Lucas Carton"] ["Lucas Cartons"] ; -} ; diff --git a/grammars/resource/german/Syntax.gf b/grammars/resource/german/Syntax.gf deleted file mode 100644 index afaf1ad86..000000000 --- a/grammars/resource/german/Syntax.gf +++ /dev/null @@ -1,969 +0,0 @@ ---1 A Small German Resource Syntax --- --- Aarne Ranta 2002 --- --- This resource grammar contains definitions needed to construct --- indicative, interrogative, and imperative sentences in German. --- --- The following modules are presupposed: - -resource Syntax = Morpho ** open Prelude, (CO = Coordination) in { - ---2 Common Nouns --- --- Simple common nouns are defined as the type $CommNoun$ in $morpho.Deu.gf$. - ---3 Common noun phrases - --- The need for this more complex type comes from the variation in the way in --- which a modifying adjective is inflected after different determiners. --- We use the $Adjf$ parameter for this ($Strong$/$Weak$). - -oper - - CommNounPhrase : Type = {s : Adjf => Number => Case => Str ; g : Gender} ; - - noun2CommNounPhrase : CommNoun -> CommNounPhrase = \haus -> - {s = \\_ => haus.s ; g = haus.g} ; - - n2n = noun2CommNounPhrase ; - - ---2 Noun phrases --- --- The worst case is pronouns, which have inflection in the possessive --- forms. Other noun phrases express all possessive forms with the genitive case. --- The parameter $pro$ tells if the $NP$ is a pronoun, which is needed in e.g. --- genitive constructions. - - NounPhrase : Type = { - s : NPForm => Str ; - n : Number ; - p : Person ; - pro : Bool - } ; - - pronNounPhrase : ProPN -> NounPhrase = \ich -> - ich ** {pro = True} ; - - caseNP : NPForm -> Case = \np -> case np of { - NPCase c => c ; - NPPoss _ _ => Gen - } ; - - normalNounPhrase : (Case => Str) -> Number -> NounPhrase = \cs,n -> - {s = \\c => cs ! caseNP c ; - n = n ; - p = P3 ; -- third person - pro = False -- not a pronoun - } ; - --- Proper names are a simple kind of noun phrases. They can usually --- be constructed from strings in a regular way. - - ProperName : Type = {s : Case => Str} ; - - nameNounPhrase : ProperName -> NounPhrase = \john -> - {s = \\np => john.s ! caseNP np ; n = Sg ; p = P3 ; pro = False} ; - - mkProperName : Str -> ProperName = \horst -> - {s = table {Gen => horst + "s" ; _ => horst}} ; - ---2 Mass nouns --- --- Mass nouns are morphologically similar to nouns, but they have one special --- rule of noun phrase formation, using the bare singular (in German). --- Example: "Bier ist gut". --- They can also be coerced to common nouns: "ein Mexikanisches Bier". - - MassNounPhrase : Type = CommNounPhrase ; - - massNounPhrase : MassNounPhrase -> NounPhrase = \bier -> { - s = \\c => let {nc = caseNP c} in - bier.s ! adjfCas Strong nc ! Sg ! nc ; - p = P3 ; - n = Sg ; - pro = False - } ; - - massCommNoun : MassNounPhrase -> CommNounPhrase = \x -> x ; - - ---2 Determiners --- --- Determiners are inflected according to the nouns they determine. --- The determiner determines the number and adjectival form from the determiner. - - Determiner : Type = {s : Gender => Case => Str ; n : Number ; a : Adjf} ; - - detNounPhrase : Determiner -> CommNounPhrase -> NounPhrase = \ein, mann -> { - s = \\c => let {nc = caseNP c} in - ein.s ! mann.g ! nc ++ mann.s ! adjfCas ein.a nc ! ein.n ! nc ; - p = P3 ; - n = ein.n ; - pro = False - } ; - - --- The adjectival form after a determiner depends both on the inferent form --- and on the case ("ein alter Mann" but "einem alten Mann"). - - adjfCas : Adjf -> Case -> Adjf = \a,c -> case <a,c> of { - <Strong,Nom> => Strong ; - <Strong,Acc> => Strong ; - _ => Weak - } ; - --- The following macros are sufficient to define most determiners, --- as shown by the examples that follow. - - DetSg = Gender => Case => Str ; - DetPl = Case => Str ; - - mkDeterminerSg : DetSg -> Adjf -> Determiner = \ein, a -> - {s = ein ; n = Sg ; a = a} ; - - mkDeterminerPl : DetPl -> Adjf -> Determiner = \alle, a -> - {s = \\_ => alle ; n = Pl ; a = a} ; - - detLikeAdj : Str -> Determiner = \jed -> mkDeterminerSg - (\\g,c => (adjReg jed).s ! AMod Strong (GSg g) c) Weak ; - - jederDet = detLikeAdj "jed" ; - alleDet = mkDeterminerPl (caselist "alle" "alle" "allen" "aller") Weak ; - einDet = mkDeterminerSg artIndef Strong ; - derDet = mkDeterminerSg (table {g => artDef ! GSg g}) Weak ; - dieDet = mkDeterminerPl (artDef ! GPl) Weak ; - - meistDet = mkDeterminerPl (table {c => artDef ! GPl ! c ++ "meisten"}) Weak ; - welcherDet = detLikeAdj "welch" ; - welcheDet = mkDeterminerPl (caselist "welche" "welche" "welchen" "welcher") Weak ; - --- Choose "welcher"/"welche" - - welchDet : Number -> Determiner = \n -> - case n of {Sg => welcherDet ; Pl => welcheDet} ; - --- Genitives of noun phrases can be used like determiners, to build noun phrases. --- The number argument makes the difference between "mein Haus" - "meine Häuser". --- --- If the 'owner' is a pronoun, only one form is available "mein Haus". --- In other cases, two variants are available: "Johanns Haus" / "das Haus Johanns". - - npGenDet : Number -> NounPhrase -> CommNounPhrase -> NounPhrase = \n,haus,Wein -> - let { - hauses : Case => Str = \\c => haus.s ! NPPoss (gNumber Wein.g n) c ; - wein : NPForm => Str = \\c => Wein.s ! Strong ! n ! caseNP c ; - derwein : NPForm => Str = (defNounPhrase n Wein).s - } - in - {s = \\c => variants { - hauses ! caseNP c ++ wein ! c ; - if_then_else Str haus.pro - nonExist - (derwein ! c ++ hauses ! Nom) -- the case does not matter - } ; - p = P3 ; - n = n ; - pro = False - } ; - --- *Bare plural noun phrases* like "Männer", "gute Häuser", are built without a --- determiner word. - - plurDet : CommNounPhrase -> NounPhrase = \cn -> - normalNounPhrase (cn.s ! Strong ! Pl) Pl ; - --- Macros for indef/def Sg/Pl noun phrases are needed in many places even --- if they might not be constituents. - - indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,haus -> case n of { - Sg => detNounPhrase einDet haus ; - Pl => plurDet haus - } ; - - defNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,haus -> case n of { - Sg => detNounPhrase derDet haus ; - Pl => detNounPhrase dieDet haus - } ; - - indefNoun : Number -> CommNounPhrase -> Str = \n, mann -> case n of { - Sg => (detNounPhrase einDet mann).s ! NPCase Nom ; - Pl => (plurDet mann).s ! NPCase Nom - } ; - --- Constructions like "die Idee, dass zwei gerade ist" are formed at the --- first place as common nouns, so that one can also have "ein Vorschlag, dass...". - - nounThatSentence : CommNounPhrase -> Sentence -> CommNounPhrase = \idee,x -> - {s = \\a,n,c => idee.s ! a! n ! c ++ [", dass"] ++ x.s ! Sub ; - g = idee.g - } ; - ---2 Adjectives --- --- Adjectival phrases have a parameter $p$ telling if postposition is --- allowed (complex APs). - - AdjPhrase : Type = Adjective ** {p : Bool} ; - - adj2adjPhrase : Adjective -> AdjPhrase = \ny -> ny ** {p = False} ; - ---3 Comparison adjectives --- --- The type is defined in $types.Deu.gf$. - - AdjDegr : Type = AdjComp ; - --- Each of the comparison forms has a characteristic use: --- --- Positive forms are used alone, as adjectival phrases ("jung"). - - positAdjPhrase : AdjDegr -> AdjPhrase = \jung -> - {s = jung.s ! Pos ; p = False} ; - --- Comparative forms are used with an object of comparison, as --- adjectival phrases ("besser als Rolf"). - - comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \besser,rolf -> - {s = \\a => besser.s ! Comp ! a ++ "als" ++ rolf.s ! NPCase Nom ; - p = True - } ; - --- Superlative forms are used with a common noun, picking out the --- maximal representative of a domain ("der Jüngste Mann"). - - superlNounPhrase : AdjDegr -> CommNounPhrase -> NounPhrase = \best,mann -> - let {gen = mann.g} in - {s = \\c => let {nc = caseNP c} in - artDef ! gNumber gen Sg ! nc ++ - best.s ! Sup ! aMod Weak gen Sg nc ++ - mann.s ! Weak ! Sg ! nc ; - p = P3 ; - n = Sg ; - pro = False - } ; - ---3 Two-place adjectives --- --- A two-place adjective is an adjective with a preposition used before --- the complement, and the complement case. - - AdjCompl = Adjective ** {s2 : Preposition ; c : Case} ; - - complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \verwandt,dich -> - {s = \\a => - bothWays (verwandt.s ! a) (verwandt.s2 ++ dich.s ! NPCase verwandt.c) ; - p = True - } ; - ---3 Modification of common nouns --- --- The two main functions of adjective are in predication ("Johann ist jung") --- and in modification ("ein junger Mann"). Predication will be defined --- later, in the chapter on verbs. --- --- Modification must pay attention to pre- and post-noun --- adjectives: "gutes Haus"; "besseres als X haus" / "haus besseres als X" - - modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase = \gut,haus -> - {s = \\a,n,c => let { - gutes = gut.s ! aMod a haus.g n c ; - Haus = haus.s ! a ! n ! c - } in - if_then_else Str gut.p (bothWays gutes Haus) (gutes ++ Haus) ; - g = haus.g} ; - ---2 Function expressions - --- A function expression is a common noun together with the --- preposition prefixed to its argument ("Mutter von x"). --- The type is analogous to two-place adjectives and transitive verbs. - - Function = CommNounPhrase ** {s2 : Preposition ; c : Case} ; - --- The application of a function gives, in the first place, a common noun: --- "Mutter/Mütter von Johann". From this, other rules of the resource grammar --- give noun phrases, such as "die Mutter von Johann", "die Mütter von Johann", --- "die Mütter von Johann und Maria", and "die Mutter von Johann und Maria" (the --- latter two corresponding to distributive and collective functions, --- respectively). Semantics will eventually tell when each --- of the readings is meaningful. - - appFunComm : Function -> NounPhrase -> CommNounPhrase = \mutter,uwe -> - {s = \\a,n,c => mutter.s ! a ! n ! c ++ mutter.s2 ++ uwe.s ! NPCase mutter.c ; - g = mutter.g - } ; - --- It is possible to use a function word as a common noun; the semantics is --- often existential or indexical. - - funAsCommNounPhrase : Function -> CommNounPhrase = \x -> x ; - --- The following is an aggregate corresponding to the original function application --- producing "Johanns Mutter" and "die Mutter von Johann". It does not appear in the --- resource grammar API any longer. - - appFun : Bool -> Function -> NounPhrase -> NounPhrase = \coll, mutter, uwe -> - let {n = uwe.n ; g = mutter.g ; nf = if_then_else Number coll Sg n} in - variants { - defNounPhrase nf (appFunComm mutter uwe) ; - npGenDet nf uwe mutter - } ; - --- The commonest cases are functions with "von" and functions with Genitive. - - mkFunC : CommNounPhrase -> Preposition -> Case -> Function = \f,p,c -> - f ** {s2 = p ; c = c} ; - - funVonC : CommNounPhrase -> Function = \wert -> - mkFunC wert "von" Dat ; - - funGenC : CommNounPhrase -> Function = \wert -> - mkFunC wert [] Gen ; - --- Two-place functions add one argument place. - - Function2 = Function ** {s3 : Preposition ; c2 : Case} ; - --- There application starts by filling the first place. - - appFun2 : Function2 -> NounPhrase -> Function = \flug, paris -> - {s = \\a,n,c => flug.s ! a ! n ! c ++ flug.s2 ++ paris.s ! NPCase flug.c ; - g = flug.g ; - s2 = flug.s3 ; - c = flug.c2 - } ; - - ---2 Verbs --- ---3 Verb phrases --- --- Verb phrases are discontinuous: the parts of a verb phrase are --- (s) an inflected verb, (s2) particle, --- (s3) negation and complement, and (s4) sentential adverbial. --- This discontinuity is needed in sentence formation --- to account for word order variations. - - VerbPhrase = Verb ** {s3 : Number => Str ; s4 : Str} ; - --- 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 "nicht" are not grammatical. - - predVerb : Bool -> Verb -> VerbPhrase = \b,aussehen -> - aussehen ** { - s3 = \\_ => negation b ; - s4 = [] - } ; - - negation : Bool -> Str = \b -> if_then_else Str b [] "nicht" ; - --- Sometimes we want to extract the verb part of a verb phrase. - - verbOfPhrase : VerbPhrase -> Verb = \v -> {s = v.s ; s2 = v.s2} ; - --- Verb phrases can also be formed from adjectives ("ist gut"), --- common nouns ("ist ein Mann"), and noun phrases ("ist der jüngste Mann"). --- The third rule is overgenerating: "ist jeder Mann" has to be ruled out --- on semantic grounds. - - predAdjective : Bool -> Adjective -> VerbPhrase = \b,gut -> - verbSein ** { - s3 = \\_ => negation b ++ gut.s ! APred ; - s4 = [] - } ; - - predCommNoun : Bool -> CommNounPhrase -> VerbPhrase = \b,man -> - verbSein ** { - s3 = \\n => negation b ++ indefNoun n man ; - s4 = [] - } ; - - predNounPhrase : Bool -> NounPhrase -> VerbPhrase = \b,dermann -> - verbSein ** { - s3 = \\n => negation b ++ dermann.s ! NPCase Nom ; - s4 = [] - } ; - ---3 Transitive verbs --- --- Transitive verbs are verbs with a preposition for the complement, --- in analogy with two-place adjectives and functions. --- One might prefer to use the term "2-place verb", since --- "transitive" traditionally means that the inherent preposition is empty. --- Such a verb is one with a *direct object* - which may still be accusative, --- dative, or genitive. - - TransVerb = Verb ** {s3 : Preposition ; c : Case} ; - - mkTransVerb : Verb -> Preposition -> Case -> TransVerb = - \v,p,c -> v ** {s3 = p ; c = c} ; - --- The rule for using transitive verbs is the complementization rule: - - complTransVerb : Bool -> TransVerb -> NounPhrase -> VerbPhrase = - \b,warten,dich -> - let { - aufdich = warten.s3 ++ dich.s ! NPCase warten.c ; - nicht = negation b - } in - {s = warten.s ; - s2 = warten.s2 ; - s3 = \\_ => bothWays aufdich nicht ; - s4 = [] - } ; - --- Transitive verbs with accusative objects can be used passively. --- The function does not check that the verb is transitive. --- Therefore, the function can also be used for "es wird gelaufen", etc. - - passVerb : Bool -> Verb -> VerbPhrase = \b,lieben -> - {s = verbumWerden ; - s2 = [] ; - s3 = \\_ => negation b ++ lieben.s ! VPart APred ; - s4 = [] - } ; - --- Transitive verb can be used elliptically as a verb. The semantics --- is left to applications. The definition is trivial, due to record --- subtyping. - - transAsVerb : TransVerb -> Verb = \lieben -> - lieben ; - --- *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. - - DitransVerb = TransVerb ** {s4 : Preposition ; c2 : Case} ; - - mkDitransVerb : - Verb -> Preposition -> Case -> Preposition -> Case -> DitransVerb = - \v,p1,c1,p2,c2 -> v ** {s3 = p1 ; c = c1 ; s4 = p2 ; c2 = c2} ; - - complDitransVerb : - Bool -> DitransVerb -> NounPhrase -> NounPhrase -> VerbPhrase = - \b,geben,dir,bier -> - let { - zudir = geben.s3 ++ dir.s ! NPCase geben.c ; - dasbier = geben.s4 ++ bier.s ! NPCase geben.c2 ; - nicht = negation b - } in - {s = geben.s ; - s2 = geben.s2 ; - s3 = \\_ => variants { - nicht ++ zudir ++ dasbier ; - zudir ++ nicht ++ dasbier ; - zudir ++ dasbier ++ nicht - } ; - s4 = [] - } ; - - ---2 Adverbials --- --- Adverbials are not inflected (we ignore comparison, and treat --- compared adverbials as separate expressions; this could be done another way). - - Adverb : Type = SS ; - - mkAdverb : Str -> Adverb = ss ; - - adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \spielt, gut -> - {s = spielt.s ; - s2 = spielt.s2 ; - s3 = \\n => spielt.s3 ! n ++ gut.s ; - s4 = spielt.s4 - } ; - - advAdjPhrase : Adverb -> AdjPhrase -> AdjPhrase = \sehr, gut -> - {s = \\a => sehr.s ++ gut.s ! a ; - p = gut.p - } ; - --- Adverbials are typically generated by prefixing prepositions. --- The rule for creating locative noun phrases by the preposition "in" --- is a little shaky, since other prepositions may be preferred ("an", "auf"). - - prepPhrase : Case -> Preposition -> NounPhrase -> Adverb = \c,auf,ihm -> - ss (auf ++ ihm.s ! NPCase c) ; - - locativeNounPhrase : NounPhrase -> Adverb = - prepPhrase Dat "in" ; - --- This is a source of the "Mann mit einem Teleskop" ambiguity, and may produce --- strange things, like "Autos immer" (while "Autos heute" is OK). --- Semantics will have to make finer distinctions among adverbials. - - advCommNounPhrase : CommNounPhrase -> Adverb -> CommNounPhrase = \haus,heute -> - {s = \\a, n, c => haus.s ! a ! n ! c ++ heute.s ; - g = haus.g} ; - - - ---2 Sentences --- --- Sentences depend on a *word order parameter* selecting between main clause, --- inverted, and subordinate clause. - - Sentence : Type = SS1 Order ; - --- This is the traditional $S -> NP VP$ rule. It takes care of both --- word order and agreement. - - predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence = - \Ich,LiebeDichNichtAus -> - let { - ich = Ich.s ! NPCase Nom ; - liebe = LiebeDichNichtAus.s ! VInd Ich.n Ich.p ; - aus = LiebeDichNichtAus.s2 ; - dichnichtgut = LiebeDichNichtAus.s3 ! Ich.n ; - wennesregnet = LiebeDichNichtAus.s4 - } in - {s = table { - Main => ich ++ liebe ++ dichnichtgut ++ aus ++ wennesregnet ; - Inv => liebe ++ ich ++ dichnichtgut ++ aus ++ wennesregnet ; - Sub => ich ++ dichnichtgut ++ aus ++ liebe ++ wennesregnet - } - } ; - ---3 Sentence-complement verbs --- --- Sentence-complement verbs take sentences as complements. - - SentenceVerb : Type = Verb ; - - complSentVerb : Bool -> SentenceVerb -> Sentence -> VerbPhrase = \b,sage,duisst -> - sage ** { - s3 = table Number {_ => negation b} ; - s4 = "," ++ "dass" ++ duisst.s ! Sub - } ; - - ---2 Sentences missing noun phrases --- --- This is one instance of Gazdar's *slash categories*, corresponding to his --- $S/NP$. --- We cannot have - nor would we want to have - a productive slash-category former. --- Perhaps a handful more will be needed. --- --- 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 ; c : Case} ; - - slashTransVerb : Bool -> NounPhrase -> TransVerb -> SentenceSlashNounPhrase = - \b, Ich, sehen -> - let { - ich = Ich.s ! NPCase Nom ; - sehe = sehen.s ! VInd Ich.n P3 ; - aus = sehen.s2 ; - nicht = negation b - } in - {s = table { - Main => ich ++ sehe ++ nicht ++ aus ; - Inv => sehe ++ ich ++ nicht ++ aus ; - Sub => ich ++ nicht ++ aus ++ sehe - } ; - s2 = sehen.s3 ; - c = sehen.c - } ; - ---2 Relative pronouns and relative clauses --- --- Relative pronouns are inflected in --- gender, number, and case just like adjectives. - -oper - identRelPron : RelPron = relPron ; - - funRelPron : Function -> RelPron -> RelPron = \wert, der -> - {s = \\gn,c => let {nu = numGenNum gn} in - artDef ! gNumber wert.g nu ! c ++ wert.s ! Weak ! nu ! c ++ - wert.s2 ++ der.s ! gn ! wert.c - } ; - --- Relative clauses can be formed from both verb phrases ("der schläft") and --- slash expressions ("den ich sehe", "auf dem ich sitze"). - - RelClause : Type = {s : GenNum => Str} ; - - relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \der, geht -> - {s = \\gn => (predVerbPhrase (normalNounPhrase (der.s ! gn) (numGenNum gn)) - geht - ).s ! Sub - } ; - - relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause = \den, ichSehe -> - {s = \\gn => ichSehe.s2 ++ den.s ! gn ! ichSehe.c ++ ichSehe.s ! Sub - } ; - --- A 'degenerate' relative clause is the one often used in mathematics, e.g. --- "Zahl x derart, dass x gerade ist". - - relSuch : Sentence -> RelClause = \A -> - {s = \\_ => "derart" ++ "dass" ++ A.s ! 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. A comma is used before the relative clause. - - modRelClause : CommNounPhrase -> RelClause -> CommNounPhrase = \mann,dergeht -> - {s = \\a,n,c => mann.s ! a ! n ! c ++ "," ++ dergeht.s ! gNumber mann.g n ; - g = mann.g - } ; - - ---2 Interrogative pronouns --- --- If relative pronouns are adjective-like, interrogative pronouns are --- noun-phrase-like. We use a simplified type, since we don't need the possessive --- forms. - - IntPron : Type = ProperName ** {n : Number} ; - --- In analogy with relative pronouns, we have a rule for applying a function --- to a relative pronoun to create a new one. - - funIntPron : Function -> IntPron -> IntPron = \wert, wer -> - let {n = wer.n} in - {s = \\c => - artDef ! gNumber wert.g n ! c ++ wert.s ! Weak ! n ! c ++ - wert.s2 ++ wer.s ! wert.c ; - n = n - } ; - --- There is a variety of simple interrogative pronouns: --- "welches Haus", "wer", "was". - - nounIntPron : Number -> CommNounPhrase -> IntPron = \n,cn -> - let {np = detNounPhrase (welchDet n) cn} in - {s = \\c => np.s ! NPCase c ; - n = np.n} ; - - intPronWho : Number -> IntPron = \num -> { - s = caselist "wer" "wen" "wem" "weren" ; - n = num - } ; - - intPronWhat : Number -> IntPron = \num -> { - s = caselist "was" "was" nonExist nonExist ; --- - n = num - } ; - - - ---2 Utterances - --- By utterances we mean whole phrases, such as --- 'can be used as moves in a language game': indicatives, questions, imperative, --- and one-word utterances. The rules are far from complete. --- --- N.B. we have not included rules for texts, which we find we cannot say much --- about on this level. In semantically rich GF grammars, texts, dialogues, etc, --- will of course play an important role as categories not reducible to utterances. --- An example is proof texts, whose semantics show a dependence between premises --- and conclusions. Another example is intersentential anaphora. - - Utterance = SS ; - - indicUtt : Sentence -> Utterance = \x -> ss (x.s ! Main ++ ".") ; - interrogUtt : Question -> Utterance = \x -> ss (x.s ! DirQ ++ "?") ; - - ---2 Questions --- --- Questions are either direct ("bist du müde") or indirect --- ("ob du müde bist"). - -param - QuestForm = DirQ | IndirQ ; - -oper - Question = SS1 QuestForm ; - ---3 Yes-no questions --- --- Yes-no questions are used both independently ("bist du müde") --- and after interrogative adverbials ("warum bist du müde"). --- It is economical to handle with these two cases by the one --- rule, $questVerbPhrase'$. The only difference is if "ob" appears --- in the indirect form. - - questVerbPhrase : NounPhrase -> VerbPhrase -> Question = - questVerbPhrase' False ; - - questVerbPhrase' : Bool -> NounPhrase -> VerbPhrase -> Question = - \adv, du,gehst -> - let {dugehst = (predVerbPhrase du gehst).s} in - {s = table { - DirQ => dugehst ! Inv ; - IndirQ => (if_then_else Str adv [] "ob") ++ dugehst ! Sub - } - } ; - - ---3 Wh-questions --- --- 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 = \Wer,geht -> - let {wer : NounPhrase = normalNounPhrase Wer.s Wer.n ; - wergeht : Sentence = predVerbPhrase wer geht - } in - {s = table { - DirQ => wergeht.s ! Main ; - IndirQ => wergeht.s ! Sub - } - } ; - - intSlash : IntPron -> SentenceSlashNounPhrase -> Question = \wer, ichSehe -> - let {zuwen = ichSehe.s2 ++ wer.s ! ichSehe.c} in - {s = table { - DirQ => zuwen ++ ichSehe.s ! Inv ; - IndirQ => zuwen ++ ichSehe.s ! Sub - } - } ; - - ---3 Interrogative adverbials --- --- These adverbials will be defined in the lexicon: they include --- "wann", "war", "wie", "warum", etc, which are all invariant one-word --- expressions. In addition, they can be formed by adding prepositions --- to interrogative pronouns, in the same way as adverbials are formed --- from noun phrases. - - IntAdverb = SS ; - - prepIntAdverb : Case -> Preposition -> IntPron -> IntAdverb =\ c,auf,wem -> - ss (auf ++ wem.s ! c) ; - --- A question adverbial can be applied to anything, and whether this makes --- sense is a semantic question. - - questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question = - \wie, du, tust -> - {s = \\q => wie.s ++ (questVerbPhrase du tust).s ! q} ; - - ---2 Imperatives --- --- We only consider second-person imperatives. No polite "Sie" form so far. - - Imperative = SS1 Number ; - - imperVerbPhrase : VerbPhrase -> Imperative = \komm -> - {s = \\n => komm.s ! VImp n ++ komm.s3 ! n ++ komm.s2 ++ komm.s4} ; - - imperUtterance : Number -> Imperative -> Utterance = \n,I -> - ss (I.s ! n ++ "!") ; - ---2 Sentence adverbials --- --- This class covers adverbials such as "sonst", "deshalb", which are prefixed --- to a sentence to form a phrase; the sentence gets inverted word order. - - advSentence : Adverb -> Sentence -> Utterance = \sonst,ist1gerade -> - ss (sonst.s ++ ist1gerade.s ! Inv ++ ".") ; - ---2 Coordination --- --- Coordination is to some extent orthogonal to the rest of syntax, and --- has been treated in a generic way in the module $CO$ in the file --- $coordination.gf$. The overall structure is independent of category, --- but there can be differences in parameter dependencies. --- ---3 Conjunctions --- --- Coordinated phrases are built by using conjunctions, which are either --- simple ("und", "oder") or distributed ("sowohl - als auch", "entweder - oder"). --- --- The conjunction has an inherent number, which is used when conjoining --- noun phrases: "John und Mary sind..." vs. "John oder Mary ist..."; in the --- case of "oder", the result is however plural if any of the disjuncts is. - - Conjunction = CO.Conjunction ** {n : Number} ; - ConjunctionDistr = CO.ConjunctionDistr ** {n : Number} ; - - ---3 Coordinating sentences --- --- We need a category of lists of sentences. It is a discontinuous --- category, the parts corresponding to 'init' and 'last' segments --- (rather than 'head' and 'tail', because we have to keep track of the slot between --- the last two elements of the list). A list has at least two elements. - - ListSentence : Type = {s1,s2 : Order => Str} ; - - twoSentence : (_,_ : Sentence) -> ListSentence = - CO.twoTable Order ; - - consSentence : ListSentence -> Sentence -> ListSentence = - CO.consTable Order CO.comma ; - --- To coordinate a list of sentences by a simple conjunction, we place --- it between the last two elements; commas are put in the other slots, --- e.g. "du rauchst, er trinkt und ich esse". - - conjunctSentence : Conjunction -> ListSentence -> Sentence = - CO.conjunctTable Order ; - --- To coordinate a list of sentences by a distributed conjunction, we place --- the first part (e.g. "entweder") in front of the first element, the second --- part ("oder") between the last two elements, and commas in the other slots. --- For sentences this is really not used. - - conjunctDistrSentence : ConjunctionDistr -> ListSentence -> Sentence = - CO.conjunctDistrTable Order ; - ---3 Coordinating adjective phrases --- --- The structure is the same as for sentences. The result is a prefix adjective --- if and only if all elements are prefix. - - ListAdjPhrase : Type = - {s1,s2 : AForm => Str ; p : Bool} ; - - twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y -> - CO.twoTable AForm x y ** {p = andB x.p y.p} ; - consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x -> - CO.consTable AForm CO.comma xs x ** {p = andB xs.p x.p} ; - - conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs -> - CO.conjunctTable AForm c xs ** {p = xs.p} ; - - conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase = \c,xs -> - CO.conjunctDistrTable AForm c xs ** {p = xs.p} ; - - - ---3 Coordinating noun phrases --- --- The structure is the same as for sentences. The result is either always plural --- or plural if any of the components is, depending on the conjunction. --- The result is a pronoun if all components are. - - ListNounPhrase : Type = - {s1,s2 : NPForm => Str ; n : Number ; p : Person ; pro : Bool} ; - - twoNounPhrase : (_,_ : NounPhrase) -> ListNounPhrase = \x,y -> - CO.twoTable NPForm x y ** - {n = conjNumber x.n y.n ; p = conjPerson x.p y.p ; pro = andB x.pro y.pro} ; - - consNounPhrase : ListNounPhrase -> NounPhrase -> ListNounPhrase = \xs,x -> - CO.consTable NPForm CO.comma xs x ** - {n = conjNumber xs.n x.n ; p = conjPerson xs.p x.p ; pro = andB xs.pro x.pro} ; - - conjunctNounPhrase : Conjunction -> ListNounPhrase -> NounPhrase = \c,xs -> - CO.conjunctTable NPForm c xs ** - {n = conjNumber c.n xs.n ; p = xs.p ; pro = xs.pro} ; - - conjunctDistrNounPhrase : ConjunctionDistr -> ListNounPhrase -> NounPhrase = - \c,xs -> - CO.conjunctDistrTable NPForm c xs ** - {n = conjNumber c.n xs.n ; p = xs.p ; pro = xs.pro} ; - --- We have to define a calculus of numbers of persons. For numbers, --- it is like the conjunction with $Pl$ corresponding to $False$. - - conjNumber : Number -> Number -> Number = \m,n -> case <m,n> of { - <Sg,Sg> => Sg ; - _ => Pl - } ; - --- For persons, we go in the descending order: --- "ich und dich sind stark", "er oder du bist stark". --- This is not always quite clear. - - conjPerson : Person -> Person -> Person = \p,q -> case <p,q> of { - <P3,P3> => P3 ; - <P1,_> => P1 ; - <_,P1> => P1 ; - _ => P2 - } ; - - ---2 Subjunction --- --- Subjunctions ("wenn", "falls", etc) --- are a different way to combine sentences than conjunctions. --- The main clause can be a sentences, an imperatives, or a question, --- but the subjoined clause must be a sentence. - - Subjunction = SS ; - - subjunctSentence : Subjunction -> Sentence -> Sentence -> Sentence = \if, A, B -> - let {As = A.s ! Sub} in - {s = table { - Main => variants {if.s ++ As ++ "," ++ B.s ! Inv ; - B.s ! Main ++ "," ++ if.s ++ As} ; - o => B.s ! o ++ "," ++ if.s ++ As - } - } ; - - subjunctImperative : Subjunction -> Sentence -> Imperative -> Imperative = - \if, A, B -> - {s = \\n => subjunctVariants if A (B.s ! n)} ; - - subjunctQuestion : Subjunction -> Sentence -> Question -> Question = \if, A, B -> - {s = \\q => subjunctVariants if A (B.s ! q)} ; - --- There are uniformly two variant word orders, e.g. --- "wenn du rauchst, werde ish böse" --- and "ich werde böse, wenn du rauchst". - - subjunctVariants : Subjunction -> Sentence -> Str -> Str = \if,A,B -> - let {As = A.s ! Sub} in - variants {if.s ++ As ++ "," ++ B ; B ++ "," ++ if.s ++ As} ; - --- Subjunctions can be used for building adverbials, which can modify verb phrases --- ("ich lache wenn ich gehe und singe wenn ich laufe"). , noun phrases, etc. --- For reasons of word order, we treat this separately from other adverbials, --- but this could be remedied by an extra parameter in adverbials. - - subjunctVerbPhrase : VerbPhrase -> Subjunction -> Sentence -> VerbPhrase = - \ruft,wenn,ergeht -> - {s = ruft.s ; - s2 = ruft.s2 ; - s3 = ruft.s3 ; - s4 = ruft.s4 ++ "," ++ wenn.s ++ ergeht.s ! Sub - } ; - ---2 One-word utterances --- --- An utterance can consist of one phrase of almost any category, --- the limiting case being one-word utterances. These --- utterances are often (but not always) in what can be called the --- default form of a category, e.g. the nominative. --- This list is far from exhaustive. - - useNounPhrase : NounPhrase -> Utterance = \john -> - postfixSS "." (defaultNounPhrase john) ; - useCommonNounPhrase : Number -> CommNounPhrase -> Utterance = \n,car -> - useNounPhrase (indefNounPhrase n car) ; - --- Here are some default forms. - - defaultNounPhrase : NounPhrase -> SS = \john -> - ss (john.s ! NPCase Nom) ; - - defaultQuestion : Question -> SS = \whoareyou -> - ss (whoareyou.s ! DirQ) ; - - defaultSentence : Sentence -> Utterance = \x -> ss (x.s ! Main) ; - ---3 Puzzle --- --- Adding some lexicon, we can generate the sentence --- --- "der grösste alte Mann ist nicht ein Auto auf die Mutter von dem Männer warten" --- --- which looks completely ungrammatical! What you should do to decipher it is --- put parentheses around "auf die Mutter von dem". - -} ; diff --git a/grammars/resource/german/TestDeu.gf b/grammars/resource/german/TestDeu.gf deleted file mode 100644 index 9201f9c15..000000000 --- a/grammars/resource/german/TestDeu.gf +++ /dev/null @@ -1,49 +0,0 @@ --- use this path to read the grammar from the same directory ---# -path=.:../abstract:../../prelude - -concrete TestDeu of TestAbs = ResDeu ** open Syntax in { - -flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ; - --- a random sample from the lexicon - -lin - Big = adjCompReg3 "gross" "grösser" "grösst"; - Small = adjCompReg "klein" ; - Old = adjCompReg3 "alt" "älter" "ältest"; - Young = adjCompReg3 "jung" "jünger" "jüngst"; - American = adjReg "Amerikanisch" ; - Finnish = adjReg "Finnisch" ; - Married = adjReg "verheiratet" ** {s2 = "mit" ; c = Dat} ; - Man = declN2u "Mann" "Männer" ; - Woman = declN1 "Frau" ; - Car = declNs "Auto" ; - House = declN3uS "Haus" "Häuser" ; - Light = declN3 "Licht" ; - Walk = mkVerbSimple (verbLaufen "gehen" "geht" "gegangen") ; - Run = mkVerbSimple (verbLaufen "laufen" "läuft" "gelaufen") ; - Say = mkVerbSimple (regVerb "sagen") ; - Prove = mkVerbSimple (regVerb "beweisen") ; - Send = mkTransVerb (mkVerbSimple (verbLaufen "senden" "sendet" "gesandt")) [] Acc; - Love = mkTransVerb (mkVerbSimple (regVerb "lieben")) [] Acc ; - Wait = mkTransVerb (mkVerbSimple (verbWarten "warten")) "auf" Acc ; - Give = mkDitransVerb - (mkVerbSimple (verbLaufen "geben" "gibt" "gegeben")) [] Dat [] Acc ; - Prefer = mkDitransVerb - (mkVerb (verbLaufen "ziehen" "zieht" "gezogen") "vor") [] Acc "vor" Dat ; - Mother = mkFunC (n2n (declN2uF "Mutter" "Mütter")) "von" Dat ; - Uncle = mkFunC (n2n (declN2i "Onkel")) "von" Dat ; - Connection = mkFunC (n2n (declN1 "Verbindung")) "von" Dat ** - {s3 = "nach" ; c2 = Dat} ; - - Always = mkAdverb "immer" ; - Well = mkAdverb "gut" ; - - SwitchOn = mkTransVerb (mkVerb (verbWarten "schalten") "auf") [] Acc ; - SwitchOff = mkTransVerb (mkVerb (verbWarten "schalten") "aus") [] Acc ; - - John = mkProperName "Johann" ; - Mary = mkProperName "Maria" ; - -} ; - diff --git a/grammars/resource/german/Types.gf b/grammars/resource/german/Types.gf deleted file mode 100644 index d597223cd..000000000 --- a/grammars/resource/german/Types.gf +++ /dev/null @@ -1,98 +0,0 @@ ---1 German Word Classes and Morphological Parameters --- --- This is a resource module for German morphology, defining the --- morphological parameters and word classes of German. It is so far only --- complete w.r.t. the syntax part of the resource grammar. --- It does not include those parameters that are not needed for --- analysing individual words: such parameters are defined in syntax modules. --- - -resource Types = 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 = Masc | Fem | Neut ; - Person = P1 | P2 | P3 ; - Case = Nom | Acc | Dat | Gen ; - Adjf = Strong | Weak ; -- the main division in adjective declension - Order = Main | Inv | Sub ; -- word order: direct, indirect, subordinate - --- For abstraction and API compatibility, we define two synonyms: - -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 mostly hierarchical. The alternative is cross-products of --- simple parameters, but this cannot be always used since it overgenerates. --- - ---3 Common nouns --- --- Common nouns are inflected in number and case and they have an inherent gender. - - CommNoun : Type = {s : Number => Case => Str ; g : Gender} ; - ---3 Pronouns --- --- Pronouns are an example - the worst-case one of noun phrases, --- which are properly defined in $syntax.Deu.gf$. --- Their inflection tables has, in addition to the normal genitive, --- the possessive forms, which are inflected like determiners. - -param - NPForm = NPCase Case | NPPoss GenNum Case ; - ---3 Adjectives --- --- Adjectives are a very complex class, and the full table has as many as --- 99 different forms. The major division is between the comparison degrees. --- There is no gender distinction in the plural, --- and the predicative forms ("X ist Adj") are not inflected. - -param - GenNum = GSg Gender | GPl ; - AForm = APred | AMod Adjf GenNum Case ; - -oper - Adjective : Type = {s : AForm => Str} ; - AdjComp : Type = {s : Degree => AForm => Str} ; - --- Comparison of adjectives: - -param Degree = Pos | Comp | Sup ; - ---3 Verbs --- --- We have a reduced conjugation with only the present tense infinitive, --- indicative, and imperative forms, and past participles. - -param VForm = VInf | VInd Number Person | VImp Number | VPart AForm ; - -oper Verbum : Type = VForm => Str ; - --- On the general level, we have to account for composite verbs as well, --- such as "aus" + "sehen" etc. - - Particle = Str ; - - Verb = {s : Verbum ; s2 : Particle} ; - - ---2 Prepositions --- --- We define prepositions simply as strings. Thus we do not capture the --- contractions "vom", "ins", etc. To define them in GF grammar we would need --- to introduce a parameter system, which we postpone. - - Preposition = Str ; - -} ; diff --git a/grammars/resource/italian/MorphoIta.gf b/grammars/resource/italian/MorphoIta.gf deleted file mode 100644 index c499f83df..000000000 --- a/grammars/resource/italian/MorphoIta.gf +++ /dev/null @@ -1,291 +0,0 @@ ---# -path=.:../romance:../../prelude - ---1 A Simple Italian Resource Morphology --- --- Aarne Ranta 2002--2003 --- --- This resource morphology contains definitions needed in the resource --- syntax. It moreover contains the most usual inflectional patterns. --- The patterns for verbs contain the complete "Bescherelle" conjugation --- tables. --- --- We use the parameter types and word classes defined in $TypesIta.gf$. - -resource MorphoIta = open (Predef=Predef), Prelude, TypesIta in { - ---2 Some phonology --- ---3 Elision --- --- The phonological rule of *elision* can be defined as follows in GF. --- In Italian it includes both vowels and the *impure 's'*. - -oper - vocale : Strs = strs { - "a" ; "e" ; "h" ; "i" ; "o" ; "u" - } ; - - sImpuro : Strs = strs { - "z" ; "sb" ; "sc" ; "sd" ; "sf" ; "sm" ; "sp" ; "sq" ; "sr" ; "st" ; "sv" - } ; - - elision : (_,_,_ : Str) -> Str = \il, l', lo -> - pre {il ; l' / vocale ; lo / sImpuro} ; - - ---2 Nouns --- --- The following macro is useful for creating the forms of number-dependent --- tables, such as common nouns. - - numForms : (_,_ : Str) -> Number => Str = \vino, vini -> - table {Sg => vino ; Pl => vini} ; - --- For example: - - nomVino : Str -> Number => Str = \vino -> let {vin = Predef.tk 1 vino} in - numForms vino (vin + "i") ; - - nomRana : Str -> Number => Str = \rana -> let {ran = Predef.tk 1 rana} in - numForms rana (ran + "e") ; - - nomSale : Str -> Number => Str = \sale -> let {sal = Predef.tk 1 sale} in - numForms sale (sal + "i") ; - - nomTram : Str -> Number => Str = \tram -> - numForms tram tram ; - --- Common nouns are inflected in number and have an inherent gender. - - mkCNom : (Number => Str) -> Gender -> CNom = \mecmecs,gen -> - {s = mecmecs ; g = gen} ; - - mkCNomIrreg : Str -> Str -> Gender -> CNom = \mec,mecs -> - mkCNom (numForms mec mecs) ; - - - ---2 Adjectives --- --- Adjectives are conveniently seen as gender-dependent nouns. --- Here are some patterns. First one that describes the worst case. - - mkAdj : (_,_,_,_ : Str) -> Adj = \solo,sola,soli,sole -> - {s = table { - Masc => numForms solo soli ; - Fem => numForms sola sole - } - } ; - --- Then the regular and invariant patterns. - - adjSolo : Str -> Adj = \solo -> let {sol = Predef.tk 1 solo} in - mkAdj solo (sol + "a") (sol + "i") (sol + "e") ; - - adjTale : Str -> Adj = \tale -> let {tali = Predef.tk 1 tale + "i"} in - mkAdj tale tale tali tali ; - - adjBlu : Str -> Adj = \blu -> - mkAdj blu blu blu blu ; - --- Adjectives themselves are records. Here the most common cases: - - ---2 Personal pronouns --- --- All the eight personal pronouns can be built by the following macro. --- The use of "ne" as atonic genitive is debatable. --- We follow the rule that the atonic nominative is empty. - - mkPronoun : (_,_,_,_,_,_,_,_ : Str) -> - PronGen -> Number -> Person -> ClitType -> Pronoun = - \il,le,lui,Lui,son,sa,ses,see,g,n,p,c -> - {s = table { - Ton Nom => il ; - Ton x => prepCase x ++ Lui ; - Aton Nom => [] ; - Aton Acc => le ; - Aton (CPrep P_di) => "ne" ; --- hmm - Aton (CPrep P_a) => lui ; - Aton (CPrep q) => strPrep q ++ Lui ; ---- GF bug with c or p! - Poss Sg Masc => son ; - Poss Sg Fem => sa ; - Poss Pl Masc => ses ; - Poss Pl Fem => see - } ; - g = g ; - n = n ; - p = p ; - c = c - } ; - - ---2 Reflexive pronouns --- --- It is simply a function depending on number and person. - - pronRefl : Number -> Person -> Str = \n,p -> case <n,p> of { - <Sg,P1> => "mi" ; - <Sg,P2> => "ti" ; - <_, P3> => "si" ; - <Pl,P1> => "ci" ; - <Pl,P2> => "vi" - } ; - - ---2 Determiners --- --- Determiners, traditionally called indefinite pronouns, are inflected --- in gender and number, like adjectives. - - pronForms : Adj -> Gender -> Number -> Str = \tale,g,n -> tale.s ! g ! n ; - - qualPron : Gender -> Number -> Str = pronForms (adjTale "quale") ; - - talPron : Gender -> Number -> Str = pronForms (adjTale "tale") ; - - tuttoPron : Gender -> Number -> Str = pronForms (adjSolo "tutto") ; - ---2 Articles --- --- The definite article has quite some variation: three parameters and --- elision. This is the simples definition we have been able to find. - - artDefTable : Gender => Number => Case => Str = \\g,n,c => case <g,n,c> of { - <_, _, CPrep P_di> => prepArt g n "de" ; - <_, _, CPrep P_da> => prepArt g n "da" ; - <_, _, CPrep P_a> => prepArt g n "a" ; - <_, _, CPrep P_in> => prepArt g n "ne" ; - <_, _, CPrep P_su> => prepArt g n "su" ; - <_, _, CPrep P_con> => prepArt g n "co" ; - <Masc,Sg, Nom> => elision "il" "l'" "lo" ; - <Masc,Sg, _> => elision "il" "l'" "lo" ; - - <Fem ,Sg, _> => elision "la" "l'" "la" ; - <Masc,Pl, _> => elision "i" "gli" "gli" ; - <Fem ,Pl, _> => "le" - } ; - --- This auxiliary expresses the uniform rule. - - prepArt : Gender -> Number -> Tok -> Tok = \g,n,de -> case <g,n> of { - <Masc,Sg> => elision (de + "l") (de + "ll'") (de + "llo") ; - <Masc,Pl> => elision (de + "i") (de + "gli") (de + "gli") ; - <Fem, Sg> => elision (de + "lla") (de + "ll'") (de + "lla") ; - <Fem, Pl> => de + "lle" - } ; - ---2 Verbs --- ---3 The present tense --- --- We first define some macros for the special case of present tense. --- --- The verb "essere" is often used in syntax. - - verbEssere = verbPres essere ; - --- We very often form the verb stem by dropping out the infinitive ending. - - troncVerb : Tok -> Tok = Predef.tk 3 ; - - -oper mkVerbPres : (_,_,_,_,_,_,_,_ : Str) -> VerbPres = - \veng, viene, ven, venite, vengono, venga, vieni, venire -> - let {vien = Predef.tk 1 vieni} in - {s = table { - VFin Ind Sg P1 => veng + "o" ; - VFin Ind Sg P2 => vien + "i" ; - VFin Ind Sg P3 => viene ; - VFin Ind Pl P1 => ven + "iamo" ; - VFin Ind Pl P2 => venite ; - VFin Ind Pl P3 => vengono ; - VFin Con Sg _ => venga ; - VFin Con Pl P1 => ven + "iamo" ; - VFin Con Pl P2 => ven + "iate" ; - VFin Con Pl P3 => venga + "no" ; - VImper SgP2 => vieni ; - VImper PlP1 => ven + "iamo" ; - VImper PlP2 => venite ; - VInfin => venire - } - } ; - --- The four main conjugations. - - verbAmare : Str -> VerbPres = \amare -> - let {am = troncVerb amare ; ama = am + "a"} in - mkVerbPres - am ama am (ama + "te") (ama + "no") - (am+"i") ama amare ; - - verbDormire : Str -> VerbPres = \dormire -> - let {dorm = troncVerb dormire} in - mkVerbPres - dorm (dorm + "e") dorm (dorm + "ite") (dorm + "ino") (dorm+"a") - (dorm + "i") dormire ; - - verbFinire : Str -> VerbPres = \finire -> - let {fin = troncVerb finire ; fini = fin + "i" ; finisc = fini + "sc"} in - mkVerbPres - finisc (finisc + "e") fin (fini + "te") (finisc + "ono") - (finisc + "a") (finisc + "i") finire ; - - verbCorrere : Str -> VerbPres = \correre -> - let {corr = troncVerb correre ; corre = corr + "e"} in - mkVerbPres corr corre corr (corre + "te") (corr + "ono") (corr+"a") (corr+"i") - correre ; - --- Some irregular verbs. - - verbPresSpegnere : VerbPres = - mkVerbPres "speng" "spegne" "spegn" "spegnete" "spengono" - "spenga" "spegni" "spegnere" ; - - verbPresDire : VerbPres = - mkVerbPres "dic" "dice" "dic" "dite" "dicono" - "dica" "di" "dire" ; - - -essere = {s = table { - Inf => "essere" ; - Indi Pres Sg P1 => "sono" ; - Indi Pres Sg P2 => "sei" ; - Indi Pres Sg P3 => "è" ; - Indi Pres Pl P1 => "siamo" ; - Indi Pres Pl P2 => "siete" ; - Indi Pres Pl P3 => "sono" ; - Cong Pres Sg P1 => "sia" ; - Cong Pres Sg P2 => "sia" ; - Cong Pres Sg P3 => "sia" ; - Cong Pres Pl P1 => "siamo" ; - Cong Pres Pl P2 => "siate" ; - Cong Pres Pl P3 => "siano" ; - Imper SgP2 => "sii" ; - Imper PlP1 => "siamo" ; - Imper PlP2 => "siate" ; - _ => "essere" --- we just don't care - }} ; - - - avere = {s = table { - Inf => "avere" ; - Indi Pres Sg P1 => "ho" ; - Indi Pres Sg P2 => "hai" ; - Indi Pres Sg P3 => "ha" ; - Indi Pres Pl P1 => "abbiamo" ; - Indi Pres Pl P2 => "avete" ; - Indi Pres Pl P3 => "hanno" ; - Cong Pres Sg P1 => "abbia" ; - Cong Pres Sg P2 => "abbia" ; - Cong Pres Sg P3 => "abbia" ; - Cong Pres Pl P1 => "abbiamo" ; - Cong Pres Pl P2 => "abbiate" ; - Cong Pres Pl P3 => "abbiano" ; - Imper SgP2 => "abbi" ; - Imper PlP1 => "abbiamo" ; - Imper PlP2 => "abbiate" ; - _ => "avere" --- we just don't care - }} ; - -} diff --git a/grammars/resource/italian/ResIta.gf b/grammars/resource/italian/ResIta.gf deleted file mode 100644 index de1995fa1..000000000 --- a/grammars/resource/italian/ResIta.gf +++ /dev/null @@ -1,3 +0,0 @@ ---# -path=.:../romance:../abstract:../../prelude - -concrete ResIta of ResAbs = ResRomance with (SyntaxRomance=SyntaxIta) ; diff --git a/grammars/resource/italian/SyntaxIta.gf b/grammars/resource/italian/SyntaxIta.gf deleted file mode 100644 index c8fc00bed..000000000 --- a/grammars/resource/italian/SyntaxIta.gf +++ /dev/null @@ -1,286 +0,0 @@ ---# -path=.:../../prelude - -instance SyntaxIta of SyntaxRomance = - TypesIta ** open Prelude, (CO=Coordination), MorphoIta in { -oper - nameNounPhrase = \jean -> - normalNounPhrase - (\\c => prepCase c ++ jean.s) - jean.g - Sg ; - - chaqueDet = mkDeterminer1 Sg "ogni" ; - tousDet = mkDeterminer Pl ["tutti i"] ["tutte le"] ; --- gli - plupartDet = mkDeterminer1 Pl ["la maggior parte di"] ; --- dei, degli, delle - unDet = mkDeterminer Sg artUno artUna ; - plDet = mkDeterminer1 Pl [] ; --- dei, degli, delle - - quelDet = mkDeterminer1 Sg "quale" ; - - npGenPoss = \n,ton,mec -> - \\c => artDef mec.g n c ++ ton.s ! Poss n mec.g ++ mec.s ! n ; --- mia madre - - mkAdjSolo : Str -> Bool -> Adjective = \adj,p -> - mkAdjective (adjSolo adj) p ; - - mkAdjTale : Str -> Bool -> Adjective = \adj,p -> - mkAdjective (adjTale adj) p ; - - mkAdjDegrSolo : Str -> Bool -> AdjDegr = \adj,p -> - mkAdjDegrLong (adjSolo adj) p ; - - mkAdjDegrTale : Str -> Bool -> AdjDegr = \adj,p -> - mkAdjDegrLong (adjTale adj) p ; - - comparConj = variants {"di" ; "che"} ; - --- The commonest case for functions is common noun + "di". - - funDi : CommNounPhrase -> Function = \mere -> - mere ** complementCas genitive ; - --- Chains of "cui" - "cui" do not arise. - - funRelPron = \mere,lequel -> - {s = table { - RComplex g n c => variants { - case mere.c of { - CPrep P_di => artDef mere.g n c ++ - lequel.s ! RSimple dative ++ mere.s ! n ; - _ => nonExist} ; - artDef mere.g n c ++ mere.s ! n ++ - mere.s2 ++ lequel.s ! RComplex g n mere.c - } ; - _ => nonExist - } ; - g = RG mere.g - } ; - --- Verbs - - negVerb = \va -> "non" ++ va ; - - copula = \b -> \\v => (if_then_else Str b [] "non") ++ verbEssere.s ! v ; - - isTransVerbClit = \v -> case v.c of { - Acc => True ; - _ => False --- hmmm - } ; - --- The negation of a verb. - - posNeg = \b,v,c -> - if_then_else Str b - (v ++ c) - ("non" ++ v ++ c) ; - - locativeNounPhrase = \jean -> - {s = "in" ++ jean.s ! Ton Acc} ; ---- - - embedConj = "che" ; - --- Relative pronouns - - identRelPron = { - s = table { - RSimple c => relPronForms ! c ; - RComplex g n c => composRelPron g n c - } ; - g = RNoGen - } ; - - suchPron = talPron ; - - composRelPron = ilqualPron ; - - allRelForms = \lequel,g,n,c -> - variants { - lequel.s ! RSimple c ; - lequel.s ! RComplex g n c - } ; - --- Interrogative pronouns - - nounIntPron = \n, mec -> - {s = \\c => prepCase c ++ qualPron mec.g n ++ mec.s ! n ; - g = mec.g ; - n = n - } ; - - intPronWho = \num -> { - s = \\c => prepCase c ++ "chi" ; - g = Masc ; --- can we decide this? - n = num - } ; - - intPronWhat = \num -> { - s = table { - c => prepCase c ++ "che" ++ optStr "cosa" - } ; - g = Masc ; --- can we decide this? - n = num - } ; - --- Questions - - questVerbPhrase = \jean,dort -> - {s = table { - DirQ => (predVerbPhrase jean dort).s ! Ind ; - IndirQ => "se" ++ (predVerbPhrase jean dort).s ! Ind - } - } ; - - intVerbPhrase = \qui, dort -> - {s = table { - DirQ => qui.s ! Nom ++ - dort.s ! qui.g ! VFin Ind qui.n P3 ; - IndirQ => qui.s ! Nom ++ dort.s ! qui.g ! VFin Ind qui.n P3 - } - } ; - - intSlash = \Qui, Tuvois -> - let {qui = Tuvois.s2 ++ Qui.s ! Tuvois.c ; tuvois = Tuvois.s ! Ind} in - {s = table { - DirQ => qui ++ tuvois ; - IndirQ => ifCe Tuvois.c ++ qui ++ tuvois - } - } ; - --- An auxiliary to distinguish between --- "je ne sais pas" ("ce qui dort" / "ce que tu veux" / "à qui tu penses"). - - ifCe : Case -> Str = \c -> case c of { --- - Nom => "ciò" ; - Acc => "ciò" ; - _ => [] - } ; - - questAdverbial = \quand, jean, dort -> - let {jeandort = (predVerbPhrase jean dort).s ! Ind} in - {s = table { - DirQ => quand.s ++ jeandort ; --- inversion? - IndirQ => quand.s ++ jeandort - } - } ; - ----- moved from MorphoIta - --- A macro for defining gender-dependent tables will be useful. --- Its first application is in the indefinite article. - - genForms = \matto, matta -> - table {Masc => matto ; Fem => matta} ; - - artUno : Str = elision "un" "un" "uno" ; - artUna : Str = elision "una" "un'" "una" ; - - artIndef = \g,n,c -> case n of { - Sg => prepCase c ++ genForms artUno artUna ! g ; - _ => prepCase c ++ [] - } ; - - artDef = \g,n,c -> artDefTable ! g ! n ! c ; - --- The composable pronoun "il quale" is inflected by varying the definite --- article and the determiner "quale" in the expected way. - - ilqualPron : Gender -> Number -> Case -> Str = \g,n,c -> - artDef g n c ++ qualPron g n ; - - pronJe = mkPronoun - "io" - "mi" - "mi" - "me" - "mio" "mia" "miei" "mie" - PNoGen -- gender cannot be known from pronoun alone - Sg - P1 - Clit1 ; - - pronTu = mkPronoun - "tu" - "ti" - "ti" - "te" - "tuo" "tua" "tuoi" "tue" - PNoGen - Sg - P2 - Clit1 ; - - pronIl = mkPronoun - "lui" - "lo" - "gli" - "lui" - "suo" "sua" "suoi" "sue" - (PGen Masc) - Sg - P3 - Clit2 ; - - pronElle = mkPronoun - "lei" - "la" - "le" - "lei" - "suo" "sua" "suoi" "sue" - (PGen Fem) - Sg - P3 - Clit2 ; - - pronNous = mkPronoun - "noi" - "ci" - "ci" - "noi" - "nostro" "nostra" "nostri" "nostre" - PNoGen - Pl - P1 - Clit3 ; - - pronVous = mkPronoun - "voi" - "vi" - "vi" - "voi" - "vostro" "vostra" "vostri" "vostre" - PNoGen - Pl --- depends! - P2 - Clit3 ; - - pronIls = mkPronoun - "loro" - "loro" - "li" --- le ! - "loro" - "loro" "loro" "loro" "loro" - PNoGen - Pl - P3 - Clit1 ; - --- moved from ResIta - - commentAdv = ss "comme" ; - quandAdv = ss "quando" ; - ouAdv = ss "o" ; - pourquoiAdv = ss "perché" ; - - etConj = ss "e" ** {n = Pl} ; - ouConj = ss "o" ** {n = Sg} ; - etetConj = sd2 "e" "e" ** {n = Pl} ; - ououConj = sd2 "o" "o" ** {n = Sg} ; - niniConj = sd2 "né" "né" ** {n = Sg} ; --- requires ne ! - siSubj = ss "se" ; - quandSubj = ss "quando" ; - - ouiPhr = ss ["Sì ."] ; - nonPhr = ss ["No ."] ; - -} - diff --git a/grammars/resource/italian/TestIta.gf b/grammars/resource/italian/TestIta.gf deleted file mode 100644 index 01d31d70d..000000000 --- a/grammars/resource/italian/TestIta.gf +++ /dev/null @@ -1,35 +0,0 @@ ---# -path=.:../romance:../abstract:../../prelude - -concrete TestIta of TestAbs = - ResIta ** open Prelude, TypesIta, MorphoIta, SyntaxIta in { - -flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ; - -lin - Big = mkAdjDegrTale "grande" adjPre ; - Small = mkAdjDegrSolo "piccolo" adjPre ; - Old = mkAdjDegrLong (mkAdj "vecchio" "vecchia" "vecchi" "vecchie") adjPre ; - Young = mkAdjDegrTale "giovane" adjPre ; - Man = mkCNom (numForms "uomo" "uomini") Masc ; - Woman = mkCNom (nomRana "donna") Fem ; - Car = mkCNom (nomRana "macchina") Fem ; - Light = mkCNom (nomSale "luce") Fem ; - House = mkCNom (nomRana "casa") Fem ; - Walk = verbAmare "camminare" ; - Run = verbCorrere "correre"; - Send = mkTransVerbDir (verbAmare "mandare") ; - Love = mkTransVerbDir (verbAmare "amare") ; - Wait = mkTransVerbDir (verbAmare "aspettare") ; - Say = verbSent verbPresDire Ind Ind ; - Prove = verbSent (verbAmare "dimostrare") Ind Ind ; - SwitchOn = mkTransVerbDir (verbAmare "allumare") ; - SwitchOff = mkTransVerbDir verbPresSpegnere ; - Mother = funDi (mkCNom (nomSale "madre") Fem) ; - Uncle = funDi (mkCNom (nomVino "zio") Masc) ; - - Well = ss "bene" ; - Always = ss "sempre" ; - - John = mkProperName "Giovanni" Masc ; - Mary = mkProperName "Maria" Fem ; -} diff --git a/grammars/resource/italian/TypesIta.gf b/grammars/resource/italian/TypesIta.gf deleted file mode 100644 index 15cab0bea..000000000 --- a/grammars/resource/italian/TypesIta.gf +++ /dev/null @@ -1,131 +0,0 @@ ---1 Italian Word Classes and Morphological Parameters --- --- This is a resource module for Italian morphology, defining the --- morphological parameters and word classes of Italian. --- The morphology is so far only --- complete w.r.t. the syntax part of the resource grammar. --- It does not include those parameters that are not needed for --- analysing individual words: such parameters are defined in syntax modules. - -instance TypesIta of TypesRomance = { - --- First we give values to the abstract types. - -param - Case = Nom | Acc | CPrep Prep ; - - Prep = P_di | P_a | P_da | P_in | P_su | P_con ; - - NPForm = Ton Case | Aton Case | Poss Number Gender ; - ---2 Prepositions --- --- The type $Case$ in $types.Ita.gf$ has the dative and genitive --- cases, which are relevant for pronouns and the definite article, --- but which are otherwise expressed by prepositions. - -oper - prepCase = \c -> case c of { - Nom => [] ; - Acc => [] ; - CPrep p => strPrep p - } ; - - strPrep : Prep -> Str = \p -> case p of { - P_di => "di" ; - P_a => "a" ; - P_da => "da" ; - P_in => "in" ; - P_su => "su" ; - P_con => "con" - } ; - -oper - CaseA = Case ; - NPFormA = NPForm ; - - nominative = Nom ; - accusative = Acc ; - genitive = CPrep P_di ; - dative = CPrep P_a ; - - stressed = Ton ; - unstressed = Aton ; - -oper - pform2case = \p -> case p of { - Ton x => x ; - Aton x => x ; - Poss _ _ => genitive - } ; - - case2pform = \c -> case c of { - Nom => Aton Nom ; - Acc => Aton Acc ; - _ => Ton c - } ; - --- Comparative adjectives are only sometimes formed morphologically --- (actually: by different morphemes). - - mkAdjComp : (_,_ : Gender => Number => Str) -> AdjComp = - \buono, migliore -> - {s = table {Pos => buono ; _ => migliore}} ; - --- Usually the comparison forms are built by prefixing the word --- "più". The definite article needed in the superlative is provided in --- $syntax.Ita.gf$. - - adjCompLong : Adj -> AdjComp = \caro -> - mkAdjComp - caro.s - (\\g,n => "più" ++ caro.s ! g ! n) ; - - --- Relative pronouns: the case-dependent parameter type. - - param RelForm = RSimple Case | RComplex Gender Number Case ; - - oper RelFormA = RelForm ; - ---2 Relative pronouns --- --- The simple (atonic) relative pronoun shows genuine variation in all of the --- cases. - - relPronForms = table { - Nom => "che" ; - Acc => "che" ; - CPrep P_a => "cui" ; --- variant a cui - CPrep p => strPrep p ++ "cui" - } ; - --- Verbs: conversion from full verbs to present-tense verbs. - - verbPres = \amare -> {s = table { - VInfin => amare.s ! Inf ; - VFin Ind n p => amare.s ! Indi Pres n p ; - VFin Con n p => amare.s ! Cong Pres n p ; - VImper np => amare.s ! Imper np - }} ; - --- The full conjunction is a table on $VForm$: - -param - Tempo = Pres | Imperf ; - TempoP = PresP | PassP ; - VForm = - Inf - | Indi Tempo Number Person - | Pass Number Person - | Fut Number Person - | Cong Tempo Number Person - | Cond Number Person - | Imper NumPersI - | Ger - | Part TempoP Gender Number ; - --- This is the full verb type. - -oper Verbum = {s : VForm => Str} ; -} diff --git a/grammars/resource/nabstract/Combinations.gf b/grammars/resource/nabstract/Combinations.gf deleted file mode 100644 index 98c555c8e..000000000 --- a/grammars/resource/nabstract/Combinations.gf +++ /dev/null @@ -1,333 +0,0 @@ ---1 Abstract Syntax for Multilingual Resource Grammar --- --- Aarne Ranta 2002 -- 2003 --- --- 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 them 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$ - -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. 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. 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. - ---! ---3 Nouns and noun phrases --- - -cat - N ; -- simple common noun, e.g. "car" - PN ; -- proper name, e.g. "John", "New York" - 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 --- - - V ; -- one-place verb, e.g. "walk" - 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" - - 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 --- - - 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." - ---! ---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. - ---! ---3 Nouns and noun phrases --- - -fun - 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" - 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. - - 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" - ---! ---3 Sentences and relative clauses --- - - PredVP : NP -> VP -> S ; -- "John walks" - PosSlashTV, NegSlashTV : NP -> TV -> Slash ; -- "John sees", "John doesn's see" - OneVP : VP -> S ; -- "one walks" - ThereIsCN : CN -> S ; -- "there is a bar" - ThereAreCN : Num -> CN -> S ; -- "there are 86 bars" - - IdRP : RP ; -- "which" - FunRP : Fun -> 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 : Fun -> IP -> IP ; -- "the mother of whom" - NounIPOne, NounIPMany : CN -> IP ; -- "which car", "which 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" - IsThereCN : CN -> Qu ; -- "is there a bar" - AreThereCN : Num -> CN -> Qu ; -- "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!" - - 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 ; - -} ; - diff --git a/grammars/resource/nabstract/PredefAbs.gf b/grammars/resource/nabstract/PredefAbs.gf deleted file mode 100644 index ccd214fd4..000000000 --- a/grammars/resource/nabstract/PredefAbs.gf +++ /dev/null @@ -1,4 +0,0 @@ -abstract PredefAbs = { - cat String ; Int ; -} ; - diff --git a/grammars/resource/nabstract/ResAbs.gf b/grammars/resource/nabstract/ResAbs.gf deleted file mode 100644 index 7828e51ac..000000000 --- a/grammars/resource/nabstract/ResAbs.gf +++ /dev/null @@ -1,275 +0,0 @@ ---1 Abstract Syntax for Multilingual Resource Grammar --- --- 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 --- 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 them 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 the $reuse$ module with the desired concrete syntax of --- $ResAbs$ as argument. - - ---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. --- --- 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. --- - -abstract ResAbs = { - ---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)" - ---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" - ---3 Verbs and verb phrases --- - - V ; -- one-place verb, e.g. "walk" - 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" - VP ; -- verb phrase, e.g. "switch the light on" - ---3 Adverbials --- - - AdV ; -- adverbial e.g. "now", "in the house" - AdA ; -- ad-adjective e.g. "very" - AdS ; -- sentence adverbial e.g. "therefore", "otherwise" - ---3 Sentences and relative clauses --- - - 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 --- - - 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 --- - - 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 --- 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. - ---3 Nouns and noun phrases --- - -fun - UseN : N -> CN ; -- "car" - ModAdj : AP -> CN -> CN ; -- "red car" - DetNP : Det -> CN -> NP ; -- "every car" - IndefOneNP, IndefManyNP : CN -> NP ; -- "a car", "cars" - DefOneNP, DefManyNP : CN -> NP ; -- "the car", "the cars" - ModGenOne, ModGenMany : NP -> CN -> NP ; -- "John's car", "John's 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" - ---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" - ---3 Verbs and verb phrases --- - - 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" - PosVS, NegVS : VS -> S -> VP ; -- "says that I run", "doesn't say..." - PosV3, NegV3 : V3 -> NP -> NP -> VP ; -- "prefers wine to beer" - VTrans : TV -> V ; -- "loves" - ---3 Adverbials --- - - AdvVP : VP -> AdV -> VP ; -- "always walks", "walks in the park" - LocNP : NP -> AdV ; -- "in London" - AdvCN : CN -> AdV -> CN ; -- "house in London", "house today" - - AdvAP : AdA -> AP -> AP ; -- "very good" - - ---3 Sentences and relative clauses --- - - PredVP : NP -> VP -> S ; -- "John walks" - PosSlashTV, NegSlashTV : NP -> TV -> Slash ; -- "John sees", "John doesn's see" - OneVP : VP -> S ; -- "one walks" - - IdRP : RP ; -- "which" - FunRP : Fun -> RP -> RP ; -- "the successor of which" - RelVP : RP -> VP -> RC ; -- "who walks" - 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 : Fun -> IP -> IP ; -- "the mother of whom" - NounIPOne, NounIPMany : CN -> IP ; -- "which car", "which cars" - - QuestVP : NP -> VP -> Qu ; -- "does 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" - - 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!" - - 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 ; - ---2 Examples of structural words --- --- 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 --- should really be replaced by masculine and feminine variants. - - EveryDet, AllDet, WhichDet, MostDet : Det ; -- every, all, which, most - INP, ThouNP, HeNP, SheNP, ItNP : NP ; -- personal pronouns in singular - WeNP, YeNP, TheyNP : NP ; -- personal pronouns in plural - YouNP : NP ; -- the polite you - WhenIAdv,WhereIAdv,WhyIAdv,HowIAdv : IAdv ; -- when, where, why, how - AndConj, OrConj : Conj ; -- and, or - BothAnd, EitherOr, NeitherNor : ConjD ; -- both-and, either-or, neither-nor - IfSubj, WhenSubj : Subj ; -- if, when - PhrYes, PhrNo : Phr ; -- yes, no - VeryAdv, TooAdv : AdA ; -- very, too - OtherwiseAdv, ThereforeAdv : AdS ; -- therefore, otherwise -} ; - diff --git a/grammars/resource/nabstract/Structural.gf b/grammars/resource/nabstract/Structural.gf deleted file mode 100644 index e651afb5e..000000000 --- a/grammars/resource/nabstract/Structural.gf +++ /dev/null @@ -1,90 +0,0 @@ ---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 --- should really be replaced by masculine and feminine variants. - -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 - - 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 ; YouNP : NP ; -- they, the polite you - - EverybodyNP, SomebodyNP, NobodyNP, -- everybody, somebody, nobody - EverythingNP, SomethingNP, NothingNP : NP ; -- everything, something, nothing - ---! ---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 - 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 ; - BeforePrep, DuringPrep, AfterPrep : Prep ; -- temporal relations - 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 - -} diff --git a/grammars/resource/nabstract/TestResource.gf b/grammars/resource/nabstract/TestResource.gf deleted file mode 100644 index adafdcfbc..000000000 --- a/grammars/resource/nabstract/TestResource.gf +++ /dev/null @@ -1,18 +0,0 @@ -abstract TestResource = Structural ** { - --- a random sample of lexicon to test resource grammar with - -fun - Big, Happy, Small, Old, Young : AdjDeg ; - American, Finnish : Adj1 ; - Married : Adj2 ; - Man, Woman, Car, House, Light, Bar, Bottle, Wine : N ; - Walk, Run : V ; - Send, Wait, Love, Drink, SwitchOn, SwitchOff : TV ; - Give, Prefer : V3 ; - Say, Prove : VS ; - Mother, Uncle : Fun ; - Connection : Fun2 ; - Well, Always : AdV ; - John, Mary : PN ; -} ; diff --git a/grammars/resource/nabstract/additions.txt b/grammars/resource/nabstract/additions.txt deleted file mode 100644 index 6d0f7fb8b..000000000 --- a/grammars/resource/nabstract/additions.txt +++ /dev/null @@ -1,123 +0,0 @@ --- 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" - 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" - 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" - 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" - - UseInt : Int -> Num ; -- "32" --- assumes i > 1 - NoNum : Num ; -- no numeral modifier - - IsThereCN, AreThereCN : CN -> Qu ;-- "is there a bar", "are there bars" - --- from Hajo's work - -AdvAP - -AdvS - -AppFun2 - -CNthatS - -ConsPhr - -ItNP - -NegPassV - -NegV3 - -OnePhr - -OneVP - -OtherwiseAdv - -PosPassV - -PosV3 - -SubjVP - -ThereforeAdv - -TooAdv - -VTrans - -VeryAdv - - --- Structural.gf - --- Some of these are just changes to Num -> Det|NP. - AllDet : Det ; -- sg all - AllsDet, WhichsDet, -- pl all, which (86) - SomesDet, AnysDet, NosDet, -- pl some, any, no - TheseDet, ThoseDet : Num -> Det ; -- these, those (86) - ThisNP, TheseNP : 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 - - EverybodyNP, SomebodyNP, NobodyNP, -- everybody, somebody, nobody - EverythingNP, SomethingNP, NothingNP : NP ; -- everything, something, nothing - EverywhereNP, SomewhereNP, NowhereNP : Adv ;-- everywhere, somewhere, nowhere - AlthoughSubj : Subj ; -- although - AlmostAdv, QuiteAdv : AdA ; -- almost, quite - InPrep, OnPrep, ToPrep, FromPrep, -- spatial relations - ThroughPrep, AbovePrep, UnderPrep, - InFrontPrep, BehindPrep, BetweenPrep : Prep ; - BeforePrep, DuringPrep, AfterPrep : Prep ; -- temporal relations - WithPrep, WithoutPrep, ByMeansPrep : Prep ; -- some other relations - PartPrep : Prep ; -- partitive "of" ("bottle of wine") - AgentPrep : Prep ; -- agent "by" in passive constructions - - - -American - -Connection - -Finnish - -Give - -Married - -Prefer - diff --git a/grammars/resource/nenglish/CombinationsEng.gf b/grammars/resource/nenglish/CombinationsEng.gf deleted file mode 100644 index 14ab90fb3..000000000 --- a/grammars/resource/nenglish/CombinationsEng.gf +++ /dev/null @@ -1,197 +0,0 @@ ---# -path=.:../nabstract:../../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 ; - ModGenMany = 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 ; - IndefManyNP = indefNounPhraseNum plural ; - DefOneNP = defNounPhrase singular ; - DefManyNP = defNounPhraseNum plural ; - MassNP = detNounPhrase (mkDeterminer Sg []) ; - - CNthatS = nounThatSentence ; - UseInt i = {s = table {Nom => i.s ; Gen => i.s ++ "'s"}} ; --- - NoNum = noNum ; - - 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")) ; - ThereIsCN A = prefixSS ["there is"] --- - (defaultNounPhrase (indefNounPhrase singular A)) ; - ThereAreCN n A = prefixSS ["there are"] - (defaultNounPhrase (indefNounPhraseNum plural n A)) ; - - 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 ; - IsThereCN = isThere singular noNum ; - AreThereCN = isThere plural ; - - 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 ; - -} ; diff --git a/grammars/resource/nenglish/MorphoEng.gf b/grammars/resource/nenglish/MorphoEng.gf deleted file mode 100644 index 54dbdeb2a..000000000 --- a/grammars/resource/nenglish/MorphoEng.gf +++ /dev/null @@ -1,202 +0,0 @@ ---# -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'") ; - ---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 ; - Past _ => 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") ; - - 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" ; - Past Sg => "was" ; - Past 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) ; -} ; - diff --git a/grammars/resource/nenglish/ParadigmsEng.gf b/grammars/resource/nenglish/ParadigmsEng.gf deleted file mode 100644 index 967c7ec56..000000000 --- a/grammars/resource/nenglish/ParadigmsEng.gf +++ /dev/null @@ -1,242 +0,0 @@ ---# -path=.:../nabstract:../../prelude - ---1 English Lexical Paradigms --- --- Aarne Ranta 2003 --- --- This is an API to the user of the resource grammar --- for adding lexical items. It give shortcuts for forming --- expressions of basic categories: nouns, adjectives, verbs. --- --- Closed categories (determiners, pronouns, conjunctions) are --- accessed through the resource syntax API, $resource.Abs.gf$. --- --- The main difference with $MorphoEng.gf$ is that the types --- referred to are compiled resource grammar types. We have moreover --- had the design principle of always having existing forms as string --- arguments of the paradigms, not stems. --- --- The following modules are presupposed: - -resource ParadigmsEng = open (Predef=Predef), Prelude, SyntaxEng, ResEng in { - ---2 Parameters --- --- To abstract over gender names, we define the following identifiers. - -oper - human : Gender ; - nonhuman : Gender ; - --- To abstract over number names, we define the following. - - singular : Number ; - plural : Number ; - - ---2 Nouns - --- Worst case: give all four forms and the semantic gender. --- In practice the worst case is just: give singular and plural nominative. - -oper - mkN : (man,men,man's,men's : Str) -> Gender -> N ; - nMan : (man,men : Str) -> Gender -> N ; - --- Regular nouns, nouns ending with "s", "y", or "o", and nouns with the same --- plural form as the singular. - - nReg : Str -> Gender -> N ; -- dog, dogs - nKiss : Str -> Gender -> N ; -- kiss, kisses - nFly : Str -> Gender -> N ; -- fly, flies - nHero : Str -> Gender -> N ; -- hero, heroes (= nKiss !) - nSheep : Str -> Gender -> N ; -- sheep, sheep - --- These use general heuristics, that recognizes the last letter. *N.B* it --- does not get right with "boy", "rush", since it only looks at one letter. - - nHuman : Str -> N ; -- gambler/actress/nanny - nNonhuman : Str -> N ; -- dog/kiss/fly - --- Nouns used as functions need a preposition. The most common is "of". - - mkFun : N -> Preposition -> Fun ; - - funHuman : Str -> Fun ; -- the father/mistress/daddy of - funNonhuman : Str -> Fun ; -- the successor/address/copy of - --- Proper names, with their regular genitive. - - pnReg : (John : Str) -> PN ; -- John, John's - --- The most common cases on the top level havee shortcuts. --- The regular "y"/"s" variation is taken into account in $CN$. - - cnNonhuman : Str -> CN ; - cnHuman : Str -> CN ; - npReg : Str -> NP ; - --- In some cases, you may want to make a complex $CN$ into a function. - - mkFunCN : CN -> Preposition -> Fun ; - funOfCN : CN -> Fun ; - ---2 Adjectives - --- Non-comparison one-place adjectives just have one form. - - mkAdj1 : (even : Str) -> Adj1 ; - --- Two-place adjectives need a preposition as second argument. - - mkAdj2 : (divisible, by : Str) -> Adj2 ; - --- Comparison adjectives have three forms. The common irregular --- cases are ones ending with "y" and a consonant that is duplicated; --- the "y" ending is recognized by the function $aReg$. - - mkAdjDeg : (good,better,best : Str) -> AdjDeg ; - - aReg : (long : Str) -> AdjDeg ; -- long, longer, longest - aFat : (fat : Str) -> AdjDeg ; -- fat, fatter, fattest - aRidiculous : (ridiculous : Str) -> AdjDeg ; -- -/more/most ridiculous - --- On top level, there are adjectival phrases. The most common case is --- just to use a one-place adjective. - - apReg : Str -> AP ; - - ---2 Verbs --- --- The fragment now has all verb forms, except the gerund/present participle. --- Except for "be", the worst case needs four forms: the infinitive and --- the third person singular present, the past indicative, and the past participle. - - mkV : (go, goes, went, gone : Str) -> V ; - - vReg : (walk : Str) -> V ; -- walk, walks - vKiss : (kiss : Str) -> V ; -- kiss, kisses - vFly : (fly : Str) -> V ; -- fly, flies - vGo : (go : Str) -> V ; -- go, goes (= vKiss !) - --- This generic function recognizes the special cases where the last --- character is "y", "s", or "z". It is not right for "finish" and "convey". - - vGen : Str -> V ; -- walk/kiss/fly - --- The verbs "be" and "have" are special. - - vBe : V ; - vHave : V ; - --- Verbs with a particle. - - vPart : (go, goes, went, gone, up : Str) -> V ; - vPartReg : (get, up : Str) -> V ; - --- Two-place verbs, and the special case with direct object. --- Notice that a particle can already be included in $V$. - - mkTV : V -> Str -> TV ; -- look for, kill - - tvGen : (look, for : Str) -> TV ; -- look for, talk about - tvDir : V -> TV ; -- switch off - tvGenDir : (kill : Str) -> TV ; -- kill - --- Regular two-place verbs with a particle. - - tvPartReg : Str -> Str -> Str -> TV ; -- get, along, with - --- The definitions should not bother the user of the API. So they are --- hidden from the document. ---. - - human = Hum ; - nonhuman = NoHum ; - -- singular defined in types.Eng - -- plural defined in types.Eng - - nominative = Nom ; - - mkN = \man,men,man's,men's,g -> - mkNoun man men man's men's ** {g = g ; lock_N = <>} ; - nReg a g = addGenN nounReg a g ; - nKiss n g = addGenN nounS n g ; - nFly = \fly -> addGenN nounY (Predef.tk 1 fly) ; - nMan = \man,men -> mkN man men (man + "'s") (men + "'s") ; - nHero = nKiss ; - nSheep = \sheep -> nMan sheep sheep ; - - nHuman = \s -> nGen s Hum ; - nNonhuman = \s -> nGen s NoHum ; - - nGen : Str -> Gender -> N = \fly,g -> let { - fl = Predef.tk 1 fly ; - y = Predef.dp 1 fly ; - eqy = ifTok (Str -> Gender -> N) y - } in - eqy "y" nFly ( - eqy "s" nKiss ( - eqy "z" nKiss ( - nReg))) fly g ; - - mkFun = \n,p -> n ** {lock_Fun = <> ; s2 = p} ; - funNonhuman = \s -> mkFun (nNonhuman s) "of" ; - funHuman = \s -> mkFun (nHuman s) "of" ; - - pnReg n = nameReg n ** {lock_PN = <>} ; - - cnNonhuman = \s -> UseN (nGen s nonhuman) ; - cnHuman = \s -> UseN (nGen s human) ; - npReg = \s -> UsePN (pnReg s) ; - - mkFunCN = \n,p -> n ** {lock_Fun = <> ; s2 = p} ; - funOfCN = \n -> mkFunCN n "of" ; - - addGenN : (Str -> CommonNoun) -> Str -> Gender -> N = \f -> - \s,g -> f s ** {g = g ; lock_N = <>} ; - - mkAdj1 a = regAdjective a ** {lock_Adj1 = <>} ; - mkAdj2 = \s,p -> regAdjective s ** {s2 = p} ** {lock_Adj2 = <>} ; - mkAdjDeg a b c = adjDegrIrreg a b c ** {lock_AdjDeg = <>} ; - aReg a = adjDegrReg a ** {lock_AdjDeg = <>} ; - aFat = \fat -> let {fatt = fat + Predef.dp 1 fat} in - mkAdjDeg fat (fatt + "er") (fatt + "est") ; - aRidiculous a = adjDegrLong a ** {lock_AdjDeg = <>} ; - apReg = \s -> AdjP1 (mkAdj1 s) ; - - mkV = \go,goes,went,gone -> verbNoPart (mkVerbP3 go goes went gone) ** - {lock_V = <>} ; - vReg = \walk -> mkV walk (walk + "s") (walk + "ed") (walk + "ed") ; - vKiss = \kiss -> mkV kiss (kiss + "es") (kiss + "ed") (kiss + "ed") ; - vFly = \cry -> let {cr = Predef.tk 1 cry} in - mkV cry (cr + "ies") (cr + "ied") (cr + "ied") ; - vGo = vKiss ; - - vGen = \fly -> let { - fl = Predef.tk 1 fly ; - y = Predef.dp 1 fly ; - eqy = ifTok (Str -> V) y - } in - eqy "y" vFly ( - eqy "s" vKiss ( - eqy "z" vKiss ( - vReg))) fly ; - - vPart = \go, goes, went, gone, up -> - verbPart (mkVerbP3 go goes went gone) up ** {lock_V = <>} ; - vPartReg = \get, up -> - verbPart (regVerbP3 get) up ** {lock_V = <>} ; - - mkTV = \v,p -> v ** {lock_TV = <> ; s3 = p} ; - tvPartReg = \get, along, to -> mkTV (vPartReg get along) to ; - - vBe = verbBe ** {s1 = [] ; lock_V = <>} ; - vHave = verbP3Have ** {s1 = [] ; lock_V = <>} ; - - tvGen = \s,p -> mkTV (vGen s) p ; - tvDir = \v -> mkTV v [] ; - tvGenDir = \s -> tvDir (vGen s) ; - -} ; diff --git a/grammars/resource/nenglish/Predication.gf b/grammars/resource/nenglish/Predication.gf deleted file mode 100644 index 4285a8e24..000000000 --- a/grammars/resource/nenglish/Predication.gf +++ /dev/null @@ -1,83 +0,0 @@ - ---1 A Small Predication Library --- --- (c) Aarne Ranta 2003 under Gnu GPL. --- --- This library is built on a language-independent API of --- resource grammars. It has a common part, the type signatures --- (defined here), and language-dependent parts. The user of --- the library should only have to look at the type signatures. - -resource Predication = open English in { - --- We first define a set of predication patterns. - -oper - predV1 : V -> NP -> S ; -- one-place verb: "John walks" - predV2 : TV -> NP -> NP -> S ; -- two-place verb: "John loves Mary" - predVColl : V -> NP -> NP -> S ; -- collective verb: "John and Mary fight" - predA1 : Adj1 -> NP -> S ; -- one-place adjective: "John is old" - predA2 : Adj2 -> NP -> NP -> S ; -- two-place adj: "John is married to Mary" - predAComp : AdjDeg -> NP -> NP -> S ; -- compar adj: "John is older than Mary" - predAColl : Adj1 -> NP -> NP -> S ; -- collective adj: "John and Mary are married" - predN1 : N -> NP -> S ; -- one-place noun: "John is a man" - predN2 : Fun -> NP -> NP -> S ; -- two-place noun: "John is a lover of Mary" - predNColl : N -> NP -> NP -> S ; -- collective noun: "John and Mary are lovers" - --- Individual-valued function applications. - - appFun1 : Fun -> NP -> NP ; -- one-place function: "the successor of x" - appFunColl : Fun -> NP -> NP -> NP ; -- collective function: "the sum of x and y" - --- Families of types, expressed by common nouns depending on arguments. - - appFam1 : Fun -> NP -> CN ; -- one-place family: "divisor of x" - appFamColl : Fun -> NP -> NP -> CN ; -- collective family: "path between x and y" - --- Type constructor, similar to a family except that the argument is a type. - - constrTyp1 : Fun -> CN -> CN ; - --- Logical connectives on two sentences. - - conjS : S -> S -> S ; - disjS : S -> S -> S ; - implS : S -> S -> S ; - --- As an auxiliary, we need two-place conjunction of names ("John and Mary"), --- used in collective predication. - - conjNP : NP -> NP -> NP ; - - ------------------------------ - ----- what follows should be an implementation of the preceding - -oper - predV1 = \F, x -> PredVP x (PosV F) ; - predV2 = \F, x, y -> PredVP x (PosTV F y) ; - predVColl = \F, x, y -> PredVP (conjNP x y) (PosV F) ; - predA1 = \F, x -> PredVP x (PosA (AdjP1 F)) ; - predA2 = \F, x, y -> PredVP x (PosA (ComplAdj F y)) ; - predAComp = \F, x, y -> PredVP x (PosA (ComparAdjP F y)) ; - predAColl = \F, x, y -> PredVP (conjNP x y) (PosA (AdjP1 F)) ; - predN1 = \F, x -> PredVP x (PosCN (UseN F)) ; - predN2 = \F, x, y -> PredVP x (PosCN (AppFun F y)) ; - predNColl = \F, x, y -> PredVP (conjNP x y) (PosCN (UseN F)) ; - - appFun1 = \f, x -> DefOneNP (AppFun f x) ; - appFunColl = \f, x, y -> DefOneNP (AppFun f (conjNP x y)) ; - - appFam1 = \F, x -> AppFun F x ; - appFamColl = \F, x, y -> AppFun F (conjNP x y) ; - - conjS = \A, B -> ConjS AndConj (TwoS A B) ; - disjS = \A, B -> ConjS OrConj (TwoS A B) ; - implS = \A, B -> SubjS IfSubj A B ; - - constrTyp1 = \F, A -> AppFun F (IndefManyNP A) ; - - conjNP = \x, y -> ConjNP AndConj (TwoNP x y) ; - -} ; diff --git a/grammars/resource/nenglish/ResEng.gf b/grammars/resource/nenglish/ResEng.gf deleted file mode 100644 index 05a559e88..000000000 --- a/grammars/resource/nenglish/ResEng.gf +++ /dev/null @@ -1,3 +0,0 @@ ---# -path=.:../nabstract:../../prelude - -resource ResEng = reuse StructuralEng ; diff --git a/grammars/resource/nenglish/StructuralEng.gf b/grammars/resource/nenglish/StructuralEng.gf deleted file mode 100644 index d3e214069..000000000 --- a/grammars/resource/nenglish/StructuralEng.gf +++ /dev/null @@ -1,103 +0,0 @@ ---# -path=.:../nabstract:../../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 ; - WeNP = pronWithNum pronWe ; - YeNP = pronWithNum pronYouPl ; - YouNP = pronYouSg ; - TheyNP = pronThey ; - - EveryDet = everyDet ; - AllDet = mkDeterminer Sg "all" ; --- all the missing - AllsDet = mkDeterminerNum Pl "all" ; - WhichDet = whichDet ; - WhichsDet = mkDeterminerNum Pl "which" ; - MostsDet = mostDet ; - MostDet = mkDeterminer Sg "most" ; - SomeDet = mkDeterminer Sg "some" ; - SomesDet = mkDeterminerNum Pl "some" ; - AnyDet = mkDeterminer Sg "any" ; - AnysDet = mkDeterminerNum Pl "any" ; - NoDet = mkDeterminer Sg "no" ; - NosDet = mkDeterminerNum Pl "no" ; - ManyDet = mkDeterminer Sg "many" ; - MuchDet = mkDeterminer Sg ["a lot of"] ; --- - ThisDet = mkDeterminer Sg "this" ; - TheseDet = mkDeterminerNum Pl "these" ; - ThatDet = mkDeterminer Sg "that" ; - ThoseDet = mkDeterminerNum Pl "those" ; - - ThisNP = nameNounPhrase (nameReg "this") ; - ThatNP = nameNounPhrase (nameReg "that") ; - TheseNP n = nameNounPhrase {s = \\c => "these" ++ n.s ! c} ; - ThoseNP n = nameNounPhrase {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" ; - PartPrep = ss "of" ; - AgentPrep = ss "by" ; - -} diff --git a/grammars/resource/nenglish/SyntaxEng.gf b/grammars/resource/nenglish/SyntaxEng.gf deleted file mode 100644 index 23e443b14..000000000 --- a/grammars/resource/nenglish/SyntaxEng.gf +++ /dev/null @@ -1,1012 +0,0 @@ ---# -path=.:../../prelude - ---1 A Small English Resource Syntax --- --- Aarne Ranta 2002 --- --- This resource grammar contains definitions needed to construct --- indicative, interrogative, and imperative sentences in English. --- --- The following files are presupposed: - -resource SyntaxEng = MorphoEng ** open Prelude, (CO = Coordination) in { - ---2 Common Nouns --- --- Simple common nouns are defined as the type $CommNoun$ in $morpho.Deu.gf$. - ---3 Common noun phrases - --- To the common nouns of morphology, --- we add natural gender (human/nonhuman) which is needed in syntactic --- combinations (e.g. "man who runs" - "program which runs"). - -oper - CommNoun = CommonNoun ** {g : Gender} ; - - CommNounPhrase = CommNoun ; - - noun2CommNounPhrase : CommNoun -> CommNounPhrase = \man -> - man ; - - cnGen : CommonNoun -> Gender -> CommNoun = \cn,g -> - cn ** {g = g} ; - - cnHum : CommonNoun -> CommNoun = \cn -> - cnGen cn Hum ; - cnNoHum : CommonNoun -> CommNoun = \cn -> - cnGen cn NoHum ; - ---2 Noun phrases --- --- The worst case is pronouns, which have inflection in the possessive forms. --- Proper names are a special case. - - NounPhrase : Type = Pronoun ; - - nameNounPhrase : ProperName -> NounPhrase = \john -> - {s = \\c => john.s ! toCase c ; n = Sg ; p = P3} ; - --- The following construction has to be refined for genitive forms: --- "we two", "us two" are OK, but "our two" is not. - - Numeral : Type = {s : Case => Str} ; - - pronWithNum : Pronoun -> Numeral -> Pronoun = \we,two -> - {s = \\c => we.s ! c ++ two.s ! toCase c ; n = we.n ; p = we.p} ; - - noNum : Numeral = {s = \\_ => []} ; - ---2 Determiners --- --- Determiners are inflected according to the nouns they determine. --- The determiner is not inflected. - - Determiner : Type = {s : Str ; n : Number} ; - - detNounPhrase : Determiner -> CommNounPhrase -> NounPhrase = \every, man -> - {s = \\c => every.s ++ man.s ! every.n ! toCase c ; - n = every.n ; - p = P3 - } ; - - mkDeterminer : Number -> Str -> Determiner = \n,the -> - mkDeterminerNum n the noNum ; - - mkDeterminerNum : Number -> Str -> Numeral -> Determiner = \n,det,two -> - {s = det ++ two.s ! Nom ; - n = n - } ; - - everyDet = mkDeterminer Sg "every" ; - allDet = mkDeterminerNum Pl "all" ; - mostDet = mkDeterminer Pl "most" ; - aDet = mkDeterminer Sg artIndef ; - plDet = mkDeterminerNum Pl [] ; - theSgDet = mkDeterminer Sg "the" ; - thePlDet = mkDeterminerNum Pl "the" ; - anySgDet = mkDeterminer Sg "any" ; - anyPlDet = mkDeterminerNum Pl "any" ; - - whichSgDet = mkDeterminer Sg "which" ; - whichPlDet = mkDeterminerNum Pl "which" ; - - whichDet = whichSgDet ; --- API - - indefNoun : Number -> CommNoun -> Str = \n,man -> - (indefNounPhrase n man).s ! NomP ; - - indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n -> - indefNounPhraseNum n noNum ; - - indefNounPhraseNum : Number -> Numeral ->CommNounPhrase -> NounPhrase = - \n,two,man -> - {s = \\c => case n of { - Sg => artIndef ++ two.s ! Nom ++ man.s ! n ! toCase c ; - Pl => two.s ! Nom ++ man.s ! n ! toCase c - } ; - n = n ; p = P3 - } ; - - defNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n -> - defNounPhraseNum n noNum ; - defNounPhraseNum : Number -> Numeral -> CommNounPhrase -> NounPhrase = - \n,two,car -> - {s = \\c => artDef ++ two.s ! Nom ++ car.s ! n ! toCase c ; - n = n ; - p = P3 - } ; - --- Genitives of noun phrases can be used like determiners, to build noun phrases. --- The number argument makes the difference between "my house" - "my houses". --- --- We have the variation "the car of John / the car of John's / John's car" - - npGenDet : Number -> Numeral -> NounPhrase -> CommNounPhrase -> NounPhrase = - \n,two,john,car -> - {s = \\c => variants { - artDef ++ two.s ! Nom ++ car.s ! n ! Nom ++ "of" ++ john.s ! GenSP ; - john.s ! GenP ++ two.s ! Nom ++ car.s ! n ! toCase c - } ; - n = n ; - p = P3 - } ; - --- *Bare plural noun phrases* like "men", "good cars", are built without a --- determiner word. - - plurDet : CommNounPhrase -> NounPhrase = \cn -> - {s = \\c => cn.s ! plural ! toCase c ; - p = P3 ; - n = Pl - } ; - --- Constructions like "the idea that two is even" are formed at the --- first place as common nouns, so that one can also have "a suggestion that...". - - nounThatSentence : CommNounPhrase -> Sentence -> CommNounPhrase = \idea,x -> - {s = \\n,c => idea.s ! n ! c ++ "that" ++ x.s ; - g = idea.g - } ; - - ---2 Adjectives --- --- Adjectival phrases have a parameter $p$ telling if they are prefixed ($True$) or --- postfixed (complex APs). - - AdjPhrase : Type = Adjective ** {p : Bool} ; - - adj2adjPhrase : Adjective -> AdjPhrase = \new -> new ** {p = True} ; - - simpleAdjPhrase : Str -> AdjPhrase = \French -> - adj2adjPhrase (regAdjective French) ; - - ---3 Comparison adjectives --- --- Each of the comparison forms has a characteristic use: --- --- Positive forms are used alone, as adjectival phrases ("big"). - - positAdjPhrase : AdjDegr -> AdjPhrase = \big -> - adj2adjPhrase {s = big.s ! Pos} ; - --- Comparative forms are used with an object of comparison, as --- adjectival phrases ("bigger then you"). - - comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \big, you -> - {s = \\a => big.s ! Comp ! a ++ "than" ++ you.s ! NomP ; - p = False - } ; - --- Superlative forms are used with a modified noun, picking out the --- maximal representative of a domain ("the biggest house"). - - superlNounPhrase : AdjDegr -> CommNoun -> NounPhrase = \big, house -> - {s = \\c => "the" ++ big.s ! Sup ! AAdj ++ house.s ! Sg ! toCase c ; - n = Sg ; - p = P3 - } ; - - ---3 Two-place adjectives --- --- A two-place adjective is an adjective with a preposition used before --- the complement. - - Preposition = Str ; - - AdjCompl = Adjective ** {s2 : Preposition} ; - - complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \related,john -> - {s = \\a => related.s ! a ++ related.s2 ++ john.s ! AccP ; - p = False - } ; - - ---3 Modification of common nouns --- --- The two main functions of adjective are in predication ("John is old") --- and in modification ("an old man"). Predication will be defined --- later, in the chapter on verbs. --- --- Modification must pay attention to pre- and post-noun --- adjectives: "big car"/"car bigger than X" - - modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase = \big, car -> - {s = \\n => if_then_else (Case => Str) big.p - (\\c => big.s ! AAdj ++ car.s ! n ! c) - (table {Nom => car.s ! n ! Nom ++ big.s ! AAdj ; Gen => variants {}}) ; - g = car.g - } ; - - ---2 Function expressions - --- A function expression is a common noun together with the --- preposition prefixed to its argument ("mother of x"). --- The type is analogous to two-place adjectives and transitive verbs. - - Function = CommNounPhrase ** {s2 : Preposition} ; - --- The application of a function gives, in the first place, a common noun: --- "mother/mothers of John". From this, other rules of the resource grammar --- give noun phrases, such as "the mother of John", "the mothers of John", --- "the mothers of John and Mary", and "the mother of John and Mary" (the --- latter two corresponding to distributive and collective functions, --- respectively). Semantics will eventually tell when each --- of the readings is meaningful. - - appFunComm : Function -> NounPhrase -> CommNounPhrase = \mother,john -> - {s = \\n => table { - Gen => nonExist ; --- ? - _ => mother.s ! n ! Nom ++ mother.s2 ++ john.s ! GenSP - } ; - g = mother.g - } ; - --- It is possible to use a function word as a common noun; the semantics is --- often existential or indexical. - - funAsCommNounPhrase : Function -> CommNounPhrase = - noun2CommNounPhrase ; - --- The following is an aggregate corresponding to the original function application --- producing "John's mother" and "the mother of John". It does not appear in the --- resource grammar API any longer. - - appFun : Bool -> Function -> NounPhrase -> NounPhrase = \coll, mother,john -> - let {n = john.n ; nf = if_then_else Number coll Sg n} in - variants { - defNounPhrase nf (appFunComm mother john) ; - npGenDet nf noNum john mother - } ; - --- The commonest case is functions with the preposition "of". - - funOf : CommNoun -> Function = \mother -> - mother ** {s2 = "of"} ; - - funOfReg : Str -> Gender -> Function = \mother,g -> - funOf (nounReg mother ** {g = g}) ; - --- Two-place functions add one argument place. - - Function2 = Function ** {s3 : Preposition} ; - --- There application starts by filling the first place. - - appFun2 : Function2 -> NounPhrase -> Function = \train, paris -> - {s = \\n,c => train.s ! n ! c ++ train.s2 ++ paris.s ! AccP ; - g = train.g ; - s2 = train.s3 - } ; - - ---2 Verbs --- ---3 Verb phrases --- --- Verb phrases are discontinuous: the two parts of a verb phrase are --- (s) an inflected verb, (s2) infinitive and complement. --- For instance: "doesn't" - "walk" ; "isn't" - "old" ; "is" - "a man" --- There's also a parameter telling if the verb is an auxiliary: --- this is needed in question. - - VerbGroup = { - s : Bool => VForm => Str ; - s2 : Bool => Number => Str ; - isAuxT : Bool ; - isAuxF : Bool - } ; - - VerbPhrase = VerbP3 ** {s2 : Number => Str ; isAux : Bool} ; - - predVerbGroup : Bool -> VerbGroup -> VerbPhrase = \b,vg -> { - s = vg.s ! b ; - s2 = vg.s2 ! b ; - isAux = if_then_else Bool b vg.isAuxT vg.isAuxF - } ; - --- From the inflection table, we selecting the finite form as function --- of person and number: - - indicVerb : VerbP3 -> Person -> Number -> Str = \v,p,n -> case n of { - Sg => v.s ! Indic p ; - Pl => v.s ! Indic P2 - } ; - --- 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 "don't" are not grammatical. - - predVerb : Verb -> VerbGroup = \walk -> - {s = \\b,v => if_then_Str b - (walk.s ! v ++ walk.s1) - (contractNot (verbP3Do.s ! v)) ; - s2 = \\b,_ => if_then_Str b - [] - (walk.s ! InfImp ++ walk.s1) ; - isAuxT = False ; - isAuxF = True - } ; - --- Sometimes we want to extract the verb part of a verb phrase. - - verbOfPhrase : VerbPhrase -> VerbP3 = \v -> {s = v.s} ; - --- Verb phrases can also be formed from adjectives ("is old"), --- common nouns ("is a man"), and noun phrases ("ist John"). --- The third rule is overgenerating: "is every man" has to be ruled out --- on semantic grounds. - - predAdjective : Adjective -> VerbGroup = \old -> - {s = beOrNotBe ; - s2 = \\_,_ => old.s ! AAdj ; - isAuxT, isAuxF = True - } ; - - predCommNoun : CommNoun -> VerbGroup = \man -> - {s = beOrNotBe ; - s2 = \\_,n => indefNoun n man ; - isAuxT, isAuxF = True - } ; - - predNounPhrase : NounPhrase -> VerbGroup = \john -> - {s = beOrNotBe ; - s2 = \\_,_ => john.s ! NomP ; - isAuxT, isAuxF = True - } ; - - predAdverb : Adverb -> VerbGroup = \elsewhere -> - {s = beOrNotBe ; - s2 = \\_,_ => elsewhere.s ; - isAuxT, isAuxF = True - } ; - --- We use an auxiliary giving all forms of "be". - - beOrNotBe : Bool => VForm => Str = \\b => - if_then_else (VForm => Str) b - verbBe.s - (table { - InfImp => contractNot "do" ++ "be" ; - Indic P1 => "am" ++ "not" ; - v => contractNot (verbBe.s ! v) - }) ; - ---3 Transitive verbs --- --- Transitive verbs are verbs with a preposition for the complement, --- in analogy with two-place adjectives and functions. --- One might prefer to use the term "2-place verb", since --- "transitive" traditionally means that the inherent preposition is empty. --- Such a verb is one with a *direct object*. - - TransVerb : Type = Verb ** {s3 : Preposition} ; - --- The rule for using transitive verbs is the complementization rule. --- Particles produce free variation: before or after the complement --- ("I switch on the TV" / "I switch the TV on"). - - complTransVerb : TransVerb -> NounPhrase -> VerbGroup = \lookat,john -> - let lookatjohn = bothWays lookat.s1 (lookat.s3 ++ john.s ! AccP) - in {s = \\b,v => if_then_Str b (lookat.s ! v) (contractNot (verbP3Do.s ! v)) ; - s2 = \\b,_ => if_then_Str b lookatjohn (lookat.s ! InfImp ++ lookatjohn) ; - isAuxT = False ; - isAuxF = True - } ; - - --- Verbs that take direct object and a particle: - mkTransVerbPart : VerbP3 -> Str -> TransVerb = \turn,off -> - {s = turn.s ; s1 = off ; s3 = []} ; - --- Verbs that take prepositional object, no particle: - mkTransVerb : VerbP3 -> Str -> TransVerb = \wait,for -> - {s = wait.s ; s1 = [] ; s3 = for} ; - --- Verbs that take direct object, no particle: - mkTransVerbDir : VerbP3 -> TransVerb = \love -> - mkTransVerbPart love [] ; - --- Transitive verbs with accusative objects can be used passively. --- The function does not check that the verb is transitive. --- Therefore, the function can also be used for "he is swum", etc. --- The syntax is the same as for adjectival predication. - - passVerb : Verb -> VerbGroup = \love -> - predAdjective (adj2adjPhrase (regAdjective (love.s ! PPart))) ; - --- Transitive verbs can be used elliptically as verbs. The semantics --- is left to applications. The definition is trivial, due to record --- subtyping. - - transAsVerb : TransVerb -> Verb = \love -> - love ; - --- *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. - - DitransVerb = TransVerb ** {s4 : Preposition} ; - - mkDitransVerb : Verb -> Preposition -> Preposition -> DitransVerb = \v,p1,p2 -> - v ** {s3 = p1 ; s4 = p2} ; - - complDitransVerb : DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup = - \give,you,beer -> - let - youbeer = give.s1 ++ give.s3 ++ you.s ! AccP ++ give.s4 ++ beer.s ! AccP - in - {s = \\b,v => if_then_Str b (give.s ! v) (contractNot (verbP3Do.s ! v)) ; - s2 = \\b,_ => if_then_Str b youbeer (give.s ! InfImp ++ youbeer) ; - isAuxT = False ; - isAuxF = True - } ; - - ---2 Adverbials --- --- Adverbials are not inflected (we ignore comparison, and treat --- compared adverbials as separate expressions; this could be done another way). --- We distinguish between post- and pre-verbal adverbs. - - Adverb : Type = SS ** {p : Bool} ; - - advPre : Str -> Adverb = \seldom -> ss seldom ** {p = False} ; - advPost : Str -> Adverb = \well -> ss well ** {p = True} ; - --- N.B. this rule generates the cyclic parsing rule $VP#2 ::= VP#2$ --- and cannot thus be parsed. - - adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \sings, well -> - let {postp = orB well.p sings.isAux} in - { - s = \\v => (if_then_else Str postp [] well.s) ++ sings.s ! v ; - s2 = \\n => sings.s2 ! n ++ (if_then_else Str postp well.s []) ; - isAux = sings.isAux - } ; - - advAdjPhrase : SS -> AdjPhrase -> AdjPhrase = \very, good -> - {s = \\a => very.s ++ good.s ! a ; - p = good.p - } ; - --- Adverbials are typically generated by prefixing prepositions. --- The rule for creating locative noun phrases by the preposition "in" --- is a little shaky, since other prepositions may be preferred ("on", "at"). - - prepPhrase : Preposition -> NounPhrase -> Adverb = \on, it -> - advPost (on ++ it.s ! AccP) ; - - locativeNounPhrase : NounPhrase -> Adverb = - prepPhrase "in" ; - --- This is a source of the "mann with a telescope" ambiguity, and may produce --- strange things, like "cars always" (while "cars today" is OK). --- Semantics will have to make finer distinctions among adverbials. --- --- N.B. the genitive case created in this way would not make sense. - - advCommNounPhrase : CommNounPhrase -> Adverb -> CommNounPhrase = \car,today -> - {s = \\n => table { - Nom => car.s ! n ! Nom ++ today.s ; - Gen => nonExist - } ; - g = car.g - } ; - - ---2 Sentences --- --- Sentences are not inflected in this fragment of English without tense. - - Sentence : Type = SS ; - --- This is the traditional $S -> NP VP$ rule. It takes care of --- agreement between subject and verb. Recall that the VP may already --- contain negation. - - predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence = \john,walks -> - ss (john.s ! NomP ++ indicVerb (verbOfPhrase walks) john.p john.n ++ - walks.s2 ! john.n) ; - - - ---3 Sentence-complement verbs --- --- Sentence-complement verbs take sentences as complements. - - SentenceVerb : Type = Verb ; - --- To generate "says that John walks" / "doesn't say that John walks": - - complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \say,johnruns -> - let {thatjohnruns = optStr "that" ++ johnruns.s} in - {s = \\b,v => if_then_Str b (say.s ! v) (contractNot (verbP3Do.s ! v)) ; - s2 = \\b,_ => if_then_Str b thatjohnruns (say.s ! InfImp ++ thatjohnruns) ; - isAuxT = False ; - isAuxF = True - } ; - ---3 Verb-complement verbs --- --- Sentence-complement verbs take verb phrases as complements. --- They can be auxiliaries ("can", "must") or ordinary verbs --- ("try"); this distinction cannot be done in the multilingual --- API and leads to some anomalies in English, such as the necessity --- to create the infinitive form "to be able to" for "can" so that --- the construction can be iterated, and the corresponding complication --- in the parameter structure. - - VerbVerb : Type = Verb ** {isAux : Bool} ; - --- To generate "can walk"/"can't walk"; "tries to walk"/"does not try to walk": --- The contraction of "not" is not provided, since it would require changing --- the verb parameter type. - - complVerbVerb : VerbVerb -> VerbGroup -> VerbGroup = \try,run -> - let - taux = try.isAux ; - to = if_then_Str taux [] "to" ; - dont = table VForm {v => if_then_Str taux - (try.s ! v ++ "not") -- can not - (contractNot (verbP3Do.s ! v)) -- doesn't ... - } ; - trnot = if_then_Str taux - [] -- - (try.s ! InfImp ++ try.s1) ; -- ... try - in - {s = \\b,v => if_then_Str b - (try.s ! v ++ try.s1 ++ to ++ run.s ! True ! InfImp) - (dont ! v) ; - s2 = \\b,v => if_then_Str b - (run.s2 ! True ! v) - (trnot ++ run.s ! True ! InfImp ++ run.s2 ! True ! v) ; - isAuxT = taux ; - isAuxF = True - } ; - --- The three most important example auxiliaries. - - mkVerbAux : (_,_,_,_: Str) -> VerbVerb = \beable, can, could, beenable -> - {s = table { - InfImp => beable ; - Indic _ => can ; - Past _ => could ; - PPart => beenable - } ; - s1 = [] ; - isAux = True - } ; - - vvCan : VerbVerb = mkVerbAux ["be able to"] "can" "could" ["been able to"] ; - vvMust : VerbVerb = mkVerbAux ["have to"] "must" ["had to"] ["had to"] ; - ---2 Sentences missing noun phrases --- --- This is one instance of Gazdar's *slash categories*, corresponding to his --- $S/NP$. --- We cannot have - nor would we want to have - a productive slash-category former. --- Perhaps a handful more will be needed. --- --- Notice that the slash category has a similar relation to sentences as --- transitive verbs have to verbs: it's like a *sentence taking a complement*. --- However, we need something more to distinguish its use in direct questions: --- not just "you see" but ("whom") "do you see". --- --- The particle always follows the verb, but the preposition can fly: --- "whom you make it up with" / "with whom you make it up". - - SentenceSlashNounPhrase = {s : Bool => Str ; s2 : Preposition} ; - - slashTransVerb : Bool -> NounPhrase -> TransVerb -> SentenceSlashNounPhrase = - \b,You,lookat -> - let {you = You.s ! NomP ; - looks = indicVerb {s = lookat.s} You.p You.n ; - look = lookat.s ! InfImp ; - do = indicVerb verbP3Do You.p You.n ; - dont = contractNot do ; - up = lookat.s1 - } in - {s = table { - True => if_then_else Str b do dont ++ you ++ look ++ up ; - False => you ++ if_then_else Str b looks (dont ++ look) ++ up - } ; - s2 = lookat.s3 - } ; - - ---2 Relative pronouns and relative clauses --- --- As described in $types.Eng.gf$, relative pronouns are inflected in --- gender (human/nonhuman), number, and case. --- --- We get the simple relative pronoun ("who"/"which"/"whom"/"whose"/"that"/$""$) --- from $morpho.Eng.gf$. - - identRelPron : RelPron = relPron ; - - funRelPron : Function -> RelPron -> RelPron = \mother,which -> - {s = \\g,n,c => "the" ++ mother.s ! n ! Nom ++ - mother.s2 ++ which.s ! g ! n ! GenSP - } ; - --- Relative clauses can be formed from both verb phrases ("who walks") and --- slash expressions ("whom you see", "on which you sit" / "that you sit on"). - - RelClause : Type = {s : Gender => Number => Str} ; - - relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \who,walks -> - {s = \\g, n => who.s ! g ! n ! NomP ++ - indicVerb (verbOfPhrase walks) P3 n ++ walks.s2 ! n - } ; - - relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause = \who,yousee -> - {s = \\g,n => - let {youSee = yousee.s ! False} in - variants { - who.s ! g ! n ! AccP ++ youSee ++ yousee.s2 ; - yousee.s2 ++ who.s ! g ! n ! GenSP ++ youSee - } - } ; - --- A 'degenerate' relative clause is the one often used in mathematics, e.g. --- "number x such that x is even". - - relSuch : Sentence -> RelClause = \A -> - {s = \\_,_ => "such" ++ "that" ++ A.s} ; - --- 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. No comma is used before these relative clause. - - modRelClause : CommNounPhrase -> RelClause -> CommNounPhrase = \man,whoruns -> - {s = \\n,c => man.s ! n ! c ++ whoruns.s ! man.g ! n ; - g = man.g - } ; - - ---2 Interrogative pronouns --- --- If relative pronouns are adjective-like, interrogative pronouns are --- noun-phrase-like. - - IntPron : Type = {s : NPForm => Str ; n : Number} ; - --- In analogy with relative pronouns, we have a rule for applying a function --- to a relative pronoun to create a new one. - - funIntPron : Function -> IntPron -> IntPron = \mother,which -> - {s = \\c => "the" ++ mother.s ! which.n ! Nom ++ mother.s2 ++ which.s ! GenSP ; - n = which.n - } ; - --- There is a variety of simple interrogative pronouns: --- "which house", "who", "what". - - nounIntPron : Number -> CommNounPhrase -> IntPron = \n, car -> - {s = \\c => "which" ++ car.s ! n ! toCase c ; - n = n - } ; - - intPronWho : Number -> IntPron = \num -> { - s = table { - NomP => "who" ; - AccP => variants {"who" ; "whom"} ; - GenP => "whose" ; - GenSP => "whom" - } ; - n = num - } ; - - intPronWhat : Number -> IntPron = \num -> { - s = table { - GenP => "what's" ; - _ => "what" - } ; - n = num - } ; - - ---2 Utterances - --- By utterances we mean whole phrases, such as --- 'can be used as moves in a language game': indicatives, questions, imperative, --- and one-word utterances. The rules are far from complete. --- --- N.B. we have not included rules for texts, which we find we cannot say much --- about on this level. In semantically rich GF grammars, texts, dialogues, etc, --- will of course play an important role as categories not reducible to utterances. --- An example is proof texts, whose semantics show a dependence between premises --- and conclusions. Another example is intersentential anaphora. - - Utterance = SS ; - - indicUtt : Sentence -> Utterance = \x -> ss (x.s ++ ".") ; - interrogUtt : Question -> Utterance = \x -> ss (x.s ! DirQ ++ "?") ; - - ---2 Questions --- --- Questions are either direct ("are you happy") or indirect --- ("if/whether you are happy"). - -param - QuestForm = DirQ | IndirQ ; - -oper - Question = SS1 QuestForm ; - ---3 Yes-no questions --- --- Yes-no questions are used both independently --- ("does John walk" / "if John walks") --- and after interrogative adverbials --- ("why does John walk" / "why John walks"). --- --- It is economical to handle with all these cases by the one --- rule, $questVerbPhrase'$. The word ("ob" / "whether") never appears --- if there is an adverbial. - - questVerbPhrase : NounPhrase -> VerbPhrase -> Question = - questVerbPhrase' False ; - - questVerbPhrase' : Bool -> NounPhrase -> VerbPhrase -> Question = - \adv,john,walk -> - {s = table { - DirQ => if_then_else Str walk.isAux - (indicVerb (verbOfPhrase walk) john.p john.n ++ - john.s ! NomP ++ walk.s2 ! john.n) - (indicVerb verbP3Do john.p john.n ++ - john.s ! NomP ++ walk.s ! InfImp ++ walk.s2 ! john.n) ; - IndirQ => if_then_else Str adv [] (variants {"if" ; "whether"}) ++ - (predVerbPhrase john walk).s - } - } ; - - isThere : Number -> Numeral -> CommNounPhrase -> Question = \n,num,bar -> - questVerbPhrase - (case n of { - Sg => nameNounPhrase (nameReg "there") ; - Pl => {s = \\_ => "there" ; n = Pl ; p = P3} - }) - (predVerbGroup True (predNounPhrase (indefNounPhraseNum n num bar))) ; - - ---3 Wh-questions --- --- 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 = \who,walk -> - {s = \\_ => who.s ! NomP ++ indicVerb (verbOfPhrase walk) P3 who.n ++ - walk.s2 ! who.n - } ; - - intSlash : IntPron -> SentenceSlashNounPhrase -> Question = \who,yousee -> - {s = \\q => - let {youSee = case q of { - DirQ => yousee.s ! True ; - IndirQ => yousee.s ! False - } - } in - variants { - who.s ! AccP ++ youSee ++ yousee.s2 ; - yousee.s2 ++ who.s ! GenSP ++ youSee - } - } ; - ---3 Interrogative adverbials --- --- These adverbials will be defined in the lexicon: they include --- "when", "where", "how", "why", etc, which are all invariant one-word --- expressions. In addition, they can be formed by adding prepositions --- to interrogative pronouns, in the same way as adverbials are formed --- from noun phrases. - - IntAdverb = SS ; - - prepIntAdverb : Preposition -> IntPron -> IntAdverb = \at, whom -> - ss (at ++ whom.s ! AccP) ; - --- A question adverbial can be applied to anything, and whether this makes --- sense is a semantic question. - - questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question = - \why, you, walk -> - {s = \\q => why.s ++ (questVerbPhrase' True you walk).s ! q} ; - - ---2 Imperatives --- --- We only consider second-person imperatives. - - Imperative = SS1 Number ; - - imperVerbPhrase : VerbPhrase -> Imperative = \walk -> - {s = \\n => walk.s ! InfImp ++ walk.s2 ! n} ; - - imperUtterance : Number -> Imperative -> Utterance = \n,I -> - ss (I.s ! n ++ "!") ; - ---2 Sentence adverbials --- --- This class covers adverbials such as "otherwise", "therefore", which are prefixed --- to a sentence to form a phrase. - - advSentence : SS -> Sentence -> Utterance = \hence,itiseven -> - ss (hence.s ++ itiseven.s ++ ".") ; - - ---2 Coordination --- --- Coordination is to some extent orthogonal to the rest of syntax, and --- has been treated in a generic way in the module $CO$ in the file --- $coordination.gf$. The overall structure is independent of category, --- but there can be differences in parameter dependencies. --- ---3 Conjunctions --- --- Coordinated phrases are built by using conjunctions, which are either --- simple ("and", "or") or distributed ("both - and", "either - or"). --- --- The conjunction has an inherent number, which is used when conjoining --- noun phrases: "John and Mary are..." vs. "John or Mary is..."; in the --- case of "or", the result is however plural if any of the disjuncts is. - - Conjunction = CO.Conjunction ** {n : Number} ; - ConjunctionDistr = CO.ConjunctionDistr ** {n : Number} ; - ---3 Coordinating sentences --- --- We need a category of lists of sentences. It is a discontinuous --- category, the parts corresponding to 'init' and 'last' segments --- (rather than 'head' and 'tail', because we have to keep track of the slot between --- the last two elements of the list). A list has at least two elements. - - ListSentence : Type = SD2 ; - - twoSentence : (_,_ : Sentence) -> ListSentence = CO.twoSS ; - - consSentence : ListSentence -> Sentence -> ListSentence = - CO.consSS CO.comma ; - --- To coordinate a list of sentences by a simple conjunction, we place --- it between the last two elements; commas are put in the other slots, --- e.g. "du rauchst, er trinkt und ich esse". - - conjunctSentence : Conjunction -> ListSentence -> Sentence = \c,xs -> - ss (CO.conjunctX c xs) ; - --- To coordinate a list of sentences by a distributed conjunction, we place --- the first part (e.g. "either") in front of the first element, the second --- part ("or") between the last two elements, and commas in the other slots. --- For sentences this is really not used. - - conjunctDistrSentence : ConjunctionDistr -> ListSentence -> Sentence = - \c,xs -> - ss (CO.conjunctDistrX c xs) ; - ---3 Coordinating adjective phrases --- --- The structure is the same as for sentences. The result is a prefix adjective --- if and only if all elements are prefix. - - ListAdjPhrase : Type = {s1,s2 : AForm => Str ; p : Bool} ; - - twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y -> - CO.twoTable AForm x y ** {p = andB x.p y.p} ; - - consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x -> - CO.consTable AForm CO.comma xs x ** {p = andB xs.p x.p} ; - - conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs -> - CO.conjunctTable AForm c xs ** {p = xs.p} ; - - conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase = - \c,xs -> - CO.conjunctDistrTable AForm c xs ** {p = xs.p} ; - - ---3 Coordinating noun phrases --- --- The structure is the same as for sentences. The result is either always plural --- or plural if any of the components is, depending on the conjunction. - - ListNounPhrase : Type = {s1,s2 : NPForm => Str ; n : Number ; p : Person} ; - - twoNounPhrase : (_,_ : NounPhrase) -> ListNounPhrase = \x,y -> - CO.twoTable NPForm x y ** {n = conjNumber x.n y.n ; 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 ; p = conjPerson xs.p x.p} ; - - conjunctNounPhrase : Conjunction -> ListNounPhrase -> NounPhrase = \c,xs -> - CO.conjunctTable NPForm c xs ** {n = conjNumber c.n xs.n ; p = xs.p} ; - - conjunctDistrNounPhrase : ConjunctionDistr -> ListNounPhrase -> NounPhrase = - \c,xs -> - CO.conjunctDistrTable NPForm c xs ** {n = conjNumber c.n xs.n ; p = xs.p} ; - --- We have to define a calculus of numbers of persons. For numbers, --- it is like the conjunction with $Pl$ corresponding to $False$. - - conjNumber : Number -> Number -> Number = \m,n -> case <m,n> of { - <Sg,Sg> => Sg ; - _ => Pl - } ; - --- For persons, we let the latter argument win ("either you or I am absent" --- but "either I or you are absent"). This is not quite clear. - - conjPerson : Person -> Person -> Person = \_,p -> - p ; - - - ---2 Subjunction --- --- Subjunctions ("when", "if", etc) --- are a different way to combine sentences than conjunctions. --- The main clause can be a sentences, an imperatives, or a question, --- but the subjoined clause must be a sentence. --- --- There are uniformly two variant word orders, e.g. --- "if you smoke I get angry" --- and "I get angry if you smoke". - - Subjunction = SS ; - - subjunctSentence : Subjunction -> Sentence -> Sentence -> Sentence = - \if, A, B -> - ss (subjunctVariants if A.s B.s) ; - - subjunctImperative : Subjunction -> Sentence -> Imperative -> Imperative = - \if, A, B -> - {s = \\n => subjunctVariants if A.s (B.s ! n)} ; - - subjunctQuestion : Subjunction -> Sentence -> Question -> Question = - \if, A, B -> - {s = \\q => subjunctVariants if A.s (B.s ! q)} ; - - subjunctVariants : Subjunction -> Str -> Str -> Str = \if,A,B -> - variants {if.s ++ A ++ "," ++ B ; B ++ "," ++ if.s ++ A} ; - - subjunctVerbPhrase : VerbPhrase -> Subjunction -> Sentence -> VerbPhrase = - \V, if, A -> - adVerbPhrase V (advPost (if.s ++ A.s)) ; - ---2 One-word utterances --- --- An utterance can consist of one phrase of almost any category, --- the limiting case being one-word utterances. These --- utterances are often (but not always) in what can be called the --- default form of a category, e.g. the nominative. --- This list is far from exhaustive. - - useNounPhrase : NounPhrase -> Utterance = \john -> - postfixSS "." (defaultNounPhrase john) ; - - useCommonNounPhrase : Number -> CommNounPhrase -> Utterance = \n,car -> - useNounPhrase (indefNounPhrase n car) ; - - useRegularName : SS -> NounPhrase = \john -> - nameNounPhrase (nameReg john.s) ; - --- Here are some default forms. - - defaultNounPhrase : NounPhrase -> SS = \john -> - ss (john.s ! NomP) ; - - defaultQuestion : Question -> SS = \whoareyou -> - ss (whoareyou.s ! DirQ) ; - - defaultSentence : Sentence -> Utterance = \x -> - x ; - -} ; diff --git a/grammars/resource/nenglish/TestResourceEng.gf b/grammars/resource/nenglish/TestResourceEng.gf deleted file mode 100644 index eaad5f941..000000000 --- a/grammars/resource/nenglish/TestResourceEng.gf +++ /dev/null @@ -1,51 +0,0 @@ --- use this path to read the grammar from the same directory ---# -path=.:../nabstract:../../prelude - -concrete TestResourceEng of TestResource = StructuralEng ** open SyntaxEng in { - -flags startcat=Phr ; lexer=literals ; parser=chart ; unlexer=text ; - --- a random sample from the lexicon - -lin - Big = adjDegrIrreg "big" "bigger" "biggest"; - Happy = adjDegrReg "happy" ; - Small = adjDegrReg "small" ; - Old = adjDegrReg "old" ; - Young = adjDegrReg "young" ; - American = regAdjective "American" ; - Finnish = regAdjective "Finnish" ; - Married = regAdjective "married" ** {s2 = "to"} ; - Man = cnHum (mkNoun "man" "men" "man's" "men's") ; - Woman = cnHum (mkNoun "woman" "women" "woman's" "women's") ; - Car = cnNoHum (nounReg "car") ; - House = cnNoHum (nounReg "house") ; - Light = cnNoHum (nounReg "light") ; - Bar = cnNoHum (nounReg "bar") ; - Bottle = cnNoHum (nounReg "bottle") ; - Wine = cnNoHum (nounReg "wine") ; - Walk = verbNoPart (regVerbP3 "walk") ; - Run = verbNoPart (mkVerb "run" "ran" "run") ; - Say = verbNoPart (mkVerb "say" "said" "said") ; - Prove = verbNoPart (regVerbP3 "prove") ; - Send = mkTransVerbDir (verbNoPart (mkVerb "send" "sent" "sent")) ; - Love = mkTransVerbDir (verbNoPart (verbP3e "love")) ; - Wait = mkTransVerb (verbNoPart (regVerbP3 "wait")) "for" ; - Drink = mkTransVerbDir (verbNoPart (mkVerb "drink" "drank" "drunk")) ; - Give = mkDitransVerb (verbNoPart (mkVerb "give" "gave" "given")) [] [] ; - Prefer = mkDitransVerb - (verbNoPart (mkVerb "prefer" "preferred" "preferred")) [] "to" ; - Mother = funOfReg "mother" Hum ; - Uncle = funOfReg "uncle" Hum ; - Connection = cnNoHum (nounReg "connection") ** {s2 = "from" ; s3 = "to"} ; - - Always = advPre "always" ; - Well = advPost "well" ; - - SwitchOn = mkTransVerbPart (verbP3s "switch") "on" ; - SwitchOff = mkTransVerbPart (verbP3s "switch") "off" ; - - John = nameReg "John" ; - Mary = nameReg "Mary" ; - -} ; diff --git a/grammars/resource/nenglish/TypesEng.gf b/grammars/resource/nenglish/TypesEng.gf deleted file mode 100644 index 61682c14f..000000000 --- a/grammars/resource/nenglish/TypesEng.gf +++ /dev/null @@ -1,104 +0,0 @@ ---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 | Past Number | PPart ; - -oper - VerbP3 : Type = SS1 VForm ; - --- 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} ; -} ; - diff --git a/grammars/resource/romance/ResRomance.gf b/grammars/resource/romance/ResRomance.gf deleted file mode 100644 index 067048d11..000000000 --- a/grammars/resource/romance/ResRomance.gf +++ /dev/null @@ -1,203 +0,0 @@ ---# -path=.:../abstract:../../prelude - ---1 The Top-Level French Resource Grammar --- --- Aarne Ranta 2002 -- 2003 --- --- This is the French concrete syntax of the multilingual resource --- grammar. Most of the work is done in the file --- $syntax.Romance.gf$, some in $syntax.Fra.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. Most parameter types are defined in $types.Romance.gf$, some in --- $types.Fra.gf$. - -incomplete concrete ResRomance of ResAbs = open Prelude, SyntaxRomance in { - -flags - startcat=Phr ; - parser=chart ; - -lincat - N = CommNoun ; - -- = {s : Number => Str ; g : Gender} ; - CN = CommNoun ; - NP = {s : NPFormA => Str ; g : PronGen ; - n : Number ; p : Person ; c : ClitType} ; - PN = {s : Str ; g : Gender} ; - Det = {s : Gender => Str ; n : Number} ; - Adj1 = Adjective ; - -- = {s : Gender => Number => Str ; p : Bool} ; - Adj2 = Adjective ** {s2 : Preposition ; c : CaseA} ; - AdjDeg = {s : Degree => Gender => Number => Str ; p : Bool} ; - AP = Adjective ; - Fun = CommNoun ** {s2 : Preposition ; c : CaseA} ; - - V = Verb ; - -- = {s : VF => Str} ; - VP = {s : Gender => VF => Str} ; - TV = Verb ** {s2 : Preposition ; c : CaseA} ; - VS = Verb ** {mp,mn : Mode} ; - AdV = {s : Str} ; - - S = Sentence ; - -- = {s : Mode => Str} ; - Slash = Sentence ** {s2 : Preposition ; c : CaseA} ; - - RP = {s : RelForm => Str ; g : RelGen} ; - RC = {s : Mode => Gender => Number => Str} ; - - IP = {s : CaseA => Str ; g : Gender ; n : Number} ; - Qu = {s : QuestForm => Str} ; - Imp = {s : Gender => Number => Str} ; - Phr = {s : Str} ; - - Conj = {s : Str ; n : Number} ; - ConjD = {s1,s2 : Str ; n : Number} ; - - ListS = {s1,s2 : Mode => Str} ; - ListAP = {s1,s2 : Gender => Number => Str ; p : Bool} ; - ListNP = {s1,s2 : CaseA => Str ; g : PronGen ; n : Number ; p : Person} ; - ---. - -lin - UseN = noun2CommNounPhrase ; - ModAdj = modCommNounPhrase ; - ModGenOne = npGenDet singular ; - ModGenMany = npGenDet plural ; - UsePN = nameNounPhrase ; - UseFun = funAsCommNounPhrase ; -- [SyntaxFra.noun2CommNounPhrase] - AppFun = appFunComm ; - AdjP1 = adj2adjPhrase ; - ComplAdj = complAdj ; - PositAdjP = positAdjPhrase ; - ComparAdjP = comparAdjPhrase ; - SuperlNP = superlNounPhrase ; - - DetNP = detNounPhrase ; - IndefOneNP = indefNounPhrase singular ; - IndefManyNP = indefNounPhrase plural ; - DefOneNP = defNounPhrase singular ; - DefManyNP = defNounPhrase plural ; - - PredVP = predVerbPhrase ; - PosV = predVerb True ; - NegV = predVerb False ; - PosA = predAdjective True ; - NegA = predAdjective False ; - PosCN = predCommNoun True ; - NegCN = predCommNoun False ; - PosTV = complTransVerb True ; - NegTV = complTransVerb False ; - PosNP = predNounPhrase True ; - NegNP = predNounPhrase False ; - PosVS = complSentVerb True ; - NegVS = complSentVerb False ; - - - AdvVP = adVerbPhrase ; - LocNP = locativeNounPhrase ; - AdvCN = advCommNounPhrase ; - - PosSlashTV = slashTransVerb True ; - NegSlashTV = slashTransVerb False ; - - 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 ; - - ImperVP = imperVerbPhrase ; - - IndicPhrase = indicUtt ; - QuestPhrase = interrogUtt ; - ImperOne = imperUtterance singular ; - ImperMany = imperUtterance plural ; - -lin - TwoS = twoSentence ; - ConsS = consSentence ; - ConjS = conjunctSentence ; - ConjDS = conjunctDistrSentence ; -- [Coordination.conjunctDistrTable] - - TwoAP = twoAdjPhrase ; - ConsAP = consAdjPhrase ; - ConjAP = conjunctAdjPhrase ; - ConjDAP = conjunctDistrAdjPhrase ; - - TwoNP = twoNounPhrase ; - ConsNP = consNounPhrase ; - ConjNP = conjunctNounPhrase ; - ConjDNP = conjunctDistrNounPhrase ; - - SubjS = subjunctSentence ; -- stack - SubjImper = subjunctImperative ; - SubjQu = subjunctQuestion ; - - PhrNP = useNounPhrase ; - PhrOneCN = useCommonNounPhrase singular ; - PhrManyCN = useCommonNounPhrase plural ; - PhrIP ip = ip ; - PhrIAdv ia = ia ; - - INP = pronNounPhrase pronJe ; - ThouNP = pronNounPhrase pronTu ; - HeNP = pronNounPhrase pronIl ; - SheNP = pronNounPhrase pronElle ; - WeNP = pronNounPhrase pronNous ; - YeNP = pronNounPhrase pronVous ; - YouNP = pronNounPhrase pronVous ; - TheyNP = pronNounPhrase pronIls ; - --- Here is a point where the API is really inadequate for French, --- which distinguishes between masculine and feminine "they". --- The following solution is not attractive. - ---- TheyNP = pronNounPhrase (variants {pronIls ; pronElles}) ; - - EveryDet = chaqueDet ; - AllDet = tousDet ; - WhichDet = quelDet ; - MostDet = plupartDet ; - - HowIAdv = commentAdv ; - WhenIAdv = quandAdv ; - WhereIAdv = ouAdv ; - WhyIAdv = pourquoiAdv ; - - AndConj = etConj ; - OrConj = ouConj ; - BothAnd = etetConj ; - EitherOr = ououConj ; - NeitherNor = niniConj ; --- requires ne ! - IfSubj = siSubj ; - WhenSubj = quandSubj ; - - PhrYes = ouiPhr ; - PhrNo = nonPhr ; --- and also Si! -} diff --git a/grammars/resource/romance/SyntaxRomance.gf b/grammars/resource/romance/SyntaxRomance.gf deleted file mode 100644 index 74af5a867..000000000 --- a/grammars/resource/romance/SyntaxRomance.gf +++ /dev/null @@ -1,871 +0,0 @@ ---1 A Small Romance Resource Syntax --- --- Aarne Ranta 2002 --- --- This resource grammar contains definitions needed to construct --- indicative, interrogative, and imperative sentences in Romance languages. --- We try to share as much as possible. Even if the definitions of certain --- operations are different in $syntax.Fra.gf$ and $syntax.Ita.gf$, we can --- often give their type signatures in this file. --- --- The following files are presupposed: - -interface SyntaxRomance = TypesRomance ** open Prelude, (CO=Coordination) in { - ---2 Common Nouns --- --- Common nouns are defined as number-dependent strings with a gender. --- Complex common noun ($CommNounPhrase$) have the same type as simple ones. --- (The distinction is made just because of uniformity with other languages.) - -oper - CommNoun : Type = {s : Number => Str ; g : Gender} ; - CommNounPhrase = CommNoun ; - noun2CommNounPhrase : CommNounPhrase -> CommNoun = \x -> x ; - - commonNounComp : CommNoun -> Str -> CommNoun = \numero, detelephone -> - {s = \\n => numero.s ! n ++ detelephone ; - g = numero.g - } ; - - ---2 Noun phrase --- --- The worst case is pronouns, which have inflection in the possessive --- forms. Other noun phrases express all possessive forms with the genitive case. --- Proper names are the simples example. - - ProperName : Type = {s : Str ; g : Gender} ; - - NounPhrase : Type = Pronoun ; -- the worst case - - nameNounPhrase : ProperName -> NounPhrase ; - - mkProperName : Str -> Gender -> ProperName = \jean,m -> - {s = jean ; g = m} ; - - mkNameNounPhrase : Str -> Gender -> NounPhrase = \jean,m -> - nameNounPhrase (mkProperName jean m) ; - - normalNounPhrase : (CaseA => Str) -> Gender -> Number -> NounPhrase = \cs,g,n -> - {s = \\p => cs ! (pform2case p) ; - g = PGen g ; - n = n ; - p = P3 ; -- third person - c = Clit0 -- not clitic - } ; - - pronNounPhrase : Pronoun -> NounPhrase = \pro -> pro ; - - ---2 Determiners --- --- Determiners are inflected according to the gender of the nouns they determine. --- The determiner determines the number of the argument noun. - - Determiner : Type = {s : Gender => Str ; n : Number} ; - - detNounPhrase : Determiner -> CommNoun -> NounPhrase = \tout, homme -> - normalNounPhrase - (\\c => prepCase c ++ tout.s ! homme.g ++ homme.s ! tout.n) - homme.g - tout.n ; - --- The following macros are sufficient to define most determiners, --- as shown by the examples that follow. - - mkDeterminer : Number -> Str -> Str -> Determiner = \n,tous,toutes -> - {s = genForms tous toutes ; n = n} ; - - mkDeterminer1 : Number -> Str -> Determiner = \n,chaque -> - mkDeterminer n chaque chaque ; - - --- Indefinite and definite noun phrases are treated separately, --- which strictly speaking is not necessary in Romance languages, since --- articles could be treated as determiners. - - indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,mec -> - normalNounPhrase - (\\c => artIndef mec.g n c ++ mec.s ! n) - mec.g - n ; - - defNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,mec -> - normalNounPhrase - (\\c => artDef mec.g n c ++ mec.s ! n) - mec.g - n ; - --- We often need indefinite noun phrases synacategorematically. - - indefNoun : Number -> CommNounPhrase -> Str = \n,mec -> - (indefNounPhrase n mec).s ! case2pform nominative ; - --- Genitives of noun phrases can be used like determiners, to build noun phrases. --- The number argument makes the difference between "ma maison" - "mes maisons". --- The clitic type of the NP decides between "ma maison" and "la maison de Jean". - - npGenDet : Number -> NounPhrase -> CommNounPhrase -> NounPhrase = \n,jeanne,mec -> - let {str : CaseA => Str = case jeanne.c of { - Clit0 => npGenDe n jeanne mec ; - _ => npGenPoss n jeanne mec - } - } in - normalNounPhrase str mec.g n ; - --- These auxiliary rules define the genitive with "de" and with the possessive. --- Here there is a difference between French and Italian: Italian has a definite --- article before possessives (with certain exceptions). - - npGenDe : Number -> NounPhrase -> CommNounPhrase -> CaseA => Str = - \n,jeanne,mec -> - \\c => artDef mec.g n c ++ mec.s ! n ++ jeanne.s ! case2pform genitive ; - - npGenPoss : Number -> NounPhrase -> CommNounPhrase -> CaseA => Str ; - ---2 Adjectives --- --- Adjectives have a parameter $p$ telling if postposition is --- allowed (complex APs). There is no real need in Romance languages to distinguish --- between simple adjectives and adjectival phrases. - - Adjective : Type = Adj ** {p : Bool} ; - - adjPre = True ; adjPost = False ; - - AdjPhrase : Type = Adjective ; - - adj2adjPhrase : Adjective -> AdjPhrase = \x -> x ; - - mkAdjective : Adj -> Bool -> Adjective = \adj,p -> adj ** {p = p} ; - - ---3 Comparison adjectives --- --- The type is defined in $types.Romance.gf$. Syntax adds to lexicon the position --- information. - - AdjDegr = AdjComp ** {p : Bool} ; - - mkAdjDegr : AdjComp -> Bool -> AdjDegr = \adj,p -> - adj ** {p = p} ; - - mkAdjDegrLong : Adj -> Bool -> AdjDegr = \adj,p -> - adjCompLong adj ** {p = p} ; - - --- Each of the comparison forms has a characteristic use: --- --- Positive forms are used alone, as adjectival phrases ("bon"). - - positAdjPhrase : AdjDegr -> AdjPhrase = \bon -> - {s = bon.s ! Pos ; - p = bon.p - } ; - --- Comparative forms are used with an object of comparison, as --- adjectival phrases ("meilleur que toi"). The comparing conjunction --- is of course language-dependent; Italian moreover has the free --- variants "che" and "di". - - comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \bon, toi -> - {s = \\g,n => bon.s ! Comp ! g ! n ++ comparConj ++ - toi.s ! stressed accusative ; - p = False - } ; - - comparConj : Str ; - --- Superlative forms are used with a common noun, picking out the --- maximal representative of a domain --- ("le meilleur mec", "le mec le plus intelligent"). - - superlNounPhrase : AdjDegr -> CommNoun -> NounPhrase = \bon, mec -> - normalNounPhrase - (\\c => artDef mec.g Sg c ++ if_then_else Str bon.p - (bon.s ! Sup ! mec.g ! Sg ++ mec.s ! Sg) - (mec.s ! Sg ++ artDef mec.g Sg nominative ++ bon.s ! Sup ! mec.g ! Sg) - ) - mec.g - Sg ; - - ---3 Prepositions and complements --- --- Most prepositions are just strings. But "à" and "de" are treated as cases in --- French. In Italian, there are more prepositions treated in this way: --- "a", "di", "da", "in", "su", "con". --- An invariant is that, if the preposition is not empty ($[]$), then the case --- is $Acc$. - - Preposition = Str ; - - Complement = {s2 : Preposition ; c : CaseA} ; - - complement : Str -> Complement = \par -> - {s2 = par ; c = nominative} ; - - complementDir : Complement = complement [] ; - - complementCas : CaseA -> Complement = \c -> - {s2 = [] ; c = c} ; - - ---3 Two-place adjectives --- --- A two-place adjective is an adjective with a preposition used before --- the complement, and the complement case. - - AdjCompl = AdjPhrase ** Complement ; - - mkAdjCompl : Adj -> Bool -> Complement -> AdjCompl = \adj,p,c -> - mkAdjective adj p ** c ; - - complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \relie,jean -> - {s = \\g,n => relie.s ! g ! n ++ relie.s2 ++ jean.s ! case2pform relie.c ; - p = False - } ; - - ---3 Modification of common nouns --- --- The two main functions of adjective are in predication ("Jean est jeune") --- and in modification ("un jeune homme"). Predication will be defined --- later, in the chapter on verbs. --- --- Modification must pay attention to pre- and post-noun --- adjectives: "jeune homme"; "homme intelligent". - - modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase = \bon,mec -> - {s = \\n => if_then_else Str bon.p - (bon.s ! mec.g ! n ++ mec.s ! n) - (mec.s ! n ++ bon.s ! mec.g ! n) ; - g = mec.g - } ; - ---2 Function expressions - --- A function expression is a common noun together with the --- preposition prefixed to its argument ("mère de x"). --- The type is analogous to two-place adjectives and transitive verbs. - - Function : Type = CommNounPhrase ** Complement ; - --- The application of a function gives, in the first place, a common noun: --- "mor/mödrar till Johan". From this, other rules of the resource grammar --- give noun phrases, such as "la mère de Jean", "les mères de Jean", --- "les mères de Jean et de Marie", and "la mère de Jean et de Marie" (the --- latter two corresponding to distributive and collective functions, --- respectively). Semantics will eventually tell when each --- of the readings is meaningful. - - appFunComm : Function -> NounPhrase -> CommNounPhrase = \mere,jean -> - noun2CommNounPhrase - {s = \\n => mere.s ! n ++ mere.s2 ++ jean.s ! case2pform mere.c ; - g = mere.g - } ; - --- It is possible to use a function word as a common noun; the semantics is --- often existential or indexical. - - funAsCommNounPhrase : Function -> CommNounPhrase = - noun2CommNounPhrase ; - --- The following is an aggregate corresponding to the original function application --- producing "ma mère" and "la mère de Jean". It does not appear in the --- resource grammar API any longer. - - appFun : Bool -> Function -> NounPhrase -> NounPhrase = \coll, mere, jean -> - let {n = jean.n ; g = mere.g ; nf = if_then_else Number coll Sg n} in - variants { - defNounPhrase nf (appFunComm mere jean) ; - npGenDet nf jean mere - } ; - - ---2 Verbs --- ---3 Verb phrases --- --- Unlike many other languages, verb phrases in Romance languages --- are not discontinuous. --- We use clitic parameters instead. --- --- (It is not quite sure, though, whether this --- will suffice in French for examples like "je n'*y* vais pas": one may want to --- add "y" to "ne vais pas" instead of "ne - pas" to "y vais".) --- --- So far we restrict the syntax to present-tense verbs, even though --- morphology has complete conjugations. - - VerbPhrase = {s : Gender => VF => Str} ; - - Verb = VerbPres ; - --- Predication is language-dependent in the negative case. - - predVerb : Bool -> VerbPres -> VerbPhrase = \b,aller -> - if_then_else VerbPhrase b - {s = \\_ => aller.s} - {s = \\_,v => negVerb (aller.s ! v)} ; - - negVerb : Str -> Str ; - --- Verb phrases can also be formed from adjectives ("est bon"), --- common nouns ("est un homme"), and noun phrases ("est Jean"). --- We need a copula, which is of course language-dependent. - - copula : Bool -> VF => Str ; - --- The third rule is overgenerating: "est chaque homme" has to be ruled out --- on semantic grounds. - - predAdjective : Bool -> AdjPhrase -> VerbPhrase = \b,bon -> - {s = \\g,v => copula b ! v ++ bon.s ! g ! nombreVerb v} ; - - predCommNoun : Bool -> CommNounPhrase -> VerbPhrase = \b,homme -> - {s = \\g,v => copula b ! v ++ indefNoun (nombreVerb v) homme} ; - - predNounPhrase : Bool -> NounPhrase -> VerbPhrase = \b,jean -> - {s = \\g,v => copula b ! v ++ jean.s ! stressed nominative} ; - - --- complement a verb with noun phrase and optional preposition - - TransVerb : Type = VerbPres ** Complement ; - - verbOfTransVerb : TransVerb -> VerbPres = \v -> {s = v.s} ; - complementOfTransVerb : TransVerb -> Complement = \v -> {s2 = v.s2 ; c = v.c} ; - - isNounPhraseClit : NounPhrase -> Bool = \n -> case n.c of { - Clit0 => False ; - _ => True - } ; - --- This function is language-dependent, because it uses the language-dependent --- type of case. - - isTransVerbClit : TransVerb -> Bool ; - - ---3 Transitive verbs --- --- Transitive verbs are verbs with a preposition for the complement, --- in analogy with two-place adjectives and functions. --- One might prefer to use the term "2-place verb", since --- "transitive" traditionally means that the inherent preposition is empty. --- Such a verb is one with a *direct object* - which may still be accusative, --- dative, or genitive. --- --- In complementation, we do need some dispatching of clitic types: --- "aime Jean" ; "n'aime pas Jean" ; "l'aime" ; "ne l'aime pas". --- More will be needed when we add ditransitive verbs. - - complTransVerb : Bool -> TransVerb -> NounPhrase -> VerbPhrase = \b,aime,jean -> - {s = \\g,w => ---- BUG: v gives stack overflow - let {Jean = jean.s ! (case2pform aime.c) ; Aime = aime.s ! w} in - if_then_else Str (andB (isNounPhraseClit jean) (isTransVerbClit aime)) - (posNeg b (Jean ++ Aime) []) - (posNeg b Aime Jean) - } ; - - mkTransVerb : Verb -> Preposition -> CaseA -> TransVerb = \v,p,c -> - v ** {s2 = p ; c = c} ; - - mkTransVerbPrep : Verb -> Preposition -> TransVerb = \passer,par -> - mkTransVerb passer par accusative ; - - mkTransVerbCas : Verb -> CaseA -> TransVerb = \penser,a -> - mkTransVerb penser [] a ; - - mkTransVerbDir : Verb -> TransVerb = \aimer -> - mkTransVerbCas aimer accusative ; - --- The following macro builds the "ne - pas" or "non" negation. The second --- string argument is used for the complement of a verb phrase. In Italian, --- one string argument would actually be enough. - - posNeg : Bool -> (verb, compl : Str) -> Str ; - - ---2 Adverbials --- --- Adverbials are not inflected (we ignore comparison, and treat --- compared adverbials as separate expressions; this could be done another way). --- --- (We should also take into account clitic ones, like "y", --- as well as the position: "est toujours heureux" / "est heureux à Paris".) - - Adverb : Type = SS ; - - adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \chante, bien -> - {s = \\g,v => chante.s ! g ! v ++ bien.s} ; - --- Adverbials are typically generated by prefixing prepositions. --- The rule for creating locative noun phrases by the preposition "dans" --- in French and "in" in Italian. This is of course shaky, since other --- prepositions may be preferred ("en", "à" ; "a", "su"). - - locativeNounPhrase : NounPhrase -> Adverb ; - --- This is a source of the "homme avec un téléscope" ambiguity, and may produce --- strange things, like "les voitures toujours". --- Semantics will have to make finer distinctions among adverbials. --- French moreover says "les voitures d'hier" rather than "les voitures hier". - - advCommNounPhrase : CommNounPhrase -> Adverb -> CommNounPhrase = \mec,aparis -> - {s = \\n => mec.s ! n ++ aparis.s ; - g = mec.g - } ; - ---2 Sentences --- --- Sentences depend on a *mode parameter* selecting between --- indicative and subjunctive forms. - - Sentence : Type = SS1 Mode ; - --- This is the traditional $S -> NP VP$ rule. It takes care of both --- mode and agreement. - - predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence = \jean,dort -> - {s = \\m => jean.s ! unstressed nominative ++ - dort.s ! pgen2gen jean.g ! VFin m jean.n jean.p - } ; - - ---3 Sentence-complement verbs --- --- Sentence-complement verbs take sentences as complements. --- The mode of the complement depends on the verb, and can be different --- for positive and negative uses of the verb --- ("je crois qu'elle vient" -"je ne crois pas qu'elle vienne"), - - SentenceVerb : Type = VerbPres ** {mp, mn : Mode} ; - - complSentVerb : Bool -> SentenceVerb -> Sentence -> VerbPhrase = - \b,croire,jeanboit -> - let {m = if_then_else Mode b croire.mp croire.mn} in - {s = \\_,w => posNeg b (croire.s ! w) (embedConj ++ jeanboit.s ! m)} ; ----w - - verbSent : Verb -> Mode -> Mode -> SentenceVerb = \v,mp,mn -> - v ** {mp = mp ; mn = mn} ; - --- The embedding conjunction is language dependent. - - embedConj : Str ; - - ---2 Sentences missing noun phrases --- --- This is one instance of Gazdar's *slash categories*, corresponding to his --- $S/NP$. --- We cannot have - nor would we want to have - a productive slash-category former. --- Perhaps a handful more will be needed. --- --- 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 = Sentence ** Complement ; - - slashTransVerb : Bool -> NounPhrase -> TransVerb -> SentenceSlashNounPhrase = - \b,jean,aimer -> - predVerbPhrase jean (predVerb b (verbOfTransVerb aimer)) ** - complementOfTransVerb aimer ; - - ---2 Relative pronouns and relative clauses --- --- Relative pronouns are inflected in --- gender, number, and case. They can also have an inherent case, --- but this case if 'variable' in the sense that it --- is sometimes just mediated from the correlate --- ("homme qui est bon"), sometimes inherent to the --- pronominal phrase itself ("homme dont la mère est bonne"). - -oper - - RelPron : Type = {s : RelFormA => Str ; g : RelGen} ; - RelClause : Type = {s : Mode => Gender => Number => Str} ; - - mkGenRel : RelGen -> Gender -> Gender = \rg,g -> case rg of { - RG gen => gen ; - _ => g - } ; - --- Simple relative pronouns ("qui", "dont", "par laquelle") --- have no inherent gender. - - identRelPron : RelPron ; - - composRelPron : Gender -> Number -> CaseA -> Str ; - --- Complex relative pronouns ("dont la mère") do have an inherent gender. - - funRelPron : Function -> RelPron -> RelPron ; - --- There are often variants, i.e. short and long forms --- ("que" - "lequel", "dont" -"duquel"), etc. - - allRelForms : RelPron -> Gender -> Number -> CaseA -> Str ; - --- Relative clauses can be formed from both verb phrases ("qui dort") and --- slash expressions ("que je vois", "dont je parle"). - - relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \qui,dort -> - {s = \\m,g,n => allRelForms qui g n nominative ++ dort.s ! g ! VFin m n P3 - } ; - - relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause = \dont,jeparle -> - {s = \\m,g,n => jeparle.s2 ++ allRelForms dont g n jeparle.c ++ jeparle.s ! m - } ; - --- A 'degenerate' relative clause is the one often used in mathematics, e.g. --- "nombre x tel que x soit pair". - - relSuch : Sentence -> RelClause = \A -> - {s = \\m,g,n => suchPron g n ++ embedConj ++ A.s ! m - } ; - - suchPron : Gender -> Number -> Str ; - --- 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. A comma is used before the relative clause. --- --- N.B. subjunctive relative clauses --- ("je cherche un mec qui sache chanter") must have another structure --- (unless common noun phrases are given a mode parameter...). - - modRelClause : CommNounPhrase -> RelClause -> CommNounPhrase = \mec,quidort -> - {s = \\n => mec.s ! n ++ quidort.s ! Ind ! mec.g ! n ; - g = mec.g - } ; - ---2 Interrogative pronouns --- --- If relative pronouns are adjective-like, interrogative pronouns are --- noun-phrase-like. We use a simplified type, since we don't need the possessive --- forms. --- --- N.B. "est-ce que", etc, will be added below --- when pronouns are used in direct questions. - - IntPron : Type = {s : CaseA => Str ; g : Gender ; n : Number} ; - --- In analogy with relative pronouns, we have a rule for applying a function --- to a relative pronoun to create a new one. - - funIntPron : Function -> IntPron -> IntPron = \mere,qui -> - {s = \\c => - artDef mere.g qui.n c ++ mere.s ! qui.n ++ mere.s2 ++ qui.s ! mere.c ; - g = mere.g ; - n = qui.n - } ; - --- There is a variety of simple interrogative pronouns: --- "quelle maison", "qui", "quoi". Their definitions are language-dependent. - - nounIntPron : Number -> CommNounPhrase -> IntPron ; - intPronWho : Number -> IntPron ; - intPronWhat : Number -> IntPron ; - ---2 Utterances - --- By utterances we mean whole phrases, such as --- 'can be used as moves in a language game': indicatives, questions, imperative, --- and one-word utterances. The rules are far from complete. --- --- N.B. we have not included rules for texts, which we find we cannot say much --- about on this level. In semantically rich GF grammars, texts, dialogues, etc, --- will of course play an important role as categories not reducible to utterances. --- An example is proof texts, whose semantics show a dependence between premises --- and conclusions. Another example is intersentential anaphora. - - Utterance = SS ; - - indicUtt : Sentence -> Utterance = \x -> ss (x.s ! Ind ++ ".") ; - interrogUtt : Question -> Utterance = \x -> ss (x.s ! DirQ ++ "?") ; - ---2 Questions --- --- Questions are either direct ("qui a pris la voiture") or indirect --- ("ce qui a pris la voiture"). - -param - QuestForm = DirQ | IndirQ ; - -oper - Question = SS1 QuestForm ; - - ---3 Yes-no questions --- --- Yes-no questions are used both independently ("Tu es fatigué?") --- and after interrogative adverbials ("Pourquoi tu es fatigué?"). --- It is economical to handle with these two cases by the one --- rule, $questVerbPhrase'$. The only difference is if "si" appears --- in the indirect form. --- --- N.B. the inversion variant ("Es-tu fatigué?") is missing, mainly because our --- verb morphology does not support the intervening "t" ("Marche-t-il?"). --- The leading "est-ce que" is recognized as a variant, and requires --- direct word order. - - questVerbPhrase : NounPhrase -> VerbPhrase -> Question ; - ---3 Wh-questions --- --- Wh-questions are of two kinds: ones that are like $NP - VP$ sentences, --- others that are line $S/NP - NP$ sentences. --- --- N.B. inversion variants and "est-ce que" are treated as above. - - intVerbPhrase : IntPron -> VerbPhrase -> Question ; - - intSlash : IntPron -> SentenceSlashNounPhrase -> Question ; - - ---3 Interrogative adverbials --- --- These adverbials will be defined in the lexicon: they include --- "quand", "où", "comment", "pourquoi", etc, which are all invariant one-word --- expressions. In addition, they can be formed by adding prepositions --- to interrogative pronouns, in the same way as adverbials are formed --- from noun phrases. --- --- N.B. inversion variants and "est-ce que" are treated as above. - - IntAdverb = SS ; - - questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question ; - - ---2 Imperatives --- --- We only consider second-person imperatives. --- --- N.B. following the API, we don't distinguish between --- singular and plural "vous", nor between masculine and feminine. --- when forming utterances. --- --- TODO: clitics, Italian negated imperative. - - Imperative = {s : Gender => Number => Str} ; - - imperVerbPhrase : VerbPhrase -> Imperative = \dormir -> - {s = \\g,n => dormir.s ! g ! vImper n P2 - } ; - - imperUtterance : Number -> Imperative -> Utterance = \n,I -> - ss (I.s ! Masc ! n ++ "!") ; - - - ---2 Coordination --- --- Coordination is to some extent orthogonal to the rest of syntax, and --- has been treated in a generic way in the module $CO$ in the file --- $coordination.gf$. The overall structure is independent of category, --- but there can be differences in parameter dependencies. --- ---3 Conjunctions --- --- Coordinated phrases are built by using conjunctions, which are either --- simple ("et", "ou") or distributed ("et - et", "pu - ou"). - - Conjunction = CO.Conjunction ** {n : Number} ; - ConjunctionDistr = CO.ConjunctionDistr ** {n : Number} ; - ---3 Coordinating sentences --- --- We need a category of lists of sentences. It is a discontinuous --- category, the parts corresponding to 'init' and 'last' segments --- (rather than 'head' and 'tail', because we have to keep track of the slot between --- the last two elements of the list). A list has at least two elements. --- --- N.B. we don't have repetion of "que" in subordinate coordinated sentences. - - ListSentence : Type = {s1,s2 : Mode => Str} ; - - twoSentence : (_,_ : Sentence) -> ListSentence = - CO.twoTable Mode ; - - consSentence : ListSentence -> Sentence -> ListSentence = - CO.consTable Mode CO.comma ; - --- To coordinate a list of sentences by a simple conjunction, we place --- it between the last two elements; commas are put in the other slots, --- e.g. "Pierre fume, Jean boit et les autres regardsnt". - - conjunctSentence : Conjunction -> ListSentence -> Sentence = - CO.conjunctTable Mode ; - --- To coordinate a list of sentences by a distributed conjunction, we place --- the first part in front of the first element, the second --- part between the last two elements, and commas in the other slots. --- For sentences this is really not used. - - conjunctDistrSentence : ConjunctionDistr -> ListSentence -> Sentence = - CO.conjunctDistrTable Mode ; - ---3 Coordinating adjective phrases --- --- The structure is the same as for sentences. The result is a prefix adjective --- if and only if all elements are prefix. - - ListAdjPhrase : Type = - {s1,s2 : Gender => Number => Str ; p : Bool} ; - - twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y -> - CO.twoTable2 Gender Number x y ** {p = andB x.p y.p} ; - - consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x -> - CO.consTable2 Gender Number CO.comma xs x ** {p = andB xs.p x.p} ; - - conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs -> - CO.conjunctTable2 Gender Number c xs ** {p = xs.p} ; - - conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase = \c,xs -> - CO.conjunctDistrTable2 Gender Number c xs ** {p = xs.p} ; - - ---3 Coordinating noun phrases --- --- The structure is the same as for sentences. The result is either always plural --- or plural if any of the components is, depending on the conjunction. --- The gender is masculine if any of the components is. A coordinated noun phrase --- cannot be clitic. - - ListNounPhrase : Type = - {s1,s2 : CaseA => Str ; g : PronGen ; n : Number ; p : Person} ; - - twoNounPhrase : (_,_ : NounPhrase) -> ListNounPhrase = \x,y -> - {s1 = \\c => x.s ! stressed c ; s2 = \\c => y.s ! stressed c} ** - {n = conjNumber x.n y.n ; g = conjGender x.g y.g ; p = conjPers x.p y.p} ; - - consNounPhrase : ListNounPhrase -> NounPhrase -> ListNounPhrase = \xs,x -> - {s1 = \\c => xs.s1 ! c ++ CO.comma ++ xs.s2 ! c ; - s2 = \\c => x.s ! stressed c} ** - {n = conjNumber xs.n x.n ; g = conjGender xs.g x.g ; p =conjPers xs.p x.p} ; - - conjunctNounPhrase : Conjunction -> ListNounPhrase -> NounPhrase = \co,xs -> - {s = \\c => xs.s1 ! pform2case c ++ co.s ++ xs.s2 ! pform2case c} ** - {n = conjNumber co.n xs.n ; g = xs.g ; p = xs.p ; c = Clit0 } ; - - conjunctDistrNounPhrase : ConjunctionDistr -> ListNounPhrase -> NounPhrase = - \co,xs -> - {s = \\c => co.s1++ xs.s1 ! pform2case c ++ co.s2 ++ xs.s2 ! pform2case c} ** - {n = conjNumber co.n xs.n ; g = xs.g ; p = xs.p ; c = Clit0} ; - --- We have to define a calculus of numbers of genders. For numbers, --- it is like the conjunction with $Pl$ corresponding to $False$. For genders, --- $Masc$ corresponds to $False$. - - conjNumber : Number -> Number -> Number = \m,n -> case <m,n> of { - <Sg,Sg> => Sg ; - _ => Pl - } ; - - conjGen : Gender -> Gender -> Gender = \m,n -> case <m,n> of { - <Fem,Fem> => Fem ; - _ => Masc - } ; - - conjGender : PronGen -> PronGen -> PronGen = \m,n -> case <m,n> of { - <PGen Fem, PGen Fem> => PGen Fem ; - _ => PNoGen - } ; - --- For persons, we go in the descending order: --- "moi et toi sommes forts", "lui ou toi es fort". --- This is not always quite clear. - - conjPers : Person -> Person -> Person = \p,q -> case <p,q> of { - <P3,P3> => P3 ; - <P1,_> => P1 ; - <_,P1> => P1 ; - _ => P2 - } ; - - - ---2 Subjunction --- --- Subjunctions ("si", "quand", etc) --- are a different way to combine sentences than conjunctions. --- The main clause can be a sentences, an imperatives, or a question, --- but the subjoined clause must be a sentence. - - Subjunction = SS ; - - subjunctSentence : Subjunction -> Sentence -> Sentence -> Sentence = \si,A,B -> - {s = \\m => subjunctVariants si A (B.s ! m) - } ; - - subjunctImperative : Subjunction -> Sentence -> Imperative -> Imperative = - \si,A,B -> - {s = \\g,n => subjunctVariants si A (B.s ! g ! n) - } ; - - subjunctQuestion : Subjunction -> Sentence -> Question -> Question = \si,A,B -> - {s = \\q => subjunctVariants si A (B.s ! q) - } ; - --- There are uniformly two variant word orders, e.g. --- "si tu fume je m'en vais" --- and "je m'en vais si tu fume". - - subjunctVariants : Subjunction -> Sentence -> Str -> Str = \si,A,B -> - let {As = A.s ! Ind} in - variants { - si.s ++ As ++ B ; - B ++ si.s ++ As - } ; - ---2 One-word utterances --- --- An utterance can consist of one phrase of almost any category, --- the limiting case being one-word utterances. These --- utterances are often (but not always) in what can be called the --- default form of a category, e.g. the nominative. --- This list is far from exhaustive. - - useNounPhrase : NounPhrase -> Utterance = \jean -> - postfixSS "." (defaultNounPhrase jean) ; - useCommonNounPhrase : Number -> CommNounPhrase -> Utterance = \n,mec -> - useNounPhrase (indefNounPhrase n mec) ; - - --- one-form variants - - defaultNounPhrase : NounPhrase -> SS = \jean -> - ss (jean.s ! stressed nominative) ; - - defaultQuestion : Question -> SS = \quiesttu -> - ss (quiesttu.s ! DirQ) ; - - defaultSentence : Sentence -> SS = \x -> ss (x.s ! Ind) ; - ------ moved from Types - - artDef : Gender -> Number -> CaseA -> Str ; - artIndef : Gender -> Number -> CaseA -> Str ; - genForms : Str -> Str -> Gender => Str ; - ------ moved from Res - - pronJe, pronTu, pronIl, pronElle, pronNous, pronVous, pronIls, pronElles : - Pronoun ; - chaqueDet, tousDet, quelDet, plupartDet : Determiner ; - - commentAdv, quandAdv, ouAdv, pourquoiAdv : Adverb ; - - etConj, ouConj : Conjunction ; - etetConj, ououConj : ConjunctionDistr ; - siSubj, quandSubj : Subjunction ; - - ouiPhr, noPhr : Utterance ; - -} diff --git a/grammars/resource/romance/TypesRomance.gf b/grammars/resource/romance/TypesRomance.gf deleted file mode 100644 index e15f453f6..000000000 --- a/grammars/resource/romance/TypesRomance.gf +++ /dev/null @@ -1,175 +0,0 @@ ---1 Romance Word Classes and Morphological Parameters --- --- This is a resource module for French and Italian morphology, defining the --- morphological parameters and parts of speech of Romance languages. --- It is used as the major part of language-specific type systems, --- defined in $types.Fra.gf$ and $types.Ita.gf$. The guiding principle has been --- to share as much as possible, which has two advantages: it saves work in --- encoding, and it shows how the languages are related. - -interface TypesRomance = { - ---2 Enumerated parameter types for morphology --- --- These types are the ones found in school grammars. --- Their parameter values are atomic. - -param - Number = Sg | Pl ; - Gender = Masc | Fem ; - Person = P1 | P2 | P3 ; - Mode = Ind | Con ; - Degree = Pos | Comp | Sup ; - --- The case must be made an abstract type, since it varies from language to --- language. The same concerns those parameter types that depend on case. --- Certain cases can however be defined. - -param - RelGen = RNoGen | RG Gender ; - -oper - CaseA : PType ; - NPFormA : PType ; - - nominative : CaseA ; - accusative : CaseA ; - genitive : CaseA ; - dative : CaseA ; - - stressed : CaseA -> NPFormA ; - unstressed : CaseA -> NPFormA ; - - RelFormA : PType ; - --- The genitive and dative cases are expressed by prepositions, except for --- clitic pronouns. The accusative case only makes a difference for pronouns. - --- Personal pronouns are the following type: - -oper - Pronoun : Type = { - s : NPFormA => Str ; - g : PronGen ; - n : Number ; - p : Person ; - c : ClitType - } ; - --- The following coercions are useful: - -oper - pform2case : NPFormA -> CaseA ; - case2pform : CaseA -> NPFormA ; - - prepCase : CaseA -> Str ; - - - adjCompLong : Adj -> AdjComp ; - - relPronForms : CaseA => Str ; - --- For abstraction and API compatibility, we define two synonyms: - -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 mostly hierarchical. The alternative is cross-products of --- simple parameters, but this cannot be always used since it overgenerates. --- - ---3 Common nouns --- --- Common nouns are inflected in number, and they have an inherent gender. - - CNom : Type = {s : Number => Str ; g : Gender} ; - ---3 Pronouns --- --- Pronouns are an example - the worst-case one of noun phrases, --- which are defined in $syntax.Ita.gf$. --- Their inflection tables has tonic and atonic forms, as well as --- the possessive forms, which are inflected like determiners. --- --- Example: "lui, de lui, à lui" - "il,le,lui" - "son,sa,ses". - --- Tonic forms are divided into four classes of clitic type. --- The first value is used for never-clitic noun phrases. --- This classification is incomplete, since we do not (yet) treat --- ditransitive verbs. --- --- Examples of each: "Giovanni" ; "io" ; "lui" ; "noi". - - param ClitType = Clit0 | Clit1 | Clit2 | Clit3 ; - --- Gender is not morphologically determined for first and second person pronouns. - - PronGen = PGen Gender | PNoGen ; - --- The following coercion is useful: - -oper - pgen2gen : PronGen -> Gender = \p -> case p of { - PGen g => g ; - PNoGen => variants {Masc ; Fem} --- the best we can do for je, tu, nous, vous - } ; - ---3 Adjectives --- --- Adjectives are inflected in gender and number. --- Comparative adjectives are moreover inflected in degree --- (which in French and Italian is usually syntactic, though). - - Adj : Type = {s : Gender => Number => Str} ; - AdjComp : Type = {s : Degree => Gender => Number => Str} ; - - ---3 Verbs --- --- In the current syntax, we use --- a reduced conjugation with only the present tense infinitive, --- indicative, subjunctive, and imperative forms. --- But our morphology has full Bescherelle conjunctions: --- so we use a coercion between full and reduced verbs. --- The full conjugations and the coercions are defined separately for French --- and Italian, since they are not identical. The differences are mostly due --- to Bescherelle structuring the forms in different groups; the --- gerund and the present participles show real differences. - -param - VF = - VFin Mode Number Person - | VImper NumPersI - | VInfin - ; - - NumPersI = SgP2 | PlP1 | PlP2 ; - --- It is sometimes useful to derive the number of a verb form. - -oper - nombreVerb : VF -> Number = \v -> case v of { - VFin _ n _ => n ; - _ => singular --- - } ; - --- The imperative forms depend on number and person. - - vImper : Number -> Person -> VF = \n,p -> case <n,p> of { - <Sg,P2> => VImper SgP2 ; - <Pl,P1> => VImper PlP1 ; - <Pl,P2> => VImper PlP2 ; - _ => VInfin - } ; - - Verbum : Type ; - - VerbPres : Type = {s : VF => Str} ; - - verbPres : Verbum -> VerbPres ; -} diff --git a/grammars/resource/russian/DatabaseRus.gf b/grammars/resource/russian/DatabaseRus.gf deleted file mode 100644 index 289e002a1..000000000 --- a/grammars/resource/russian/DatabaseRus.gf +++ /dev/null @@ -1,61 +0,0 @@ -concrete DatabaseRus of Database = open Prelude,Syntax,English,Predication,Paradigms in {
-
-flags lexer=text ; unlexer=text ; coding=utf8 ;
-
-lincat
- Phras = SS1 Bool ; -- long or short form
- Subject = NP ;
- Noun = CN ;
- Property = AP ;
- Comparison = AdjDeg ;
- Relation = Adj2 ;
- Feature = Fun ;
- Value = NP ;
- Name = ProperName ;
-
-lin
- LongForm sent = ss (sent.s ! True ++ "?") ;
- ShortForm sent = ss (sent.s ! False ++ "?") ;
-
-oper
- mkSent : SS -> SS -> SS1 Bool = \long, short ->
- {s = table {b => if_then_else Str b long.s short.s}} ;
-
- mkSentPrel : Str -> SS -> SS1 Bool = \prel, matter ->
- mkSent (ss (prel ++ matter.s)) matter ;
-
- mkSentSame : SS -> SS1 Bool = \s ->
- mkSent s s ;
-
-lin
- WhichAre A B = mkSent (defaultQuestion (IntVP (NounIPMany A) (PosA B)))
- (defaultNounPhrase (IndefManyNP (ModAdj B A))) ;
-
- IsIt Q A = mkSentSame (defaultQuestion (QuestVP Q (PosA A))) ;
-
- MoreThan = ComparAdjP ;
- TheMost = SuperlNP ;
- Relatively C _ = PositAdjP C ;
-
- RelatedTo = ComplAdj ;
-
- FeatureOf = appFun1 ;
- ValueOf F V = appFun1 F (UsePN V) ;
-
- WithProperty A B = ModAdj B A ;
-
- Individual = UsePN ;
-
- AllN = DetNP AllDet ;
- MostN = DetNP MostDet ;
- EveryN = DetNP EveryDet ;
-
--- only these are language-dependent
-
- Any = detNounPhrase anyPlDet ; --- in the sense "some", not "all"
-
- IsThere A = mkSentPrel ["еÑть ли"] (defaultNounPhrase (IndefOneNP A)) ;
- AreThere A = mkSentPrel ["еÑть ли"] (defaultNounPhrase (IndefManyNP A)) ;
-
- WhatIs V = mkSentPrel ["какой"] (defaultNounPhrase V) ;
-};
diff --git a/grammars/resource/russian/Morpho.gf b/grammars/resource/russian/Morpho.gf deleted file mode 100644 index 9e48e86e6..000000000 --- a/grammars/resource/russian/Morpho.gf +++ /dev/null @@ -1,1027 +0,0 @@ ---1 A Simple Russian Resource Morphology
---
--- Aarne Ranta, Janna Khegai 2003
---
--- This resource morphology contains definitions of the lexical entries
--- needed in the resource syntax.
--- It moreover contains copies of the most usual inflectional patterns.
---
--- We use the parameter types and word classes defined for morphology.
---
--- Note: mkPassive operation is at the moment incorrect. Low-level ending-analysis
--- is needed to fix the operation.
-
-resource Morpho = Types ** open (Predef=Predef), Prelude in {
-flags coding=utf8 ;
-
---2 Personal (together with possesive) pronouns.
-oper pronYa: Pronoun =
- { s = table {
- PF Nom _ NonPoss => "Ñ" ;
- PF Gen _ NonPoss => "менÑ" ;
- PF Dat _ NonPoss => "мне" ;
- PF Acc _ NonPoss => "менÑ" ;
- PF Inst _ NonPoss => "мной" ;
- PF Prepos _ NonPoss => "мне" ;
- PF Nom _ (Poss (ASg Masc)) => "мой" ;
- PF Gen _ (Poss (ASg Masc)) => "моего" ;
- PF Dat _ (Poss (ASg Masc)) => "моему" ;
- PF Acc _ (Poss (ASg Masc)) => "моего" ;
- PF Inst _ (Poss (ASg Masc)) => "моим" ;
- PF Prepos _ (Poss (ASg Masc)) => "моём" ;
- PF Nom _ (Poss (ASg Fem)) => "моÑ" ;
- PF Gen _ (Poss (ASg Fem)) => "моей" ;
- PF Dat _ (Poss (ASg Fem)) => "моей" ;
- PF Acc _ (Poss (ASg Fem)) => "мою" ;
- PF Inst _ (Poss (ASg Fem)) => "моею" ;
- PF Prepos _ (Poss (ASg Fem)) => "моей" ;
- PF Nom _ (Poss (ASg Neut)) => "моё" ;
- PF Gen _ (Poss (ASg Neut)) => "моего" ;
- PF Dat _ (Poss (ASg Neut)) => "моему" ;
- PF Acc _ (Poss (ASg Neut)) => "моё" ;
- PF Inst _ (Poss (ASg Neut)) => "моим" ;
- PF Prepos _ (Poss (ASg Neut)) => "моём" ;
- PF Nom _ (Poss APl) => "мои" ;
- PF Gen _ (Poss APl)=> "моих" ;
- PF Dat _ (Poss APl) => "моим" ;
- PF Acc _ (Poss APl) => "моих" ;
- PF Inst _ (Poss APl) => "моими" ;
- PF Prepos _ (Poss APl) => "моих"
- } ;
- g = PNoGen ;
- n = Sg ;
- p = P1 ;
- pron = True
- } ;
-
-oper pronTu: Pronoun =
- { s = table {
- PF Nom _ NonPoss => "ты" ;
- PF Gen _ NonPoss => "тебÑ" ;
- PF Dat _ NonPoss => "тебе" ;
- PF Acc _ NonPoss => "тебÑ" ;
- PF Inst _ NonPoss => "тобой" ;
- PF Prepos _ NonPoss => ["о тебе"] ;
- PF Nom _ (Poss (ASg Masc)) => "твой" ;
- PF Gen _ (Poss (ASg Masc)) => "твоего" ;
- PF Dat _ (Poss (ASg Masc)) => "твоему" ;
- PF Acc _ (Poss (ASg Masc)) => "твоего" ;
- PF Inst _ (Poss (ASg Masc)) => "твоим" ;
- PF Prepos _ (Poss (ASg Masc)) => "твоём" ;
- PF Nom _ (Poss (ASg Fem)) => "твоÑ" ;
- PF Gen _ (Poss (ASg Fem)) => "твоей" ;
- PF Dat _ (Poss (ASg Fem)) => "твоей" ;
- PF Acc _ (Poss (ASg Fem)) => "твою" ;
- PF Inst _ (Poss (ASg Fem)) => "твоею" ;
- PF Prepos _ (Poss (ASg Fem)) => "твоей" ;
- PF Nom _ (Poss (ASg Neut)) => "твоё" ;
- PF Gen _ (Poss (ASg Neut)) => "твоего" ;
- PF Dat _ (Poss (ASg Neut)) => "твоему" ;
- PF Acc _ (Poss (ASg Neut)) => "твоё" ;
- PF Inst _ (Poss (ASg Neut)) => "твоим" ;
- PF Prepos _ (Poss (ASg Neut)) => "твоём" ;
- PF Nom _ (Poss APl) => "твои" ;
- PF Gen _ (Poss APl)=> "твоих" ;
- PF Dat _ (Poss APl) => "твоим" ;
- PF Acc _ (Poss APl) => "твоих" ;
- PF Inst _ (Poss APl) => "твоими" ;
- PF Prepos _ (Poss APl) => "твоих"
- } ;
- g = PNoGen ;
- n = Sg ;
- p = P2 ;
- pron = True
- } ;
-
-oper pronOn: Pronoun =
- { s = table {
- PF Nom _ NonPoss => "он" ;
- PF Gen No NonPoss => "его" ;
- PF Gen Yes NonPoss => "него" ;
- PF Dat No NonPoss => "ему" ;
- PF Dat Yes NonPoss => "нему" ;
- PF Acc No NonPoss => "его" ;
- PF Acc Yes NonPoss => "него" ;
- PF Inst No NonPoss => "им" ;
- PF Inst Yes NonPoss => "ним" ;
- PF Prepos _ NonPoss => ["о нем"] ;
- PF _ _ (Poss _) => "его"
- } ;
- g = PGen Masc ;
- n = Sg ;
- p = P3 ;
- pron = True
- } ;
-
-oper pronOna: Pronoun =
- { s = table {
- PF Nom _ NonPoss => "она" ;
- PF Gen No NonPoss => "её" ;
- PF Gen Yes NonPoss => "неё" ;
- PF Dat No NonPoss => "ей" ;
- PF Dat Yes NonPoss => "ней" ;
- PF Acc No NonPoss => "её" ;
- PF Acc Yes NonPoss => "неё" ;
- PF Inst No NonPoss => "ей" ;
- PF Inst Yes NonPoss => "ней" ;
- PF Prepos _ NonPoss => ["о ней"] ;
- PF _ _ (Poss _ ) => "её"
-
- } ;
- g = PGen Fem ;
- n = Sg ;
- p = P3 ;
- pron = True
- } ;
-
-oper pronMu: Pronoun =
- { s = table {
- PF Nom _ NonPoss => "мы" ;
- PF Gen _ NonPoss => "наÑ" ;
- PF Dat _ NonPoss => "нам" ;
- PF Acc _ NonPoss => "наÑ" ;
- PF Inst _ NonPoss => "нами" ;
- PF Prepos _ NonPoss => ["о наÑ"] ;
- PF Nom _ ((Poss (ASg Masc))) => "наш" ;
- PF Gen _ (Poss (ASg Masc)) => "нашего" ;
- PF Dat _ ((Poss (ASg Masc))) => "нашему" ;
- PF Acc _ ((Poss (ASg Masc))) => "нашего" ;
- PF Inst _ (Poss (ASg Masc)) => "нашим" ;
- PF Prepos _ (Poss (ASg Masc)) => "нашем" ;
- PF Nom _ (Poss (ASg Fem)) => "наша" ;
- PF Gen _ (Poss (ASg Fem)) => "нашей" ;
- PF Dat _ (Poss (ASg Fem)) => "нашей" ;
- PF Acc _ (Poss (ASg Fem)) => "нашу" ;
- PF Inst _ (Poss (ASg Fem)) => "нашею" ;
- PF Prepos _ (Poss (ASg Fem)) => "нашей" ;
- PF Nom _ (Poss (ASg Neut)) => "наше" ;
- PF Gen _ (Poss (ASg Neut)) => "нашего" ;
- PF Dat _ (Poss (ASg Neut)) => "нашему" ;
- PF Acc _ (Poss (ASg Neut)) => "наше" ;
- PF Inst _ (Poss (ASg Neut)) => "нашим" ;
- PF Prepos _ (Poss (ASg Neut)) => "нашем" ;
- PF Nom _ (Poss APl) => "наши" ;
- PF Gen _ (Poss APl)=> "наших" ;
- PF Dat _ (Poss APl) => "нашим" ;
- PF Acc _ (Poss APl) => "наших" ;
- PF Inst _ (Poss APl) => "нашими" ;
- PF Prepos _ (Poss APl) => "наших"
- };
- g = PNoGen ;
- n = Pl ;
- p = P1 ;
- pron = True
- } ;
-
-oper pronVu: Pronoun =
- { s = table {
- PF Nom _ NonPoss => "вы" ;
- PF Gen _ NonPoss => "ваÑ" ;
- PF Dat _ NonPoss => "вам" ;
- PF Acc _ NonPoss => "ваÑ" ;
- PF Inst _ NonPoss => "вами" ;
- PF Prepos _ NonPoss => "ваÑ" ;
- PF Nom _ (Poss (ASg Masc)) => "ваш" ;
- PF Gen _ (Poss (ASg Masc)) => "вашего" ;
- PF Dat _ (Poss (ASg Masc)) => "вашему" ;
- PF Acc _ (Poss (ASg Masc)) => "вашего" ;
- PF Inst _ (Poss (ASg Masc)) => "вашим" ;
- PF Prepos _ (Poss (ASg Masc)) => "вашем" ;
- PF Nom _ (Poss (ASg Fem)) => "ваша" ;
- PF Gen _ (Poss (ASg Fem)) => "вашей" ;
- PF Dat _ (Poss (ASg Fem)) => "вашей" ;
- PF Acc _ (Poss (ASg Fem)) => "вашу" ;
- PF Inst _ (Poss (ASg Fem)) => "вашею" ;
- PF Prepos _ (Poss (ASg Fem)) => "вашей" ;
- PF Nom _ (Poss (ASg Neut)) => "ваше" ;
- PF Gen _ (Poss (ASg Neut)) => "вашего" ;
- PF Dat _ (Poss (ASg Neut)) => "вашему" ;
- PF Acc _ (Poss (ASg Neut)) => "ваше" ;
- PF Inst _ (Poss (ASg Neut)) => "вашим" ;
- PF Prepos _ (Poss (ASg Neut)) => "вашем" ;
- PF Nom _ (Poss APl) => "ваши" ;
- PF Gen _ (Poss APl)=> "ваших" ;
- PF Dat _ (Poss APl) => "вашим" ;
- PF Acc _ (Poss APl) => "ваших" ;
- PF Inst _ (Poss APl) => "вашими" ;
- PF Prepos _ (Poss APl) => "ваших"
- };
- g = PNoGen ;
- n = Pl ;
- p = P2 ;
- pron = True
- } ;
-
-oper pronOni: Pronoun =
- { s = table {
- PF Nom _ NonPoss => "они" ;
- PF Gen No NonPoss => "их" ;
- PF Gen Yes NonPoss => "них" ;
- PF Dat No NonPoss => "им" ;
- PF Dat Yes NonPoss => "ним" ;
- PF Acc No NonPoss => "их" ;
- PF Acc Yes NonPoss => "них" ;
- PF Inst No NonPoss => "ими" ;
- PF Inst Yes NonPoss => "ними" ;
- PF Prepos _ NonPoss => ["о них"] ;
- PF _ _ (Poss _) => "их"
- } ;
- g = PNoGen ;
- n = Pl ;
- p = P3 ;
- pron = True
- } ;
-
---2 Nouns
-
--- Help type SubstFormDecl is introduced to reduce repetition in
--- the declination definitions. It allows us to define a declination type,
--- namely, the String component "s" of the CommNoun type
--- without any reference to the Gender parameter "g".
-
-oper SubstFormDecl = SS1 SubstForm ;
-
-oper muzhchina : CommNoun = (aEndAnimateDecl "мужчин") ** { g = Masc ; anim = Animate } ;
-oper zhenchina : CommNoun = (aEndAnimateDecl "женщин") ** { g = Fem ; anim = Animate } ;
-oper mama : CommNoun = (aEndAnimateDecl "мам")**{ g = Fem ; anim = Animate } ;
-oper cena : CommNoun = (aEndAnimateDecl "цен") ** { g = Fem ; anim = Inanimate } ;
-
-oper aEndAnimateDecl: Str -> SubstFormDecl = \muzhchin ->
-{s = table {
- SF Sg Nom => muzhchin+"а" ;
- SF Sg Gen => muzhchin+"Ñ‹" ;
- SF Sg Dat => muzhchin+"е" ;
- SF Sg Acc => muzhchin+"у" ;
- SF Sg Inst => muzhchin+"ой" ;
- SF Sg Prepos => muzhchin +"е" ;
- SF Pl Nom => muzhchin +"Ñ‹" ;
-
SF Pl Gen => muzhchin ;
- SF Pl Dat => muzhchin+"ам" ;
- SF Pl Acc => muzhchin ;
- SF Pl Inst => muzhchin+"ами" ;
- SF Pl Prepos => muzhchin+"ах" }
- } ;
-
-oper stomatolog : CommNoun = nullEndAnimateDecl "Ñтоматолог" ;
-oper nullEndAnimateDecl: Str -> CommNoun = \stomatolog ->
- {s = table
- { SF Sg Nom => stomatolog ;
- SF Sg Gen => stomatolog+"а" ;
- SF Sg Dat => stomatolog+"у" ;
- SF Sg Acc => stomatolog +"а" ;
- SF Sg Inst => stomatolog+"ом" ;
- SF Sg Prepos => stomatolog+"е" ;
- SF Pl Nom => stomatolog+"и" ;
- SF Pl Gen => stomatolog+"ов" ;
- SF Pl Dat => stomatolog+"ам" ;
- SF Pl Acc => stomatolog+"ов" ;
- SF Pl Inst => stomatolog+"ами" ;
- SF Pl Prepos => stomatolog+"ах" } ;
- g = Masc ; anim = Animate
- } ;
-
-oper gripp : CommNoun = nullEndInAnimateDecl1 "грипп" ;
-oper bar : CommNoun = nullEndInAnimateDecl1 "бар" ;
-oper telefon: CommNoun = nullEndInAnimateDecl1 "телефон" ;
-oper restoran : CommNoun = nullEndInAnimateDecl1 "реÑторан" ;
-
--- Note: Plural form of the "грипп" (influenza) is a bit doubious
--- However, according to http://starling.rinet.ru/morph.htm it exists.
--- so we also keep it.
-oper nullEndInAnimateDecl1: Str -> CommNoun = \gripp ->
- {s = table
- { SF Sg Nom => gripp ;
- SF Sg Gen => gripp+"а" ;
- SF Sg Dat => gripp+"у" ;
- SF Sg Acc => gripp ;
- SF Sg Inst => gripp+"ом" ;
- SF Sg Prepos => gripp+"е" ;
- SF Pl Nom => gripp+"Ñ‹" ;
- SF Pl Gen => gripp+"ов" ;
- SF Pl Dat => gripp+"ам" ;
- SF Pl Acc => gripp +"Ñ‹";
- SF Pl Inst => gripp+"ами" ;
- SF Pl Prepos => gripp+"ах"
- } ;
- g = Masc ; anim = Inanimate
-
- } ;
-
-oper adres: CommNoun = nullEndInAnimateDecl2 "адреÑ" ;
-oper dom : CommNoun = nullEndInAnimateDecl2 "дом" ;
-oper svet : CommNoun = nullEndInAnimateDecl2 "Ñвет" ;
-oper nullEndInAnimateDecl2: Str -> CommNoun = \gripp ->
- {s = table
- { SF Sg Nom => gripp ;
- SF Sg Gen => gripp+"а" ;
- SF Sg Dat => gripp+"у" ;
- SF Sg Acc => gripp ;
- SF Sg Inst => gripp+"ом" ;
- SF Sg Prepos => gripp+"е" ;
- SF Pl Nom => gripp+"а" ;
- SF Pl Gen => gripp+"ов" ;
- SF Pl Dat => gripp+"ам" ;
- SF Pl Acc => gripp +"а";
- SF Pl Inst => gripp+"ами" ;
- SF Pl Prepos => gripp+"ах"
- } ;
- g = Masc ; anim = Inanimate
- } ;
-
-oper obezbolivauchee : CommNoun = eeEndInAnimateDecl "обезболивающ" ;
-oper eeEndInAnimateDecl: Str -> CommNoun = \obezbolivauch ->
- { s = table
- { SF Sg Nom => obezbolivauch +"ее";
- SF Sg Gen => obezbolivauch+"его" ;
- SF Sg Dat => obezbolivauch+"ему" ;
- SF Sg Acc => obezbolivauch +"ее";
- SF Sg Inst => obezbolivauch+"им" ;
- SF Sg Prepos => obezbolivauch+"ем" ;
- SF Pl Nom => obezbolivauch+"ие" ;
- SF Pl Gen => obezbolivauch+"их" ;
- SF Pl Dat => obezbolivauch+"им" ;
- SF Pl Acc => obezbolivauch+"ие" ;
- SF Pl Inst => obezbolivauch+"ими" ;
- SF Pl Prepos => obezbolivauch+"их"
- } ;
- g = Neut ; anim = Inanimate
- } ;
-
-oper proizvedenie : CommNoun = eEndInAnimateDecl "произведени" ;
-oper eEndInAnimateDecl: Str -> CommNoun = \proizvedeni ->
- { s = table
- { SF Sg Nom => proizvedeni +"е";
- SF Sg Gen => proizvedeni+"Ñ" ;
- SF Sg Dat => proizvedeni+"ÑŽ" ;
- SF Sg Acc => proizvedeni +"е";
- SF Sg Inst => proizvedeni+"ем" ;
- SF Sg Prepos => proizvedeni+"и" ;
- SF Pl Nom => proizvedeni+"Ñ" ;
- SF Pl Gen => proizvedeni+"й" ;
- SF Pl Dat => proizvedeni+"Ñм" ;
- SF Pl Acc => proizvedeni+"Ñ" ;
- SF Pl Inst => proizvedeni+"Ñми" ;
- SF Pl Prepos => proizvedeni+"ÑÑ…"
- } ;
- g = Neut ; anim = Inanimate
- } ;
-oper chislo : CommNoun = oEndInAnimateDecl "чиÑл" ;
-oper oEndInAnimateDecl: Str -> CommNoun = \chisl ->
- let { chis = Predef.tk 1 chisl ; ending = Predef.dp 3 chisl } in
- oEndInAnimateDecl3 chisl (chis+"e"+ending) ;
-oper oEndInAnimateDecl3: Str -> Str -> CommNoun = \chisl, chisel ->
- { s = table
- { SF Sg Nom => chisl +"о";
- SF Sg Gen => chisl+"а" ;
- SF Sg Dat => chisl+"у" ;
- SF Sg Acc => chisl +"о";
- SF Sg Inst => chisl+"ом" ;
- SF Sg Prepos => chisl+"е" ;
- SF Pl Nom => chisl+"а" ;
- SF Pl Gen => chisel;
- SF Pl Dat => chisl+"ам" ;
- SF Pl Acc => chisl+"а" ;
- SF Pl Inst => chisl+"ами" ;
- SF Pl Prepos => chisl+"ах"
- } ;
- g = Neut ; anim = Inanimate
- } ;
-
-oper malaria : CommNoun = i_yaEndDecl "малÑри" ;
-oper i_yaEndDecl: Str -> CommNoun = \malar ->
- { s = table
- { SF Sg Nom => malar+"Ñ" ;
- SF Sg Gen => malar+"и" ;
- SF Sg Dat => malar+"и" ;
- SF Sg Acc => malar+"ÑŽ" ;
- SF Sg Inst => malar+"ей" ;
- SF Sg Prepos => malar+"и" ;
- SF Pl Nom => malar+"и" ;
- SF Pl Gen => malar+"й" ;
- SF Pl Dat => malar+"Ñм" ;
- SF Pl Acc => malar+"и" ;
- SF Pl Inst => malar+"Ñми" ;
- SF Pl Prepos => malar+"ÑÑ…"
- } ;
- g = Fem ; anim = Inanimate
- } ;
-
-oper bol : CommNoun = softSignEndDeclFem "бол" ;
-oper nol : CommNoun = softSignEndDeclMasc "нол" ;
-oper uroven : CommNoun = EN_softSignEndDeclMasc "уровен" ;
-oper softSignEndDeclFem: Str -> CommNoun = \bol ->
- {s = table
- { SF Sg Nom => bol+"ь" ;
- SF Sg Gen => bol+"и" ;
- SF Sg Dat => bol+"и" ;
- SF Sg Acc => bol+"ь" ;
-
- SF Sg Inst => bol+"ью" ;
- SF Sg Prepos => bol+"и" ;
- SF Pl Nom => bol+"и" ;
- SF Pl Gen => bol+"ей" ;
- SF Pl Dat => bol+"Ñм" ;
- SF Pl Acc => bol+"и" ;
- SF Pl Inst => bol+"Ñми" ;
-
SF Pl Prepos => bol+"ÑÑ…"
- } ;
- g = Fem ; anim = Inanimate
- } ;
-oper softSignEndDeclMasc: Str -> CommNoun = \nol ->
- {s = table
- { SF Sg Nom => nol+"ь" ;
- SF Sg Gen => nol+"Ñ" ;
- SF Sg Dat => nol+"ÑŽ" ;
- SF Sg Acc => nol+"ь" ;
- SF Sg Inst => nol+"ем" ;
- SF Sg Prepos => nol+"е" ;
- SF Pl Nom => nol+"и" ;
- SF Pl Gen => nol+"ей" ;
- SF Pl Dat => nol+"Ñм" ;
- SF Pl Acc => nol+"и" ;
- SF Pl Inst => nol+"Ñми" ;
- SF Pl Prepos => nol+"ÑÑ…"
- } ;
- g = Masc ; anim = Inanimate
- } ;
-
-oper EN_softSignEndDeclMasc: Str -> CommNoun = \rem ->
- {s = table
- { SF Sg Nom => rem+"ень" ;
- SF Sg Gen => rem+"нÑ" ;
- SF Sg Dat => rem+"ню" ;
- SF Sg Acc => rem+"ень" ;
- SF Sg Inst => rem+"нем" ;
- SF Sg Prepos => rem+"не" ;
- SF Pl Nom => rem+"ни" ;
- SF Pl Gen => rem+"ней" ;
- SF Pl Dat => rem+"нÑм" ;
- SF Pl Acc => rem+"ни" ;
- SF Pl Inst => rem+"нÑми" ;
- SF Pl Prepos => rem+"нÑÑ…"
- } ;
- g = Masc ; anim = Inanimate
- } ;
-
-oper noga : CommNoun = aEndG_K_KH_Decl "ног" ;
-oper dvojka : CommNoun = aEndG_K_KH_Decl "двойк" ;
-oper aEndG_K_KH_Decl: Str -> CommNoun = \nog ->
-{ s = table {
- SF Sg Nom => nog+"а" ;
- SF Sg Gen => nog+"и" ;
- SF Sg Dat => nog+"е" ;
- SF Sg Acc => nog+"у" ;
- SF Sg Inst => nog+"ой" ;
- SF Sg Prepos => nog+"е" ;
- SF Pl Nom => nog+"и" ;
- SF Pl Gen => nog ;
- SF Pl Dat => nog+"ам" ;
- SF Pl Acc => nog+ "и" ;
- SF Pl Inst => nog+"ами" ;
- SF Pl Prepos => nog+"ах"
- } ;
- g = Fem ; anim = Inanimate
-} ;
-
-oper golova : CommNoun = aEndInanimateDecl "голов" ;
-oper mashina : CommNoun = aEndInanimateDecl "машин" ;
-oper temperatura : CommNoun = aEndInanimateDecl "температур" ;
-oper edinica : CommNoun = ej_aEndInanimateDecl "единиц" ;
-
-oper aEndInanimateDecl: Str -> CommNoun = \golov ->
- { s = table
- { SF Sg Nom => golov+"а" ;
- SF Sg Gen => golov+"Ñ‹" ;
- SF Sg Dat => golov+"е" ;
- SF Sg Acc => golov+"у" ;
- SF Sg Inst => golov+"ой" ;
- SF Sg Prepos => golov+"е" ;
- SF Pl Nom => golov+"Ñ‹" ;
- SF Pl Gen => golov ;
- SF Pl Dat => golov+"ам" ;
- SF Pl Acc => golov+ "Ñ‹" ;
- SF Pl Inst => golov+"ами" ;
- SF Pl Prepos => golov+"ах"
- } ;
- g = Fem ; anim = Inanimate
- } ;
-oper ej_aEndInanimateDecl: Str -> CommNoun = \ediniz ->
- { s = table
- { SF Sg Nom => ediniz+"а" ;
- SF Sg Gen => ediniz+"Ñ‹" ;
- SF Sg Dat => ediniz+"е" ;
- SF Sg Acc => ediniz+"у" ;
- SF Sg Inst => ediniz+"ей" ;
- SF Sg Prepos => ediniz+"е" ;
- SF Pl Nom => ediniz+"Ñ‹" ;
- SF Pl Gen => ediniz ;
- SF Pl Dat => ediniz+"ам" ;
- SF Pl Acc => ediniz+ "Ñ‹" ;
- SF Pl Inst => ediniz+"ами" ;
- SF Pl Prepos => ediniz+"ах"
- } ;
- g = Fem ; anim = Inanimate
- } ;
-
-
-oper dyadya : CommNoun = (yaEndAnimateDecl "дÑд") ** {g = Masc; anim = Animate} ;
-oper yaEndAnimateDecl: Str -> SubstFormDecl = \nyan ->
-{s = table {
- SF Sg Nom => nyan + "Ñ" ;
- SF Sg Gen => nyan + "и" ;
- SF Sg Dat => nyan + "е" ;
- SF Sg Acc => nyan + "ÑŽ" ;
- SF Sg Inst => nyan + "ей" ;
- SF Sg Prepos => nyan + "е" ;
- SF Pl Nom => nyan + "и" ;
- SF Pl Gen => nyan + "ей" ;
- SF Pl Inst => nyan + "Ñми" ;
- SF Pl Prepos => nyan + "ÑÑ…" ;
- SF Pl Dat => nyan + "Ñм" ;
- SF Pl Acc => nyan + "ей"
- }
- } ;
-
-oper oEnd_Decl: Str -> CommNoun = \bolshinstv ->
-{ s = table {
- SF Sg Nom => bolshinstv+"о" ;
- SF Sg Gen => bolshinstv+"а" ;
- SF Sg Dat => bolshinstv+"у" ;
- SF Sg Acc => bolshinstv+"о" ;
- SF Sg Inst => bolshinstv+"ом" ;
- SF Sg Prepos => bolshinstv+"е" ;
- SF Pl Nom => bolshinstv+"а" ;
- SF Pl Gen => bolshinstv ;
- SF Pl Dat => bolshinstv+"ам" ;
- SF Pl Acc => bolshinstv+ "а" ;
- SF Pl Inst => bolshinstv+"ами" ;
- SF Pl Prepos => bolshinstv+"ах"
- } ;
- g = Neut ; anim = Inanimate
-} ;
-
-oper oEnd_SgDecl: Str -> CommNoun = \bolshinstv ->
-{ s = table {
- SF _ Nom => bolshinstv+"о" ;
- SF _ Gen => bolshinstv+"а" ;
- SF _ Dat => bolshinstv+"у" ;
- SF _ Acc => bolshinstv+"о" ;
- SF _ Inst => bolshinstv+"ом" ;
- SF _ Prepos => bolshinstv+"е"
- } ;
- g = Neut ; anim = Inanimate
-} ;
-
--- Note: Now we consider only the plural form of the pronoun "вÑе" (all)
--- treated as an adjective (see AllDetPl definition).
--- The meaning "entire" is not considered, which allows us to form
--- the pronoun-adjective from the substantive form below:
-
-oper eEnd_Decl: Str -> CommNoun = \vs ->
-{ s = table {
- SF Sg Nom => vs+"е" ;
- SF Sg Gen => vs+"ех" ;
- SF Sg Dat => vs+"ем" ;
- SF Sg Acc => vs+"ех" ;
- SF Sg Inst => vs+"еми" ;
- SF Sg Prepos => vs+"ех" ;
- SF Pl Nom => vs+"е" ;
- SF Pl Gen => vs +"ех";
- SF Pl Dat => vs+"ем" ;
- SF Pl Acc => vs+ "ех" ;
- SF Pl Inst => vs+"еми" ;
- SF Pl Prepos => vs+"ех"
- } ;
- g = Neut ; anim = Inanimate
-} ;
-
---2 Adjectives
-
--- Type Adjective only has positive degree while AdjDegr type
--- includes also comparative and superlative forms.
--- The later entries can be converted into the former using
--- "extAdjective" operation defined in the syntax module
--- and vice verca using "mkAdjDeg" operation.
-
-oper
- kazhdujDet: Adjective = uy_j_EndDecl "кажд" ;
- samuj: Adjective = uy_j_EndDecl "Ñам" ;
- lubojDet: Adjective = uy_oj_EndDecl "люб" ;
- kotorujDet: Adjective = uy_j_EndDecl "котор";
- takoj: Adjective = i_oj_EndDecl "так" [];
- kakojNibudDet: Adjective = i_oj_EndDecl "как" "-нибудь";
- kakojDet: Adjective = i_oj_EndDecl "как" [];
- bolshinstvoDet: Adjective = extAdjFromSubst (oEnd_SgDecl "большинÑтв");
- vseDetPl: Adjective = extAdjFromSubst (eEnd_Decl "вÑ") ;
- extAdjFromSubst: CommNoun -> Adjective = \ vse ->
- {s = \\af => vse.s ! SF (numAF af) (caseAF af) } ;
-
-
-oper mkAdjDeg: Adjective -> Str -> AdjDegr = \adj, s ->
- { s = table
- {
- Pos => adj.s ;
- Comp => \\af => s ;
- Super => \\af => samuj.s !af ++ adj.s ! af
- }
- };
-oper uzhasnuj: AdjDegr = mkAdjDeg (uy_j_EndDecl "ужаÑн") "ужаÑнее";
-oper deshevuj: AdjDegr = mkAdjDeg (uy_j_EndDecl "дешев") "дешевле";
-oper staruj: AdjDegr = mkAdjDeg (uy_j_EndDecl "Ñтар") "Ñтарше";
-oper uy_j_EndDecl : Str -> Adjective = \s ->{s = table {
- AF Nom _ (ASg Masc) => s+"ый";
- AF Nom _ (ASg Fem) => s+"аÑ";
- AF Nom _ (ASg Neut) => s+"ое";
- AF Nom _ APl => s+"ые";
- AF Acc Inanimate (ASg Masc) => s+"ый";
- AF Acc Animate (ASg Masc) => s+"ого";
- AF Acc _ (ASg Fem) => s+"ую";
- AF Acc _ (ASg Neut) => s+"ое";
- AF Acc Inanimate APl => s+"ые";
- AF Acc Animate APl => s+"ых";
- AF Gen _ (ASg Masc) => s+"ого";
- AF Gen _ (ASg Fem) => s+"ой";
- AF Gen _ (ASg Neut) => s+"ого";
- AF Gen _ APl => s+"ых";
- AF Inst _ (ASg Masc) => s+"ым";
- AF Inst _ (ASg Fem) => s+"ой";
- AF Inst _ (ASg Neut) => s+"ым";
- AF Inst _ APl => s+"ыми";
- AF Dat _ (ASg Masc) => s+"ому";
- AF Dat _ (ASg Fem) => s+"ой";
- AF Dat _ (ASg Neut) => s+"ому";
- AF Dat _ APl => s+"ым";
- AF Prepos _ (ASg Masc) => s+"ом";
- AF Prepos _ (ASg Fem) => s+"ой";
- AF Prepos _ (ASg Neut) => s+"ом";
- AF Prepos _ APl => s+"ых"
- }
- } ;
-oper indijskij: Adjective = ij_EndK_G_KH_Decl "индийÑк" ;
-oper francuzskij: Adjective = ij_EndK_G_KH_Decl "французÑк" ;
-oper russkij: Adjective = ij_EndK_G_KH_Decl "руÑÑк" ;
-oper italyanskij: Adjective = ij_EndK_G_KH_Decl "итальÑнÑк" ;
-oper yaponskij: Adjective = ij_EndK_G_KH_Decl "ÑпонÑк" ;
-oper malenkij: AdjDegr = mkAdjDeg (ij_EndK_G_KH_Decl "маленьк") "меньше" ;
-oper vusokij: AdjDegr = mkAdjDeg (ij_EndK_G_KH_Decl "выÑок") "выше";
-oper ij_EndK_G_KH_Decl : Str -> Adjective = \s ->{s = table {
- AF Nom _ (ASg Masc) => s+"ий";
- AF Nom _ (ASg Fem) => s+"аÑ";
- AF Nom _ (ASg Neut) => s+"ое";
- AF Nom _ APl => s+"ие";
- AF Acc Animate (ASg Masc) => s+"ого";
- AF Acc Inanimate (ASg Masc) => s+"ий";
- AF Acc _ (ASg Fem) => s+"ую";
- AF Acc _ (ASg Neut) => s+"ое";
- AF Acc Animate APl => s+"их";
- AF Acc Inanimate APl => s+"ие";
- AF Gen _ (ASg Masc) => s+"ого";
- AF Gen _ (ASg Fem) => s+"ой";
- AF Gen _ (ASg Neut) => s+"ого";
- AF Gen _ APl => s+"их";
- AF Inst _ (ASg Masc) => s+"им";
- AF Inst _ (ASg Fem) => s+"ой";
- AF Inst _ (ASg Neut) => s+"им";
- AF Inst _ APl => s+"ими";
- AF Dat _ (ASg Masc) => s+"ому";
- AF Dat _ (ASg Fem) => s+"ой";
- AF Dat _ (ASg Neut) => s+"ому";
- AF Dat _ APl => s+"им";
- AF Prepos _ (ASg Masc) => s+"ом";
- AF Prepos _ (ASg Fem) => s+"ой";
- AF Prepos _ (ASg Neut) => s+"ом";
- AF Prepos _ APl => s+"их"
- }
- } ;
-
-oper bolshoj: AdjDegr = mkAdjDeg (i_oj_EndDecl "больш" []) "больше";
-oper dorogoj: AdjDegr = mkAdjDeg (i_oj_EndDecl "дорог" []) "дороже";
-oper i_oj_EndDecl : Str -> Str -> Adjective = \s, chastica ->{s = table {
- AF Nom _ (ASg Masc) => s+"ой" + chastica ;
- AF Nom _ (ASg Fem) => s+"аÑ"+ chastica ;
- AF Nom _ (ASg Neut) => s+"ое"+ chastica ;
- AF Nom _ APl => s+"ие"+ chastica ;
- AF Acc Animate (ASg Masc) => s+"ого"+ chastica ;
- AF Acc Inanimate (ASg Masc) => s+"ое"+ chastica ;
- AF Acc _ (ASg Fem) => s+"ую"+ chastica ;
- AF Acc _ (ASg Neut) => s+"ое"+ chastica ;
- AF Acc Animate APl => s+"их"+ chastica ;
- AF Acc Inanimate APl => s+"ие"+ chastica ;
- AF Gen _ (ASg Masc) => s+"ого"+ chastica ;
- AF Gen _ (ASg Fem) => s+"ой"+ chastica ;
- AF Gen _ (ASg Neut) => s+"ого"+ chastica ;
- AF Gen _ APl => s+"их"+ chastica ;
-
AF Inst _ (ASg Masc) => s+"им"+ chastica ;
- AF Inst _ (ASg Fem) => s+"ой"+ chastica ;
- AF Inst _ (ASg Neut) => s+"им"+ chastica ;
- AF Inst _ APl => s+"ими"+ chastica ;
- AF Dat _ (ASg Masc) => s+"ому"+ chastica ;
- AF Dat _ (ASg Fem) => s+"ой"+ chastica ;
- AF Dat _ (ASg Neut) => s+"ому"+ chastica ;
- AF Dat _ APl => s+"им"+ chastica ;
- AF Prepos _ (ASg Masc) => s+"ом"+ chastica ;
- AF Prepos _ (ASg Fem) => s+"ой"+ chastica ;
- AF Prepos _ (ASg Neut) => s+"ом"+ chastica ;
- AF Prepos _ APl => s+"их" + chastica
- }
- } ;
-oper molodoj: AdjDegr = mkAdjDeg (uy_oj_EndDecl "молод") "моложе";
-oper uy_oj_EndDecl : Str -> Adjective = \s ->{s = table {
- AF Nom _ (ASg Masc) => s+"ой";
- AF Nom _ (ASg Fem) => s+"аÑ";
- AF Nom _ (ASg Neut) => s+"ое";
- AF Nom _ APl => s+"ые";
- AF Acc Animate (ASg Masc) => s+"ого";
- AF Acc Inanimate (ASg Masc) => s+"ой";
- AF Acc _ (ASg Fem) => s+"ую";
- AF Acc _ (ASg Neut) => s+"ое";
- AF Acc Animate APl => s+"ых";
- AF Acc Inanimate APl => s+"ые";
- AF Gen _ (ASg Masc) => s+"ого";
- AF Gen _ (ASg Fem) => s+"ой";
- AF Gen _ (ASg Neut) => s+"ого";
- AF Gen _ APl => s+"ых";
- AF Inst _ (ASg Masc) => s+"ым";
- AF Inst _ (ASg Fem) => s+"ой";
- AF Inst _ (ASg Neut) => s+"ым";
- AF Inst _ APl => s+"ыми";
- AF Dat _ (ASg Masc) => s+"ому";
- AF Dat _ (ASg Fem) => s+"ой";
- AF Dat _ (ASg Neut) => s+"ому";
- AF Dat _ APl => s+"ым";
- AF Prepos _ (ASg Masc) => s+"ом";
- AF Prepos _ (ASg Fem) => s+"ой";
- AF Prepos _ (ASg Neut) => s+"ом";
- AF Prepos _ APl => s+"ых"
- }
- } ;
-oper prostuzhen: Adjective = shortDecl1 "проÑтужен" ;
-oper beremenen: Adjective = shortDecl "беремен" ;
-oper need: Adjective = shortDecl "нуж" ;
-oper shortDecl1 : Str -> Adjective = \s ->{s = table {
- AF _ _ (ASg Masc) => s;
- AF _ _ (ASg Fem) => s+"а";
- AF _ _ (ASg Neut) => s+"о";
- AF _ _ APl => s+"Ñ‹"
- }
- } ;
-oper shortDecl : Str -> Adjective = \s ->{s = table {
- AF _ _ (ASg Masc) => s +"ен";
- AF _ _ (ASg Fem) => s+"на";
- AF _ _ (ASg Neut) => s+"но";
- AF _ _ APl => s+"ны"
- }
} ;
-
--- 2 Adverbs
-
-oper vsegda: Adverb = { s = "вÑегда" } ;
-oper chorosho: Adverb = { s = "хорошо" } ;
-
--- 2 Verbs
-
--- Dummy verbum "have" that corresponds to the phrases like
--- "I have a headache" in English. The corresponding sentence
--- in Russian doesn't contain a verb:
-
-oper have: Verbum = {s=\\ vf => "-" ; asp = Imperfective} ;
-
--- There are two common conjugations
--- (according to the number and the person of the subject)
--- patterns in the present tense in the indicative mood.
-
-param Conjugation = First | Second ;
-
---3 First conjugation (in Present) verbs :
-
-oper verbGulyat : Verbum = verbDecl Imperfective First "гулÑ" "ÑŽ" "гулÑл" "гулÑй" "гулÑть";
-oper verbVkluchat : Verbum = verbDecl Imperfective First "включа" "ю" "включал" "включай" "включать";
-oper verbVukluchat : Verbum = verbDecl Imperfective First "выключа" "ю" "выключал" "выключай" "выключать";
-oper verbZhdat : Verbum = verbDecl Imperfective First "жд" "у" "ждал" "жди" "ждать" ;
-oper verbBegat : Verbum = verbDecl Imperfective First "бега" "ю" "бегал" "бегай" "бегать";
-oper verbPrinimat : Verbum = verbDecl Imperfective First "принима" "ю" "принимал" "принимай" "принимать";
-oper verbDokazuvat : Verbum = verbDecl Imperfective First "доказыва" "ю" "доказывал" "доказывай" "доказывать";
-oper verbOtpravlyat : Verbum = verbDecl Imperfective First "отправлÑ" "ÑŽ" "отправлÑл" "отправлÑй" "отправлÑть";
-oper verbSlomat : Verbum = verbDecl Perfective First "Ñлома" "ÑŽ" "Ñломал" "Ñломай" "Ñломать";
-oper verbByut : Verbum = verbDecl Perfective First "буд" "у" "был" "будь" "быть";
-
---3 Second conjugation (in Present) verbs :
-
-oper verbLubit : Verbum = verbDecl Imperfective Second "люб" "лю" "любил" "люби" "любить";
-oper verbGovorit : Verbum = verbDecl Imperfective Second "говор" "ю" "говорил" "говори" "говорить";
-
oper verbBolet_2 : Verbum = verbDecl Imperfective Second "бол" "ю" "болел" "боли" "болеть";
-oper verbPoranit : Verbum = verbDecl Perfective Second "поран" "ю" "поранил" "порань" "поранить";
-
--- To reduces the redundancies in the definitions
--- we introduce some intermediate types,
--- so that the full type can be described as a combination
--- of the intermediate types. For example "AspectVoice"
--- is a type for defining a pattern for a particular
--- aspect and voice.
-
-oper AspectVoice: Type = { s : VerbConj => Str ; asp: Aspect } ;
-
--- "PresentVerb" takes care of the present tense conjugation.
-
-param PresentVF = PRF Number Person ;
-oper PresentVerb : Type = PresentVF => Str ;
-
-oper presentConj2: Str -> Str -> PresentVerb = \del, sgP1End ->
- table {
- PRF Sg P1 => del+ sgP1End ;
- PRF Sg P2 => del+ "ишь" ;
- PRF Sg P3 => del+ "ит" ;
- PRF Pl P1 => del+ "им" ;
- PRF Pl P2 => del+ "ите'" ;
- PRF Pl P3 => del+ "ÑÑ‚"
- };
-oper presentConj1: Str -> Str -> PresentVerb = \del, sgP1End ->
- table {
- PRF Sg P1 => del+ sgP1End ;
- PRF Sg P2 => del+ "ешь" ;
- PRF Sg P3 => del+ "ет" ;
- PRF Pl P1 => del+ "ем" ;
- PRF Pl P2 => del+ "ете'" ;
- PRF Pl P3 => del+ sgP1End + "Ñ‚"
- };
-
--- "PastVerb" takes care of the past tense conjugation.
-
-param PastVF = PSF GenNum ;
-oper PastVerb : Type = PastVF => Str ;
-oper pastConj: Str -> PastVerb = \del ->
- table {
- PSF (ASg Masc) => del ;
- PSF (ASg Fem) => del +"а" ;
- PSF (ASg Neut) => del+"о" ;
- PSF APl => del+ "и"
- };
-
--- "verbDecl" sorts out verbs according to the aspect and voice parameters.
--- It produces the full conjugation table for a verb entry
-
-oper verbDecl: Aspect -> Conjugation -> Str -> Str -> Str -> Str ->Str -> Verbum =
- \a, c, del, sgP1End, sgMascPast, imperSgP2, inf -> case a of
-{ Perfective => case c of {
- First => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj1 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
- Second => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj2 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast)
-} ;
- Imperfective => case c of {
- First => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj1 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
- Second => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj2 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast)
- }
-};
-
--- "mkVerb" produce the passive forms from
--- the active forms using the "mkPassive" method.
--- Passive is expressed in Russian by so called reflexive verbs,
--- which are formed from the active form by suffixation.
-
-
oper mkVerb : AspectVoice -> PastVerb -> Verbum = \av1, pv ->
- { s = table {
- VFORM Act vf => av1.s !vf;
- VFORM Pass vf => (mkPassive av1 pv ).s ! vf
- } ;
- asp = av1.asp
-};
-
- vowels : Strs = strs {
- "а" ; "е" ; "ё" ; "и" ; "о" ; "у" ;
- "Ñ‹" ; "Ñ" ; "ÑŽ" ; "Ñ"
- } ;
-
-oper mkPassive: AspectVoice -> PastVerb -> AspectVoice = \av, pv ->
- { s = table {
- VINF => av.s ! VINF + "ÑÑ";
- VIMP Sg P1 => av.s ! (VIMP Sg P1) +"ÑÑŒ" ;
- VIMP Pl P1 => av.s ! (VIMP Pl P1) +"ÑÑ";
- VIMP Sg P2 => av.s ! (VIMP Sg P2 ) +"ÑÑŒ";
- VIMP Pl P2 => av.s! (VIMP Pl P2) +"ÑÑŒ";
- VIMP Sg P3 => av.s ! (VIMP Sg P3) +"ÑÑ";
- VIMP Pl P3 => av.s ! (VIMP Pl P3) +"ÑÑ";
- VSUB (ASg Masc) => pv ! (PSF (ASg Masc)) + "ÑÑ"+[" бы"];
- VSUB (ASg Fem) => pv ! (PSF (ASg Fem)) + "ÑÑŒ"+[" бы"];
- VSUB (ASg Neut) => pv ! (PSF (ASg Neut)) + "ÑÑŒ"+[" бы"];
- VSUB APl => pv ! (PSF APl) + "ÑÑŒ"+[" бы"] ;
- VIND (VPresent Sg P1) =>
- -- case av.asp of { Imperfective =>
- av.s ! (VIND (VPresent Sg P1)) + "ÑÑŒ" ;
- -- Perfective = > nonExist
- -- } ;
- VIND (VPresent Sg P2) => av.s ! (VIND (VPresent Sg P2))+ "ÑÑ" ;
- VIND (VPresent Sg P3) => av.s ! (VIND (VPresent Sg P3))+ "ÑÑ" ;
- VIND (VPresent Pl P1) => av.s !( VIND (VPresent Pl P1)) + "ÑÑ" ;
- VIND (VPresent Pl P2) => av.s !( VIND (VPresent Pl P2)) + "ÑÑŒ'" ;
- VIND (VPresent Pl P3) => av.s !( VIND (VPresent Pl P3)) + "ÑÑ" ;
- VIND (VFuture Sg P1) => av.s ! (VIND (VFuture Sg P1)) + "ÑÑŒ";
- VIND (VFuture Sg P2) => av.s! (VIND (VFuture Sg P2) )+ "ÑÑ";
- VIND (VFuture Sg P3) => av.s! (VIND (VFuture Sg P3)) + "ÑÑ";
- VIND (VFuture Pl P1) => av.s! (VIND (VFuture Pl P1) )+ "ÑÑ";
- VIND (VFuture Pl P2) => av.s! (VIND (VFuture Pl P2) )+ "ÑÑŒ";
- VIND (VFuture Pl P3) => av.s! (VIND (VFuture Pl P3)) + "ÑÑ";
- VIND (VPast (ASg Masc)) => av.s ! (VIND (VPast (ASg Masc) )) + "ÑÑ";
- VIND (VPast (ASg Fem)) => av.s ! (VIND (VPast (ASg Fem) )) + "ÑÑŒ";
- VIND (VPast (ASg Neut)) => av.s ! (VIND (VPast (ASg Neut)) ) + "ÑÑŒ";
- VIND (VPast APl) => av.s ! (VIND (VPast APl)) + "ÑÑŒ"
- } ;
- asp = av.asp
-};
-
--- Generation the imperfective active pattern given
--- a number of basic conjugation forms.
-
-oper
- imperfectiveActivePattern : Str -> Str -> PresentVerb -> PastVerb -> AspectVoice =
- \inf, imper, presentFuture, past -> { s= table {
- VINF => inf ;
- VIMP Sg P1 => ["давайте "]+ inf ;
- VIMP Pl P1 => ["давайте "] + inf ;
- VIMP Sg P2 => imper ;
- VIMP Pl P2 => imper+"те" ;
- VIMP Sg P3 => ["пуÑкай "] + presentFuture ! (PRF Sg P3) ;
- VIMP Pl P3 => ["пуÑкай "] + presentFuture ! (PRF Pl P3) ;
- VSUB (ASg Masc) => past ! (PSF (ASg Masc)) +[" бы"];
- VSUB (ASg Fem) => past ! (PSF (ASg Fem)) +[" бы"];
-
- VSUB (ASg Neut) => past ! (PSF (ASg Neut) )+[" бы"];
- VSUB APl => past ! (PSF APl) +[" бы"];
- VIND (VPresent Sg P1) => presentFuture ! ( PRF Sg P1);
- VIND (VPresent Sg P2) => presentFuture! (PRF Sg P2) ;
- VIND (VPresent Sg P3) => presentFuture ! (PRF Sg P3) ;
- VIND (VPresent Pl P1) => presentFuture ! (PRF Pl P1);
- VIND (VPresent Pl P2) => presentFuture ! (PRF Pl P2);
- VIND (VPresent Pl P3) => presentFuture ! (PRF Pl P3);
- VIND (VFuture Sg P1) => ["буду "] + presentFuture ! (PRF Sg P1) ;
- VIND (VFuture Sg P2) => ["будешь"] + presentFuture ! (PRF Sg P2) ;
- VIND (VFuture Sg P3) => ["будет "] + presentFuture ! (PRF Sg P3) ;
- VIND (VFuture Pl P1) => ["будем "] + presentFuture ! (PRF Pl P1) ;
- VIND (VFuture Pl P2) => ["будете "] + presentFuture ! (PRF Pl P2) ;
- VIND (VFuture Pl P3) => ["будут "] + presentFuture ! (PRF Pl P3) ;
-
- VIND (VPast (ASg Masc)) => past ! (PSF (ASg Masc)) ;
- VIND (VPast (ASg Fem)) => past ! (PSF (ASg Fem) ) ;
- VIND (VPast (ASg Neut) ) => past ! (PSF (ASg Neut)) ;
- VIND (VPast APl) => past ! (PSF APl)
- } ;
- asp = Imperfective
-} ;
-
- oper perfectiveActivePattern: Str -> Str -> PresentVerb -> PastVerb -> AspectVoice =
- \inf, imper, presentFuture, past -> { s= table {
- VINF => inf ;
- VIMP Sg P1 => ["давайте "]+ presentFuture ! (PRF Sg P1);
- VIMP Pl P1 => ["давайте "] + presentFuture ! (PRF Pl P1);
- VIMP Sg P2 => imper ;
- VIMP Pl P2 => imper+"те" ;
- VIMP Sg P3 => ["пуÑкай "] + presentFuture ! (PRF Sg P3) ;
- VIMP Pl P3 => ["пуÑкай "] + presentFuture ! (PRF Pl P3) ;
- VSUB (ASg Masc) => past ! (PSF (ASg Masc)) +[" бы"];
- VSUB (ASg Fem) => past ! (PSF (ASg Fem)) +[" бы"];
-
- VSUB (ASg Neut) => past ! (PSF (ASg Neut) )+[" бы"];
- VSUB APl => past ! (PSF APl) +[" бы"];
- VIND (VPresent Sg P1) => [] ;
- VIND (VPresent Sg P2) => [] ;
- VIND (VPresent Sg P3) => [] ;
- VIND (VPresent Pl P1) => nonExist ;
- VIND (VPresent Pl P2) => nonExist ;
- VIND (VPresent Pl P3) => [] ;
- VIND (VFuture Sg P1) => presentFuture ! (PRF Sg P1) ;
- VIND (VFuture Sg P2) => presentFuture ! (PRF Sg P2) ;
- VIND (VFuture Sg P3) => presentFuture ! (PRF Sg P3) ;
- VIND (VFuture Pl P1) => presentFuture ! (PRF Pl P1) ;
- VIND (VFuture Pl P2) => presentFuture ! (PRF Pl P2) ;
- VIND (VFuture Pl P3) => presentFuture ! (PRF Pl P3) ;
- VIND (VPast (ASg Masc)) => past ! (PSF (ASg Masc)) ;
- VIND (VPast (ASg Fem)) => past ! (PSF (ASg Fem) ) ;
- VIND (VPast (ASg Neut) ) => past ! (PSF (ASg Neut)) ;
- VIND (VPast APl) => past ! (PSF APl)
- } ;
- asp = Perfective
-} ;
-
---2 Proper names are a simple kind of noun phrases.
-
- ProperName : Type = {s : Case => Str ; g : Gender ; anim : Animacy} ;
-
- mkProperNameMasc : Str -> Animacy -> ProperName = \ivan, anim ->
- { s = table { Nom => ivan ;
- Gen => ivan + "а";
- Dat => ivan + "у";
- Acc => case anim of
- { Animate => ivan + "а";
- Inanimate => ivan
- };
- Inst => ivan + "ом";
- Prepos => ivan + "е" } ;
- g = Masc; anim = anim };
-
- mkProperNameFem : Str -> Animacy -> ProperName = \masha, anim ->
- { s = table { Nom => masha + "а";
- Gen => masha + "и";
- Dat => masha + "е";
- Acc => masha + "у";
- Inst => masha + "ей";
- Prepos => masha + "е" } ;
- g = Fem ; anim = anim };
- };
-
diff --git a/grammars/resource/russian/Paradigms.gf b/grammars/resource/russian/Paradigms.gf deleted file mode 100644 index d574e4793..000000000 --- a/grammars/resource/russian/Paradigms.gf +++ /dev/null @@ -1,362 +0,0 @@ ---# -path=.:../abstract:../../prelude
-
---1 Russian Lexical Paradigms
---
--- Aarne Ranta, Janna Khegai 2003
---
--- This is an API to the user of the resource grammar
--- for adding lexical items. It give shortcuts for forming
--- expressions of basic categories: nouns, adjectives, verbs.
---
--- Closed categories (determiners, pronouns, conjunctions) are
--- accessed through the resource syntax API, $resource.Abs.gf$.
---
---
--- The following files are presupposed:
-
-resource Paradigms = open (Predef=Predef), Prelude, Syntax, Russian in {
-
-flags coding=utf8 ;
-
---2 Parameters
---
--- To abstract over gender names, we define the following identifiers.
-
-oper
- masculine : Gender ;
- feminine : Gender ;
- neuter : Gender ;
-
--- To abstract over case names, we define the following.
-
- nominative : Case ;
- genitive : Case ;
- dative : Case ;
- accusative : Case ;
- instructive : Case ;
- prepositional : Case ;
-
--- In some (written in English) textbooks accusative case
--- is put on the second place. However, we follow the case order
--- standard for Russian textbooks.
-
--- To abstract over number names, we define the following.
-
- singular : Number ;
- plural : Number ;
-
---2 Nouns
-
--- Best case: indeclinabe nouns: "кофе", "пальто", "ВУЗ".
-
- mkIndeclinableNoun: Str -> Gender -> Animacy -> N ;
-
--- Worst case - give six singular forms:
--- Nominative, Genetive, Dative, Accusative, Instructive and Prepositional;
--- corresponding six plural forms and the gender.
--- May be the number of forms needed can be reduced,
--- but this requires a separate investigation.
--- Animacy parameter (determining whether the Accusative form is equal
--- to the Nominative or the Genetive one) is actually of no help,
--- since there are a lot of exceptions and the gain is just one form less.
-
- mkN : (_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> Gender -> Animacy -> N ;
-
- -- мужчина, мужчины, мужчине, мужчину, мужчиной, мужчине
- -- мужчины, мужчин, мужчинам, мужчин, мужчинами, мужчинах
-
-
--- Here are some common patterns. The list is far from complete.
-
--- Feminine patterns.
-
- nMashina : Str -> N ; -- feminine, inanimate, ending with "-а", Inst -"машин-ой"
- nEdinica : Str -> N ; -- feminine, inanimate, ending with "-а", Inst -"единиц-ей"
- nZhenchina : Str -> N ; -- feminine, animate, ending with "-a"
- nNoga : Str -> N ; -- feminine, inanimate, ending with "г_к_х-a"
- nMalyariya : Str -> N ; -- feminine, inanimate, ending with "-иÑ"
- nTetya : Str -> N ; -- feminine, animate, ending with "-Ñ"
- nBol : Str -> N ; -- feminine, inanimate, ending with "-ь"(soft sign)
-
--- Neuter patterns.
-
- nObezbolivauchee : Str -> N ; -- neutral, inanimate, ending with "-ee"
- nProizvedenie : Str -> N ; -- neutral, inanimate, ending with "-e"
- nChislo : Str -> N ; -- neutral, inanimate, ending with "-o"
-
--- Masculine patterns.
-
- nStomatolog : Str -> N ; -- masculine, animate, ending with consonant
-
- -- the next two differ only in
- -- plural nominative (= accusative) form(s) :
- nAdres : Str -> N ; -- адреÑ-а
- nTelefon : Str -> N ; -- телефон-ы
- -- masculine, inanimate, ending with consonant
-
- nNol : Str -> N ; -- masculine, inanimate, ending with "-ь" (soft sign)
- nUroven : Str -> N ; -- masculine, inanimate, ending with "-ень"
-
--- Nouns used as functions need a preposition. The most common is with Genitive.
-
- mkFun : N -> Preposition -> Case -> Fun ;
- funGen : N -> Fun ;
-
--- Proper names.
-
- mkPN : Str -> Gender -> Animacy -> PN ; -- "Иван", "Маша"
-
--- On the top level, it is maybe $CN$ that is used rather than $N$, and
--- $NP$ rather than $PN$.
-
- mkCN : N -> CN ;
- mkNP : Str -> Gender -> Animacy -> NP ;
-
-
---2 Adjectives
-
--- Non-comparison (only positive degree) one-place adjectives need 28 (4 by 7)
--- forms in the worst case:
-
-
--- Masculine | Feminine | Neutral | Plural
--- Nominative
--- Genitive
--- Dative
--- Accusative Inanimate
--- Accusative Animate
--- Instructive
--- Prepositional
-
-
--- Notice that 4 short forms, which exist for some adjectives are not included
--- in the current description, otherwise there would be 32 forms for
--- positive degree.
-
--- mkAdj1 : ( : Str) -> Adj1 ;
-
--- Invariable adjective is a special case.
-
- adjInvar : Str -> Adj1 ; -- khaki, mini, hindi, netto
-
--- Some regular patterns depending on the ending.
-
- adj1Staruyj : Str -> Adj1 ; -- ending with "-ый"
- adj1Malenkij : Str -> Adj1 ; -- endign with "-ий"
- adj1Molodoj : Str -> Adj1 ; -- ending with "-ой",
- -- plural - молод-ые"
- adj1Kakoj_Nibud : Str -> Str -> Adj1 ; -- ending with "-ой",
- -- plural - "как-ие"
-
--- Two-place adjectives need a preposition and a case as extra arguments.
-
- mkAdj2 : Adj1 -> Str -> Case -> Adj2 ; -- "делим на"
-
--- Comparison adjectives need a positive adjective
--- (28 forms without short forms).
--- Taking only one comparative form (non-syntaxic) and
--- only one superlative form (syntaxic) we can produce the
--- comparison adjective with only one extra argument -
--- non-syntaxic comparative form.
--- Syntaxic forms are based on the positive forms.
-
-
- mkAdjDeg : Adj1 -> Str -> AdjDeg ;
-
--- On top level, there are adjectival phrases. The most common case is
--- just to use a one-place adjective.
-
- ap : Adj1 -> IsPostfixAdj -> AP ;
-
-
---2 Verbs
---
--- In our lexicon description ("Verbum") there are 62 forms:
--- 2 (Voice) by { 1 (infinitive) + [2(number) by 3 (person)](imperative) +
--- [ [2(Number) by 3(Person)](present) + [2(Number) by 3(Person)](future) +
--- 4(GenNum)(past) ](indicative)+ 4 (GenNum) (subjunctive) }
--- Participles (Present and Past) and Gerund forms are not included,
--- since they fuction more like Adjectives and Adverbs correspondingly
--- rather than verbs. Aspect regarded as an inherent parameter of a verb.
--- Notice, that some forms are never used for some verbs. Actually,
--- the majority of verbs do not have many of the forms.
-
--- The worst case need 6 forms of the present tense in indicative mood
--- ("Ñ Ð±ÐµÐ³Ñƒ", "ты бежишь", "он бежит", "мы бежим", "вы бежите", "они бегут"),
--- a past form (singular, masculine: "Ñ Ð±ÐµÐ¶Ð°Ð»"), an imperative form
--- (singular, second person: "беги"), an infinitive ("бежать").
--- Inherent aspect should also be specified.
-
- mkVerbum : Aspect -> (_,_,_,_,_,_,_,_,_ : Str) -> Verbum ;
-
--- Common conjugation patterns are two conjugations:
--- first - verbs ending with "-ать/-Ñть" and second - "-ить/-еть".
--- Instead of 6 present forms of the worst case, we only need
--- a present stem and one ending (singular, first person):
--- "Ñ Ð»ÑŽÐ±-лю", "Ñ Ð¶Ð´-у", etc. To determine where the border
--- between stem and ending lies it is sufficient to compare
--- first person from with second person form:
--- "Ñ Ð»ÑŽÐ±-лю", "ты люб-ишь". Stems shoud be the same.
--- So the definition for verb "любить" looks like:
--- mkRegVerb Imperfective Second "люб" "лю" "любил" "люби" "любить";
-
- mkRegVerb :Aspect -> Conjugation -> (_,_,_,_,_ : Str) -> Verbum ;
-
--- For writing an application grammar one usualy doesn't need
--- the whole inflection table, since each verb is used in
--- a particular context that determines some of the parameters
--- (Tense and Voice while Aspect is fixed from the beginning) for certain usage.
--- The "V" type, that have these parameters fixed.
--- We can extract the "V" from the lexicon.
-
- mkV: Verbum -> Voice -> Tense -> V ;
- mkPresentV: Verbum -> Voice -> V ;
-
-
--- Two-place verbs, and the special case with direct object. Notice that
--- a particle can be included in a $V$.
-
- mkTV : V -> Str -> Case -> TV ; -- "войти в дом"; "в", accusative
- tvDir : V -> TV ; -- "видеть", "любить"
-
--- The definitions should not bother the user of the API. So they are
--- hidden from the document.
---.
-
-
- masculine = Masc ;
- feminine = Fem ;
- neuter = Neut ;
- nominative = Nom ;
- accusative = Acc ;
- dative = Dat ;
- genitive = Gen ;
- instructive = Inst ;
- prepositional = Prepos ;
- singular = Sg ;
- plural = Pl ;
-
--- Noun definitions
-
- mkIndeclinableNoun = \s,g, anim ->
- {
- s = table { SF _ _ => s } ;
- g = g ;
- anim = anim
- } ;
-
-
- mkN = \nomSg, genSg, datSg, accSg, instSg, preposSg,
- nomPl, genPl, datPl, accPl, instPl, preposPl, g, anim ->
- {
- s = table {
- SF Sg Nom => nomSg ;
- SF Sg Gen => genSg ;
- SF Sg Dat => datSg ;
- SF Sg Acc => accSg ;
- SF Sg Inst => instSg ;
- SF Sg Prepos => preposSg ;
- SF Pl Nom => nomPl ;
- SF Pl Gen => genPl ;
- SF Pl Dat => datPl ;
- SF Pl Acc => accPl ;
- SF Pl Inst => instPl ;
- SF Pl Prepos => preposPl
- } ;
- g = g ;
- anim = anim
- } ;
-
- nMashina = \s -> aEndInanimateDecl s;
- nEdinica = \s -> ej_aEndInanimateDecl s;
- nZhenchina = \s -> (aEndAnimateDecl s) ** { g = Fem } ;
- nNoga = \s -> aEndG_K_KH_Decl s ;
- nMalyariya = \s -> i_yaEndDecl s ;
- nTetya = \s -> (yaEndAnimateDecl s) ** {g = Fem} ;
- nBol = \s -> softSignEndDeclFem s ;
-
--- Neuter patterns.
-
- nObezbolivauchee = \s -> eeEndInAnimateDecl s ;
- nProizvedenie = \s -> eEndInAnimateDecl s ;
- nChislo = \s -> oEndInAnimateDecl s ;
-
-
--- Masculine patterns.
-
- nStomatolog = \s -> nullEndAnimateDecl s ;
-
- nAdres = \s -> nullEndInAnimateDecl2 s ;
- nTelefon = \s -> nullEndInAnimateDecl1 s ;
-
- nNol = \s -> softSignEndDeclMasc s ;
- nUroven = \s -> EN_softSignEndDeclMasc s ;
-
--- mkFun defined in syntax.RusU
--- funGen defined in syntax.RusU
-
- mkPN = \ivan, g, anim ->
- case g of {
- Masc => mkProperNameMasc ivan anim ;
- _ => mkProperNameFem ivan anim
- } ;
- mkCN = UseN ;
- mkNP = \x,y,z -> UsePN (mkPN x y z) ;
-
--- Adjective definitions
-
- adjInvar = \s -> { s = \\af => s };
-
- adj1Staruyj = uy_j_EndDecl ;
- adj1Malenkij = ij_EndK_G_KH_Decl ;
- adj1Molodoj = uy_oj_EndDecl ;
- adj1Kakoj_Nibud = i_oj_EndDecl ;
-
- mkAdj2 = \a,p,c -> a ** {s2 = p ; c = c} ;
-
- -- mkAdjDeg defined in morpho.RusU
-
- ap = \a,p -> a ** { p = p } ;
-
--- Verb definitions
-
- mkVerbum = \asp, sgP1, sgP2, sgP3, plP1, plP2, plP3,
- sgMascPast, imperSgP2, inf -> case asp of {
- Perfective =>
- mkVerb (perfectiveActivePattern inf imperSgP2
- (presentConj sgP1 sgP2 sgP3 plP1 plP2 plP3) (pastConj sgMascPast))
- (pastConj sgMascPast);
- Imperfective =>
- mkVerb (imperfectiveActivePattern inf imperSgP2
- (presentConj sgP1 sgP2 sgP3 plP1 plP2 plP3) (pastConj sgMascPast))
- (pastConj sgMascPast)
- };
-
- oper presentConj: (_,_,_,_,_,_: Str) -> PresentVerb =
- \sgP1, sgP2, sgP3, plP1, plP2, plP3 ->
- table {
- PRF Sg P1 => sgP1 ;
- PRF Sg P2 => sgP2 ;
- PRF Sg P3 => sgP3 ;
- PRF Pl P1 => plP1 ;
- PRF Pl P2 => plP2 ;
- PRF Pl P3 => plP3
- };
-
-
- mkRegVerb = verbDecl ; -- defined in morpho.RusU.gf
-
- mkV = extVerb ; -- defined in types.RusU.gf
-
- mkPresentV = \aller, vox ->
- { s = table {
- VFin gn p => aller.s ! VFORM vox (VIND (VPresent (numGNum gn) p)) ;
- VImper n p => aller.s ! VFORM vox (VIMP n p) ;
- VInf => aller.s ! VFORM vox VINF ;
- VSubj gn => aller.s ! VFORM vox (VSUB gn)
- }; t = Present ; a = aller.asp ; v = vox } ;
-
- mkTV = mkTransVerb ; -- defined in syntax.RusU.gf
- tvDir = mkDirectVerb; -- defined in syntax.RusU.gf
-
-} ;
diff --git a/grammars/resource/russian/Predication.gf b/grammars/resource/russian/Predication.gf deleted file mode 100644 index 1fab240c4..000000000 --- a/grammars/resource/russian/Predication.gf +++ /dev/null @@ -1,35 +0,0 @@ --- predication library, built on resource grammar. AR 2002--2003
-
--- Users of the library should *not* look into this file, but only into
--- $predication.Types.gf$.
-
-resource Predication = open Russian in {
-
-
-oper
- predV1 = \F, x -> PredVP x (PosV F) ;
- predV2 = \F, x, y -> PredVP x (PosTV F y) ;
- predVColl = \F, x, y -> PredVP (conjNP x y) (PosV F) ;
- predA1 = \F, x -> PredVP x (PosA F) ;
- predA2 = \F, x, y -> PredVP x (PosA (ComplAdj F y)) ;
- predAComp = \F, x, y -> PredVP x (PosA (ComparAdjP F y)) ;
- predAColl = \F, x, y -> PredVP (conjNP x y) (PosA F) ;
- predN1 = \F, x -> PredVP x (PosCN (UseN F)) ;
- predN2 = \F, x, y -> PredVP x (PosCN (AppFun F y)) ;
- predNColl = \F, x, y -> PredVP (conjNP x y) (PosCN (UseN F)) ;
-
- appFun1 = \f, x -> DefOneNP (AppFun f x) ;
- appFunColl = \f, x, y -> DefOneNP (AppFun f (conjNP x y)) ;
-
- appFam1 = \F, x -> AppFun F x ;
- appFamColl = \F, x, y -> AppFun F (conjNP x y) ;
-
- conjS = \A, B -> ConjS AndConj (TwoS A B) ;
- disjS = \A, B -> ConjS OrConj (TwoS A B) ;
- implS = \A, B -> SubjS IfSubj A B ;
-
- constrTyp1 = \F, A -> AppFun F (IndefManyNP A) ;
-
- conjNP = \x, y -> ConjNP AndConj (TwoNP x y) ;
-
-};
diff --git a/grammars/resource/russian/ResRus.gf b/grammars/resource/russian/ResRus.gf deleted file mode 100644 index cc998c4aa..000000000 --- a/grammars/resource/russian/ResRus.gf +++ /dev/null @@ -1,241 +0,0 @@ ---# -path=.:../abstract:../../prelude
-
---1 The Top-Level Russian Resource Grammar
---
--- Janna Khegai 2003
--- on the basis of code for other languages by Aarne Ranta
---
--- This is the Russian concrete syntax of the multilingual resource
--- grammar. Most of the work is done in the file $syntax.RusU.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 is 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 $types.RusU.gf$.
-
-concrete ResRus of ResAbs = open Prelude, Syntax in {
-flags
- coding=utf8 ;
- startcat=Phr ;
- lexer=text ;
- unlexer=text ;
-
-lincat
-
- N = CommNoun ;
- -- = {s : SubstForm => Str ; g : Gender ; anim : Animacy } ;
- CN = CommNounPhrase ;
- -- = {s : Number => Case => Str; g : Gender; anim : Animacy} ;
- NP = NounPhrase ;
- -- = { s : PronForm => Str ; n : Number ; p : Person ;
- -- g: Gender ; anim : Animacy ; pron: Bool} ;
- PN = ProperName ;
- -- = {s : Case => Str ; g : Gender ; anim : Animacy} ;
- Adj1 = Adjective ;
- -- = {s : AdjForm => Str} ;
- Det = Determiner ;
- -- = Adjective ** { n: Number; c : Case } ;
- Adj2 = AdjCompl ;
- -- = Adjective ** Complement ;
- AdjDeg = AdjDegr ;
- -- = {s : Degree => AdjForm => Str} ;
- AP = AdjPhrase ;
- -- = Adjective ** {p : IsPostfixAdj} ;
- Fun = Function ;
- -- = CommNounPhrase ** Complement ;
- Fun2 = Function ** {s3 : Preposition; c2: Case} ;
-
- V = Verb ;
- -- = {s : VF => Str ; t: Tense ; a : Aspect ; v: Voice} ;
- VP = VerbPhrase ;
- -- = Verb ** {s2 : Str ; s3 : Gender => Number => Str ;
- -- negBefore: Bool} ;
- TV = TransVerb ;
- -- = Verb ** {s2 : Preposition ; c: Case } ;
- V3 = TransVerb ** {s4 : Preposition; c2: Case} ;
- VS = SentenceVerb ;
- -- = Verb ;
- AdV = Adverb ;
- -- = {s : Str} ;
-
- S = Sentence ;
- -- = {s : Str} ;
- Slash = SentenceSlashNounPhrase ;
- -- = Sentence ** Complement ;
-
- RP = RelPron ;
- -- = {s : GenNum => Case => Animacy => Str} ;
- RC = RelClause ;
- -- = RelPron ;
-
- IP = IntPron ;
- -- = NounPhrase ;
- Qu = Question ;
- -- = {s : QuestForm => Str} ;
- Imp = Imperative ;
- -- = { s: Gender => Number => Str } ;
- Phr = Utterance ;
- -- = {s : Str} ;
- Text = {s : Str} ;
-
- Conj = Conjunction ;
- -- = {s : Str ; n : Number} ;
- ConjD = ConjunctionDistr ;
- -- = {s1,s2 : Str ; n : Number} ;
-
- ListS = ListSentence ;
- -- = {s1,s2 : Mode => Str} ;
- ListAP = ListAdjPhrase ;
- -- = {s1,s2 : AdjForm => Str ; p : Bool} ;
- ListNP = ListNounPhrase ;
- -- = { s1,s2 : PronForm => Str ; g: Gender ; anim : Animacy ;
- -- n : Number ; p : Person ; pron : Bool } ;
-
---.
-lin
- UsePN = nameNounPhrase ;
- ComplAdj = complAdj ;
- PredVP = predVerbPhrase ;
- PosTV = complTransVerb True ;
- NegTV = complTransVerb False ;
- AdjP1 = adj2adjPhrase ;
- ModAdj = modCommNounPhrase ;
- PosA = predAdjective True ;
- NegA = predAdjective False ;
-
- UseN = noun2CommNounPhrase ;
- ModGenOne = npGenDet Sg ;
- ModGenMany = npGenDet Pl ;
- UseFun = funAsCommNounPhrase ;
- AppFun = appFunComm ;
- PositAdjP = positAdjPhrase ;
- ComparAdjP = comparAdjPhrase ;
- SuperlNP = superlNounPhrase ;
-
- DetNP = detNounPhrase ;
- IndefOneNP = indefNounPhrase Sg ;
- IndefManyNP = indefNounPhrase Pl ;
- DefOneNP = defNounPhrase Sg ;
- DefManyNP = defNounPhrase Pl ;
-
- PosV = predVerb True ;
- NegV = predVerb False ;
- PosCN = predCommNoun True ;
- NegCN = predCommNoun False ;
- PosNP = predNounPhrase True ;
- NegNP = predNounPhrase False ;
- PosVS = complSentVerb True ;
- NegVS = complSentVerb False ;
-
- AdvVP = adVerbPhrase ;
- LocNP = locativeNounPhrase ;
- AdvCN = advCommNounPhrase ;
--- AdvAP = advAdjPhrase ;
-
- PosSlashTV = slashTransVerb True ;
- NegSlashTV = slashTransVerb False ;
-
- IdRP = identRelPron ;
- FunRP = funRelPron ;
- RelVP = relVerbPhrase ;
- RelSlash = relSlash ;
- ModRC = modRelClause ;
- RelSuch = relSuch ;
-
- WhoOne = intPronKto Sg ;
- WhoMany = intPronKto Pl ;
- WhatOne = intPronChto Sg ;
- WhatMany = intPronChto Pl ;
- FunIP = funIntPron ;
- NounIPOne = nounIntPron Sg ;
- NounIPMany = nounIntPron Pl ;
-
- QuestVP = questVerbPhrase ;
- IntVP = intVerbPhrase ;
- IntSlash = intSlash ;
- QuestAdv = questAdverbial ;
-
- ImperVP = imperVerbPhrase ;
-
- IndicPhrase = indicUtt ;
- QuestPhrase = interrogUtt ;
- ImperOne = imperUtterance Masc Sg ;
- ImperMany = imperUtterance Masc Pl ;
- --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 ;
-
- PhrNP = useNounPhrase ;
- PhrOneCN = useCommonNounPhrase Sg ;
- PhrManyCN = useCommonNounPhrase Pl ;
- PhrIP ip = postfixSS "?" ip ;
- PhrIAdv ia = postfixSS "?" ia ;
- OnePhr p = p ;
- ConsPhr = cc2 ;
-
-
- INP = pron2NounPhrase pronYa Animate;
- ThouNP = pron2NounPhrase pronTu Animate;
- HeNP = pron2NounPhrase pronOn Animate;
- SheNP = pron2NounPhrase pronOna Animate;
- WeNP = pron2NounPhrase pronMu Animate;
- YeNP = pron2NounPhrase pronVu Animate;
- YouNP = pron2NounPhrase pronVu Animate;
- TheyNP = pron2NounPhrase pronOni Animate;
-
- EveryDet = kazhdujDet ** {n = Sg ; c= Nom} ;
- AllDet = vseDetPl ** {n = Pl; c= Nom} ;
- WhichDet = kotorujDet ** {n = Sg; c= Nom} ; -- a singular version only
- MostDet = bolshinstvoDet ** {n = Pl; c= Gen} ;
-
- HowIAdv = ss "как" ;
- WhenIAdv = ss "когда" ;
- WhereIAdv = ss "где" ;
- WhyIAdv = ss "почему" ;
-
- AndConj = ss "и" ** {n = Pl} ;
- OrConj = ss "или" ** {n = Sg} ;
- BothAnd = sd2 "как" [", так"] ** {n = Pl} ;
- EitherOr = sd2 "либо" [", либо"] ** {n = Sg} ;
-
--- In case of "neither.. no" expression double negation is not
--- only possible, but also required in Russian.
--- There is no means of control for this however in the resource grammar.
-
- NeitherNor = sd2 "ни" [", ни"] ** {n = Sg} ;
-
- IfSubj = ss "еÑли" ;
- WhenSubj = ss "когда" ;
-
- PhrYes = ss ["да ."] ;
- PhrNo = ss ["нет ."] ;
-
- VeryAdv = ss "очень" ;
- TooAdv = ss "Ñлишком" ;
- OtherwiseAdv = ss "иначе" ;
- ThereforeAdv = ss "Ñледовательно" ;
-} ;
diff --git a/grammars/resource/russian/RestaurantRus.gf b/grammars/resource/russian/RestaurantRus.gf deleted file mode 100644 index fa07e4afd..000000000 --- a/grammars/resource/russian/RestaurantRus.gf +++ /dev/null @@ -1,30 +0,0 @@ ---# -path=.:../abstract:../../prelude
-
-concrete RestaurantRus of Restaurant =
- DatabaseRus ** open Prelude,Paradigms in {
-flags coding=utf8 ;
-lin
- Restaurant = n2n restoran;
- Bar = n2n bar ;
- French = AdjP1 francuzskij ;
- Italian = AdjP1 italyanskij ;
- Indian = AdjP1 indijskij ;
- Japanese = AdjP1 yaponskij ;
-
- address = funGen adres ;
- phone = funGen telefon ;
- priceLevel = funGen (commNounPhrase2CommNoun(appFunComm urovenFun cenu)) ;
-
- Cheap = deshevuj;
- Expensive = dorogoj ;
-
- WhoRecommend rest = mkSentSame (ss2 ["кто порекомендовал"] (rest.s ! Acc)) ;
- WhoHellRecommend rest =
- mkSentSame (ss2 ["кто, черт возьми, порекомендовал"] (rest.s ! Acc)) ;
-
- LucasCarton = mkProperNameMasc ["Ð›ÑƒÐºÐ°Ñ ÐšÐ°Ñ€Ñ‚ÑƒÐ½"] Inanimate;
-
-oper
- urovenFun : Function = funGen uroven ;
- cenu : NounPhrase = mkNounPhrase Pl (n2n cena) ;
-};
diff --git a/grammars/resource/russian/Russian.gf b/grammars/resource/russian/Russian.gf deleted file mode 100644 index 52265b556..000000000 --- a/grammars/resource/russian/Russian.gf +++ /dev/null @@ -1,3 +0,0 @@ ---# -path=.:../abstract:../../prelude - -resource Russian = reuse ResRus ; diff --git a/grammars/resource/russian/Syntax.gf b/grammars/resource/russian/Syntax.gf deleted file mode 100644 index 11b325bfc..000000000 --- a/grammars/resource/russian/Syntax.gf +++ /dev/null @@ -1,898 +0,0 @@ ---1 A Small Russian Resource Syntax
---
--- Aarne Ranta, Janna Khegai 2003
---
--- This resource grammar contains definitions needed to construct
--- indicative, interrogative, and imperative sentences in Russian.
---
--- The following files are presupposed:
-resource Syntax = Morpho ** open Prelude, (CO = Coordination) in {
-flags coding=utf8 ;
-
---2 Common Nouns
---
---
---3 Common noun phrases
---
--- Complex common nouns ($Comm'NounPhrase$) have in principle
--- the same parameters as simple ones.
-
-oper
- CommNounPhrase: Type = {s : Number => Case => Str; g : Gender; anim : Animacy} ;
-
- noun2CommNounPhrase : CommNoun -> CommNounPhrase = \sb ->
- {s = \\n,c => sb.s ! SF n c ;
- g = sb.g ;
- anim = sb.anim
- } ;
-
- commNounPhrase2CommNoun : CommNounPhrase -> CommNoun = \sb ->
- {s = \\sf => sb.s ! (numSF sf) ! (caseSF sf) ;
- g = sb.g ;
- anim = sb.anim
- } ;
-
- n2n = noun2CommNounPhrase;
- n2n2 = commNounPhrase2CommNoun ;
-
---2 Noun Phrases
---
-
-oper
-
- NounPhrase : Type = { s : PronForm => Str ; n : Number ;
- p : Person ; g: Gender ; anim : Animacy ; pron: Bool} ;
-
- -- A function specific for Russian for setting the gender for
- -- personal pronouns in first and second person, singular :
- setNPGender : Gender -> NounPhrase -> NounPhrase = \gen, pronI ->
- { s = pronI.s ; g = gen ; anim = pronI.anim ;
- n = pronI.n ; nComp = pronI.nComp ; p = pronI.p ; pron = pronI.pron } ;
-
-
- mkNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,chelovek ->
- {s = \\cas => chelovek.s ! n ! (extCase cas) ;
- n = n ; g = chelovek.g ; p = P3 ; pron =False ;
- anim = chelovek.anim
- } ;
- pron2NounPhrase : Pronoun -> Animacy -> NounPhrase = \ona, anim ->
- {s = ona.s ; n = ona.n ; g = pgen2gen ona.g ;
- pron = ona.pron; p = ona.p ; anim = anim } ;
-
- nameNounPhrase : ProperName -> NounPhrase =
- \masha -> {s = \\c => masha.s ! (extCase c) ;
- p = P3; g = masha.g ; anim = masha.anim ;
- n = Sg; nComp = Sg; pron = False} ;
-
-
---2 Determiners
---
--- Determiners (only determinative pronouns in Russian) are inflected
--- according to the gender of nouns they determine.
--- The determined noun has the case parameter specific for the determiner:
-
- Determiner : Type = Adjective ** { n: Number; c : Case } ;
-
- anyPlDet = kakojNibudDet ** {n = Pl; c= Nom} ;
-
- detNounPhrase : Determiner -> CommNounPhrase -> NounPhrase = \kazhduj, okhotnik ->
- {s = \\c => case kazhduj.c of {
- Nom =>
- kazhduj.s ! AF (extCase c) okhotnik.anim (gNum okhotnik.g kazhduj.n) ++
- okhotnik.s ! kazhduj.n ! (extCase c) ;
- _ =>
- kazhduj.s ! AF (extCase c) okhotnik.anim (gNum okhotnik.g kazhduj.n) ++
- okhotnik.s ! kazhduj.n ! kazhduj.c };
- n = kazhduj.n ;
- p = P3 ;
- pron = False;
- g = okhotnik.g ;
- anim = okhotnik.anim
- } ;
-
- indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,mashina ->
- {s = \\c => mashina.s ! n ! (extCase c) ;
- n = n ; p = P3 ; g = mashina.g ; anim = mashina.anim ;
- pron = False
- } ;
-
- defNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n,mashina ->
- { s = \\c => mashina.s ! n ! (extCase c) ;
- n = n ; p = P3 ; g = mashina.g ;anim = mashina.anim ; pron = False } ;
-
--- Genitives of noun phrases can be used like determiners,
--- to build noun phrases.
--- The number argument makes the difference between "мой дом" - "мои дома".
---
--- The variation like in "the car of John / John's car" in English is
--- not equally natural for proper names and pronouns and the rest of nouns.
--- Compare "дверца машины" and "машины дверца", while
--- "Ванина мама" and "мама Вани" or "Ð¼Ð¾Ñ Ð¼Ð°Ð¼Ð°" and "мама моÑ".
--- Here we have to make a choice of a universal form, which will be
--- "Ð¼Ð¾Ñ Ð¼Ð°Ð¼Ð°" - "Вани мама" - "машины дверца", which sounds
--- the best for pronouns, a little worse for proper names and
--- the worst for the rest of nouns. The reason is the fact that
--- possession/genetive is more a human category and pronouns are
--- used very often, so we try to suit this case in the first place.
-
- npGenDet : Number -> NounPhrase -> CommNounPhrase -> NounPhrase =
- \n,masha,mashina ->
- {s = \\c => case masha.pron of
- { True => masha.s ! (mkPronForm Nom No (Poss (gNum mashina.g n))) ++
- mashina.s ! n ! (extCase c) ;
- False => masha.s ! (mkPronForm Gen No (Poss (gNum mashina.g n))) ++
- mashina.s ! n ! (extCase c)
- } ;
- n = n ; p = P3 ; g = mashina.g ; anim = mashina.anim ; pron = False
- } ;
-
---2 Adjectives
---3 Simple adjectives
---
--- A special type of adjectives just having positive forms
--- (for semantic reasons) is useful, e.g. "руÑÑкий".
-
-oper
-
- extAdjective : AdjDegr -> Adjective = \adj ->
- { s = \\af => adj.s ! Pos ! af } ;
-
- -- Coercions between the compound gen-num type and gender and number:
-
- gNum : Gender -> Number -> GenNum = \g,n ->
- case n of {Sg => case g of
- { Fem => ASg Fem ;
- Masc => ASg Masc ;
- Neut => ASg Neut
- -- _ => variants {ASg Masc ; ASg Fem}
- } ; Pl => APl} ;
-
-
-
---3 Adjective phrases
---
--- An adjective phrase may contain a complement, e.g. "моложе Риты".
--- Then it is used as postfix in modification, e.g. "человек, моложе Риты".
-
- IsPostfixAdj = Bool ;
-
- AdjPhrase : Type = Adjective ** {p : IsPostfixAdj} ;
-
--- Simple adjectives are not postfix:
-
- adj2adjPhrase : Adjective -> AdjPhrase = \novuj -> novuj ** {p = False} ;
-
---3 Comparison adjectives
---
--- Each of the comparison forms has a characteristic use:
---
--- Positive forms are used alone, as adjectival phrases ("большой").
-
- positAdjPhrase : AdjDegr -> AdjPhrase = \bolshoj ->
- adj2adjPhrase (extAdjective bolshoj) ;
-
--- Comparative forms are used with an object of comparison, as
--- adjectival phrases ("больше тебÑ").
-
- comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \bolshoj, tu ->
- {s = \\af => bolshoj.s ! Comp ! af ++ tu.s ! (mkPronForm Gen Yes NonPoss) ;
- p = True
- } ;
-
--- Superlative forms are used with a modified noun, picking out the
--- maximal representative of a domain ("Ñамый большой дом").
-
- superlNounPhrase : AdjDegr -> CommNounPhrase -> NounPhrase = \bolshoj, dom ->
- {s = \\pf => bolshoj.s ! Super ! AF (extCase pf) dom.anim (gNum dom.g Sg) ++
- dom.s ! Sg ! (extCase pf) ;
- n = Sg ;
- p = P3 ;
- pron = False;
- anim = dom.anim ;
- g = dom.g
- } ;
-
-
---3 Two-place adjectives
---
--- A two-place adjective is an adjective with a preposition used before
--- the complement. (Rem. $Complement = {s2 : Preposition ; c : Case} $).
-
-
- AdjCompl = Adjective ** Complement ;
-
- complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \vlublen,tu ->
- {s = \\af => vlublen.s ! af ++ vlublen.s2 ++
- tu.s ! (mkPronForm vlublen.c No NonPoss) ;
- p = True
- } ;
-
---3 Complements
---
-
- Complement = {s2 : Preposition ; c : Case} ;
-
- complement : Str -> Complement = \cherez ->
- {s2 = cherez ; c = Nom} ;
-
- complementDir : Complement = complement [] ;
-
- complementCas : Case -> Complement = \c ->
- {s2 = [] ; c = c} ;
-
---2 Individual-valued functions
-
--- An individual-valued function is a common noun together with the
--- preposition prefixed to its argument ("ключ от дома").
--- The situation is analogous to two-place adjectives and transitive verbs.
---
--- We allow the genitive construction to be used as a variant of
--- all function applications. It would definitely be too restrictive only
--- to allow it when the required case is genitive. We don't know if there
--- are counterexamples to the liberal choice we've made.
-
- Function = CommNounPhrase ** Complement ;
-
-
--- The application of a function gives, in the first place, a common noun:
--- "ключ от дома". From this, other rules of the resource grammar
--- give noun phrases, such as "ключи от дома", "ключи от дома
--- и от машины", and "ключ от дома и машины" (the
--- latter two corresponding to distributive and collective functions,
--- respectively). Semantics will eventually tell when each
--- of the readings is meaningful.
-
- appFunComm : Function -> NounPhrase -> CommNounPhrase = \mama,ivan ->
- {s = \\n, cas =>
- mama.s ! n ! cas ++ mama.s2 ++
- ivan.s ! (mkPronForm mama.c No (Poss (gNum mama.g n)));
- g = mama.g ;
- anim = mama.anim
- } ;
-
--- It is possible to use a function word as a common noun; the semantics is
--- often existential or indexical.
-
- funAsCommNounPhrase : Function -> CommNounPhrase = \x -> x ;
-
- mkFun : CommNoun -> Preposition -> Case -> Function = \f,p,c ->
- (n2n f) ** {s2 = p ; c = c} ;
-
--- The following is an aggregate corresponding to the original function application
--- producing "детÑтво Ивана" and "Иваново детÑтво". It does not appear in the
--- resource abstract syntax any longer.
--- Both versions return "детÑво Ивана" although "Иваново детÑтво"
--- must also be included
--- Such possesive form is only possible with proper names in Russian :
-
- appFun : Bool -> Function -> NounPhrase -> NounPhrase = \coll,detstvo, ivan ->
- let {n = ivan.n ; nf = if_then_else Number coll Sg n} in
- variants {
- defNounPhrase nf (appFunComm detstvo ivan) ; -- detstvoIvana
- npGenDet nf ivan detstvo
- } ;
-
-
--- The commonest cases are functions with Genitive.
-
- funGen : CommNoun -> Function = \urovenCen ->
- mkFun urovenCen [] Gen ;
-
---3 Modification of common nouns
---
--- The two main functions of adjective are in predication ("Иван - молод")
--- and in modification ("молодой человек"). Predication will be defined
--- later, in the chapter on verbs.
-
- modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase =
- \khoroshij,novayaMashina ->
- {s = \\n, c =>
- khoroshij.s ! AF c novayaMashina.anim (gNum novayaMashina.g n) ++
- novayaMashina.s ! n ! c ;
- g = novayaMashina.g ;
- anim = novayaMashina.anim
- } ;
-
---2 Verbs
-
---3 Transitive verbs
---
--- Transitive verbs are verbs with a preposition for the complement,
--- in analogy with two-place adjectives and functions.
--- One might prefer to use the term "2-place verb", since
--- "transitive" traditionally means that the inherent preposition is empty
--- and the case is accusative.
--- Such a verb is one with a *direct object*.
--- Note: Direct verb phrases where the Genitive case is also possible
--- ("купить хлеба", "не читать газет") are overlooked in mkDirectVerb
--- and can be expressed via more a general rule mkTransVerb.
-
- TransVerb : Type = Verb ** {s2 : Preposition ; c: Case } ;
-
- complementOfTransVerb : TransVerb -> Complement = \v -> {s2 = v.s2 ; c = v.c} ;
- verbOfTransVerb : TransVerb -> Verb = \v ->
- {s = v.s; t = v.t; a = v.a ; w = v.w } ;
-
- mkTransVerb : Verb -> Preposition -> Case -> TransVerb = \v,p,cas ->
- v ** {s2 = p ; c = cas } ;
-
- mkDirectVerb : Verb -> TransVerb = \v ->
- mkTransVerb v nullPrep Acc;
-
- nullPrep : Preposition = [] ;
-
--- The rule for using transitive verbs is the complementization rule:
-
- complTransVerb : Bool -> TransVerb -> NounPhrase -> VerbPhrase = \b,se,tu ->
- {s = se.s ; a = se.a ; t = se.t ; w = se.w ; s2 = negation b ;
- s3 = \\_,_ => se.s2 ++ tu.s ! (mkPronForm se.c No NonPoss) ;
- negBefore = True } ;
-
---3 Verb phrases
---
--- Verb phrases are discontinuous: the parts of a verb phrase are
--- (s) an inflected verb, (s2) verb adverbials (such as negation), and
--- (s3) complement. This discontinuity is needed in sentence formation
--- to account for word order variations.
-
- VerbPhrase : Type = Verb ** {s2 : Str ; s3 : Gender => Number => Str ;
- negBefore: Bool} ;
-
--- 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.
-
- predVerb : Bool -> Verb -> VerbPhrase = \b,vidit ->
- vidit ** {
- s2 = negation b ;
- s3 = \\_,_ => [] ;
- negBefore = True
- } ;
-
- negation : Bool -> Str = \b -> if_then_else Str b [] "не" ;
-
--- Sometimes we want to extract the verb part of a verb phrase.
-
- verbOfPhrase : VerbPhrase -> Verb = \v ->
- {s = v.s; t = v.t ; a = v.a ; w =v.w} ;
-
-
--- Verb phrases can also be formed from adjectives ("- молод"),
--- common nouns ("- человек"), and noun phrases ("- Ñамый молодой").
--- The third rule is overgenerating: "- каждый человек" has to be ruled out
--- on semantic grounds.
--- Note: in some case we can even omit a dash "-" :
--- "Я думаю, что Ñто Ñ…Ð¾Ñ€Ð¾ÑˆÐ°Ñ Ð¼Ð°ÑˆÐ¸Ð½Ð°".
-
- predAdjective : Bool -> Adjective -> VerbPhrase = \b,zloj ->
- { s= \\_ => "-" ;
- t = Present ;
- a = Imperfective ;
- w = Act ;
- s2 = negation b ;
- s3 = \\g,n => case n of {
- Sg => zloj.s ! AF Nom Animate (ASg g) ;
- Pl => zloj.s ! AF Nom Animate APl
- } ;
- negBefore = False
- } ;
-
- predCommNoun : Bool -> CommNounPhrase -> VerbPhrase = \b,chelovek ->
- { s= \\_ => "-" ;
- t = Present ;
- a = Imperfective ;
- w = Act ;
- s2 = negation b ;
- s3 = \\_,n => (indefNounPhrase n chelovek ).s ! (mkPronForm Nom No NonPoss) ;
- negBefore = False
- } ;
-
- predNounPhrase : Bool -> NounPhrase -> VerbPhrase = \b,masha ->
- { s= \\_ => "-" ;
- t = Present ;
- a = Imperfective ;
- w = Act ;
- s2 = negation b ;
- s3 = \\_,_ => masha.s ! (mkPronForm Nom No NonPoss) ;
- negBefore = False
- } ;
-
- -- A function specific for Russian :
- predNeedShortAdjective: Bool -> NounPhrase -> CommNounPhrase -> Sentence =
- \ b, Jag, Dig -> { s =
- let {
- mne = Jag.s ! (mkPronForm Dat No NonPoss) ;
- nuzhen = need.s ! AF Nom Inanimate (gNum Dig.g Sg) ;
- doctor = Dig.s ! Sg ! Nom ;
- ne = negation b
- } in
- mne ++ ne ++ nuzhen ++ doctor
- } ;
-
---2 Adverbials
---
- adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \poet, khorosho ->
- {s = \\vf => khorosho.s ++ poet.s ! vf ; s2 = poet.s2; s3 = poet.s3;
- a = poet.a; w = poet.w; t = poet.t ; negBefore = poet.negBefore } ;
-
--- Adverbials are typically generated by prefixing prepositions.
--- The rule for creating locative noun phrases by the preposition "в"
--- is a little shaky: "в РоÑÑии" but "на оÑтрове".
-
- locativeNounPhrase : NounPhrase -> Adverb = \ivan ->
- {s = "в" ++ ivan.s ! (mkPronForm Prepos Yes NonPoss) } ;
-
--- This is a source of the "man with a telescope" ambiguity, and may produce
--- strange things, like "машины вÑегда".
--- Semantics will have to make finer distinctions among adverbials.
-
- advCommNounPhrase : CommNounPhrase -> Adverb -> CommNounPhrase = \chelovek,uTelevizora ->
- {s = \\n,c => chelovek.s ! n ! c ++ uTelevizora.s ;
- g = chelovek.g ;
- anim = chelovek.anim
- } ;
-
-
---2 Sentences
---
--- We do not introduce the word order parameter for sentences in Russian
--- although there exist several word orders, but they are too specific
--- to capture on the level we work here.
-
-oper
- Sentence : Type = { s : Str } ;
-
--- This is the traditional $S -> NP VP$ rule.
-
- predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence =
- \Ya, tebyaNeVizhu -> { s =
- let
- { ya = Ya.s ! (mkPronForm Nom No NonPoss);
- ne = tebyaNeVizhu.s2;
- vizhu = tebyaNeVizhu.s ! VFin (gNum Ya.g Ya.n) Ya.p;
- tebya = tebyaNeVizhu.s3 ! Ya.g ! Ya.n
- }
- in
- if_then_else Str tebyaNeVizhu.negBefore
- (ya ++ ne ++ vizhu ++ tebya)
- (ya ++ vizhu ++ ne ++ tebya)
-
- } ;
-
- -- A function specific for Russian:
- U_predTransVerb : Bool -> TransVerb -> NounPhrase -> NounPhrase -> Sentence =
- \b,Ser,Jag,Dig -> { s =
- let {
- menya = Jag.s ! (mkPronForm Gen Yes NonPoss) ;
- bolit = Ser.s ! VFin (gNum Dig.g Dig.n) Dig.p ;
- golova = Dig.s ! (mkPronForm Nom No NonPoss) ;
- ne = negation b
- } in
- "у" ++ menya ++ ne ++ bolit ++ golova
- } ;
-
-
--- This is a macro for simultaneous predication and complementation.
-
- predTransVerb : Bool -> TransVerb -> NounPhrase -> NounPhrase -> Sentence =
- \b,vizhu,ya,tu -> predVerbPhrase ya (complTransVerb b vizhu tu) ;
-
---3 Sentence-complement verbs
---
--- Sentence-complement verbs take sentences as complements.
-
- SentenceVerb : Type = Verb ;
-
--- To generate "Ñказал, что Иван гулÑет" / "не Ñказал, что Иван гулÑет":
-
- complSentVerb : Bool -> SentenceVerb -> Sentence -> VerbPhrase =
- \b,vidit,tuUlubaeshsya ->
- {s = vidit.s ; s2 = negation b ; s3 = \\_,_ => [", что"] ++
- tuUlubaeshsya.s ;
- t = vidit.t ; w = vidit.w ; a = vidit.a ; negBefore = True } ;
-
-
---2 Sentences missing noun phrases
---
--- This is one instance of Gazdar's *slash categories*, corresponding to his
--- $S/NP$.
--- We cannot have - nor would we want to have - a productive slash-category former.
--- Perhaps a handful more will be needed.
---
--- 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 = Sentence ** Complement ;
-
- slashTransVerb : Bool -> NounPhrase -> TransVerb -> SentenceSlashNounPhrase =
- \b,ivan,lubit ->
- predVerbPhrase ivan (predVerb b (verbOfTransVerb lubit)) **
- complementOfTransVerb lubit ;
-
-
---2 Coordination
---
--- Coordination is to some extent orthogonal to the rest of syntax, and
--- has been treated in a generic way in the module $CO$ in the file
--- $coordination.gf$. The overall structure is independent of category,
--- but there can be differences in parameter dependencies.
---
---3 Conjunctions
---
--- Coordinated phrases are built by using conjunctions, which are either
--- simple ("и", "или") or distributed ("как - так", "либо - либо").
---
--- The conjunction has an inherent number, which is used when conjoining
--- noun phrases: "Иван и Маша поют" vs. "Иван или Маша поет"; in the
--- case of "или", the result is however plural if any of the disjuncts is.
-
- Conjunction = CO.Conjunction ** {n : Number} ;
- ConjunctionDistr = CO.ConjunctionDistr ** {n : Number} ;
-
---2 Relative pronouns and relative clauses
---
-
-oper
- identRelPron : RelPron = { s = \\gn, c, anim =>
- kotorujDet.s ! (AF c anim gn )} ;
-
- funRelPron : Function -> RelPron -> RelPron = \mama, kotoruj ->
- {s = \\gn,c, anim => let {nu = numGNum gn} in
- mama.s ! nu ! c ++
- mama.s2 ++ kotoruj.s ! gn ! mama.c ! anim
- } ;
-
--- Relative clauses can be formed from both verb phrases ("видит Машу") and
--- slash expressions ("Ñ Ð²Ð¸Ð¶Ñƒ").
-
- RelClause : Type = RelPron ;
-
- relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \kotoruj, gulyaet ->
- { s = \\gn, c, anim => let { nu = numGNum gn } in
- kotoruj.s ! gn ! c ! anim ++ gulyaet.s2 ++ gulyaet.s ! VFin gn P3 ++
- gulyaet.s3 ! genGNum gn ! nu
- } ;
-
- relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause =
- \kotoruj, yaVizhu ->
- {s = \\gn, _ , anim => yaVizhu.s2 ++ kotoruj.s ! gn ! yaVizhu.c ! anim
- ++ yaVizhu.s
- } ;
-
--- A 'degenerate' relative clause is the one often used in mathematics, e.g.
--- "чиÑло x, такое что x - четное".
-
- relSuch : Sentence -> RelClause = \A ->
- {s = \\gn,c, anim => takoj.s ! AF c anim gn ++ "что" ++ A.s } ;
-
--- 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. A comma is used before the relative clause.
-
- modRelClause : CommNounPhrase -> RelClause -> CommNounPhrase =
- \chelovek,kotorujSmeetsya ->
- { s = \\n,c => chelovek.s ! n ! c ++ "," ++
- kotorujSmeetsya.s ! gNum chelovek.g n ! Nom ! chelovek.anim;
- g = chelovek.g ;
- anim = chelovek.anim
- } ;
-
-
---2 Interrogative pronouns
---
--- If relative pronouns are adjective-like, interrogative pronouns are
--- noun-phrase-like. Actually we can use the very same type!
-
- IntPron : Type = NounPhrase ;
-
--- In analogy with relative pronouns, we have a rule for applying a function
--- to a relative pronoun to create a new one. We can reuse the rule applying
--- functions to noun phrases!
-
- funIntPron : Function -> IntPron -> IntPron =
- appFun False ;
-
--- There is a variety of simple interrogative pronouns:
--- "ÐºÐ°ÐºÐ°Ñ Ð¼Ð°ÑˆÐ¸Ð½Ð°", "кто", "что".
-
- nounIntPron : Number -> CommNounPhrase -> IntPron = \n, x ->
- detNounPhrase (kakojDet ** {n = n; c= Nom}) x ;
-
- intPronKto : Number -> IntPron = \num ->
- { s = table {
- PF Nom _ _ => "кто" ;
- PF Gen _ _ => "кого" ;
- PF Dat _ _ => "кому" ;
- PF Acc _ _ => "кого" ;
- PF Inst _ _ => "кем" ;
- PF Prepos _ _ => ["о ком"]
- } ;
- g = Masc ;
- anim = Animate ;
- n = num ;
- p = P3 ;
- pron = False
- } ;
-
-
-
- intPronChto : Number -> IntPron = \num ->
- { s = table {
- PF Nom _ _ => "что" ;
- PF Gen _ _ => "чего" ;
- PF Dat _ _ => "чему" ;
- PF Acc _ _ => "что" ;
- PF Inst _ _ => "чем" ;
- PF Prepos _ _=> ["о чем"]
- } ;
- g = Neut ;
- anim = Inanimate ;
- n = num ;
- p = P3 ;
- pron = False
- } ;
-
-
---2 Utterances
-
--- By utterances we mean whole phrases, such as
--- 'can be used as moves in a language game': indicatives, questions, imperative,
--- and one-word utterances. The rules are far from complete.
---
--- N.B. we have not included rules for texts, which we find we cannot say much
--- about on this level. In semantically rich GF grammars, texts, dialogues, etc,
--- will of course play an important role as categories not reducible to utterances.
--- An example is proof texts, whose semantics show a dependence between premises
--- and conclusions. Another example is intersentential anaphora.
-
- Utterance = SS ;
-
- indicUtt : Sentence -> Utterance = \x -> postfixSS "." (defaultSentence x) ;
- interrogUtt : Question -> Utterance = \x -> postfixSS "?" (defaultQuestion x) ;
-
---2 Questions
---
--- Questions are either direct ("Ты ÑчаÑтлив?")
--- or indirect ("Потом он ÑпроÑил ÑчаÑтлив ли ты").
-
-param
- QuestForm = DirQ | IndirQ ;
-
-oper
- Question = SS1 QuestForm ;
-
---3 Yes-no questions
---
--- Yes-no questions are used both independently ("Ты взÑл мÑч?")
--- and after interrogative adverbials ("Почему ты взÑл мÑч?").
-
--- Note: The particle "ли" can also be used in direct questions:
--- Видел ли ты что-нибудь подобное?
--- but we are not considering this case.
-
- questVerbPhrase : NounPhrase -> VerbPhrase -> Question =
- \tu,spish ->
- let { vu = tu.s ! (mkPronForm Nom No NonPoss);
- spish = spish.s ! VFin (gNum tu.g tu.n) tu.p
- ++ spish.s2 ++ spish.s3 ! tu.g ! tu.n } in
- { s = table {
- DirQ => vu ++ spish ;
- IndirQ => spish ++ "ли" ++ vu
- }
- } ;
-
---3 Wh-questions
---
--- Wh-questions are of two kinds: ones that are like $NP - VP$ sentences,
--- others that are like $S/NP - NP$ sentences.
-
- intVerbPhrase : IntPron -> VerbPhrase -> Question = \kto,spit ->
- {s = table { _ => (predVerbPhrase kto spit).s }
- } ;
-
- intSlash : IntPron -> SentenceSlashNounPhrase -> Question = \Kto, yaGovoru ->
- let { kom = Kto.s ! (mkPronForm yaGovoru.c No NonPoss) ; o = yaGovoru.s2 } in
- {s = table { _ => o ++ kom ++ yaGovoru.s }
- } ;
-
---3 Interrogative adverbials
---
--- These adverbials will be defined in the lexicon: they include
--- "когда", "где", "как", "почему", etc, which are all invariant one-word
--- expressions. In addition, they can be formed by adding prepositions
--- to interrogative pronouns, in the same way as adverbials are formed
--- from noun phrases. N.B. we rely on record subtyping when ignoring the
--- position component.
-
- IntAdverb = SS ;
-
--- A question adverbial can be applied to anything, and whether this makes
--- sense is a semantic question.
-
- questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question =
- \kak, tu, pozhivaesh ->
- {s = \\q => kak.s ++ tu.s ! (mkPronForm Nom No NonPoss) ++
- pozhivaesh.s2 ++ pozhivaesh.s ! VFin (gNum tu.g tu.n) tu.p ++
- pozhivaesh.s3 ! tu.g ! tu.n } ;
-
---2 Imperatives
---
--- We only consider second-person imperatives.
-
- Imperative: Type = { s: Gender => Number => Str } ;
-
- imperVerbPhrase : VerbPhrase -> Imperative = \budGotov ->
- {s = \\g, n => budGotov.s ! VImper n P2 ++ budGotov.s2 ++ budGotov.s3 ! g ! n} ;
-
- imperUtterance : Gender -> Number -> Imperative -> Utterance = \g,n,I ->
- ss (I.s ! g ! n ++ "!") ;
-
---3 Coordinating sentences
---
--- We need a category of lists of sentences. It is a discontinuous
--- category, the parts corresponding to 'init' and 'last' segments
--- (rather than 'head' and 'tail', because we have to keep track of the slot between
--- the last two elements of the list). A list has at least two elements.
-
- ListSentence : Type = SD2 ;
-
- twoSentence : (_,_ : Sentence) -> ListSentence = CO.twoSS ;
-
- consSentence : ListSentence -> Sentence -> ListSentence =
- CO.consSS CO.comma ;
-
--- To coordinate a list of sentences by a simple conjunction, we place
--- it between the last two elements; commas are put in the other slots,
--- e.g. "ты куришь, вы пьете и Ñ ÐµÐ¼".
-
- conjunctSentence : Conjunction -> ListSentence -> Sentence = \c,xs ->
- ss (CO.conjunctX c xs) ;
-
--- To coordinate a list of sentences by a distributed conjunction, we place
--- the first part (e.g. "как") in front of the first element, the second
--- part ("так и") between the last two elements, and commas in the other slots.
--- For sentences this is really not used.
-
- conjunctDistrSentence : ConjunctionDistr -> ListSentence -> Sentence =
- \c,xs ->
- ss (CO.conjunctDistrX c xs) ;
-
---3 Coordinating adjective phrases
---
--- The structure is the same as for sentences. The result is a prefix adjective
--- if and only if all elements are prefix.
-
- ListAdjPhrase : Type =
- {s1,s2 : AdjForm => Str ; p : Bool} ;
-
- twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y ->
- CO.twoTable AdjForm x y ** {p = andB x.p y.p} ;
-
- consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x ->
- CO.consTable AdjForm CO.comma xs x ** {p = andB xs.p x.p} ;
-
- conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs ->
- CO.conjunctTable AdjForm c xs ** {p = xs.p} ;
-
- conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase = \c,xs ->
- CO.conjunctDistrTable AdjForm c xs ** {p = xs.p} ;
-
-
---3 Coordinating noun phrases
---
--- The structure is the same as for sentences. The result is either always plural
--- or plural if any of the components is, depending on the conjunction.
-
- ListNounPhrase : Type = { s1,s2 : PronForm => Str ; g: Gender ;
- anim : Animacy ; n : Number ; p : Person ; pron : Bool } ;
-
- twoNounPhrase : (_,_ : NounPhrase) -> ListNounPhrase = \x,y ->
- CO.twoTable PronForm x y ** {n = conjNumber x.n y.n ;
- g = conjGender x.g y.g ; p = conjPerson x.p y.p ;
- pron = conjPron x.pron y.pron ; anim = conjAnim x.anim y.anim } ;
-
- consNounPhrase : ListNounPhrase -> NounPhrase -> ListNounPhrase = \xs,x ->
- CO.consTable PronForm CO.comma xs x **
- {n = conjNumber xs.n x.n ; g = conjGender x.g xs.g ;
- anim = conjAnim x.anim xs.anim ;
- p = conjPerson xs.p x.p; pron = conjPron xs.pron x.pron} ;
-
- conjunctNounPhrase : Conjunction -> ListNounPhrase -> NounPhrase = \c,xs ->
- CO.conjunctTable PronForm c xs ** {n = conjNumber c.n xs.n ;
- anim = xs.anim ;
- p = xs.p; g = xs.g ; pron = xs.pron} ;
-
- conjunctDistrNounPhrase : ConjunctionDistr -> ListNounPhrase -> NounPhrase =
- \c,xs ->
- CO.conjunctDistrTable PronForm c xs ** {n = conjNumber c.n xs.n ;
- p = xs.p ; pron = xs.pron ; anim = xs.anim ;
- g = xs.g } ;
-
--- We have to define a calculus of numbers of persons. For numbers,
--- it is like the conjunction with $Pl$ corresponding to $False$.
-
- conjNumber : Number -> Number -> Number = \m,n -> case <m,n> of {
- <Sg,Sg> => Sg ;
- _ => Pl
- } ;
-
--- For persons, we let the latter argument win ("либо ты, либо Ñ Ð¿Ð¾Ð¹Ð´Ñƒ"
--- but "либо Ñ, либо ты пойдешь"). This is not quite clear.
-
- conjPerson : Person -> Person -> Person = \_,p ->
- p ;
-
--- For pron, we let the latter argument win - "Маша или Ð¼Ð¾Ñ Ð¼Ð°Ð¼Ð°" (Nominative case)
--- but - "моей или Машина мама" (Genetive case) both corresponds to
--- "Masha's or my mother"), which is actually not exactly correct, since
--- different cases should be used - "Машина или Ð¼Ð¾Ñ Ð¼Ð°Ð¼Ð°".
-
- conjPron : Bool -> Bool -> Bool = \_,p ->
- p ;
-
--- For gender in a similar manner as for person:
--- Needed for adjective predicates like:
--- "Маша или ÐžÐ»Ñ - краÑиваÑ", "Ðнтон или Олег - краÑивый",
--- "Маша или Олег - краÑивый".
--- The later is not totally correct, but there is no correct way to say that.
-
- conjGender : Gender -> Gender -> Gender = \_,m -> m ;
-
- conjAnim : Animacy -> Animacy -> Animacy = \_,m -> m ;
-
---2 Subjunction
---
--- Subjunctions ("когда", "еÑли", etc)
--- are a different way to combine sentences than conjunctions.
--- The main clause can be a sentence, an imperative, or a question,
--- but the subjoined clause must be a sentence.
---
--- There are uniformly two variant word orders, e.g.
--- "еÑли ты закуришь, Ñ Ñ€Ð°ÑÑержуÑÑŒ"
--- and "Ñ Ñ€Ð°ÑÑержуÑÑŒ, еÑли ты закуришь".
-
- Subjunction = SS ;
-
- subjunctSentence : Subjunction -> Sentence -> Sentence -> Sentence =
- \if, A, B ->
- ss (subjunctVariants if A.s B.s) ;
-
- subjunctImperative : Subjunction -> Sentence -> Imperative -> Imperative =
- \if, A, B ->
- {s = \\g,n => subjunctVariants if A.s (B.s ! g ! n)} ;
-
- subjunctQuestion : Subjunction -> Sentence -> Question -> Question =
- \if, A, B ->
- {s = \\q => subjunctVariants if A.s (B.s ! q)} ;
-
- subjunctVariants : Subjunction -> Str -> Str -> Str = \if,A,B ->
- variants {if.s ++ A ++ "," ++ B ; B ++ "," ++ if.s ++ A} ;
-
---2 One-word utterances
---
--- An utterance can consist of one phrase of almost any category,
--- the limiting case being one-word utterances. These
--- utterances are often (but not always) in what can be called the
--- default form of a category, e.g. the nominative.
--- This list is far from exhaustive.
-
- useNounPhrase : NounPhrase -> Utterance = \masha ->
- postfixSS "." (defaultNounPhrase masha) ;
-
- useCommonNounPhrase : Number -> CommNounPhrase -> Utterance = \n,mashina ->
- useNounPhrase (indefNounPhrase n mashina) ;
-
- useRegularName : Gender -> SS -> NounPhrase = \g, masha ->
- nameNounPhrase (case g of { Masc => mkProperNameMasc masha.s Animate;
- _ => mkProperNameFem masha.s Animate }) ;
-
--- Here are some default forms.
-
- defaultNounPhrase : NounPhrase -> SS = \masha ->
- ss (masha.s ! PF Nom No NonPoss) ;
-
- defaultQuestion : Question -> SS = \ktoTu ->
- ss (ktoTu.s ! DirQ) ;
-
- defaultSentence : Sentence -> Utterance = \x ->
- x ;
-};
diff --git a/grammars/resource/russian/TestRus.gf b/grammars/resource/russian/TestRus.gf deleted file mode 100644 index 4a160afbe..000000000 --- a/grammars/resource/russian/TestRus.gf +++ /dev/null @@ -1,48 +0,0 @@ --- use this path to read the grammar from the same directory
---# -path=.:../abstract:../../prelude
-
-concrete TestRus of TestAbs = ResRus ** open Syntax in {
-
-flags
- coding=utf8 ;
- startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ;
-
--- a random sample from the lexicon
-
-lin
- Big = bolshoj ;
- Small = malenkij ;
- Old = staruj ;
- Young = molodoj ;
-
- --Connection = cnNoHum (nounReg "connection") ** {s2 = "from" ; s3 = "to"} ; Fun2
- -- American = adj1Malenkij "американÑк" ;
- -- Finnish = adj1Malenkij "финÑк" ;
- -- Married = adjInvar "замужем" ** {s2 = "за"; c = instructive} ;
- --Give = mkDitransVerb (verbNoPart (mkVerb "give" "gave" "given")) [] [] ; V3
- --Prefer = mkDitransVerb (mkVerb "prefer" "preferred" "preferred")) [] "to" ; V3
-
- Man = muzhchina ;
- Woman = zhenchina ;
- Car = mashina ;
- House = dom ;
- Light = svet ;
- Walk = extVerb verbGulyat Act Present ;
- Run = extVerb verbBegat Act Present ;
- Love = mkDirectVerb (extVerb verbLubit Act Present ) ;
- Send = mkDirectVerb (extVerb verbOtpravlyat Act Present ) ;
- Wait = mkDirectVerb (extVerb verbZhdat Act Present );
- Say = extVerb verbGovorit Act Present ; --- works in present tense...
- Prove = extVerb verbDokazuvat Act Present ;
- SwitchOn = mkDirectVerb (extVerb verbVkluchat Act Present ) ;
- SwitchOff = mkDirectVerb (extVerb verbVukluchat Act Present ) ;
-
- Mother = funGen mama ;
- Uncle = funGen dyadya ;
-
- Always = vsegda ;
- Well = chorosho ;
-
- John = mkProperNameMasc "Иван" Animate ;
- Mary = mkProperNameFem "Маш" Animate ;
-};
diff --git a/grammars/resource/russian/Types.gf b/grammars/resource/russian/Types.gf deleted file mode 100644 index b9da5f4e3..000000000 --- a/grammars/resource/russian/Types.gf +++ /dev/null @@ -1,288 +0,0 @@ ---1 Russian Word Classes and Morphological Parameters
---
--- Aarne Ranta, Janna Khegai 2003
---
--- This is a resource module for Russian morphology, defining the
--- morphological parameters and word classes of Russian. It is aimed
--- to be complete w.r.t. the description of word forms.
--- However, it does not include those parameters that are not needed for
--- analysing individual words: such parameters are defined in syntax modules.
---
-
-resource Types = open Prelude in {
-
-flags coding=utf8 ;
-
---2 Enumerated parameter types
---
--- These types are the ones found in school grammars.
--- Their parameter values are atomic.
-
-param
- Gender = Masc | Fem | Neut ;
- Number = Sg | Pl ;
- Case = Nom | Gen | Dat | Acc | Inst | Prepos ;
- Voice = Act | Pass ;
- Aspect = Imperfective | Perfective ;
- Tense = Present | Past ;
- Degree = Pos | Comp | Super ;
- Person = P1 | P2 | P3 ;
- AfterPrep = Yes | No ;
- Possessive = NonPoss | Poss GenNum ;
- Animacy = Animate | Inanimate ;
-
--- A number of Russian nouns have common gender. They can
--- denote both males and females: "умница" (a clever person), "инженер" (an engineer).
--- We overlook this phenomenon for now.
-
--- The AfterPrep parameter is introduced in order to describe
--- the variations of the third person personal pronoun forms
--- depending on whether they come after a preposition or not.
-
--- The Possessive parameter is introduced in order to describe
--- the possessives of personal pronouns, which are used in the
--- Genetive constructions like "мама моÑ" (my mother) instead of
--- "мама менÑ" (the mother of mine).
-
---2 Word classes and hierarchical parameter types
---
--- Real parameter types (i.e. ones on which words and phrases depend)
--- are mostly hierarchical. The alternative would be cross-products of
--- simple parameters, but this would usually overgenerate.
-
--- However, we use the cross-products in complex cases
--- (for example, aspect and tense parameter in the verb description)
--- where the relationship between the parameters are non-trivial
--- even though we aware that some combinations do not exist
--- (for example, present perfective does not exist, but removing
--- this combination would lead to having different descriptions
--- for perfective and imperfective verbs, which we do not want for the
--- sake of uniformity).
-
---3 Nouns
---
--- Common nouns decline according to number and case.
--- For the sake of shorter description these parameters are
--- combined in the type SubstForm.
-
-
-param SubstForm = SF Number Case ;
-
--- Substantives moreover have an inherent gender.
-
-oper
- CommNoun : Type = {s : SubstForm => Str ; g : Gender ; anim : Animacy } ;
- numSF: SubstForm -> Number = \sf -> case sf of
- {
- SF Sg _ => Sg ;
- _ => Pl
- } ;
-
- caseSF: SubstForm -> Case = \sf -> case sf of
- {
- SF _ Nom => Nom ;
- SF _ Gen => Gen ;
- SF _ Dat => Dat ;
- SF _ Inst => Inst ;
- SF _ Acc => Acc ;
- SF _ Prepos => Prepos
- } ;
-
---
---3 Pronouns
---
-
-oper
- Pronoun : Type = { s : PronForm => Str ; n : Number ;
- p : Person ; g: PronGen ; pron: Bool} ;
-
-param PronForm = PF Case AfterPrep Possessive;
-
--- Gender is not morphologically determined for first
--- and second person pronouns.
-
- PronGen = PGen Gender | PNoGen ;
-
--- The following coercion is useful:
-
-oper
- pgen2gen : PronGen -> Gender = \p -> case p of {
- PGen g => g ;
- PNoGen => variants {Masc ; Fem} --- the best we can do for ya, tu
- } ;
-
-oper
- extCase: PronForm -> Case = \pf -> case pf of
- { PF Nom _ _ => Nom ;
- PF Gen _ _ => Gen ;
- PF Dat _ _ => Dat ;
- PF Inst _ _ => Inst ;
- PF Acc _ _ => Acc ;
- PF Prepos _ _ => Prepos
- } ;
-
- mkPronForm: Case -> AfterPrep -> Possessive -> PronForm =
- \c,n,p -> PF c n p ;
-
---3 Adjectives
---
--- Adjectives is a very complex class.
--- The major division is between the comparison degrees.
-
-param
- AdjForm = AF Case Animacy GenNum ;
-
--- Declination forms depend on Case, Animacy , Gender:
--- "большие дома" - "больших домов" (big houses - big houses'),
--- Animacy plays role only in the Accusative case:
--- "Ñ Ð»ÑŽÐ±Ð»ÑŽ большие дома"-"Ñ Ð»ÑŽÐ±Ð»ÑŽ больших мужчин"
--- (I love big houses - I love big men);
--- and on Number: "большой дом" - "большие дома"
--- (a big house - big houses).
--- The plural never makes a gender distinction.
-
- GenNum = ASg Gender | APl ;
-
-oper numGNum : GenNum -> Number = \gn ->
- case gn of { APl => Pl ; _ => Sg } ;
-
-oper genGNum : GenNum -> Gender = \gn ->
- case gn of { ASg Fem => Fem; _ => Masc } ;
-
-oper numAF: AdjForm -> Number = \af ->
- case af of { AF _ _ gn => (numGNum gn) } ;
-
-oper caseAF: AdjForm -> Case = \af ->
- case af of { AF c _ _ => c } ;
-
--- The Degree parameter should also be more complex, since most Russian
--- adjectives have two comparative forms:
--- attributive (syntactic (compound), declinable) -
--- "более выÑокий" (corresponds to "more high")
--- and predicative (indeclinable)- "выше" (higher) and more than one
--- superlative forms: "Ñамый выÑокий" (corresponds to "the most high") -
--- "наивыÑший" (the highest).
-
--- Even one more parameter independent of the degree can be added,
--- since Russian adjectives in the positive degree also have two forms:
--- long (attributive and predicative) - "выÑокий" (high) and short (predicative) - "выÑок"
--- although this parameter will not be exactly orthogonal to the
--- degree parameter.
--- Short form has no case declension, so in principle
--- it can be considered as an additional case.
-
--- Note: although the predicative usage of the long
--- form is perfectly grammatical, it can have a slightly different meaning
--- compared to the short form.
--- For example: "он - больной" (long, predicative) vs.
--- "он - болен" (short, predicative).
-
-oper
- AdjDegr : Type = {s : Degree => AdjForm => Str} ;
-
--- Adjective type includes both non-degree adjective classes:
--- possesive ("мамин"[mother's], "лиÑий" [fox'es])
--- and relative ("руÑÑкий" [Russian]) adjectives.
-
- Adjective : Type = {s : AdjForm => Str} ;
-
-
---3 Verbs
-
--- Mood is the main verb classification parameter.
--- The verb mood can be infinitive, subjunctive, imperative, and indicative.
-
--- Note: subjunctive mood is analytical, i.e. formed from the past form of the
--- indicative mood plus the particle "бы". That is why they have the same GenNum
--- parameter. We choose to keep the "redundant" form in order to indicate
--- the presence of the subjunctive mood in Russian verbs.
-
--- Aspect and Voice parameters are present in every mood, so Voice is put
--- before the mood parameter in verb form description the hierachy.
--- Moreover Aspect is regarded as an inherent parameter of a verb entry.
--- The primary reason for that is that one imperfective form can have several
--- perfective forms: "ломать" - "Ñ-ломать" - "по-ломать" (to break).
--- Besides, the perfective form could be formed from imperfective
--- by prefixation, but also by taking a completely different stem:
--- "говорить"-"Ñказать" (to say). In the later case it is even natural to
--- regard them as different verb entries.
--- Another reason is that looking at the Aspect as an inherent verb parameter
--- seem to be customary in other similar projects:
--- http://starling.rinet.ru/morph.htm
-
--- Note: Of course, the whole inflection table has many redundancies
--- in a sense that many verbs do not have all grammatically possible
--- forms. For example, passive does not exist for the verb
--- "любить" (to love), but exists for the verb "ломать" (to break).
-
--- Depending on the tense verbs conjugate according to combinations
--- of gender, person and number of the verb objects.
--- Participles (Present and Past) and Gerund forms are not included in the
--- current description. This is the verb type used in the lexicon:
-
-oper Verbum : Type = { s: VerbForm => Str ; asp : Aspect };
-
-param
-
- VerbForm = VFORM Voice VerbConj ;
- VerbConj = VIND VTense | VIMP Number Person | VINF | VSUB GenNum ;
- VTense = VPresent Number Person | VPast GenNum | VFuture Number Person ;
-
--- For writing an application grammar one usually doesn't need
--- the whole inflection table, since each verb is used in
--- a particular context that determines some of the parameters
--- (Tense and Voice while Aspect is fixed from the beginning) for certain usage.
--- So we define the "Verb" type, that have these parameters fixed.
--- The conjugation parameters left (Gender, Number, Person)
--- are combined in the "VF" type:
-
-param VF =
- VFin GenNum Person | VImper Number Person | VInf | VSubj GenNum;
-
-oper
- Verb : Type = {s : VF => Str ; t: Tense ; a : Aspect ; w: Voice} ;
-
- extVerb : Verbum -> Voice -> Tense -> Verb = \aller, vox, t ->
- { s = table {
- VFin gn p => case t of {
- Present => aller.s ! VFORM vox (VIND (VPresent (numGNum gn) p)) ;
- Past => aller.s ! VFORM vox (VIND (VPast gn))
- } ;
- VImper n p => aller.s ! VFORM vox (VIMP n p) ;
- VInf => aller.s ! VFORM vox VINF ;
- VSubj gn => aller.s ! VFORM vox (VSUB gn)
- }; t = t ; a = aller.asp ; w = vox } ;
-
-
---3 Other open classes
---
--- Proper names and adverbs are the remaining open classes.
-
-oper
- PNm : Type = {s : Case => Str ; g : Gender} ;
-
--- Adverbials are not inflected (we ignore comparison, and treat
--- compared adverbials as separate expressions; this could be done another way).
-
- Adverb : Type = SS ;
-
-
---3 Closed classes
---
--- The rest of the Russian word classes are closed, i.e. not extensible by new
--- lexical entries. Thus we don't have to know how to build them, but only
--- how to use them, i.e. which parameters they have.
---
-
---3 Relative pronouns
---
--- Relative pronouns are inflected in
--- gender, number, and case just like adjectives.
-
- RelPron : Type = {s : GenNum => Case => Animacy => Str} ;
-
-
---3 Prepositions are just strings.
-
- Preposition = Str ;
-};
diff --git a/grammars/resource/swedish/CombinationsSwe.gf b/grammars/resource/swedish/CombinationsSwe.gf deleted file mode 100644 index 4f8d57de3..000000000 --- a/grammars/resource/swedish/CombinationsSwe.gf +++ /dev/null @@ -1,210 +0,0 @@ ---# -path=.:../nabstract:../../prelude - ---1 The Top-Level Swedish Resource Grammar: Combination Rules --- --- Aarne Ranta 2002 -- 2003 --- --- This is the Swedish concrete syntax of the multilingual resource --- grammar. Most of the work is done in the file $SyntaxSwe.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 $TypesSwe.gf$. - -concrete CombinationsSwe of Combinations = open Prelude, SyntaxSwe in { - -flags - startcat=Phr ; - lexer=text ; - unlexer=text ; - -lincat - CN = {s : Number => SpeciesP => Case => Str ; g : Gender ; x : Sex ; - p : IsComplexCN} ; - N = CommNoun ; - -- = {s : Number => Species => Case => Str ; g : Gender ; x : Sex} ; - NP = NounPhrase ; - -- = {s : NPForm => Str ; g : Gender ; n : Number} ; - PN = {s : Case => Str ; g : Gender ; x : Sex} ; - Det = {s : Gender => Sex => Str ; n : Number ; b : SpeciesP} ; - Fun = Function ; - -- = CommNoun ** {s2 : Preposition} ; - Fun2 = Function ** {s3 : Preposition} ; - Num = {s : Case => Str} ; - Prep = {s : Str} ; - - Adj1 = Adjective ; - -- = {s : AdjFormPos => Case => Str} ; - Adj2 = Adjective ** {s2 : Preposition} ; - AdjDeg = {s : AdjForm => Str} ; - AP = Adjective ** {p : IsPostfixAdj} ; - - V = Verb ; - -- = {s : VForm => Str} ; - VG = Verb ** {s2 : Bool => Str ; s3 : Gender => Number => Str} ; - VP = Verb ** {s2 : Str ; s3 : Gender => Number => Str} ; - TV = TransVerb ; - -- = Verb ** {s2 : Preposition} ; - V3 = TransVerb ** {s3 : Preposition} ; - VS = Verb ; - VV = Verb ** {isAux : Bool} ; - - AdV = {s : Str ; isPost : Bool} ; - - S = Sentence ; - -- = {s : Order => Str} ; - Slash = Sentence ** {s2 : Preposition} ; - RP = {s : RelCase => GenNum => Str ; g : RelGender} ; - RC = {s : GenNum => Str} ; - IP = NounPhrase ; - Qu = {s : QuestForm => Str} ; - Imp = {s : Number => Str} ; - - Phr = {s : Str} ; - - Conj = {s : Str ; n : Number} ; - ConjD = {s1 : Str ; s2 : Str ; n : Number} ; - - ListS = {s1,s2 : Order => Str} ; - ListAP = {s1,s2 : AdjFormPos => Case => Str ; p : Bool} ; - ListNP = {s1,s2 : NPForm => Str ; g : Gender ; n : Number} ; - ---. - -lin - UseN = noun2CommNounPhrase ; - ModAdj = modCommNounPhrase ; - ModGenOne = npGenDet singular noNum ; - ModGenMany = 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 ; - IndefManyNP = indefNounPhraseNum plural ; - DefOneNP = defNounPhrase singular ; - DefManyNP = defNounPhraseNum plural ; - MassNP = detNounPhrase (mkDeterminerSg (detSgInvar []) IndefP) ; - UseInt i = {s = table {Nom => i.s ; Gen => i.s ++ "s"}} ; --- - NoNum = noNum ; - - CNthatS = nounThatSentence ; - - 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 ! adverbForm ! Nom) ; - PrepNP p = prepPhrase p.s ; --- - AdvVP = adVerbPhrase ; - AdvCN = advCommNounPhrase ; - AdvAP = advAdjPhrase ; - - ThereIsCN A = predVerbPhrase npDet - (predVerbGroup True - (complTransVerb (mkDirectVerb verbFinnas) - (indefNounPhrase singular A))) ; - ThereAreCN n A = predVerbPhrase npDet - (predVerbGroup True - (complTransVerb (mkDirectVerb verbFinnas) - (indefNounPhraseNum plural n A))) ; - - PosSlashTV = slashTransVerb True ; - NegSlashTV = slashTransVerb False ; - OneVP = predVerbPhrase npMan ; - - 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 ; - IsThereCN A = questVerbPhrase npDet - (predVerbGroup True - (complTransVerb (mkDirectVerb verbFinnas) - (indefNounPhrase singular A))) ; - AreThereCN n A = questVerbPhrase npDet - (predVerbGroup True - (complTransVerb (mkDirectVerb verbFinnas) - (indefNounPhraseNum plural n A))) ; - - - 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 ; - -} ; diff --git a/grammars/resource/swedish/MorphoSwe.gf b/grammars/resource/swedish/MorphoSwe.gf deleted file mode 100644 index b742fe455..000000000 --- a/grammars/resource/swedish/MorphoSwe.gf +++ /dev/null @@ -1,1162 +0,0 @@ ---1 A Simple Swedish Resource Morphology --- --- Aarne Ranta 2002 --- --- This resource morphology contains definitions needed in the resource --- syntax. It moreover contains copies of the most usual inflectional patterns --- as defined in functional morphology (in the Haskell file $RulesSw.hs$). --- --- We use the parameter types and word classes defined for morphology. - -resource MorphoSwe = TypesSwe ** open Prelude in { - --- The indefinite and definite article -oper - artIndef = table {Utr => "en" ; Neutr => "ett"} ; - - artDef : Bool => GenNum => Str = table { - True => table { - ASg Utr => "den" ; - ASg Neutr => "det" ; -- det gamla huset - APl => variants {"de" ; "dom"} - } ; - False => table {_ => []} -- huset - } ; - --- A simplified verb category: present tense only. -oper - verbVara = extVerb Act vara_1200 ; - verbHava = extVerb Act hava_1198 ; - verbFinnas = mkVerb "finnas" "finns" "finns" ; - --- A simplified conjugation takes three forms in the worst case. - - mkVerb : (supa,super,sup : Str) -> Verb = \supa,super,sup -> - {s = table { - VPres Infinit Act => supa ; - VPres Infinit Pass => supa + "s" ; - VPres Indicat Act => super ; - VPres Indicat Pass => sup + "s" ; - VPres Imperat Act => sup ; - VPres Imparat Pass => sup + "s" - } - } ; - --- Prepositions are just strings. - Preposition = Str ; - --- Relative pronouns have a special case system. $RPrep$ is the form used --- after a preposition (e.g. "det hus i vilket jag bor"). -param - RelCase = RNom | RAcc | RGen | RPrep ; - -oper - relPronForms : RelCase => GenNum => Str = table { - RNom => \\_ => "som" ; - RAcc => \\_ => variants {"som" ; []} ; - RGen => \\_ => "vars" ; - RPrep => pronVilken - } ; - - pronVilken = table { - ASg Utr => "vilken" ; - ASg Neutr => "vilket" ; - APl => "vilka" - } ; - - pronSådan = table { - ASg Utr => "sådan" ; - ASg Neutr => "sådant" ; - APl => "sådana" - } ; - --- What follows are machine-generated inflection paradigms from functional --- morphology. Hence they are low-level paradigms, without any --- abstractions or generalizations: the Haskell code is better in these respects. --- --- The variable names are selected in such a way that the paradigms can be read --- as inflection tables of certain words. - -oper sApa : Str -> Subst = \ap -> - {s = table { - SF Sg Indef Nom => ap + "a" ; - SF Sg Indef Gen => ap + "as" ; - SF Sg Def Nom => ap + "an" ; - SF Sg Def Gen => ap + "ans" ; - SF Pl Indef Nom => ap + "or" ; - SF Pl Indef Gen => ap + "ors" ; - SF Pl Def Nom => ap + "orna" ; - SF Pl Def Gen => ap + "ornas" - } ; - h1 = Utr - } ; - -oper sBil : Str -> Subst = \bil -> - {s = table { - SF Sg Indef Nom => bil ; - SF Sg Indef Gen => bil + "s" ; - SF Sg Def Nom => bil + "en" ; - SF Sg Def Gen => bil + "ens" ; - SF Pl Indef Nom => bil + "ar" ; - SF Pl Indef Gen => bil + "ars" ; - SF Pl Def Nom => bil + "arna" ; - SF Pl Def Gen => bil + "arnas" - } ; - h1 = Utr - } ; - -oper sPojke : Str -> Subst = \pojk -> - {s = table { - SF Sg Indef Nom => pojk + "e" ; - SF Sg Indef Gen => pojk + "es" ; - SF Sg Def Nom => pojk + "en" ; - SF Sg Def Gen => pojk + "ens" ; - SF Pl Indef Nom => pojk + "ar" ; - SF Pl Indef Gen => pojk + "ars" ; - SF Pl Def Nom => pojk + "arna" ; - SF Pl Def Gen => pojk + "arnas" - } ; - h1 = Utr - } ; - -oper sNyckel : Str -> Subst = \nyck -> - {s = table { - SF Sg Indef Nom => nyck + "el" ; - SF Sg Indef Gen => nyck + "els" ; - SF Sg Def Nom => nyck + "eln" ; - SF Sg Def Gen => nyck + "elns" ; - SF Pl Indef Nom => nyck + "lar" ; - SF Pl Indef Gen => nyck + "lars" ; - SF Pl Def Nom => nyck + "larna" ; - SF Pl Def Gen => nyck + "larnas" - } ; - h1 = Utr - } ; - -oper sKam : Str -> Subst = \kam -> - {s = table { - SF Sg Indef Nom => kam ; - SF Sg Indef Gen => kam + "s" ; - SF Sg Def Nom => kam + "men" ; - SF Sg Def Gen => kam + "mens" ; - SF Pl Indef Nom => kam + "mar" ; - SF Pl Indef Gen => kam + "mars" ; - SF Pl Def Nom => kam + "marna" ; - SF Pl Def Gen => kam + "marnas" - } ; - h1 = Utr - } ; - -oper sSak : Str -> Subst = \sak -> - {s = table { - SF Sg Indef Nom => sak ; - SF Sg Indef Gen => sak + "s" ; - SF Sg Def Nom => sak + "en" ; - SF Sg Def Gen => sak + "ens" ; - SF Pl Indef Nom => sak + "er" ; - SF Pl Indef Gen => sak + "ers" ; - SF Pl Def Nom => sak + "erna" ; - SF Pl Def Gen => sak + "ernas" - } ; - h1 = Utr - } ; - -oper sVarelse : Str -> Subst = \varelse -> - {s = table { - SF Sg Indef Nom => varelse ; - SF Sg Indef Gen => varelse + "s" ; - SF Sg Def Nom => varelse + "n" ; - SF Sg Def Gen => varelse + "ns" ; - SF Pl Indef Nom => varelse + "r" ; - SF Pl Indef Gen => varelse + "rs" ; - SF Pl Def Nom => varelse + "rna" ; - SF Pl Def Gen => varelse + "rnas" - } ; - h1 = Utr - } ; - -oper sNivå : Str -> Subst = \nivå -> - {s = table { - SF Sg Indef Nom => nivå ; - SF Sg Indef Gen => nivå + "s" ; - SF Sg Def Nom => nivå + "n" ; - SF Sg Def Gen => nivå + "ns" ; - SF Pl Indef Nom => nivå + "er" ; - SF Pl Indef Gen => nivå + "ers" ; - SF Pl Def Nom => nivå + "erna" ; - SF Pl Def Gen => nivå + "ernas" - } ; - h1 = Utr - } ; - -oper sParti : Str -> Subst = \parti -> - {s = table { - SF Sg Indef Nom => parti ; - SF Sg Indef Gen => parti + "s" ; - SF Sg Def Nom => parti + "et" ; - SF Sg Def Gen => parti + "ets" ; - SF Pl Indef Nom => parti + "er" ; - SF Pl Indef Gen => parti + "ers" ; - SF Pl Def Nom => parti + "erna" ; - SF Pl Def Gen => parti + "ernas" - } ; - h1 = Neutr - } ; - -oper sMuseum : Str -> Subst = \muse -> - {s = table { - SF Sg Indef Nom => muse + "um" ; - SF Sg Indef Gen => muse + "ums" ; - SF Sg Def Nom => muse + "et" ; - SF Sg Def Gen => muse + "ets" ; - SF Pl Indef Nom => muse + "er" ; - SF Pl Indef Gen => muse + "ers" ; - SF Pl Def Nom => muse + "erna" ; - SF Pl Def Gen => muse + "ernas" - } ; - h1 = Neutr - } ; - -oper sRike : Str -> Subst = \rike -> - {s = table { - SF Sg Indef Nom => rike ; - SF Sg Indef Gen => rike + "s" ; - SF Sg Def Nom => rike + "t" ; - SF Sg Def Gen => rike + "ts" ; - SF Pl Indef Nom => rike + "n" ; - SF Pl Indef Gen => rike + "ns" ; - SF Pl Def Nom => rike + "na" ; - SF Pl Def Gen => rike + "nas" - } ; - h1 = Neutr - } ; - -oper sLik : Str -> Subst = \lik -> - {s = table { - SF Sg Indef Nom => lik ; - SF Sg Indef Gen => lik + "s" ; - SF Sg Def Nom => lik + "et" ; - SF Sg Def Gen => lik + "ets" ; - SF Pl Indef Nom => lik ; - SF Pl Indef Gen => lik + "s" ; - SF Pl Def Nom => lik + "en" ; - SF Pl Def Gen => lik + "ens" - } ; - h1 = Neutr - } ; - -oper sRum : Str -> Subst = \rum -> - {s = table { - SF Sg Indef Nom => rum ; - SF Sg Indef Gen => rum + "s" ; - SF Sg Def Nom => rum + "met" ; - SF Sg Def Gen => rum + "mets" ; - SF Pl Indef Nom => rum ; - SF Pl Indef Gen => rum + "s" ; - SF Pl Def Nom => rum + "men" ; - SF Pl Def Gen => rum + "mens" - } ; - h1 = Neutr - } ; - -oper sHus : Str -> Subst = \hus -> - {s = table { - SF Sg Indef Nom => hus ; - SF Sg Indef Gen => hus ; - SF Sg Def Nom => hus + "et" ; - SF Sg Def Gen => hus + "ets" ; - SF Pl Indef Nom => hus ; - SF Pl Indef Gen => hus ; - SF Pl Def Nom => hus + "en" ; - SF Pl Def Gen => hus + "ens" - } ; - h1 = Neutr - } ; - -oper sPapper : Str -> Subst = \papp -> - {s = table { - SF Sg Indef Nom => papp + "er" ; - SF Sg Indef Gen => papp + "ers" ; - SF Sg Def Nom => papp + "ret" ; - SF Sg Def Gen => papp + "rets" ; - SF Pl Indef Nom => papp + "er" ; - SF Pl Indef Gen => papp + "ers" ; - SF Pl Def Nom => papp + "ren" ; - SF Pl Def Gen => papp + "rens" - } ; - h1 = Neutr - } ; - -oper sNummer : Str -> Subst = \num -> - {s = table { - SF Sg Indef Nom => num + "mer" ; - SF Sg Indef Gen => num + "mers" ; - SF Sg Def Nom => num + "ret" ; - SF Sg Def Gen => num + "rets" ; - SF Pl Indef Nom => num + "mer" ; - SF Pl Indef Gen => num + "mers" ; - SF Pl Def Nom => num + "ren" ; - SF Pl Def Gen => num + "rens" - } ; - h1 = Neutr - } ; - -oper sKikare : Str -> Subst = \kikar -> - {s = table { - SF Sg Indef Nom => kikar + "e" ; - SF Sg Indef Gen => kikar + "es" ; - SF Sg Def Nom => kikar + "en" ; - SF Sg Def Gen => kikar + "ens" ; - SF Pl Indef Nom => kikar + "e" ; - SF Pl Indef Gen => kikar + "es" ; - SF Pl Def Nom => kikar + "na" ; - SF Pl Def Gen => kikar + "nas" - } ; - h1 = Utr - } ; - -oper sProgram : Str -> Subst = \program -> - {s = table { - SF Sg Indef Nom => program ; - SF Sg Indef Gen => program + "s" ; - SF Sg Def Nom => program + "met" ; - SF Sg Def Gen => program + "mets" ; - SF Pl Indef Nom => program ; - SF Pl Indef Gen => program + "s" ; - SF Pl Def Nom => program + "men" ; - SF Pl Def Gen => program + "mens" - } ; - h1 = Neutr - } ; - -oper aFin : Str -> Adj = \fin -> - {s = table { - AF (Posit (Strong (ASg Utr))) Nom => fin ; - AF (Posit (Strong (ASg Utr))) Gen => fin + "s" ; - AF (Posit (Strong (ASg Neutr))) Nom => fin + "t" ; - AF (Posit (Strong (ASg Neutr))) Gen => fin + "ts" ; - AF (Posit (Strong APl)) Nom => fin + "a" ; - AF (Posit (Strong APl)) Gen => fin + "as" ; - AF (Posit (Weak (AxSg NoMasc))) Nom => fin + "a" ; - AF (Posit (Weak (AxSg NoMasc))) Gen => fin + "as" ; - AF (Posit (Weak (AxSg Masc))) Nom => fin + "e" ; - AF (Posit (Weak (AxSg Masc))) Gen => fin + "es" ; - AF (Posit (Weak AxPl)) Nom => fin + "a" ; - AF (Posit (Weak AxPl)) Gen => fin + "as" ; - AF Compar Nom => fin + "are" ; - AF Compar Gen => fin + "ares" ; - AF (Super SupStrong) Nom => fin + "ast" ; - AF (Super SupStrong) Gen => fin + "asts" ; - AF (Super SupWeak) Nom => fin + "aste" ; - AF (Super SupWeak) Gen => fin + "astes" - } - } ; - -oper aFager : Str -> Adj = \fag -> - {s = table { - AF (Posit (Strong (ASg Utr))) Nom => fag + "er" ; - AF (Posit (Strong (ASg Utr))) Gen => fag + "ers" ; - AF (Posit (Strong (ASg Neutr))) Nom => fag + "ert" ; - AF (Posit (Strong (ASg Neutr))) Gen => fag + "erts" ; - AF (Posit (Strong APl)) Nom => fag + "era" ; - AF (Posit (Strong APl)) Gen => fag + "eras" ; - AF (Posit (Weak (AxSg NoMasc))) Nom => fag + "era" ; - AF (Posit (Weak (AxSg NoMasc))) Gen => fag + "eras" ; - AF (Posit (Weak (AxSg Masc))) Nom => fag + "ere" ; - AF (Posit (Weak (AxSg Masc))) Gen => fag + "eres" ; - AF (Posit (Weak AxPl)) Nom => fag + "era" ; - AF (Posit (Weak AxPl)) Gen => fag + "eras" ; - AF Compar Nom => fag + "erare" ; - AF Compar Gen => fag + "erares" ; - AF (Super SupStrong) Nom => fag + "erast" ; - AF (Super SupStrong) Gen => fag + "erasts" ; - AF (Super SupWeak) Nom => fag + "eraste" ; - AF (Super SupWeak) Gen => fag + "erastes" - } - } ; - -oper aGrund : Str -> Adj = \grun -> - {s = table { - AF (Posit (Strong (ASg Utr))) Nom => grun + "d" ; - AF (Posit (Strong (ASg Utr))) Gen => grun + "ds" ; - AF (Posit (Strong (ASg Neutr))) Nom => grun + "t" ; - AF (Posit (Strong (ASg Neutr))) Gen => grun + "ts" ; - AF (Posit (Strong APl)) Nom => grun + "da" ; - AF (Posit (Strong APl)) Gen => grun + "das" ; - AF (Posit (Weak (AxSg NoMasc))) Nom => grun + "da" ; - AF (Posit (Weak (AxSg NoMasc))) Gen => grun + "das" ; - AF (Posit (Weak (AxSg Masc))) Nom => grun + "de" ; - AF (Posit (Weak (AxSg Masc))) Gen => grun + "des" ; - AF (Posit (Weak AxPl)) Nom => grun + "da" ; - AF (Posit (Weak AxPl)) Gen => grun + "das" ; - AF Compar Nom => grun + "dare" ; - AF Compar Gen => grun + "dares" ; - AF (Super SupStrong) Nom => grun + "dast" ; - AF (Super SupStrong) Gen => grun + "dasts" ; - AF (Super SupWeak) Nom => grun + "daste" ; - AF (Super SupWeak) Gen => grun + "dastes" - } - } ; - -oper aVid : Str -> Adj = \vi -> - {s = table { - AF (Posit (Strong (ASg Utr))) Nom => vi + "d" ; - AF (Posit (Strong (ASg Utr))) Gen => vi + "ds" ; - AF (Posit (Strong (ASg Neutr))) Nom => vi + "tt" ; - AF (Posit (Strong (ASg Neutr))) Gen => vi + "tts" ; - AF (Posit (Strong APl)) Nom => vi + "da" ; - AF (Posit (Strong APl)) Gen => vi + "das" ; - AF (Posit (Weak (AxSg NoMasc))) Nom => vi + "da" ; - AF (Posit (Weak (AxSg NoMasc))) Gen => vi + "das" ; - AF (Posit (Weak (AxSg Masc))) Nom => vi + "de" ; - AF (Posit (Weak (AxSg Masc))) Gen => vi + "des" ; - AF (Posit (Weak AxPl)) Nom => vi + "da" ; - AF (Posit (Weak AxPl)) Gen => vi + "das" ; - AF Compar Nom => vi + "dare" ; - AF Compar Gen => vi + "dares" ; - AF (Super SupStrong) Nom => vi + "dast" ; - AF (Super SupStrong) Gen => vi + "dasts" ; - AF (Super SupWeak) Nom => vi + "daste" ; - AF (Super SupWeak) Gen => vi + "dastes" - } - } ; - -oper aVaken : Str -> Adj = \vak -> - {s = table { - AF (Posit (Strong (ASg Utr))) Nom => vak + "en" ; - AF (Posit (Strong (ASg Utr))) Gen => vak + "ens" ; - AF (Posit (Strong (ASg Neutr))) Nom => vak + "et" ; - AF (Posit (Strong (ASg Neutr))) Gen => vak + "ets" ; - AF (Posit (Strong APl)) Nom => vak + "na" ; - AF (Posit (Strong APl)) Gen => vak + "nas" ; - AF (Posit (Weak (AxSg NoMasc))) Nom => vak + "na" ; - AF (Posit (Weak (AxSg NoMasc))) Gen => vak + "nas" ; - AF (Posit (Weak (AxSg Masc))) Nom => vak + "ne" ; - AF (Posit (Weak (AxSg Masc))) Gen => vak + "nes" ; - AF (Posit (Weak AxPl)) Nom => vak + "na" ; - AF (Posit (Weak AxPl)) Gen => vak + "nas" ; - AF Compar Nom => vak + "nare" ; - AF Compar Gen => vak + "nares" ; - AF (Super SupStrong) Nom => vak + "nast" ; - AF (Super SupStrong) Gen => vak + "nasts" ; - AF (Super SupWeak) Nom => vak + "naste" ; - AF (Super SupWeak) Gen => vak + "nastes" - } - } ; - -oper aKorkad : Str -> Adj = \korka -> - {s = table { - AF (Posit (Strong (ASg Utr))) Nom => korka + "d" ; - AF (Posit (Strong (ASg Utr))) Gen => korka + "ds" ; - AF (Posit (Strong (ASg Neutr))) Nom => korka + "t" ; - AF (Posit (Strong (ASg Neutr))) Gen => korka + "ts" ; - AF (Posit (Strong APl)) Nom => korka + "de" ; - AF (Posit (Strong APl)) Gen => korka + "des" ; - AF (Posit (Weak (AxSg NoMasc))) Nom => korka + "de" ; - AF (Posit (Weak (AxSg NoMasc))) Gen => korka + "des" ; - AF (Posit (Weak (AxSg Masc))) Nom => korka + "de" ; - AF (Posit (Weak (AxSg Masc))) Gen => korka + "des" ; - AF (Posit (Weak AxPl)) Nom => korka + "de" ; - AF (Posit (Weak AxPl)) Gen => korka + "des" ; - AF Compar Nom => variants {} ; - AF Compar Gen => variants {} ; - AF (Super SupStrong) Nom => variants {} ; - AF (Super SupStrong) Gen => variants {} ; - AF (Super SupWeak) Nom => variants {} ; - AF (Super SupWeak) Gen => variants {} - } - } ; - -oper aAbstrakt : Str -> Adj = \abstrakt -> - {s = table { - AF (Posit (Strong (ASg Utr))) Nom => abstrakt ; - AF (Posit (Strong (ASg Utr))) Gen => abstrakt + "s" ; - AF (Posit (Strong (ASg Neutr))) Nom => abstrakt ; - AF (Posit (Strong (ASg Neutr))) Gen => abstrakt + "s" ; - AF (Posit (Strong APl)) Nom => abstrakt + "a" ; - AF (Posit (Strong APl)) Gen => abstrakt + "as" ; - AF (Posit (Weak (AxSg NoMasc))) Nom => abstrakt + "a" ; - AF (Posit (Weak (AxSg NoMasc))) Gen => abstrakt + "as" ; - AF (Posit (Weak (AxSg Masc))) Nom => abstrakt + "e" ; - AF (Posit (Weak (AxSg Masc))) Gen => abstrakt + "es" ; - AF (Posit (Weak AxPl)) Nom => abstrakt + "a" ; - AF (Posit (Weak AxPl)) Gen => abstrakt + "as" ; - AF Compar Nom => abstrakt + "are" ; - AF Compar Gen => abstrakt + "ares" ; - AF (Super SupStrong) Nom => abstrakt + "ast" ; - AF (Super SupStrong) Gen => abstrakt + "asts" ; - AF (Super SupWeak) Nom => abstrakt + "aste" ; - AF (Super SupWeak) Gen => abstrakt + "astes" - } - } ; - -oper vTala : Str -> Verbum = \tal -> - {s = table { - VF (Pres Ind Act) => tal + "ar" ; - VF (Pres Ind Pass) => tal + "as" ; - VF (Pres Cnj Act) => tal + "e" ; - VF (Pres Cnj Pass) => tal + "es" ; - VF (Pret Ind Act) => tal + "ade" ; - VF (Pret Ind Pass) => tal + "ades" ; - VF (Pret Cnj Act) => tal + "ade" ; - VF (Pret Cnj Pass) => tal + "ades" ; - VF Imper => tal + "a" ; - VI (Inf Act) => tal + "a" ; - VI (Inf Pass) => tal + "as" ; - VI (Supin Act) => tal + "at" ; - VI (Supin Pass) => tal + "ats" ; - VI (PtPres Nom) => tal + "ande" ; - VI (PtPres Gen) => tal + "andes" ; - VI (PtPret (Strong (ASg Utr)) Nom) => tal + "ad" ; - VI (PtPret (Strong (ASg Utr)) Gen) => tal + "ads" ; - VI (PtPret (Strong (ASg Neutr)) Nom) => tal + "at" ; - VI (PtPret (Strong (ASg Neutr)) Gen) => tal + "ats" ; - VI (PtPret (Strong APl) Nom) => tal + "ade" ; - VI (PtPret (Strong APl) Gen) => tal + "ades" ; - VI (PtPret (Weak (AxSg NoMasc)) Nom) => tal + "ade" ; - VI (PtPret (Weak (AxSg NoMasc)) Gen) => tal + "ades" ; - VI (PtPret (Weak (AxSg Masc)) Nom) => tal + "ade" ; - VI (PtPret (Weak (AxSg Masc)) Gen) => tal + "ades" ; - VI (PtPret (Weak AxPl) Nom) => tal + "ade" ; - VI (PtPret (Weak AxPl) Gen) => tal + "ades" - } - } ; - -oper vLeka : Str -> Verbum = \lek -> - {s = table { - VF (Pres Ind Act) => lek + "er" ; - VF (Pres Ind Pass) => variants {lek + "s" ; lek + "es"} ; - VF (Pres Cnj Act) => lek + "e" ; - VF (Pres Cnj Pass) => lek + "es" ; - VF (Pret Ind Act) => lek + "te" ; - VF (Pret Ind Pass) => lek + "tes" ; - VF (Pret Cnj Act) => lek + "te" ; - VF (Pret Cnj Pass) => lek + "tes" ; - VF Imper => lek ; - VI (Inf Act) => lek + "a" ; - VI (Inf Pass) => lek + "as" ; - VI (Supin Act) => lek + "t" ; - VI (Supin Pass) => lek + "ts" ; - VI (PtPres Nom) => lek + "ande" ; - VI (PtPres Gen) => lek + "andes" ; - VI (PtPret (Strong (ASg Utr)) Nom) => lek + "t" ; - VI (PtPret (Strong (ASg Utr)) Gen) => lek + "ts" ; - VI (PtPret (Strong (ASg Neutr)) Nom) => lek + "t" ; - VI (PtPret (Strong (ASg Neutr)) Gen) => lek + "ts" ; - VI (PtPret (Strong APl) Nom) => lek + "ta" ; - VI (PtPret (Strong APl) Gen) => lek + "tas" ; - VI (PtPret (Weak (AxSg NoMasc)) Nom) => lek + "ta" ; - VI (PtPret (Weak (AxSg NoMasc)) Gen) => lek + "tas" ; - VI (PtPret (Weak (AxSg Masc)) Nom) => lek + "te" ; - VI (PtPret (Weak (AxSg Masc)) Gen) => lek + "tes" ; - VI (PtPret (Weak AxPl) Nom) => lek + "ta" ; - VI (PtPret (Weak AxPl) Gen) => lek + "tas" - } - } ; - -oper vTyda : Str -> Verbum = \ty -> - {s = table { - VF (Pres Ind Act) => ty + "der" ; - VF (Pres Ind Pass) => variants {ty + "ds" ; ty + "des"} ; - VF (Pres Cnj Act) => ty + "de" ; - VF (Pres Cnj Pass) => ty + "des" ; - VF (Pret Ind Act) => ty + "dde" ; - VF (Pret Ind Pass) => ty + "ddes" ; - VF (Pret Cnj Act) => ty + "dde" ; - VF (Pret Cnj Pass) => ty + "ddes" ; - VF Imper => ty + "d" ; - VI (Inf Act) => ty + "da" ; - VI (Inf Pass) => ty + "das" ; - VI (Supin Act) => ty + "tt" ; - VI (Supin Pass) => ty + "tts" ; - VI (PtPres Nom) => ty + "dande" ; - VI (PtPres Gen) => ty + "dandes" ; - VI (PtPret (Strong (ASg Utr)) Nom) => ty + "dd" ; - VI (PtPret (Strong (ASg Utr)) Gen) => ty + "dds" ; - VI (PtPret (Strong (ASg Neutr)) Nom) => ty + "tt" ; - VI (PtPret (Strong (ASg Neutr)) Gen) => ty + "tts" ; - VI (PtPret (Strong APl) Nom) => ty + "dda" ; - VI (PtPret (Strong APl) Gen) => ty + "ddas" ; - VI (PtPret (Weak (AxSg NoMasc)) Nom) => ty + "dda" ; - VI (PtPret (Weak (AxSg NoMasc)) Gen) => ty + "ddas" ; - VI (PtPret (Weak (AxSg Masc)) Nom) => ty + "dde" ; - VI (PtPret (Weak (AxSg Masc)) Gen) => ty + "ddes" ; - VI (PtPret (Weak AxPl) Nom) => ty + "dda" ; - VI (PtPret (Weak AxPl) Gen) => ty + "ddas" - } - } ; - -oper vVända : Str -> Verbum = \vän -> - {s = table { - VF (Pres Ind Act) => vän + "der" ; - VF (Pres Ind Pass) => variants {vän + "ds" ; vän + "des"} ; - VF (Pres Cnj Act) => vän + "de" ; - VF (Pres Cnj Pass) => vän + "des" ; - VF (Pret Ind Act) => vän + "de" ; - VF (Pret Ind Pass) => vän + "des" ; - VF (Pret Cnj Act) => vän + "de" ; - VF (Pret Cnj Pass) => vän + "des" ; - VF Imper => vän + "d" ; - VI (Inf Act) => vän + "da" ; - VI (Inf Pass) => vän + "das" ; - VI (Supin Act) => vän + "t" ; - VI (Supin Pass) => vän + "ts" ; - VI (PtPres Nom) => vän + "dande" ; - VI (PtPres Gen) => vän + "dandes" ; - VI (PtPret (Strong (ASg Utr)) Nom) => vän + "d" ; - VI (PtPret (Strong (ASg Utr)) Gen) => vän + "ds" ; - VI (PtPret (Strong (ASg Neutr)) Nom) => vän + "t" ; - VI (PtPret (Strong (ASg Neutr)) Gen) => vän + "ts" ; - VI (PtPret (Strong APl) Nom) => vän + "da" ; - VI (PtPret (Strong APl) Gen) => vän + "das" ; - VI (PtPret (Weak (AxSg NoMasc)) Nom) => vän + "da" ; - VI (PtPret (Weak (AxSg NoMasc)) Gen) => vän + "das" ; - VI (PtPret (Weak (AxSg Masc)) Nom) => vän + "de" ; - VI (PtPret (Weak (AxSg Masc)) Gen) => vän + "des" ; - VI (PtPret (Weak AxPl) Nom) => vän + "da" ; - VI (PtPret (Weak AxPl) Gen) => vän + "das" - } - } ; - -oper vByta : Str -> Verbum = \by -> - {s = table { - VF (Pres Ind Act) => by + "ter" ; - VF (Pres Ind Pass) => variants {by + "ts" ; by + "tes"} ; - VF (Pres Cnj Act) => by + "te" ; - VF (Pres Cnj Pass) => by + "tes" ; - VF (Pret Ind Act) => by + "tte" ; - VF (Pret Ind Pass) => by + "ttes" ; - VF (Pret Cnj Act) => by + "tte" ; - VF (Pret Cnj Pass) => by + "ttes" ; - VF Imper => by + "t" ; - VI (Inf Act) => by + "ta" ; - VI (Inf Pass) => by + "tas" ; - VI (Supin Act) => by + "tt" ; - VI (Supin Pass) => by + "tts" ; - VI (PtPres Nom) => by + "tande" ; - VI (PtPres Gen) => by + "tandes" ; - VI (PtPret (Strong (ASg Utr)) Nom) => by + "tt" ; - VI (PtPret (Strong (ASg Utr)) Gen) => by + "tts" ; - VI (PtPret (Strong (ASg Neutr)) Nom) => by + "tt" ; - VI (PtPret (Strong (ASg Neutr)) Gen) => by + "tts" ; - VI (PtPret (Strong APl) Nom) => by + "tta" ; - VI (PtPret (Strong APl) Gen) => by + "ttas" ; - VI (PtPret (Weak (AxSg NoMasc)) Nom) => by + "tta" ; - VI (PtPret (Weak (AxSg NoMasc)) Gen) => by + "ttas" ; - VI (PtPret (Weak (AxSg Masc)) Nom) => by + "tte" ; - VI (PtPret (Weak (AxSg Masc)) Gen) => by + "ttes" ; - VI (PtPret (Weak AxPl) Nom) => by + "tta" ; - VI (PtPret (Weak AxPl) Gen) => by + "ttas" - } - } ; - -oper vGömma : Str -> Verbum = \göm -> - {s = table { - VF (Pres Ind Act) => göm + "mer" ; - VF (Pres Ind Pass) => variants {göm + "s" ; göm + "mes"} ; - VF (Pres Cnj Act) => göm + "me" ; - VF (Pres Cnj Pass) => göm + "mes" ; - VF (Pret Ind Act) => göm + "de" ; - VF (Pret Ind Pass) => göm + "des" ; - VF (Pret Cnj Act) => göm + "de" ; - VF (Pret Cnj Pass) => göm + "des" ; - VF Imper => göm ; - VI (Inf Act) => göm + "ma" ; - VI (Inf Pass) => göm + "mas" ; - VI (Supin Act) => göm + "t" ; - VI (Supin Pass) => göm + "ts" ; - VI (PtPres Nom) => göm + "mande" ; - VI (PtPres Gen) => göm + "mandes" ; - VI (PtPret (Strong (ASg Utr)) Nom) => göm + "d" ; - VI (PtPret (Strong (ASg Utr)) Gen) => göm + "ds" ; - VI (PtPret (Strong (ASg Neutr)) Nom) => göm + "t" ; - VI (PtPret (Strong (ASg Neutr)) Gen) => göm + "ts" ; - VI (PtPret (Strong APl) Nom) => göm + "da" ; - VI (PtPret (Strong APl) Gen) => göm + "das" ; - VI (PtPret (Weak (AxSg NoMasc)) Nom) => göm + "da" ; - VI (PtPret (Weak (AxSg NoMasc)) Gen) => göm + "das" ; - VI (PtPret (Weak (AxSg Masc)) Nom) => göm + "de" ; - VI (PtPret (Weak (AxSg Masc)) Gen) => göm + "des" ; - VI (PtPret (Weak AxPl) Nom) => göm + "da" ; - VI (PtPret (Weak AxPl) Gen) => göm + "das" - } - } ; - -oper vHyra : Str -> Verbum = \hyr -> - {s = table { - VF (Pres Ind Act) => hyr ; - VF (Pres Ind Pass) => variants {hyr + "s" ; hyr + "es"} ; - VF (Pres Cnj Act) => hyr + "e" ; - VF (Pres Cnj Pass) => hyr + "es" ; - VF (Pret Ind Act) => hyr + "de" ; - VF (Pret Ind Pass) => hyr + "des" ; - VF (Pret Cnj Act) => hyr + "de" ; - VF (Pret Cnj Pass) => hyr + "des" ; - VF Imper => hyr ; - VI (Inf Act) => hyr + "a" ; - VI (Inf Pass) => hyr + "as" ; - VI (Supin Act) => hyr + "t" ; - VI (Supin Pass) => hyr + "ts" ; - VI (PtPres Nom) => hyr + "ande" ; - VI (PtPres Gen) => hyr + "andes" ; - VI (PtPret (Strong (ASg Utr)) Nom) => hyr + "d" ; - VI (PtPret (Strong (ASg Utr)) Gen) => hyr + "ds" ; - VI (PtPret (Strong (ASg Neutr)) Nom) => hyr + "t" ; - VI (PtPret (Strong (ASg Neutr)) Gen) => hyr + "ts" ; - VI (PtPret (Strong APl) Nom) => hyr + "da" ; - VI (PtPret (Strong APl) Gen) => hyr + "das" ; - VI (PtPret (Weak (AxSg NoMasc)) Nom) => hyr + "da" ; - VI (PtPret (Weak (AxSg NoMasc)) Gen) => hyr + "das" ; - VI (PtPret (Weak (AxSg Masc)) Nom) => hyr + "de" ; - VI (PtPret (Weak (AxSg Masc)) Gen) => hyr + "des" ; - VI (PtPret (Weak AxPl) Nom) => hyr + "da" ; - VI (PtPret (Weak AxPl) Gen) => hyr + "das" - } - } ; - -oper vTåla : Str -> Verbum = \tål -> - {s = table { - VF (Pres Ind Act) => tål ; - VF (Pres Ind Pass) => variants {tål + "s" ; tål + "es"} ; - VF (Pres Cnj Act) => tål + "e" ; - VF (Pres Cnj Pass) => tål + "es" ; - VF (Pret Ind Act) => tål + "de" ; - VF (Pret Ind Pass) => tål + "des" ; - VF (Pret Cnj Act) => tål + "de" ; - VF (Pret Cnj Pass) => tål + "des" ; - VF Imper => tål ; - VI (Inf Act) => tål + "a" ; - VI (Inf Pass) => tål + "as" ; - VI (Supin Act) => tål + "t" ; - VI (Supin Pass) => tål + "ts" ; - VI (PtPres Nom) => tål + "ande" ; - VI (PtPres Gen) => tål + "andes" ; - VI (PtPret (Strong (ASg Utr)) Nom) => tål + "d" ; - VI (PtPret (Strong (ASg Utr)) Gen) => tål + "ds" ; - VI (PtPret (Strong (ASg Neutr)) Nom) => tål + "t" ; - VI (PtPret (Strong (ASg Neutr)) Gen) => tål + "ts" ; - VI (PtPret (Strong APl) Nom) => tål + "da" ; - VI (PtPret (Strong APl) Gen) => tål + "das" ; - VI (PtPret (Weak (AxSg NoMasc)) Nom) => tål + "da" ; - VI (PtPret (Weak (AxSg NoMasc)) Gen) => tål + "das" ; - VI (PtPret (Weak (AxSg Masc)) Nom) => tål + "de" ; - VI (PtPret (Weak (AxSg Masc)) Gen) => tål + "des" ; - VI (PtPret (Weak AxPl) Nom) => tål + "da" ; - VI (PtPret (Weak AxPl) Gen) => tål + "das" - } - } ; - -oper vFinna : (_,_,_ : Str) -> Verbum = \finn, fann, funn -> - {s = table { - VF (Pres Ind Act) => finn + "er" ; - VF (Pres Ind Pass) => variants {finn + "s" ; finn + "es"} ; - VF (Pres Cnj Act) => finn + "e" ; - VF (Pres Cnj Pass) => finn + "es" ; - VF (Pret Ind Act) => fann ; - VF (Pret Ind Pass) => fann + "s" ; - VF (Pret Cnj Act) => funn + "e" ; - VF (Pret Cnj Pass) => funn + "es" ; - VF Imper => finn ; - VI (Inf Act) => finn + "a" ; - VI (Inf Pass) => finn + "as" ; - VI (Supin Act) => funn + "it" ; - VI (Supin Pass) => funn + "its" ; - VI (PtPres Nom) => finn + "ande" ; - VI (PtPres Gen) => finn + "andes" ; - VI (PtPret (Strong (ASg Utr)) Nom) => funn + "en" ; - VI (PtPret (Strong (ASg Utr)) Gen) => funn + "ens" ; - VI (PtPret (Strong (ASg Neutr)) Nom) => funn + "et" ; - VI (PtPret (Strong (ASg Neutr)) Gen) => funn + "ets" ; - VI (PtPret (Strong APl) Nom) => funn + "a" ; - VI (PtPret (Strong APl) Gen) => funn + "as" ; - VI (PtPret (Weak (AxSg NoMasc)) Nom) => funn + "a" ; - VI (PtPret (Weak (AxSg NoMasc)) Gen) => funn + "as" ; - VI (PtPret (Weak (AxSg Masc)) Nom) => funn + "e" ; - VI (PtPret (Weak (AxSg Masc)) Gen) => funn + "es" ; - VI (PtPret (Weak AxPl) Nom) => funn + "a" ; - VI (PtPret (Weak AxPl) Gen) => funn + "as" - } - } ; - --- machine-generated exceptional inflection tables from rules.Swe.gf - -oper mor_1 : Subst = - {s = table { - SF Sg Indef Nom => variants {"mor" ; "moder"} ; - SF Sg Indef Gen => variants {"mors" ; "moders"} ; - SF Sg Def Nom => "modern" ; - SF Sg Def Gen => "moderns" ; - SF Pl Indef Nom => "mödrar" ; - SF Pl Indef Gen => "mödrars" ; - SF Pl Def Nom => "mödrarna" ; - SF Pl Def Gen => "mödrarnas" - } ; - h1 = Utr - } ; - -oper farbror_8 : Subst = - {s = table { - SF Sg Indef Nom => variants {"farbror" ; "farbroder"} ; - SF Sg Indef Gen => variants {"farbrors" ; "farbroders"} ; - SF Sg Def Nom => "farbrodern" ; - SF Sg Def Gen => "farbroderns" ; - SF Pl Indef Nom => "farbröder" ; - SF Pl Indef Gen => "farbröders" ; - SF Pl Def Nom => "farbröderna" ; - SF Pl Def Gen => "farbrödernas" - } ; - h1 = Utr - } ; - -oper gammal_16 : Adj = - {s = table { - AF (Posit (Strong (ASg Utr))) Nom => "gammal" ; - AF (Posit (Strong (ASg Utr))) Gen => "gammals" ; - AF (Posit (Strong (ASg Neutr))) Nom => "gammalt" ; - AF (Posit (Strong (ASg Neutr))) Gen => "gammalts" ; - AF (Posit (Strong APl)) Nom => "gamla" ; - AF (Posit (Strong APl)) Gen => "gamlas" ; - AF (Posit (Weak (AxSg NoMasc))) Nom => "gamla" ; - AF (Posit (Weak (AxSg NoMasc))) Gen => "gamlas" ; - AF (Posit (Weak (AxSg Masc))) Nom => "gamle" ; - AF (Posit (Weak (AxSg Masc))) Gen => "gamles" ; - AF (Posit (Weak AxPl)) Nom => "gamla" ; - AF (Posit (Weak AxPl)) Gen => "gamlas" ; - AF Compar Nom => "äldre" ; - AF Compar Gen => "äldres" ; - AF (Super SupStrong) Nom => "äldst" ; - AF (Super SupStrong) Gen => "äldsts" ; - AF (Super SupWeak) Nom => "äldsta" ; - AF (Super SupWeak) Gen => "äldstas" - } - } ; - - -oper stor_25 : Adj = - {s = table { - AF (Posit (Strong (ASg Utr))) Nom => "stor" ; - AF (Posit (Strong (ASg Utr))) Gen => "stors" ; - AF (Posit (Strong (ASg Neutr))) Nom => "stort" ; - AF (Posit (Strong (ASg Neutr))) Gen => "storts" ; - AF (Posit (Strong APl)) Nom => "stora" ; - AF (Posit (Strong APl)) Gen => "storas" ; - AF (Posit (Weak (AxSg NoMasc))) Nom => "stora" ; - AF (Posit (Weak (AxSg NoMasc))) Gen => "storas" ; - AF (Posit (Weak (AxSg Masc))) Nom => "store" ; - AF (Posit (Weak (AxSg Masc))) Gen => "stores" ; - AF (Posit (Weak AxPl)) Nom => "stora" ; - AF (Posit (Weak AxPl)) Gen => "storas" ; - AF Compar Nom => "större" ; - AF Compar Gen => "störres" ; - AF (Super SupStrong) Nom => "störst" ; - AF (Super SupStrong) Gen => "störsts" ; - AF (Super SupWeak) Nom => "största" ; - AF (Super SupWeak) Gen => "störstas" - } - } ; - -oper ung_29 : Adj = - {s = table { - AF (Posit (Strong (ASg Utr))) Nom => "ung" ; - AF (Posit (Strong (ASg Utr))) Gen => "ungs" ; - AF (Posit (Strong (ASg Neutr))) Nom => "ungt" ; - AF (Posit (Strong (ASg Neutr))) Gen => "ungts" ; - AF (Posit (Strong APl)) Nom => "unga" ; - AF (Posit (Strong APl)) Gen => "ungas" ; - AF (Posit (Weak (AxSg NoMasc))) Nom => "unga" ; - AF (Posit (Weak (AxSg NoMasc))) Gen => "ungas" ; - AF (Posit (Weak (AxSg Masc))) Nom => "unge" ; - AF (Posit (Weak (AxSg Masc))) Gen => "unges" ; - AF (Posit (Weak AxPl)) Nom => "unga" ; - AF (Posit (Weak AxPl)) Gen => "ungas" ; - AF Compar Nom => "yngre" ; - AF Compar Gen => "yngres" ; - AF (Super SupStrong) Nom => "yngst" ; - AF (Super SupStrong) Gen => "yngsts" ; - AF (Super SupWeak) Nom => "yngsta" ; - AF (Super SupWeak) Gen => "yngstas" - } - } ; - - -oper jag_32 : ProPN = - {s = table { - PNom => "jag" ; - PAcc => "mig" ; - PGen (ASg Utr) => "min" ; - PGen (ASg Neutr) => "mitt" ; - PGen APl => "mina" - } ; - h1 = Utr ; - h2 = Sg ; - h3 = P1 - } ; - -oper du_33 : ProPN = - {s = table { - PNom => "du" ; - PAcc => "dig" ; - PGen (ASg Utr) => "din" ; - PGen (ASg Neutr) => "ditt" ; - PGen APl => "dina" - } ; - h1 = Utr ; - h2 = Sg ; - h3 = P2 - } ; - -oper han_34 : ProPN = - {s = table { - PNom => "han" ; - PAcc => "honom" ; - PGen (ASg Utr) => "hans" ; - PGen (ASg Neutr) => "hans" ; - PGen APl => "hans" - } ; - h1 = Utr ; - h2 = Sg ; - h3 = P3 - } ; - -oper hon_35 : ProPN = - {s = table { - PNom => "hon" ; - PAcc => "henne" ; - PGen (ASg Utr) => "hennes" ; - PGen (ASg Neutr) => "hennes" ; - PGen APl => "hennes" - } ; - h1 = Utr ; - h2 = Sg ; - h3 = P3 - } ; - -oper vi_36 : ProPN = - {s = table { - PNom => "vi" ; - PAcc => "oss" ; - PGen (ASg Utr) => "vår" ; - PGen (ASg Neutr) => "vårt" ; - PGen APl => "våra" - } ; - h1 = Utr ; - h2 = Pl ; - h3 = P1 - } ; - -oper ni_37 : ProPN = - {s = table { - PNom => "ni" ; - PAcc => "er" ; - PGen (ASg Utr) => "er" ; - PGen (ASg Neutr) => "ert" ; - PGen APl => "era" - } ; - h1 = Utr ; - h2 = Pl ; - h3 = P2 - } ; - -oper de_38 : ProPN = - {s = table { - PNom => "de" ; - PAcc => "dem" ; - PGen (ASg Utr) => "deras" ; - PGen (ASg Neutr) => "deras" ; - PGen APl => "deras" - } ; - h1 = Utr ; - h2 = Pl ; - h3 = P3 - } ; - -oper den_39 : ProPN = - {s = table { - PNom => "den" ; - PAcc => "den" ; - PGen (ASg Utr) => "dess" ; - PGen (ASg Neutr) => "dess" ; - PGen APl => "dess" - } ; - h1 = Utr ; - h2 = Sg ; - h3 = P3 - } ; - -oper det_40 : ProPN = - {s = table { - PNom => "det" ; - PAcc => "det" ; - PGen (ASg Utr) => "dess" ; - PGen (ASg Neutr) => "dess" ; - PGen APl => "dess" - } ; - h1 = Neutr ; - h2 = Sg ; - h3 = P3 - } ; - -oper man_1144 : Subst = - {s = table { - SF Sg Indef Nom => "man" ; - SF Sg Indef Gen => "mans" ; - SF Sg Def Nom => "mannen" ; - SF Sg Def Gen => "mannens" ; - SF Pl Indef Nom => "män" ; - SF Pl Indef Gen => "mäns" ; - SF Pl Def Nom => "männen" ; - SF Pl Def Gen => "männens" - } ; - h1 = Utr - } ; - -oper liten_1146 : Adj = - {s = table { - AF (Posit (Strong (ASg Utr))) Nom => "liten" ; - AF (Posit (Strong (ASg Utr))) Gen => "litens" ; - AF (Posit (Strong (ASg Neutr))) Nom => "litet" ; - AF (Posit (Strong (ASg Neutr))) Gen => "litets" ; - AF (Posit (Strong APl)) Nom => "små" ; - AF (Posit (Strong APl)) Gen => "smås" ; - AF (Posit (Weak (AxSg NoMasc))) Nom => "lilla" ; - AF (Posit (Weak (AxSg NoMasc))) Gen => "lillas" ; - AF (Posit (Weak (AxSg Masc))) Nom => "lille" ; - AF (Posit (Weak (AxSg Masc))) Gen => "lilles" ; - AF (Posit (Weak AxPl)) Nom => "små" ; - AF (Posit (Weak AxPl)) Gen => "smås" ; - AF Compar Nom => "mindre" ; - AF Compar Gen => "mindres" ; - AF (Super SupStrong) Nom => "minst" ; - AF (Super SupStrong) Gen => "minsts" ; - AF (Super SupWeak) Nom => "minsta" ; - AF (Super SupWeak) Gen => "minstas" - } - } ; - -oper giva_1147 : Verbum = - {s = table { - VF (Pres Ind Act) => variants {"giver" ; "ger"} ; - VF (Pres Ind Pass) => variants {"gives" ; "givs" ; "ges"} ; - VF (Pres Conj Act) => "give" ; - VF (Pres Conj Pass) => "gives" ; - VF (Pret Ind Act) => "gav" ; - VF (Pret Ind Pass) => "gavs" ; - VF (Pret Conj Act) => "give" ; - VF (Pret Conj Pass) => "gives" ; - VF Imper => variants {"giv" ; "ge"} ; - VI (Inf Act) => variants {"giva" ; "ge"} ; - VI (Inf Pass) => variants {"givas" ; "ges"} ; - VI (Supin Act) => "givit" ; - VI (Supin Pass) => "givits" ; - VI (PtPres Nom) => "givande" ; - VI (PtPres Gen) => "givandes" ; - VI (PtPret (Strong (ASg Utr)) Nom) => "given" ; - VI (PtPret (Strong (ASg Utr)) Gen) => "givens" ; - VI (PtPret (Strong (ASg Neutr)) Nom) => "givet" ; - VI (PtPret (Strong (ASg Neutr)) Gen) => "givets" ; - VI (PtPret (Strong APl) Nom) => "givna" ; - VI (PtPret (Strong APl) Gen) => "givnas" ; - VI (PtPret (Weak (AxSg NoMasc)) Nom) => "givna" ; - VI (PtPret (Weak (AxSg NoMasc)) Gen) => "givnas" ; - VI (PtPret (Weak (AxSg Masc)) Nom) => "givne" ; - VI (PtPret (Weak (AxSg Masc)) Gen) => "givnes" ; - VI (PtPret (Weak AxPl) Nom) => "givna" ; - VI (PtPret (Weak AxPl) Gen) => "givnas" - } - } ; - -oper gå_1174 : Verbum = - {s = table { - VF (Pres Ind Act) => "går" ; - VF (Pres Ind Pass) => "gås" ; - VF (Pres Cnj Act) => "gå" ; - VF (Pres Cnj Pass) => "gås" ; - VF (Pret Ind Act) => "gick" ; - VF (Pret Ind Pass) => "gicks" ; - VF (Pret Cnj Act) => "ginge" ; - VF (Pret Cnj Pass) => "ginges" ; - VF Imper => "gå" ; - VI (Inf Act) => "gå" ; - VI (Inf Pass) => "gås" ; - VI (Supin Act) => "gått" ; - VI (Supin Pass) => "gåtts" ; - VI (PtPres Nom) => "gående" ; - VI (PtPres Gen) => "gåendes" ; - VI (PtPret (Strong (ASg Utr)) Nom) => "gången" ; - VI (PtPret (Strong (ASg Utr)) Gen) => "gångens" ; - VI (PtPret (Strong (ASg Neutr)) Nom) => "gånget" ; - VI (PtPret (Strong (ASg Neutr)) Gen) => "gångets" ; - VI (PtPret (Strong APl) Nom) => "gångna" ; - VI (PtPret (Strong APl) Gen) => "gångnas" ; - VI (PtPret (Weak (AxSg NoMasc)) Nom) => "gångna" ; - VI (PtPret (Weak (AxSg NoMasc)) Gen) => "gångnas" ; - VI (PtPret (Weak (AxSg Masc)) Nom) => "gångne" ; - VI (PtPret (Weak (AxSg Masc)) Gen) => "gångnes" ; - VI (PtPret (Weak AxPl) Nom) => "gångna" ; - VI (PtPret (Weak AxPl) Gen) => "gångnas" - } - } ; -oper hava_1198 : Verbum = - {s = table { - VF (Pres Ind Act) => variants {"haver" ; "har"} ; - VF (Pres Ind Pass) => variants {"havs" ; "has"} ; - VF (Pres Conj Act) => "have" ; - VF (Pres Conj Pass) => "haves" ; - VF (Pret Ind Act) => "hade" ; - VF (Pret Ind Pass) => "hades" ; - VF (Pret Conj Act) => "hade" ; - VF (Pret Conj Pass) => "hades" ; - VF Imper => variants {"hav" ; "ha"} ; - VI (Inf Act) => variants {"hava" ; "ha"} ; - VI (Inf Pass) => variants {"havas" ; "has"} ; - VI (Supin Act) => "haft" ; - VI (Supin Pass) => "hafts" ; - VI (PtPres Nom) => "havande" ; - VI (PtPres Gen) => "havandes" ; - VI (PtPret (Strong (ASg Utr)) Nom) => variants {} ; - VI (PtPret (Strong (ASg Utr)) Gen) => variants {} ; - VI (PtPret (Strong (ASg Neutr)) Nom) => variants {} ; - VI (PtPret (Strong (ASg Neutr)) Gen) => variants {} ; - VI (PtPret (Strong APl) Nom) => variants {} ; - VI (PtPret (Strong APl) Gen) => variants {} ; - VI (PtPret (Weak (AxSg NoMasc)) Nom) => variants {} ; - VI (PtPret (Weak (AxSg NoMasc)) Gen) => variants {} ; - VI (PtPret (Weak (AxSg Masc)) Nom) => variants {} ; - VI (PtPret (Weak (AxSg Masc)) Gen) => variants {} ; - VI (PtPret (Weak AxPl) Nom) => variants {} ; - VI (PtPret (Weak AxPl) Gen) => variants {} - } - } ; - -oper vara_1200 : Verbum = - {s = table { - VF (Pres Ind Act) => "är" ; - VF (Pres Ind Pass) => variants {} ; - VF (Pres Conj Act) => "vare" ; - VF (Pres Conj Pass) => variants {} ; - VF (Pret Ind Act) => "var" ; - VF (Pret Ind Pass) => variants {} ; - VF (Pret Conj Act) => "vore" ; - VF (Pret Conj Pass) => variants {} ; - VF Imper => "var" ; - VI (Inf Act) => "vara" ; - VI (Inf Pass) => variants {} ; - VI (Supin Act) => "varit" ; - VI (Supin Pass) => variants {} ; - VI (PtPres Nom) => "varande" ; - VI (PtPres Gen) => "varandes" ; - VI (PtPret (Strong (ASg Utr)) Nom) => variants {} ; - VI (PtPret (Strong (ASg Utr)) Gen) => variants {} ; - VI (PtPret (Strong (ASg Neutr)) Nom) => variants {} ; - VI (PtPret (Strong (ASg Neutr)) Gen) => variants {} ; - VI (PtPret (Strong APl) Nom) => variants {} ; - VI (PtPret (Strong APl) Gen) => variants {} ; - VI (PtPret (Weak (AxSg NoMasc)) Nom) => variants {} ; - VI (PtPret (Weak (AxSg NoMasc)) Gen) => variants {} ; - VI (PtPret (Weak (AxSg Masc)) Nom) => variants {} ; - VI (PtPret (Weak (AxSg Masc)) Gen) => variants {} ; - VI (PtPret (Weak AxPl) Nom) => variants {} ; - VI (PtPret (Weak AxPl) Gen) => variants {} - } - } ; -} diff --git a/grammars/resource/swedish/ParadigmsSwe.gf b/grammars/resource/swedish/ParadigmsSwe.gf deleted file mode 100644 index db14351d2..000000000 --- a/grammars/resource/swedish/ParadigmsSwe.gf +++ /dev/null @@ -1,286 +0,0 @@ ---# -path=.:../abstract:../../prelude - ---1 Swedish Lexical Paradigms --- --- Aarne Ranta 2003 --- --- This is an API to the user of the resource grammar --- for adding lexical items. It give shortcuts for forming --- expressions of basic categories: nouns, adjectives, verbs. --- --- Closed categories (determiners, pronouns, conjunctions) are --- accessed through the resource syntax API, $resource.Abs.gf$. --- --- The main difference with $morpho.Swe.gf$ is that the types --- referred to are compiled resource grammar types. We have moreover --- had the design principle of always having existing forms as string --- arguments of the paradigms, not stems. --- --- The following modules are presupposed: - -resource ParadigmsSwe = open (Predef=Predef), Prelude, TypesSwe, SyntaxSwe, Swedish in { - ---2 Parameters --- --- To abstract over gender names, we define the following identifiers. - -oper - utrum : Gender ; - neutrum : Gender ; - - masculine : Sex ; - nonmasculine : Sex ; - --- To abstract over case names, we define the following. - - nominative : Case ; - genitive : Case ; - --- To abstract over number names, we define the following. - - singular : Number ; - plural : Number ; - - ---2 Nouns - --- Worst case: give all nominative forms and the gender. --- The genitive is formed automatically, even when the nominative --- ends with an "s". - - mkN : (_,_,_,_ : Str) -> Gender -> Sex -> N ; - -- man, mannen, män, männen - --- Here are some common patterns, corresponding to school-gramamr declensions. --- Except $nPojke$, $nKarl$, and $nMurare$, --- they are defined to be $nonmasculine$, which means that they don't create --- the definite adjective form with "e" but with "a". - - nApa : Str -> N ; -- apa (apan, apor, aporna) ; utrum - nBil : Str -> N ; -- bil (bilen, bilar, bilarna) ; utrum - nKarl : Str -> N ; -- karl (karlen, karlar, karlarna) ; utrum ; masculine - nPojke : Str -> N ; -- pojke (pojken, pojkar, pojkarna) ; utrum ; masculine - nNyckel : Str -> N ; -- nyckel (nyckeln, nycklar, nycklarna) ; utrum - nRisk : Str -> N ; -- risk (risken, risker, riskerna) ; utrum - nDike : Str -> N ; -- dike (diket, diken, dikena) ; neutrum - nRep : Str -> N ; -- rep (repet, rep, repen) ; neutrum - nPapper : Str -> N ; -- papper (pappret, papper, pappren) ; neutrum - nMurare : Str -> N ; -- murare (muraren, murare, murarna) ; utrum ; masculine - nKikare : Str -> N ; -- kikare (kikaren, kikare, kikarna) ; utrum - --- Nouns used as functions need a preposition. The most common ones are "av", --- "på", and "till". - - mkFun : N -> Preposition -> Fun ; - funAv : N -> Fun ; - funPå : N -> Fun ; - funTill : N -> Fun ; - --- Proper names, with their possibly --- irregular genitive. The regular genitive is "s", omitted after "s". - - mkPN : (_,_ : Str) -> Gender -> Sex -> PN ; -- Karolus, Karoli - pnReg : Str -> Gender -> Sex -> PN ; -- Johan,Johans ; Johannes, Johannes - --- On the top level, it is maybe $CN$ that is used rather than $N$, and --- $NP$ rather than $PN$. - - mkCN : N -> CN ; - mkNP : (Karolus, Karoli : Str) -> Gender -> NP ; - - npReg : Str -> Gender -> NP ; -- Johann, Johanns - - ---2 Adjectives - --- Non-comparison one-place adjectives need four forms in the worst case: --- strong singular, weak singular, plural. - - mkAdj1 : (_,_,_,_ : Str) -> Adj1 ; -- liten, litet, lilla, små - --- Special cases needing one form each are: regular adjectives, --- adjectives with unstressed "e" in the last syllable, those --- ending with "n" as a further special case, and invariable --- adjectives. - - adjReg : Str -> Adj1 ; -- billig (billigt, billiga, billiga) - adjNykter : Str -> Adj1 ; -- nykter (nyktert, nyktra, nyktra) - adjGalen : Str -> Adj1 ; -- galen (galet, galna, galna) - adjInvar : Str -> Adj1 ; -- bra - --- Two-place adjectives need a preposition and a case as extra arguments. - - mkAdj2 : Adj1 -> Str -> Adj2 ; -- delbar, med - mkAdj2Reg : Str -> Str -> Adj2 ; -- - --- Comparison adjectives may need the three four forms for the positive case, plus --- three more forms for the comparison cases. - - mkAdjDeg : (liten, litet, lilla, sma, mindre, minst, minsta : Str) -> AdjDeg ; - --- Some comparison adjectives are completely regular. - - aReg : Str -> AdjDeg ; - --- On top level, there are adjectival phrases. The most common case is --- just to use a one-place adjective. The variation in $adjGen$ is taken --- into account. - - apReg : Str -> AP ; - ---2 Verbs --- --- The fragment only has present tense so far. --- The worst case needs three forms: the infinitive, the indicative, and the --- imperative. - - mkV : (_,_,_ : Str) -> V ; -- vara, är, var; trivas, trivs, trivs - --- The main conjugations need one string each. - - vKoka : Str -> V ; -- tala (talar, tala) - vSteka : Str -> V ; -- leka (leker, lek) - vBo : Str -> V ; -- bo (bor, bo) - - vAndas : Str -> V ; -- andas [all forms the same: also "slåss"] - vTrivas : Str -> V ; -- trivas (trivs, trivs) - --- The verbs 'be' and 'have' are special. - - vVara : V ; - vHa : V ; - --- Two-place verbs, and the special case with direct object. - - mkTV : V -> Preposition -> TV ; -- tycka, om - tvDir : V -> TV ; -- gilla - --- The definitions should not bother the user of the API. So they are --- hidden from the document. ---. - - utrum = Utr ; - neutrum = Neutr ; - masculine = Masc ; - nonmasculine = NoMasc ; - nominative = Nom ; - genitive = Gen ; - -- singular defined in Types - -- plural defined in Types - - mkN = \apa, apan, apor, aporna, g, x -> let - {nom = table { - SF Sg Indef _ => apa ; - SF Sg Def _ => apan ; - SF Pl Indef _ => apor ; - SF Pl Def _ => aporna - } - } in - {s = \\n,d,c => mkCase c (nom ! SF n d Nom) ; - g = g ; x = x ; lock_N = <> - } ; - - -- auxiliaries - mkGenit : Tok -> Tok = \s -> ifTok Tok (Predef.dp 1 s) "s" s (s + "s") ; - mkCase : Case -> Tok -> Tok = \c,t -> case c of { - Nom => t ; - Gen => mkGenit t - } ; - - nApa = \apa -> - let {apor = Predef.tk 1 apa + "or"} in - mkN apa (apa + "n") apor (apor + "na") utrum nonmasculine ; - - nBil = \bil -> - mkN bil (bil + "en") (bil + "ar") (bil + "arna") utrum nonmasculine ; - nKarl = \bil -> - mkN bil (bil + "en") (bil + "ar") (bil + "arna") utrum masculine ; - nPojke = \pojke -> - let {bil = Predef.tk 1 pojke} in - mkN pojke (bil + "en") (bil + "ar") (bil + "arna") utrum masculine ; - nNyckel = \cykel -> - let {cykl = Predef.tk 2 cykel + Predef.dp 1 cykel} in - mkN cykel (cykel + "n") (cykl + "ar") (cykl + "arna") utrum nonmasculine ; - nRisk = \bil -> - mkN bil (bil + "en") (bil + "er") (bil + "erna") utrum nonmasculine ; - nDike = \dike -> - mkN dike (dike + "t") (dike + "n") (dike + "na") neutrum nonmasculine ; - nRep = \rep -> - mkN rep (rep + "et") rep (rep + "en") neutrum nonmasculine ; - nPapper = \cykel -> - let {cykl = Predef.tk 2 cykel + Predef.dp 1 cykel} in - mkN cykel (cykl + "et") cykel (cykl + "en") neutrum nonmasculine ; - nMurare = \murare -> - let {murar = Predef.tk 1 murare} in - mkN murare (murar + "en") murare (murar + "na") utrum masculine ; - nKikare = \murare -> - let {murar = Predef.tk 1 murare} in - mkN murare (murar + "en") murare (murar + "na") utrum nonmasculine ; - - - mkFun x y = SyntaxSwe.mkFun x y ** {lock_Fun = <>} ; - funAv = \f -> mkFun f "av" ; - funPå = \f -> mkFun f "på" ; - funTill = \f -> mkFun f "till" ; - - mkPN = \karolus, karoli, g, x -> - {s = table {Gen => karoli ; _ => karolus} ; g = g ; x = x ; lock_PN = <>} ; - pnReg = \horst -> - mkPN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) ; - - mkCN = UseN ; - mkNP = \a,b,g -> UsePN (mkPN a b g nonmasculine) ; -- gender irrelevant in NP - npReg = \s,g -> UsePN (pnReg s g nonmasculine) ; - - mkAdj1 = \liten, litet, lilla, små -> - {s = table { - Strong (ASg Utr) => \\c => mkCase c liten ; - Strong (ASg Neutr) => \\c => mkCase c litet ; - Strong APl => \\c => mkCase c små ; - Weak (AxSg Masc) => \\c => mkCase c (Predef.tk 1 lilla + "e") ; - Weak _ => \\c => mkCase c lilla - } ; - lock_Adj1 = <> - } ; - - adjReg = \billig -> mkAdj1 billig (billig + "t") (billig + "a") (billig + "a") ; - adjNykter = \nykter -> - let {nyktr = Predef.tk 2 nykter + Predef.dp 1 nykter} in - mkAdj1 nykter (nykter + "t") (nyktr + "a") (nyktr + "a") ; - adjGalen = \galen -> - let {gal = Predef.tk 2 galen} in - mkAdj1 galen (gal + "et") (gal + "na") (gal + "na") ; - adjInvar = \bra -> {s = \\_,_ => bra ; lock_Adj1 = <>} ; - - mkAdj2 = \a,p -> a ** {s2 = p ; lock_Adj2 = <>} ; - mkAdj2Reg = \a -> mkAdj2 (adjReg a) ; - - mkAdjDeg = \liten, litet, lilla, sma, mindre, minst, minsta -> - let {lit = (mkAdj1 liten litet lilla sma).s} in - {s = table { - AF (Posit f) c => lit ! f ! c ; - AF Compar c => mkCase c mindre ; - AF (Super SupStrong) c => mkCase c minst ; - AF (Super SupWeak) c => mkCase c minsta --- masculine! - } ; - lock_AdjDeg = <> - } ; - - aReg = \fin -> mkAdjDeg fin - (fin + "t") (fin + "a") (fin + "a") (fin + "are") (fin + "ast") (fin + "aste") ; - - apReg = \s -> AdjP1 (adjReg s) ; - - mkV x y z = mkVerb x y z ** {lock_V = <>} ; - vKoka = \tala -> mkV tala (tala+"r") tala ; - vSteka = \leka -> let {lek = Predef.tk 1 leka} in mkV leka (lek + "er") lek ; - vBo = \bo -> mkV bo (bo+"r") bo ; - vAndas = \andas -> mkV andas andas andas ; - vTrivas = \trivas -> - let {trivs = Predef.tk 1 trivas + "s"} in mkV trivas trivs trivs ; - vVara = verbVara ** {lock_V = <>} ; - vHa = verbHava ** {lock_V = <>} ; - mkTV x y = mkTransVerb x y ** {lock_TV = <>} ; - tvDir = \v -> mkTV v [] ; - -} ; diff --git a/grammars/resource/swedish/ResSwe.gf b/grammars/resource/swedish/ResSwe.gf deleted file mode 100644 index 4767db0f6..000000000 --- a/grammars/resource/swedish/ResSwe.gf +++ /dev/null @@ -1,221 +0,0 @@ ---1 The Top-Level Swedish Resource Grammar --- --- Aarne Ranta 2002 -- 2003 --- --- This is the Swedish concrete syntax of the multilingual resource --- grammar. Most of the work is done in the file $syntax.Swe.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 $ResAbs.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 $TypesSwe.gf$. - -concrete ResSwe of ResAbs = open Prelude, SyntaxSwe in { - -flags - startcat=Phr ; - parser=chart ; - -lincat - CN = {s : Number => SpeciesP => Case => Str ; g : Gender ; x : Sex ; - p : IsComplexCN} ; - N = CommNoun ; - -- = {s : Number => Species => Case => Str ; g : Gender ; x : Sex} ; - NP = NounPhrase ; - -- = {s : NPForm => Str ; g : Gender ; n : Number} ; - PN = {s : Case => Str ; g : Gender ; x : Sex} ; - Det = {s : Gender => Sex => Str ; n : Number ; b : SpeciesP} ; - Fun = Function ; - -- = CommNoun ** {s2 : Preposition} ; - Fun2 = Function ** {s3 : Preposition} ; - - Adj1 = Adjective ; - -- = {s : AdjFormPos => Case => Str} ; - Adj2 = Adjective ** {s2 : Preposition} ; - AdjDeg = {s : AdjForm => Str} ; - AP = Adjective ** {p : IsPostfixAdj} ; - - V = Verb ; - -- = {s : VForm => Str} ; - VP = Verb ** {s2 : Str ; s3 : Gender => Number => Str} ; - TV = TransVerb ; - -- = Verb ** {s2 : Preposition} ; - V3 = TransVerb ** {s3 : Preposition} ; - VS = Verb ; - - AdV = {s : Str ; isPost : Bool} ; - - S = Sentence ; - -- = {s : Order => Str} ; - Slash = Sentence ** {s2 : Preposition} ; - RP = {s : RelCase => GenNum => Str ; g : RelGender} ; - RC = {s : GenNum => Str} ; - IP = NounPhrase ; - Qu = {s : QuestForm => Str} ; - Imp = {s : Number => Str} ; - - Phr = {s : Str} ; - - Conj = {s : Str ; n : Number} ; - ConjD = {s1 : Str ; s2 : Str ; n : Number} ; - - ListS = {s1,s2 : Order => Str} ; - ListAP = {s1,s2 : AdjFormPos => Case => Str ; p : Bool} ; - ListNP = {s1,s2 : NPForm => Str ; g : Gender ; n : Number} ; - ---. - -lin - UseN = noun2CommNounPhrase ; - ModAdj = modCommNounPhrase ; - ModGenOne = npGenDet singular ; - ModGenMany = 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 ; - IndefManyNP = indefNounPhrase plural ; - DefOneNP = defNounPhrase singular ; - DefManyNP = defNounPhrase plural ; - - CNthatS = nounThatSentence ; - - PredVP = predVerbPhrase ; - PosV = predVerb True ; - NegV = predVerb False ; - PosA = predAdjective True ; - NegA = predAdjective False ; - PosCN = predCommNoun True ; - NegCN = predCommNoun False ; - PosTV = complTransVerb True ; - NegTV = complTransVerb False ; - PosV3 = complDitransVerb True ; - NegV3 = complDitransVerb False ; - PosNP = predNounPhrase True ; - NegNP = predNounPhrase False ; - PosPassV = passVerb True ; - NegPassV = passVerb False ; - PosVS = complSentVerb True ; - NegVS = complSentVerb False ; - VTrans = transAsVerb ; - - AdvVP = adVerbPhrase ; - LocNP = locativeNounPhrase ; - AdvCN = advCommNounPhrase ; - AdvAP = advAdjPhrase ; - - PosSlashTV = slashTransVerb True ; - NegSlashTV = slashTransVerb False ; - OneVP = predVerbPhrase (nameNounPhrase (mkProperName "man" Utr Masc)) ; - - 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 ; - - ImperVP = imperVerbPhrase ; - - IndicPhrase = indicUtt ; - QuestPhrase = interrogUtt ; - ImperOne = imperUtterance singular ; - ImperMany = imperUtterance plural ; - - AdvS = advSentence ; - -lin - 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 ; - - INP = pronNounPhrase jag_32 ; - ThouNP = pronNounPhrase du_33 ; - HeNP = pronNounPhrase han_34 ; - SheNP = pronNounPhrase hon_35 ; - ItNP = pronNounPhrase det_40 ; ---- - WeNP = pronNounPhrase vi_36 ; - YeNP = pronNounPhrase ni_37 ; - TheyNP = pronNounPhrase de_38 ; - - YouNP = let {ni = pronNounPhrase ni_37 } in {s = ni.s ; g = ni.g ; n = Sg} ; - - EveryDet = varjeDet ; - AllDet = allaDet ; - WhichDet = vilkenDet ; - MostDet = flestaDet ; - - HowIAdv = ss "hur" ; - WhenIAdv = ss "när" ; - WhereIAdv = ss "var" ; - WhyIAdv = ss "varför" ; - - AndConj = ss "och" ** {n = Pl} ; - OrConj = ss "eller" ** {n = Sg} ; - BothAnd = sd2 "både" "och" ** {n = Pl} ; - EitherOr = sd2 "antingen" "eller" ** {n = Sg} ; - NeitherNor = sd2 "varken" "eller" ** {n = Sg} ; - IfSubj = ss "om" ; - WhenSubj = ss "när" ; - - PhrYes = ss ["Ja ."] ; - PhrNo = ss ["Nej ."] ; - - VeryAdv = ss "mycket" ; - TooAdv = ss "för" ; - OtherwiseAdv = ss "annars" ; - ThereforeAdv = ss "därför" ; -} ; diff --git a/grammars/resource/swedish/StructuralSwe.gf b/grammars/resource/swedish/StructuralSwe.gf deleted file mode 100644 index d19c7bd77..000000000 --- a/grammars/resource/swedish/StructuralSwe.gf +++ /dev/null @@ -1,115 +0,0 @@ ---# -path=.:../nabstract:../../prelude - ---1 The Top-Level English Resource Grammar: Structural Words --- --- Aarne Ranta 2002 -- 2003 --- -concrete StructuralSwe of Structural = - CombinationsSwe ** open Prelude, SyntaxSwe in { - lin - - INP = pronNounPhrase jag_32 ; - ThouNP = pronNounPhrase du_33 ; - HeNP = pronNounPhrase han_34 ; - SheNP = pronNounPhrase hon_35 ; - ItNP = pronNounPhrase det_40 ; ---- - WeNP n = pronNounPhrase (pronWithNum vi_36 n) ; - YeNP n = pronNounPhrase (pronWithNum ni_37 n) ; - TheyNP = pronNounPhrase de_38 ; - - YouNP = let {ni = pronNounPhrase ni_37 } in {s = ni.s ; g = ni.g ; n = Sg} ; - - EveryDet = varjeDet ; - AllsDet = mkDeterminerPlNum "alla" IndefP ; - WhichDet = vilkenDet ; - MostDet = flestaDet ; - - HowIAdv = ss "hur" ; - WhenIAdv = ss "när" ; - WhereIAdv = ss "var" ; - WhyIAdv = ss "varför" ; - - AndConj = ss "och" ** {n = Pl} ; - OrConj = ss "eller" ** {n = Sg} ; - BothAnd = sd2 "både" "och" ** {n = Pl} ; - EitherOr = sd2 "antingen" "eller" ** {n = Sg} ; - NeitherNor = sd2 "varken" "eller" ** {n = Sg} ; - IfSubj = ss "om" ; - WhenSubj = ss "när" ; - - PhrYes = ss ["Ja ."] ; - PhrNo = ss ["Nej ."] ; - - VeryAdv = ss "mycket" ; - TooAdv = ss "för" ; - OtherwiseAdv = ss "annars" ; - ThereforeAdv = ss "därför" ; - -{- - EveryDet = everyDet ; - AllDet = mkDeterminer Sg "all" ; --- all the missing - AllsDet = mkDeterminerNum Pl "all" ; - WhichDet = whichDet ; - WhichsDet = mkDeterminerNum Pl "which" ; - MostsDet = mostDet ; - MostDet = mkDeterminer Sg "most" ; - SomeDet = mkDeterminer Sg "some" ; - SomesDet = mkDeterminerNum Pl "some" ; - AnyDet = mkDeterminer Sg "any" ; - AnysDet = mkDeterminerNum Pl "any" ; - NoDet = mkDeterminer Sg "no" ; - NosDet = mkDeterminerNum Pl "no" ; - ManyDet = mkDeterminer Sg "many" ; - MuchDet = mkDeterminer Sg ["a lot of"] ; --- - ThisDet = mkDeterminer Sg "this" ; - TheseDet = mkDeterminerNum Pl "these" ; - ThatDet = mkDeterminer Sg "that" ; - ThoseDet = mkDeterminerNum Pl "those" ; - - ThisNP = nameNounPhrase (nameReg "this") ; - ThatNP = nameNounPhrase (nameReg "that") ; - TheseNP n = nameNounPhrase {s = \\c => "these" ++ n.s ! c} ; - ThoseNP n = nameNounPhrase {s = \\c => "those" ++ n.s ! c} ; --} - - EverybodyNP = nameNounPhrase (mkProperName "alleman" Utr Masc) ; - SomebodyNP = nameNounPhrase (mkProperName "någon" Utr Masc) ; - NobodyNP = nameNounPhrase (mkProperName "ingen" Utr Masc) ; - EverythingNP = nameNounPhrase (mkProperName "allting" Neutr NoMasc) ; - SomethingNP = nameNounPhrase (mkProperName "någonting" Neutr NoMasc) ; - NothingNP = nameNounPhrase (mkProperName "ingenting" Neutr NoMasc) ; - - CanVV = mkVerb "kunna" "kan" "kunn" ** {isAux = True} ; --- - CanKnowVV = mkVerb "kunna" "kan" "kunn" ** {isAux = True} ; --- - MustVV = mkVerb "få" "måste" "få" ** {isAux = True} ; --- - WantVV = mkVerb "vilja" "vill" "vilj" ** {isAux = True} ; --- - - EverywhereNP = advPost "varstans" ; - SomewhereNP = advPost "någonstans" ; - NowhereNP = advPost "ingenstans" ; - - AlthoughSubj = ss "fast" ; - - AlmostAdv = ss "nästan" ; - QuiteAdv = ss "ganska" ; - - InPrep = ss "i" ; - OnPrep = ss "på" ; - ToPrep = ss "till" ; - ThroughPrep = ss "genom" ; - AbovePrep = ss "ovanför" ; - UnderPrep = ss "under" ; - InFrontPrep = ss "framför" ; - BehindPrep = ss "bakom" ; - BetweenPrep = ss "mellan" ; - FromPrep = ss "från" ; - BeforePrep = ss "före" ; - DuringPrep = ss "under" ; - AfterPrep = ss "efter" ; - WithPrep = ss "med" ; - WithoutPrep = ss "utan" ; - ByMeansPrep = ss "med" ; - PartPrep = ss "av" ; - AgentPrep = ss "av" ; - -} diff --git a/grammars/resource/swedish/Swedish.gf b/grammars/resource/swedish/Swedish.gf deleted file mode 100644 index 64a6223a5..000000000 --- a/grammars/resource/swedish/Swedish.gf +++ /dev/null @@ -1,4 +0,0 @@ --- use this path to read the grammar from the same directory ---# -path=.:../abstract:../../prelude - -resource Swedish = reuse ResSwe ; diff --git a/grammars/resource/swedish/SyntaxSwe.gf b/grammars/resource/swedish/SyntaxSwe.gf deleted file mode 100644 index a8b0c20dc..000000000 --- a/grammars/resource/swedish/SyntaxSwe.gf +++ /dev/null @@ -1,1138 +0,0 @@ ---1 A Small Swedish Resource Syntax --- --- Aarne Ranta 2002 --- --- This resource grammar contains definitions needed to construct --- indicative, interrogative, and imperative sentences in Swedish. --- --- The following modules are presupposed: - -resource SyntaxSwe = MorphoSwe ** open Prelude, (CO = Coordination) in { - ---2 Common Nouns --- ---3 Simple common nouns - -oper - CommNoun : Type = {s : Number => Species => Case => Str ; g : Gender ; x : Sex} ; - --- When common nouns are extracted from lexicon, the composite noun form is ignored. --- But we have to indicate a sex. - extCommNoun : Sex -> Subst -> CommNoun = \x,sb -> - {s = \\n,b,c => sb.s ! SF n b c ; - g = sb.h1 ; - x = x} ; - --- These constants are used for data abstraction over the parameter type $Num$. - singular = Sg ; - plural = Pl ; - ---3 Common noun phrases - --- The need for this more complex type comes from the variation in the way in --- which a modifying adjective is inflected after different determiners: --- "(en) ful orm" / "(den) fula ormen" / "(min) fula orm". -param - SpeciesP = IndefP | DefP Species ; - --- We also have to be able to decide if a $CommNounPhrase$ is complex --- (to form the definite form: "bilen" / "den stora bilen"). - -oper - IsComplexCN : Type = Bool ; - --- Coercions between simple $Species$ and $SpeciesP$: - unSpeciesP : SpeciesP -> Species = \b -> - case b of {IndefP => Indef ; DefP p => p} ; -- bil/bil/bilen - unSpeciesAdjP : SpeciesP -> Species = \b -> - case b of {IndefP => Indef ; DefP _ => Def} ; -- gammal/gamla/gamla - --- Here's the type itself. - CommNounPhrase : Type = - {s : Number => SpeciesP => Case => Str ; - g : Gender ; x : Sex ; p : IsComplexCN} ; - --- To use a $CommNoun$ as $CommNounPhrase$. - noun2CommNounPhrase : CommNoun -> CommNounPhrase = \hus -> - {s = \\n,b,c => hus.s ! n ! unSpeciesP b ! c ; - g = hus.g ; x = hus.x ; p = False} ; - - n2n = noun2CommNounPhrase ; - - ---2 Noun Phrases --- --- The worst case for noun phrases is pronouns, which have inflection --- in (what is syntactically) their genitive. Most noun phrases can --- ignore this variation. - -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} ; - --- Proper names are a simple kind of noun phrases. However, we want to --- anticipate the rule that proper names can be modified by --- adjectives, even though noun phrases in general cannot - hence the sex. - - ProperName : Type = {s : Case => Str ; g : Gender ; x : Sex} ; - - mkProperName : Str -> Gender -> Sex -> ProperName = \john,g,x -> - {s = table {Nom => john ; Gen => john + "s"} ; g = g ; x = x} ; - - nameNounPhrase : ProperName -> NounPhrase = - \john -> {s = table {c => john.s ! npCase c} ; g = john.g ; n = Sg} ; - - pronNounPhrase : ProPN -> NounPhrase = \jag -> - {s = jag.s ; g = jag.h1 ; n = jag.h2} ; - --- The following construction has to be refined for genitive forms: --- "vi tre", "oss tre" are OK, but "vår tres" is not. - - Numeral : Type = {s : Case => Str} ; - - pronWithNum : ProPN -> Numeral -> ProPN = \we,two -> - {s = \\c => we.s ! c ++ two.s ! npCase c ; - h1 = we.h1 ; - h2 = we.h2 ; - h3 = we.h3 - } ; - - noNum : Numeral = {s = \\_ => []} ; - --- Formal subjects - - npMan = nameNounPhrase (mkProperName "man" Utr Masc) ; - npDet = nameNounPhrase (mkProperName "det" Neutr NoMasc) ; - ---2 Determiners --- --- Determiners are inflected according to noun in gender and sex. --- The number and species of the noun are determined by the determiner. - - Determiner : Type = {s : Gender => Sex => Str ; n : Number ; b : SpeciesP} ; - --- This is the rule for building noun phrases. - - detNounPhrase : Determiner -> CommNounPhrase -> NounPhrase = \en, man -> - {s = table {c => en.s ! man.g ! man.x ++ man.s ! en.n ! en.b ! npCase c} ; - g = man.g ; n = en.n} ; - --- The following macros are sufficient to define most determiners. --- All $SpeciesP$ values come into question: --- "en god vän" - "min gode vän" - "den gode vännen". - - DetSg : Type = Gender => Sex => Str ; - DetPl : Type = Str ; - - mkDeterminerSg : DetSg -> SpeciesP -> Determiner = \en, b -> - {s = en ; n = Sg ; b = b} ; - - mkDeterminerPl : DetPl -> SpeciesP -> Determiner = \alla,b -> - mkDeterminerPlNum alla b noNum ; - - mkDeterminerPlNum : DetPl -> SpeciesP -> Numeral -> Determiner = \alla,b,n -> - {s = \\_,_ => alla ++ n.s ! Nom ; - n = Pl ; - b = b - } ; - - detSgInvar : Str -> DetSg = \varje -> table {_ => table {_ => varje}} ; - --- A large class of determiners can be built from a gender-dependent table. - - mkDeterminerSgGender : (Gender => Str) -> SpeciesP -> Determiner = \en -> - mkDeterminerSg (table {g => table {_ => en ! g}}) ; - --- Here are some examples. We are in fact doing some ad hoc morphology here, --- instead of importing the lexicon. - - varjeDet = mkDeterminerSg (detSgInvar "varje") IndefP ; - allaDet = mkDeterminerPl "alla" IndefP ; - enDet = mkDeterminerSgGender artIndef IndefP ; - - flestaDet = mkDeterminerPl ["de flesta"] IndefP ; - vilkenDet = mkDeterminerSgGender - (table {Utr => "vilken" ; Neutr => "vilket"}) IndefP ; - vilkaDet = mkDeterminerPl "vilka" IndefP ; - - vilkDet : Number -> Determiner = \n -> case n of { - Sg => vilkenDet ; - Pl => vilkaDet - } ; - - någDet : Number -> Determiner = \n -> case n of { - Sg => mkDeterminerSgGender - (table {Utr => "någon" ; Neutr => "något"}) IndefP ; - Pl => mkDeterminerPl "några" IndefP - } ; - - --- Genitives of noun phrases can be used like determiners, to build noun phrases. --- The number argument makes the difference between "min bil" - "mina bilar". - - npGenDet : Number -> Numeral -> NounPhrase -> CommNounPhrase -> NounPhrase = - \n,tre,huset,vin -> { - s = \\c => case n of { - Sg => huset.s ! PGen (ASg vin.g) ++ - vin.s ! Sg ! DefP Indef ! npCase c ; - Pl => huset.s ! PGen APl ++ tre.s ! Nom ++ - vin.s ! Pl ! DefP Indef ! npCase c - } ; - g = vin.g ; - n = n - } ; - --- *Bare plural noun phrases* like "män", "goda vänner", are built without a --- determiner word. But a $Numeral$ may occur. - - plurDet : CommNounPhrase -> NounPhrase = plurDetNum noNum ; - - plurDetNum : Numeral -> CommNounPhrase -> NounPhrase = \num,cn -> - {s = \\c => num.s ! Nom ++ cn.s ! Pl ! IndefP ! npCase c ; - g = cn.g ; - n = Pl - } ; - --- Definite phrases in Swedish are special, since determiner may be absent --- depending on if the noun is complex: "bilen" - "den nya bilen". - - denDet : CommNounPhrase -> NounPhrase = \cn -> - detNounPhrase - (mkDeterminerSgGender (table {g => artDef ! cn.p ! ASg g}) (DefP Def)) cn ; - deDet : Numeral -> CommNounPhrase -> NounPhrase = \n,cn -> - detNounPhrase (mkDeterminerPlNum (artDef ! cn.p ! APl) (DefP Def) n) cn ; - --- It is useful to have macros for indefinite and definite, singular and plural --- noun-phrase-like syncategorematic expressions. - - indefNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n -> - indefNounPhraseNum n noNum ; - - indefNounPhraseNum : Number -> Numeral -> CommNounPhrase -> NounPhrase = - \n,num,hus -> - case n of { - Sg => detNounPhrase enDet hus ; - Pl => plurDetNum num hus - } ; - - defNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n -> - defNounPhraseNum n noNum ; - - defNounPhraseNum : Number -> Numeral -> CommNounPhrase -> NounPhrase = - \n,num,hus -> case n of { - Sg => denDet hus ; - Pl => deDet num hus - } ; - - indefNoun : Number -> CommNounPhrase -> Str = \n,man -> case n of { - Sg => artIndef ! man.g ++ man.s ! Sg ! IndefP ! Nom ; - Pl => man.s ! Pl ! IndefP ! Nom - } ; - --- Constructions like "tanken att två är jämnt" are formed at the --- first place as common nouns, so that one can also have "ett förslag att...". - - nounThatSentence : CommNounPhrase -> Sentence -> CommNounPhrase = \tanke,x -> - {s = \\n,d,c => tanke.s ! n ! d ! c ++ "att" ++ x.s ! Sub ; - g = tanke.g ; - x = tanke.x ; - p = tanke.p - } ; - - ---2 Adjectives ---3 Simple adjectives --- --- A special type of adjectives just having positive forms (for semantic reasons) --- is useful, e.g. "finsk", "trekantig". - - Adjective : Type = {s : AdjFormPos => Case => Str} ; - - extAdjective : Adj -> Adjective = \adj -> - {s = table {f => table {c => adj.s ! AF (Posit f) c}}} ; - --- Coercions between the compound gen-num type and gender and number: - - gNum : Gender -> Number -> GenNum = \g,n -> - case n of {Sg => ASg g ; Pl => APl} ; - - genGN : GenNum -> Gender = \gn -> - case gn of {ASg g => g ; _ => Utr} ; - numGN : GenNum -> Number = \gn -> - case gn of {ASg _ => Sg ; APl => Pl} ; - ---3 Adjective phrases --- --- An adjective phrase may contain a complement, e.g. "yngre än Rolf". --- Then it is used as postfix in modification, e.g. "en man yngre än Rolf". - - IsPostfixAdj = Bool ; - - AdjPhrase : Type = Adjective ** {p : IsPostfixAdj} ; - --- Simple adjectives are not postfix: - - adj2adjPhrase : Adjective -> AdjPhrase = \ny -> ny ** {p = False} ; - ---3 Comparison adjectives - --- We take comparison adjectives directly from --- the lexicon, which has full adjectives: - - AdjDegr = Adj ; - --- Each of the comparison forms has a characteristic use: --- --- Positive forms are used alone, as adjectival phrases ("ung"). - - positAdjPhrase : AdjDegr -> AdjPhrase = \ung -> - {s = table {a => \\c => ung.s ! AF (Posit a) c} ; - p = False - } ; - --- Comparative forms are used with an object of comparison, as --- adjectival phrases ("yngre än Rolf"). - - comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \yngre,rolf -> - {s = \\_, c => yngre.s ! AF Compar Nom ++ "än" ++ rolf.s ! mkNPForm c ; - p = True - } ; - --- Superlative forms are used with a modified noun, picking out the --- maximal representative of a domain ("den yngste mannen"). - - superlNounPhrase : AdjDegr -> CommNounPhrase -> NounPhrase = \yngst,man -> - {s = \\c => let {gn = gNum man.g Sg} in - artDef ! True ! gn ++ - yngst.s ! AF (Super SupWeak) Nom ++ - man.s ! Sg ! DefP Def ! npCase c ; - g = man.g ; - n = Sg - } ; - --- Moreover, superlatives can be used alone as adjectival phrases --- ("yngst", "den yngste" - in free variation). --- N.B. the former is only permitted in predicative position. - - superlAdjPhrase : AdjDegr -> AdjPhrase = \ung -> - {s = \\a,c => variants { - --- artDef ! True ! gn ++ yngst.s ! AF (Super SupWeak) c - ung.s ! AF (Super SupStrong) c - } ; - p = False - } ; - ---3 Two-place adjectives --- --- A two-place adjective is an adjective with a preposition used before --- the complement. (Rem. $Preposition = Str$). - - AdjCompl = Adjective ** {s2 : Preposition} ; - - complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \förtjust,dig -> - {s = \\a,c => förtjust.s ! a ! c ++ förtjust.s2 ++ dig.s ! PAcc ; - p = True - } ; - - ---3 Modification of common nouns --- --- The two main functions of adjective are in predication ("Johan är ung") --- and in modification ("en ung man"). Predication will be defined --- later, in the chapter on verbs. - - modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase = \God,Nybil -> - {s = \\n, b, c => - let { - god = God.s ! mkAdjForm (unSpeciesAdjP b) n Nybil.g Nybil.x ! Nom ; - nybil = Nybil.s ! n ! b ! c - } in - preOrPost God.p nybil god ; - g = Nybil.g ; - x = Nybil.x ; - p = True} ; - --- A special case is modification of a noun that has not yet been modified. --- But it is simply a special case. - - modCommNoun : Adjective -> CommNoun -> CommNounPhrase = \god,bil -> - modCommNounPhrase (adj2adjPhrase god) (n2n bil) ; - --- We have used a straightforward --- method building adjective forms from simple parameters. - - mkAdjForm : Species -> Number -> Gender -> Sex -> AdjFormPos = \b,n,g,x -> - case <b,n> of { - <Indef,Sg> => Strong (ASg g) ; - <Indef,Pl> => Strong APl ; - <Def, Sg> => Weak (AxSg x) ; ---- add masc! - <Def, Pl> => Weak AxPl - } ; - - ---2 Function expressions - --- A function expression is a common noun together with the --- preposition prefixed to its argument ("mor till x"). --- The type is analogous to two-place adjectives and transitive verbs. - - Function = CommNoun ** {s2 : Preposition} ; - - mkFun : CommNoun -> Preposition -> Function = \f,p -> - f ** {s2 = p} ; - --- The application of a function gives, in the first place, a common noun: --- "mor/mödrar till Johan". From this, other rules of the resource grammar --- give noun phrases, such as "modern till Johan", "mödrarna till Johan", --- "mödrarna till Johan och Maria", and "modern till Johan och Maria" (the --- latter two corresponding to distributive and collective functions, --- respectively). Semantics will eventually tell when each --- of the readings is meaningful. - - appFunComm : Function -> NounPhrase -> CommNounPhrase = \värde,x -> - noun2CommNounPhrase - {s = \\n,b => table { - Gen => nonExist ; - _ => värde.s ! n ! b ! Nom ++ värde.s2 ++ x.s ! PAcc - } ; - g = värde.g ; - x = värde.x - } ; - --- It is possible to use a function word as a common noun; the semantics is --- often existential or indexical. - - funAsCommNounPhrase : Function -> CommNounPhrase = - noun2CommNounPhrase ; - --- The following is an aggregate corresponding to the original function application --- producing "Johans mor" and "modern till Johan". It does not appear in the --- resource grammar API any longer. - - appFun : Bool -> Function -> NounPhrase -> NounPhrase = \coll,värde,x -> - let {n = x.n ; nf = if_then_else Number coll Sg n} in - variants { - defNounPhrase nf (appFunComm värde x) ; - npGenDet nf noNum x (noun2CommNounPhrase värde) - } ; - --- Two-place functions add one argument place. - - Function2 = Function ** {s3 : Preposition} ; - --- There application starts by filling the first place. - - appFun2 : Function2 -> NounPhrase -> Function = \flyg, paris -> - {s = \\n,d,c => flyg.s ! n ! d ! c ++ flyg.s2 ++ paris.s ! PAcc ; - g = flyg.g ; - x = flyg.x ; - s2 = flyg.s3 - } ; - - ---2 Verbs - --- Although the Swedish lexicon has full verb inflection, --- we have limited this first version of the resource syntax to --- verbs in present tense. Their mode can be infinitive, imperative, and indicative. - - ---3 Verb phrases --- --- Verb phrases are discontinuous: the parts of a verb phrase are --- (s) an inflected verb, (s2) verb adverbials (such as negation), and --- (s3) complement. This discontinuity is needed in sentence formation --- to account for word order variations. - - VerbPhrase : Type = Verb ** {s2 : Str ; s3 : Gender => Number => Str} ; - VerbGroup : Type = Verb ** {s2 : Bool => Str ; s3 : Gender => Number => Str} ; - - predVerbGroup : Bool -> VerbGroup -> VerbPhrase = \b,vg -> { - s = vg.s ; - s2 = vg.s2 ! b ; - s3 = vg.s3 - } ; - --- 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 -> - se ** { - s2 = negation ; - s3 = \\_,_ => [] - } ; - - negation : Bool => Str = \\b => if_then_Str b [] "inte" ; - --- Verb phrases can also be formed from adjectives ("är snäll"), --- common nouns ("är en man"), and noun phrases ("är den yngste mannen"). --- The third rule is overgenerating: "är varje man" has to be ruled out --- on semantic grounds. - - predAdjective : Adjective -> VerbGroup = \arg -> - verbVara ** { - s2 = negation ; - s3 = \\g,n => arg.s ! mkAdjForm Indef n g NoMasc ! Nom - } ; - - predCommNoun : CommNounPhrase -> VerbGroup = \man -> - verbVara ** { - s2 = negation ; - s3 = \\_,n => indefNoun n man - } ; - - predNounPhrase : NounPhrase -> VerbGroup = \john -> - verbVara ** { - s2 = negation ; - s3 = \\_,_ => john.s ! PNom - } ; - - predAdverb : Adverb -> VerbGroup = \ute -> - verbVara ** { - s2 = negation ; - s3 = \\_,_ => ute.s - } ; - ---3 Transitive verbs --- --- Transitive verbs are verbs with a preposition for the complement, --- in analogy with two-place adjectives and functions. --- One might prefer to use the term "2-place verb", since --- "transitive" traditionally means that the inherent preposition is empty. --- Such a verb is one with a *direct object*. - - TransVerb : Type = Verb ** {s2 : Preposition} ; - - mkTransVerb : Verb -> Preposition -> TransVerb = \v,p -> - v ** {s2 = p} ; - - mkDirectVerb : Verb -> TransVerb = \v -> - mkTransVerb v nullPrep ; - - nullPrep : Preposition = [] ; - - extTransVerb : Verbum -> Preposition -> TransVerb = - \v -> mkTransVerb (extVerb Act v) ; - --- The rule for using transitive verbs is the complementization rule: - - complTransVerb : TransVerb -> NounPhrase -> VerbGroup = \se,dig -> - {s = se.s ; - s2 = negation ; - s3 = \\_,_ => se.s2 ++ dig.s ! PAcc - } ; - --- Transitive verbs with accusative objects can be used passively. --- The function does not check that the verb is transitive. --- Therefore, the function can also be used for "han löps", etc. --- The syntax is the same as for active verbs, with the choice of the --- "s" passive form. - - passVerb : Verb -> VerbGroup = \se -> ---- passive not yet - {s = table {VPres m _ => se.s ! VPres m Pass} ; - s2 = negation ; - s3 = \\_,_ => [] - } ; - --- Transitive verbs can be used elliptically as verbs. The semantics --- is left to applications. The definition is trivial, due to record --- subtyping. - - transAsVerb : TransVerb -> Verb = \love -> - love ; - --- *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. - - DitransVerb = TransVerb ** {s3 : Preposition} ; - - mkDitransVerb : Verb -> Preposition -> Preposition -> DitransVerb = \v,p1,p2 -> - v ** {s2 = p1 ; s3 = p2} ; - - complDitransVerb : - DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup = \ge,dig,vin -> - {s = ge.s ; - s2 = negation ; - s3 = \\_,_ => ge.s2 ++ dig.s ! PAcc ++ ge.s3 ++ vin.s ! PAcc - } ; - - ---2 Adverbials --- --- Adverbials that modify verb phrases are either post- or pre-verbal. --- As a rule of thumb, simple adverbials ("bra","alltid") are pre-verbal, --- but this is not always the case ("här" is post-verbal). - - Adverb : Type = SS ** {isPost : Bool} ; - - advPre : Str -> Adverb = \alltid -> ss alltid ** {isPost = False} ; - advPost : Str -> Adverb = \bra -> ss bra ** {isPost = True} ; - - adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \spelar, bra -> - let {postp = bra.isPost} in - { - --- this unfortunately generates VP#2 ::= VP#2 - s = spelar.s ; - s2 = (if_then_else Str postp [] bra.s) ++ spelar.s2 ; - s3 = \\g,n => spelar.s3 ! g ! n ++ (if_then_else Str postp bra.s []) - } ; - - advAdjPhrase : SS -> AdjPhrase -> AdjPhrase = \mycket, dyr -> - {s = \\a,c => mycket.s ++ dyr.s ! a ! c ; - p = dyr.p - } ; - --- Adverbials are typically generated by prefixing prepositions. --- The rule for creating locative noun phrases by the preposition "i" --- is a little shaky: "i Sverige" but "på Island". - - prepPhrase : Preposition -> NounPhrase -> Adverb = \i,huset -> - advPost (i ++ huset.s ! PAcc) ; - - locativeNounPhrase : NounPhrase -> Adverb = - prepPhrase "i" ; - --- This is a source of the "mannen med teleskopen" ambiguity, and may produce --- strange things, like "bilar alltid" (while "bilar idag" is OK). --- Semantics will have to make finer distinctions among adverbials. - - advCommNounPhrase : CommNounPhrase -> Adverb -> CommNounPhrase = \bil,idag -> - {s = \\n, b, c => bil.s ! n ! b ! c ++ idag.s ; - g = bil.g ; - x = bil.x ; - p = bil.p} ; - - ---2 Sentences --- --- Sentences depend on a *word order parameter* selecting between main clause, --- inverted, and subordinate clause. - -param - Order = Main | Inv | Sub ; - -oper - Sentence : Type = SS1 Order ; - --- This is the traditional $S -> NP VP$ rule. It takes care of both --- word order and agreement. - - predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence = - \Jag, serdiginte -> - let { - jag = Jag.s ! PNom ; - ser = serdiginte.s ! VPres Indicat Act ; - dig = serdiginte.s3 ! Jag.g ! Jag.n ; - inte = serdiginte.s2 - } in - {s = table { - Main => jag ++ ser ++ inte ++ dig ; - Inv => ser ++ jag ++ inte ++ dig ; - Sub => jag ++ inte ++ ser ++ dig - } - } ; - - ---3 Sentence-complement verbs --- --- Sentence-complement verbs take sentences as complements. - - SentenceVerb : Type = Verb ; - - complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \se,duler -> - {s = se.s ; - s2 = negation ; - s3 = \\_,_ => optStr "att" ++ duler.s ! Main - } ; - ---3 Verb-complement verbs --- --- Sentence-complement verbs take verb phrases as complements. --- They can be auxiliaries ("kan", "måste") or ordinary verbs --- ("försöka"); this distinction cannot be done in the multilingual --- API and leads to some anomalies in Swedish, but less so than in English. - - VerbVerb : Type = Verb ** {isAux : Bool} ; - - complVerbVerb : VerbVerb -> VerbGroup -> VerbGroup = \vilja, simma -> - {s = vilja.s ; - s2 = negation ; - s3 = \\g,n => if_then_Str vilja.isAux [] "att" ++ - simma.s ! VPres Infinit Act ++ simma.s2 ! True ++ simma.s3 ! g ! n - } ; - - ---2 Sentences missing noun phrases --- --- This is one instance of Gazdar's *slash categories*, corresponding to his --- $S/NP$. --- We cannot have - nor would we want to have - a productive slash-category former. --- Perhaps a handful more will be needed. --- --- 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 ! VPres Indicat Act ; - inte = negation ! b - } in - {s = table { - Main => jag ++ ser ++ inte ; - Inv => ser ++ jag ++ inte ; - Sub => jag ++ inte ++ ser - } ; - s2 = se.s2 - } ; - - ---2 Relative pronouns and relative clauses --- --- Relative pronouns can be nominative, accusative, or genitive, and --- they depend on gender and number just like adjectives. --- Moreover they may or may not carry their own genders: for instance, --- "som" just transmits the gender of a noun ("tal som är primt"), whereas --- "vars efterföljare" is $Utrum$ independently of the noun --- ("tal vars efterföljare är prim"). --- This variation is expressed by the $RelGender$ type. - - RelPron : Type = {s : RelCase => GenNum => Str ; g : RelGender} ; - -param - RelGender = RNoGen | RG Gender ; - --- The following functions are selectors for relative-specific parameters. - -oper - -- this will be needed in "tal som är jämnt" / "tal vars efterföljare är jämn" - mkGenderRel : RelGender -> Gender -> Gender = \rg,g -> case rg of { - RG gen => gen ; - _ => g - } ; - - relCase : RelCase -> Case = \c -> case c of { - RGen => Gen ; - _ => Nom - } ; - --- The simplest relative pronoun has no gender of its own. As accusative variant, --- it has the omission of the pronoun ("mannen (som) jag ser"). - - identRelPron : RelPron = - {s = table { - RNom => \\_ => "som" ; - RAcc => \\_ => variants {"som" ; []} ; - RGen => \\_ => "vars" ; - RPrep => pronVilken - } ; - g = RNoGen - } ; - --- Composite relative pronouns have the same variation as function --- applications ("efterföljaren till vilket" - "vars efterföljare"). - - funRelPron : Function -> RelPron -> RelPron = \värde,vilken -> - {s = \\c,gn => - variants { - vilken.s ! RGen ! gn ++ värde.s ! numGN gn ! Indef ! relCase c ; - värde.s ! numGN gn ! Def ! Nom ++ värde.s2 ++ vilken.s ! RPrep ! gn - } ; - g = RG värde.g - } ; - --- Relative clauses can be formed from both verb phrases ("som sover") and --- 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} ; - - relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \som,sover -> - {s = \\gn => - som.s ! RNom ! gn ++ sover.s2 ++ sover.s ! VPres Indicat Act ++ - sover.s3 ! mkGenderRel som.g (genGN gn) ! numGN gn - } ; - - relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause = \som,jagTalar -> - {s = \\gn => - let {jagtalar = jagTalar.s ! Sub ; om = jagTalar.s2} in - variants { - som.s ! RAcc ! gn ++ jagtalar ++ om ; - om ++ som.s ! RPrep ! gn ++ jagtalar - } - } ; - --- 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 ++ "att" ++ A.s ! 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 man.g n ; - g = man.g ; - x = man.x ; - p = False - } ; - --- N.B. we do not get the determinative pronoun --- construction "den man som sover" in this way, but only "mannen som sover". --- Thus we need an extra rule: - - detRelClause : Number -> CommNounPhrase -> RelClause -> NounPhrase = - \n,man,somsover -> - {s = \\c => let {gn = gNum man.g n} in - artDef ! True ! gn ++ - man.s ! n ! DefP Indef ! npCase c ++ somsover.s ! gn ; - g = man.g ; - n = n - } ; - - ---2 Interrogative pronouns --- --- If relative pronouns are adjective-like, interrogative pronouns are --- noun-phrase-like. Actually we can use the very same type! - - IntPron : Type = NounPhrase ; - --- In analogy with relative pronouns, we have a rule for applying a function --- to a relative pronoun to create a new one. We can reuse the rule applying --- functions to noun phrases! - - funIntPron : Function -> IntPron -> IntPron = - appFun False ; - --- There is a variety of simple interrogative pronouns: --- "vilken bil", "vem", "vad". - - nounIntPron : Number -> CommNounPhrase -> IntPron = \n -> - detNounPhrase (vilkDet n) ; - - intPronWho : Number -> IntPron = \num -> { - s = table { - PGen _ => "vems" ; - _ => "vem" - } ; - g = Utr ; - n = num - } ; - - intPronWhat : Number -> IntPron = \num -> { - s = table { - PGen _ => nonExist ; --- - _ => "vad" - } ; - n = num ; - g = Neutr - } ; - ---2 Utterances - --- By utterances we mean whole phrases, such as --- 'can be used as moves in a language game': indicatives, questions, imperative, --- and one-word utterances. The rules are far from complete. --- --- N.B. we have not included rules for texts, which we find we cannot say much --- about on this level. In semantically rich GF grammars, texts, dialogues, etc, --- will of course play an important role as categories not reducible to utterances. --- An example is proof texts, whose semantics show a dependence between premises --- and conclusions. Another example is intersentential anaphora. - - Utterance = SS ; - - indicUtt : Sentence -> Utterance = \x -> postfixSS "." (defaultSentence x) ; - interrogUtt : Question -> Utterance = \x -> postfixSS "?" (defaultQuestion x) ; - - ---2 Questions --- --- Questions are either direct ("vem tog bollen") or indirect --- ("vem som tog bollen"). - -param - QuestForm = DirQ | IndirQ ; - -oper - Question = SS1 QuestForm ; - ---3 Yes-no questions --- --- Yes-no questions are used both independently ("tog du bollen") --- and after interrogative adverbials ("varför tog du bollen"). --- It is economical to handle with these two cases by the one --- rule, $questVerbPhrase'$. The only difference is if "om" appears --- in the indirect form. - - questVerbPhrase : NounPhrase -> VerbPhrase -> Question = - questVerbPhrase' False ; - - questVerbPhrase' : Bool -> NounPhrase -> VerbPhrase -> Question = - \adv,du,sover -> - let {dusover = (predVerbPhrase du sover).s} in - {s = table { - DirQ => dusover ! Inv ; - IndirQ => (if_then_else Str adv [] "om") ++ dusover ! Sub - } - } ; - ---3 Wh-questions --- --- 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 - } - } ; - - intSlash : IntPron -> SentenceSlashNounPhrase -> Question = \Vem, jagTalar -> - let { - vem = Vem.s ! PAcc ; - jagtalar = jagTalar.s ! Sub ; - talarjag = jagTalar.s ! Inv ; - om = jagTalar.s2 - } in - {s = table { - DirQ => variants { - vem ++ talarjag ++ om ; - om ++ vem ++ talarjag - } ; - IndirQ => variants { - vem ++ jagtalar ++ om ; - om ++ vem ++ jagtalar - } - } - } ; - ---3 Interrogative adverbials --- --- These adverbials will be defined in the lexicon: they include --- "när", "var", "hur", "varför", etc, which are all invariant one-word --- expressions. In addition, they can be formed by adding prepositions --- to interrogative pronouns, in the same way as adverbials are formed --- from noun phrases. N.B. we rely on record subtyping when ignoring the --- position component. - - IntAdverb = SS ; - - prepIntAdverb : Preposition -> IntPron -> IntAdverb = - prepPhrase ; - --- A question adverbial can be applied to anything, and whether this makes --- sense is a semantic question. - - questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question = - \hur, du, mår -> - {s = \\q => hur.s ++ (questVerbPhrase' True du mår).s ! q} ; - - ---2 Imperatives --- --- We only consider second-person imperatives. - - Imperative = SS1 Number ; - - imperVerbPhrase : VerbPhrase -> Imperative = \titta -> - {s = \\n => titta.s ! VPres Imperat Act ++ titta.s2 ++ titta.s3 ! Utr ! n} ; - - imperUtterance : Number -> Imperative -> Utterance = \n,I -> - ss (I.s ! n ++ "!") ; - ---2 Sentence adverbials --- --- This class covers adverbials such as "annars", "därför", which are prefixed --- to a sentence to form a phrase. - - advSentence : SS -> Sentence -> Utterance = \annars,soverhan -> - ss (annars.s ++ soverhan.s ! Inv ++ ".") ; - - ---2 Coordination --- --- Coordination is to some extent orthogonal to the rest of syntax, and --- has been treated in a generic way in the module $CO$ in the file --- $coordination.gf$. The overall structure is independent of category, --- but there can be differences in parameter dependencies. --- ---3 Conjunctions --- --- Coordinated phrases are built by using conjunctions, which are either --- simple ("och", "eller") or distributed ("både - och", "antingen - eller"). --- --- The conjunction has an inherent number, which is used when conjoining --- noun phrases: "John och Mary är rika" vs. "John eller Mary är rik"; in the --- case of "eller", the result is however plural if any of the disjuncts is. - - Conjunction = CO.Conjunction ** {n : Number} ; - ConjunctionDistr = CO.ConjunctionDistr ** {n : Number} ; - - ---3 Coordinating sentences --- --- We need a category of lists of sentences. It is a discontinuous --- category, the parts corresponding to 'init' and 'last' segments --- (rather than 'head' and 'tail', because we have to keep track of the slot between --- the last two elements of the list). A list has at least two elements. - - ListSentence : Type = {s1,s2 : Order => Str} ; - - twoSentence : (_,_ : Sentence) -> ListSentence = - CO.twoTable Order ; - - consSentence : ListSentence -> Sentence -> ListSentence = - CO.consTable Order CO.comma ; - --- To coordinate a list of sentences by a simple conjunction, we place --- it between the last two elements; commas are put in the other slots, --- e.g. "månen lyser, solen skiner och stjärnorna blinkar". - - conjunctSentence : Conjunction -> ListSentence -> Sentence = - CO.conjunctTable Order ; - - conjunctOrd : Bool -> Conjunction -> CO.ListTable Order -> {s : Order => Str} = - \b,or,xs -> - {s = \\p => xs.s1 ! p ++ or.s ++ xs.s2 ! p} ; - - --- To coordinate a list of sentences by a distributed conjunction, we place --- the first part (e.g. "antingen") in front of the first element, the second --- part ("eller") between the last two elements, and commas in the other slots. --- For sentences this is really not used. - - conjunctDistrSentence : ConjunctionDistr -> ListSentence -> Sentence = - CO.conjunctDistrTable Order ; - ---3 Coordinating adjective phrases --- --- The structure is the same as for sentences. The result is a prefix adjective --- if and only if all elements are prefix. - - ListAdjPhrase : Type = - {s1,s2 : AdjFormPos => Case => Str ; p : Bool} ; - - twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y -> - CO.twoTable2 AdjFormPos Case x y ** {p = andB x.p y.p} ; - consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x -> - CO.consTable2 AdjFormPos Case CO.comma xs x ** {p = andB xs.p x.p} ; - - conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs -> - CO.conjunctTable2 AdjFormPos Case c xs ** {p = xs.p} ; - - conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase = \c,xs -> - CO.conjunctDistrTable2 AdjFormPos Case c xs ** {p = xs.p} ; - - ---3 Coordinating noun phrases --- --- The structure is the same as for sentences. The result is either always plural --- 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} ; - - twoNounPhrase : (_,_ : NounPhrase) -> ListNounPhrase = \x,y -> - CO.twoTable NPForm x y ** {n = conjNumber x.n y.n ; g = conjGender x.g y.g} ; - - 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} ; - - conjunctNounPhrase : Conjunction -> ListNounPhrase -> NounPhrase = \c,xs -> - CO.conjunctTable NPForm c xs ** {n = conjNumber c.n xs.n ; g = xs.g} ; - - conjunctDistrNounPhrase : ConjunctionDistr -> ListNounPhrase -> NounPhrase = - \c,xs -> - CO.conjunctDistrTable NPForm c xs ** {n = conjNumber c.n xs.n ; g = xs.g} ; - --- We hve 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$. - - conjNumber : Number -> Number -> Number = \m,n -> case <m,n> of { - <Sg,Sg> => Sg ; - _ => Pl - } ; - - conjGender : Gender -> Gender -> Gender = \m,n -> case <m,n> of { - <Utr,Utr> => Utr ; - _ => Neutr - } ; - - ---2 Subjunction --- --- Subjunctions ("om", "när", etc) --- are a different way to combine sentences than conjunctions. --- The main clause can be a sentences, an imperatives, or a question, --- but the subjoined clause must be a sentence. --- --- There are uniformly two variant word orders, e.g. "om du sover kommer björnen" --- and "björnen kommer om du sover". - - Subjunction = SS ; - - subjunctSentence : Subjunction -> Sentence -> Sentence -> Sentence = \if, A, B -> - let {As = A.s ! Sub} in - {s = table { - Main => variants {if.s ++ As ++ "," ++ B.s ! Inv ; - B.s ! Main ++ "," ++ if.s ++ As} ; - o => B.s ! o ++ "," ++ if.s ++ As - } - } ; - - subjunctImperative : Subjunction -> Sentence -> Imperative -> Imperative = - \if, A, B -> - {s = \\n => subjunctVariants if A (B.s ! n)} ; - - subjunctQuestion : Subjunction -> Sentence -> Question -> Question = \if, A, B -> - {s = \\q => subjunctVariants if A (B.s ! q)} ; - - subjunctVariants : Subjunction -> Sentence -> Str -> Str = \if,A,B -> - let {As = A.s ! Sub} in - variants {if.s ++ As ++ "," ++ B ; B ++ "," ++ if.s ++ As} ; - - subjunctVerbPhrase : VerbPhrase -> Subjunction -> Sentence -> VerbPhrase = - \V, if, A -> - adVerbPhrase V (advPost (if.s ++ A.s ! Sub)) ; - ---2 One-word utterances --- --- An utterance can consist of one phrase of almost any category, --- the limiting case being one-word utterances. These --- utterances are often (but not always) in what can be called the --- default form of a category, e.g. the nominative. --- This list is far from exhaustive. - - useNounPhrase : NounPhrase -> Utterance = \john -> - postfixSS "." (defaultNounPhrase john) ; - useCommonNounPhrase : Number -> CommNounPhrase -> Utterance = \n,car -> - useNounPhrase (indefNounPhrase n car) ; - --- Here are some default forms. - - defaultNounPhrase : NounPhrase -> SS = \john -> - ss (john.s ! PNom) ; - - defaultQuestion : Question -> SS = \whoareyou -> - ss (whoareyou.s ! DirQ) ; - - defaultSentence : Sentence -> Utterance = \x -> ss (x.s ! Main) ; -} ; diff --git a/grammars/resource/swedish/TestResourceSwe.gf b/grammars/resource/swedish/TestResourceSwe.gf deleted file mode 100644 index 0c4c2018b..000000000 --- a/grammars/resource/swedish/TestResourceSwe.gf +++ /dev/null @@ -1,46 +0,0 @@ ---# -path=.:../nabstract:../../prelude - -concrete TestResourceSwe of TestResource = StructuralSwe ** open SyntaxSwe in { - -flags startcat=Phr ; lexer=text ; unlexer=text ; - --- a random sample from the lexicon - -lin - Big = stor_25 ; - Small = liten_1146 ; - Old = gammal_16 ; - Young = ung_29 ; - American = extAdjective (aFin "amerikansk") ; - Finnish = extAdjective (aFin "finsk") ; - Married = extAdjective (aAbstrakt "gift") ** {s2 = "med"} ; - Man = extCommNoun Masc man_1144 ; - Woman = extCommNoun NoMasc (sApa "kvinn") ; - Car = extCommNoun NoMasc (sBil "bil") ; - House = extCommNoun NoMasc (sHus "hus") ; - Light = extCommNoun NoMasc (sHus "ljus") ; - Walk = extVerb Act gå_1174 ; - Run = extVerb Act (vFinna "spring" "sprang" "sprung") ; - Love = extTransVerb (vTala "älsk") [] ; - Send = extTransVerb (vTala "skick") [] ; - Wait = extTransVerb (vTala "vänt") "på" ; - Give = extTransVerb (vFinna "giv" "gav" "giv") [] ** {s3 = "till"} ; --- ge - Prefer = extTransVerb (vFinna "föredrag" "föredrog" "föredrag") [] ** - {s3 = "framför"} ; --- föredra - - Say = extVerb Act (vLeka "säg") ; --- works in present tense... - Prove = extVerb Act (vTala "bevis") ; - SwitchOn = extTransVerb (vVända "tän") [] ; - SwitchOff = extTransVerb (vLeka "släck") [] ; - - Mother = mkFun (extCommNoun NoMasc mor_1) "till" ; - Uncle = mkFun (extCommNoun Masc farbror_8) "till" ; - Connection = mkFun (extCommNoun NoMasc (sVarelse "förbindelse")) "från" ** - {s3 = "till"} ; - - Always = advPre "alltid" ; - Well = advPost "bra" ; - - John = mkProperName "Johan" Utr Masc ; - Mary = mkProperName "Maria" Utr NoMasc ; -} ; diff --git a/grammars/resource/swedish/TestSwe.gf b/grammars/resource/swedish/TestSwe.gf deleted file mode 100644 index 05d02c5ee..000000000 --- a/grammars/resource/swedish/TestSwe.gf +++ /dev/null @@ -1,47 +0,0 @@ --- use this path to read the grammar from the same directory ---# -path=.:../abstract:../../prelude - -concrete TestSwe of TestAbs = ResSwe ** open SyntaxSwe in { - -flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ; - --- a random sample from the lexicon - -lin - Big = stor_25 ; - Small = liten_1146 ; - Old = gammal_16 ; - Young = ung_29 ; - American = extAdjective (aFin "amerikansk") ; - Finnish = extAdjective (aFin "finsk") ; - Married = extAdjective (aAbstrakt "gift") ** {s2 = "med"} ; - Man = extCommNoun Masc man_1144 ; - Woman = extCommNoun NoMasc (sApa "kvinn") ; - Car = extCommNoun NoMasc (sBil "bil") ; - House = extCommNoun NoMasc (sHus "hus") ; - Light = extCommNoun NoMasc (sHus "ljus") ; - Walk = extVerb Act gå_1174 ; - Run = extVerb Act (vFinna "spring" "sprang" "sprung") ; - Love = extTransVerb (vTala "älsk") [] ; - Send = extTransVerb (vTala "skick") [] ; - Wait = extTransVerb (vTala "vänt") "på" ; - Give = extTransVerb (vFinna "giv" "gav" "giv") [] ** {s3 = "till"} ; --- ge - Prefer = extTransVerb (vFinna "föredrag" "föredrog" "föredrag") [] ** - {s3 = "framför"} ; --- föredra - - Say = extVerb Act (vLeka "säg") ; --- works in present tense... - Prove = extVerb Act (vTala "bevis") ; - SwitchOn = extTransVerb (vVända "tän") [] ; - SwitchOff = extTransVerb (vLeka "släck") [] ; - - Mother = mkFun (extCommNoun NoMasc mor_1) "till" ; - Uncle = mkFun (extCommNoun Masc farbror_8) "till" ; - Connection = mkFun (extCommNoun NoMasc (sVarelse "förbindelse")) "från" ** - {s3 = "till"} ; - - Always = advPre "alltid" ; - Well = advPost "bra" ; - - John = mkProperName "Johan" Utr Masc ; - Mary = mkProperName "Maria" Utr NoMasc ; -} ; diff --git a/grammars/resource/swedish/TypesSwe.gf b/grammars/resource/swedish/TypesSwe.gf deleted file mode 100644 index beead9489..000000000 --- a/grammars/resource/swedish/TypesSwe.gf +++ /dev/null @@ -1,155 +0,0 @@ ---1 Swedish Word Classes and Morphological Parameters --- --- This is a resource module for Swedish morphology, defining the --- morphological parameters and word classes of Swedish. It is aimed --- to be complete w.r.t. the description of word forms. --- However, it does not include those parameters that are not needed for --- analysing individual words: such parameters are defined in syntax modules. --- --- This GF grammar was obtained from the functional morphology file TypesSw.hs --- semi-automatically. The GF inflection engine obtained was obtained automatically. - -resource TypesSwe = open Prelude in { - --- - ---2 Enumerated parameter types --- --- These types are the ones found in school grammars. --- Their parameter values are atomic. - -param - Gender = Utr | Neutr ; - Number = Sg | Pl ; - Species = Indef | Def ; - Case = Nom | Gen ; - Sex = NoMasc | Masc ; - Mode = Ind | Cnj ; - Voice = Act | Pass ; - Degree = Pos | Comp | Sup ; - Person = P1 | P2 | P3 ; - ---2 Word classes and hierarchical parameter types --- --- Real parameter types (i.e. ones on which words and phrases depend) --- are mostly hierarchical. The alternative would be cross-products of --- simple parameters, but this would usually overgenerate. --- - ---3 Substantives --- --- Substantives (= common nouns) have a parameter of type SubstForm. - -param SubstForm = SF Number Species Case ; - --- Substantives moreover have an inherent gender. - -oper Subst : Type = {s : SubstForm => Str ; h1 : Gender} ; - ---3 Adjectives --- --- Adjectives are a very complex class, and the full table has as many as --- 18 different forms. The major division is between the comparison degrees; --- the comparative has only the 2 case forms, whereas the positive has 12 forms. - -param - AdjForm = AF AdjFormGrad Case ; - --- The positive strong forms depend on gender: "en stor bil" - "ett stort hus". --- But the weak forms depend on sex: "den stora bilen" - "den store mannen". --- The plural never makes a gender-sex distinction. - - GenNum = ASg Gender | APl ; - SexNum = AxSg Sex | AxPl ; - - AdjFormPos = Strong GenNum | Weak SexNum ; - AdjFormSup = SupStrong | SupWeak ; - - AdjFormGrad = - Posit AdjFormPos - | Compar - | Super AdjFormSup ; - -oper - Adj : Type = {s : AdjForm => Str} ; - - adverbForm : AdjFormPos = Strong (ASg Neutr) ; - ---3 Verbs --- --- Verbs have 9 finite forms and as many as 18 infinite forms; the large number --- of the latter comes from adjectives. - -oper Verbum : Type = {s : VerbForm => Str} ; - -param - VFin = - Pres Mode Voice - | Pret Mode Voice - | Imper ; --- no passive - - VInf = - Inf Voice - | Supin Voice - | PtPres Case - | PtPret AdjFormPos Case ; - - VerbForm = - VF VFin - | VI VInf ; - --- However, the syntax only needs a simplified verb category, with --- present tense only. Such a verb can be extracted from the full verb, --- and a choice can be made between an active and a passive (deponent) verb. --- Active verbs continue to have passive forms. - -param - VMode = Infinit | Indicat | Imperat ; - VForm = VPres VMode Voice ; - -oper - Verb : Type = SS1 VForm ; - - extVerb : Voice -> Verbum -> Verb = \v,verb -> {s = table { - VPres Infinit v => verb.s ! VI (Inf v) ; - VPres Indicat v => verb.s ! VF (Pres Ind v) ; - VPres Imperat Act => verb.s ! VF Imper ; - VPres Imperat Pass => verb.s ! VF (Pres Ind Pass) --- no passive in Verbum - }} ; - ---3 Other open classes --- --- Proper names, adverbs (Adv having comparison forms and AdvIn not having them), --- and interjections are the remaining open classes. - -oper - PNm : Type = {s : Case => Str ; h1 : Gender} ; - Adv : Type = {s : Degree => Str} ; - AdvInv : Type = {s : Str} ; - Interj : Type = {s : Str} ; - ---3 Closed classes --- --- The rest of the Swedish word classes are closed, i.e. not extensible by new --- lexical entries. Thus we don't have to know how to build them, but only --- how to use them, i.e. which parameters they have. --- --- The most important distinction is between proper-name-like pronouns and --- adjective-like pronouns, which are inflected in completely different parameters. - -param - NPForm = PNom | PAcc | PGen GenNum ; - AdjPronForm = APron GenNum Case ; - AuxVerbForm = AuxInf | AuxPres | AuxPret | AuxSup ; - -oper - ProPN : Type = {s : NPForm => Str ; h1 : Gender ; h2 : Number ; h3 : Person} ; - ProAdj : Type = {s : AdjPronForm => Str} ; - Prep : Type = {s : Str} ; - Conjunct : Type = {s : Str} ; - Subjunct : Type = {s : Str} ; - Art : Type = {s : GenNum => Str} ; - Part : Type = {s : Str} ; - Infin : Type = {s : Str} ; - VAux : Type = {s : AuxVerbForm => Str} ; -} |
