forked from GitHub/gf-core
fixed decodeUTF8 for pgf; removed old resources from darcs
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
all:
|
||||
make test ; make paradigms
|
||||
test:
|
||||
gf <mkTest.gfs
|
||||
paradigms:
|
||||
gf <mkParadigms.gfs
|
||||
gfdoc:
|
||||
gfdoc abstract/Combinations.gf abstract/Structural.gf english/ParadigmsEng.gf finnish/ParadigmsFin.gf french/ParadigmsFre.gf german/ParadigmsGer.gf italian/ParadigmsIta.gf russian/ParadigmsRus.gf swedish/ParadigmsSwe.gf abstract/Predication.gf ; mv ????*/*.html doc
|
||||
|
||||
clean:
|
||||
rm -f */*.gfc */*.gfr
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
GF Resource grammar library, v. 0.6.
|
||||
|
||||
VERSION NOTICE: This library is replaced by v. 0.9
|
||||
(directory ../resource). It will be gradually replaced
|
||||
by v. 1.0 (directory ../resource-1.0). However, v. 0.6
|
||||
is the only version currently supporting German.
|
||||
|
||||
To precompile a test suite:
|
||||
|
||||
gf <mkTest.gfs
|
||||
|
||||
To precompile resource syntaxes and paradigms:
|
||||
|
||||
gf <mkParadigms.gfs
|
||||
|
||||
To test multilingual syntax editing:
|
||||
|
||||
jgf TestAll.gfcm
|
||||
|
||||
Modules to use (open) for a given language X:
|
||||
|
||||
ResourceX -- basic resource API
|
||||
ParadigmsX -- morphological paradigms
|
||||
|
||||
API documentation found in
|
||||
|
||||
Combinations -- syntactic categories and combination rules
|
||||
Structural -- structural words
|
||||
ParadigmsX -- parameter types and morphological paradigms
|
||||
|
||||
Known bugs:
|
||||
|
||||
Finnish
|
||||
Numerals (1,2,3,...) are not inflected
|
||||
Omission of subject personal pronoun not permitted
|
||||
|
||||
French
|
||||
Order of clitics with ditransitives is not fully controlled
|
||||
|
||||
Italian
|
||||
Order of clitics with ditransitives is not fully controlled.
|
||||
Omission of subject personal pronoun not permitted.
|
||||
Article is not omitted in "la mia madre".
|
||||
|
||||
General
|
||||
* Negative noun phrases ("nobody", "nothing", etc) in TestResource are
|
||||
not treated adequately. For instance, in French
|
||||
the negation word "pas" appears even if "rien" or "personne" is present.
|
||||
* The numeral 1 is not treated specially in "these 1 are old" etc
|
||||
|
||||
|
||||
Missing structures
|
||||
* Tense and aspect
|
||||
* Alternative word orders in many languages (Finnish, German, ...)
|
||||
* coordination of VP, TV, AdV
|
||||
* "I want you to go"
|
||||
* "I paint the house blue"
|
||||
* "the house that he wants to buy"
|
||||
|
||||
|
||||
|
||||
opyright (c) 2001-2004 Janna Khegai, Aarne Ranta
|
||||
under GNU General Public License (GPL).
|
||||
|
||||
Document last updated August 3, 2004, by Aarne Ranta.
|
||||
@@ -1,20 +0,0 @@
|
||||
interface Atom = ResourceExt ** open Resource in {
|
||||
param
|
||||
Polarity = Pos | Neg ;
|
||||
|
||||
oper
|
||||
AS : Type = {s : Polarity => SBranch} ;
|
||||
SBranch : Type ;
|
||||
|
||||
mkPred : NP -> VG -> {s : Polarity => SBranch} = \x,F -> {s =
|
||||
table {
|
||||
Pos => (PredVP x (PosVG F)).s ;
|
||||
Neg => (PredVP x (NegVG F)).s
|
||||
}
|
||||
} ;
|
||||
|
||||
posAS, negAS : AS -> S ;
|
||||
|
||||
posAS p = {s = p.s ! Pos ; lock_S =<>} ;
|
||||
negAS p = {s = p.s ! Neg ; lock_S =<>} ;
|
||||
} ;
|
||||
@@ -1,337 +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 required additions was usually small.
|
||||
--
|
||||
-- To use the resource in applications, you need the following
|
||||
-- $cat$ and $fun$ rules in $oper$ form, completed by taking the
|
||||
-- $lincat$ and $lin$ judgements of a particular language. This is done
|
||||
-- by using, instead of this module, the $reuse$ module which has the name
|
||||
-- $ResourceX$. It is located in the subdirectory
|
||||
-- $grammars/resource/lang$ where $lang$ is the full name of the language.
|
||||
|
||||
|
||||
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
|
||||
|
||||
SymbPN : String -> PN ; -- "x"
|
||||
SymbCN : CN -> String -> CN ; -- "number x"
|
||||
|
||||
ModAdj : AP -> CN -> CN ; -- "red car"
|
||||
DetNP : Det -> CN -> NP ; -- "every car"
|
||||
MassNP : CN -> NP ; -- "wine"
|
||||
IndefOneNP : CN -> NP ; -- "a car", "cars"
|
||||
IndefNumNP : Num -> CN -> NP ; -- "houses", "86 houses"
|
||||
DefOneNP : CN -> NP ; -- "the car"
|
||||
DefNumNP : Num -> CN -> NP ; -- "the cars", "the 86 cars"
|
||||
ModGenOne : NP -> CN -> NP ; -- "John's car"
|
||||
ModGenNum : 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 Adverbs
|
||||
--
|
||||
-- Here is how complex adverbs 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't see"
|
||||
OneVP : VP -> S ; -- "one walks"
|
||||
ThereNP : NP -> S ; -- "there is a bar","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"
|
||||
IsThereNP : NP -> Qu ; -- "is there a bar", "are there (86) bars"
|
||||
|
||||
ImperVP : VP -> Imp ; -- "be a man"
|
||||
|
||||
IndicPhrase : S -> Phr ; -- "I walk."
|
||||
QuestPhrase : Qu -> Phr ; -- "Do I walk?"
|
||||
ImperOne, ImperMany : Imp -> Phr ; -- "Be a man!", "Be men!"
|
||||
|
||||
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 ;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -1,92 +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.
|
||||
|
||||
incomplete resource Logic = open Atom in {
|
||||
|
||||
-- We first define a set of predication patterns.
|
||||
|
||||
oper
|
||||
|
||||
predV1 : V -> NP -> AS ; -- one-place verb: "John walks"
|
||||
predV2 : TV -> NP -> NP -> AS ; -- two-place verb: "John loves Mary"
|
||||
predV3 : V3 -> NP -> NP -> NP -> AS ;-- three-place verb: "John prefers Mary to Jane"
|
||||
predVColl : V -> NP -> NP -> AS ; -- collective verb: "John and Mary fight"
|
||||
predA1 : Adj1 -> NP -> AS ; -- one-place adjective: "John is old"
|
||||
predA2 : Adj2 -> NP -> NP -> AS ; -- two-place adj: "John is married to Mary"
|
||||
predAComp : AdjDeg -> NP -> NP -> AS ; -- compar adj: "John is older than Mary"
|
||||
predAColl : Adj1 -> NP -> NP -> AS ; -- collective adj: "John and Mary are married"
|
||||
predN1 : CN -> NP -> AS ; -- one-place noun: "John is a man"
|
||||
predN2 : Fun -> NP -> NP -> AS ; -- two-place noun: "John is a lover of Mary"
|
||||
predNColl : CN -> NP -> NP -> AS ; -- collective noun: "John and Mary are lovers"
|
||||
predAdv : AdV -> NP -> AS ; -- adverb: "Joh is outside"
|
||||
|
||||
-- Individual-valued function applications.
|
||||
|
||||
appFun1 : Fun -> NP -> NP ; -- one-place function: "the successor of x"
|
||||
appFun2 : Fun2 -> NP -> NP -> NP ; -- two-place function: "the distance 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"
|
||||
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 -> mkPred x (PredV F) ;
|
||||
predV2 = \F, x, y -> mkPred x (PredTV F y) ;
|
||||
predV3 = \F, x, y, z -> mkPred x (PredV3 F y z) ;
|
||||
predVColl = \F, x, y -> mkPred (conjNP x y) (PredV F) ;
|
||||
predA1 = \F, x -> mkPred x (PredAP (AdjP1 F)) ;
|
||||
predA2 = \F, x, y -> mkPred x (PredAP (ComplAdj F y)) ;
|
||||
predAComp = \F, x, y -> mkPred x (PredAP (ComparAdjP F y)) ;
|
||||
predAColl = \F, x, y -> mkPred (conjNP x y) (PredAP (AdjP1 F)) ;
|
||||
predN1 = \F, x -> mkPred x (PredCN F) ;
|
||||
predN2 = \F, x, y -> mkPred x (PredCN (AppFun F y)) ;
|
||||
predNColl = \F, x, y -> mkPred (conjNP x y) (PredCN F) ;
|
||||
predAdv = \F, x -> mkPred x (PredAdV F) ;
|
||||
---- predAdvColl = \F, x, y -> mkPred (conjNP x y) (PredAdV F) ;
|
||||
|
||||
|
||||
appFun1 = \f, x -> DefOneNP (AppFun f x) ;
|
||||
appFun2 = \f, x, y -> DefOneNP (AppFun (AppFun2 f y) 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) ;
|
||||
|
||||
} ;
|
||||
@@ -1,34 +0,0 @@
|
||||
-- numerals from 1 to 999999 in decimal notation
|
||||
|
||||
abstract Numerals = {
|
||||
|
||||
flags startcat=Numeral ;
|
||||
|
||||
cat
|
||||
Numeral ; -- 0..
|
||||
Digit ; -- 2..9
|
||||
Sub10 ; -- 1..9
|
||||
Sub100 ; -- 1..99
|
||||
Sub1000 ; -- 1..999
|
||||
Sub1000000 ; -- 1..999999
|
||||
|
||||
fun
|
||||
num : Sub1000000 -> Numeral ;
|
||||
|
||||
n2, n3, n4, n5, n6, n7, n8, n9 : Digit ;
|
||||
|
||||
pot01 : Sub10 ; -- 1
|
||||
pot0 : Digit -> Sub10 ; -- d * 1
|
||||
pot110 : Sub100 ; -- 10
|
||||
pot111 : Sub100 ; -- 11
|
||||
pot1to19 : Digit -> Sub100 ; -- 10 + d
|
||||
pot0as1 : Sub10 -> Sub100 ; -- coercion of 1..9
|
||||
pot1 : Digit -> Sub100 ; -- d * 10
|
||||
pot1plus : Digit -> Sub10 -> Sub100 ; -- d * 10 + n
|
||||
pot1as2 : Sub100 -> Sub1000 ; -- coercion of 1..99
|
||||
pot2 : Sub10 -> Sub1000 ; -- m * 100
|
||||
pot2plus : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n
|
||||
pot2as3 : Sub1000 -> Sub1000000 ; -- coercion of 1..999
|
||||
pot3 : Sub1000 -> Sub1000000 ; -- m * 1000
|
||||
pot3plus : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
--# -path=.:../../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.
|
||||
|
||||
incomplete resource Predication = open Resource, ResourceExt 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 : V3 -> NP -> NP -> NP -> S ;-- three-place verb: "John prefers Mary to Jane"
|
||||
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"
|
||||
predAdv : AdV -> NP -> S ; -- adverb: "Joh is outside"
|
||||
|
||||
-- Individual-valued function applications.
|
||||
|
||||
appFun1 : Fun -> NP -> NP ; -- one-place function: "the successor of x"
|
||||
appFun2 : Fun2 -> NP -> NP -> NP ; -- two-place function: "the distance 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"
|
||||
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) ;
|
||||
predV3 = \F, x, y, z -> PredVP x (PosVG (PredV3 F y z)) ;
|
||||
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)) ;
|
||||
predAdv = \F, x -> PredVP x (PosVG (PredAdV F)) ;
|
||||
|
||||
|
||||
appFun1 = \f, x -> DefOneNP (AppFun f x) ;
|
||||
appFun2 = \f, x, y -> DefOneNP (AppFun (AppFun2 f y) 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) ;
|
||||
|
||||
} ;
|
||||
@@ -1,3 +0,0 @@
|
||||
--# -path=.:../../prelude
|
||||
|
||||
interface Resource = reuse Structural ;
|
||||
@@ -1,38 +0,0 @@
|
||||
incomplete resource ResourceExt = open Resource in {
|
||||
|
||||
-- Mostly for compatibility with old API (v 0.4). Also for
|
||||
-- special cases of plural determiners without numerals.
|
||||
-- AR 12/1/2004
|
||||
|
||||
oper
|
||||
|
||||
PosV : V -> VP = \x -> PosVG (PredV x) ;
|
||||
NegV : V -> VP = \x -> NegVG (PredV x) ;
|
||||
PosTV : TV -> NP -> VP = \x,y -> PosVG (PredTV x y) ;
|
||||
NegTV : TV -> NP -> VP = \x,y -> NegVG (PredTV x y) ;
|
||||
PosA : AP -> VP = \x -> PosVG (PredAP x) ;
|
||||
NegA : AP -> VP = \x -> NegVG (PredAP x) ;
|
||||
PosCN : CN -> VP = \x -> PosVG (PredCN x) ;
|
||||
NegCN : CN -> VP = \x -> NegVG (PredCN x) ;
|
||||
|
||||
IndefManyNP : CN -> NP = IndefNumNP NoNum ;
|
||||
DefManyNP : CN -> NP = DefNumNP NoNum ;
|
||||
ModGenMany : NP -> CN -> NP = ModGenNum NoNum ;
|
||||
|
||||
LocNP : NP -> AdV = PrepNP InPrep ;
|
||||
|
||||
WeNP : NP = WeNumNP NoNum ;
|
||||
YeNP : NP = YeNumNP NoNum ;
|
||||
|
||||
TheseNP : NP = TheseNumNP NoNum ;
|
||||
ThoseNP : NP = ThoseNumNP NoNum ;
|
||||
|
||||
AllDet : Det = AllNumDet NoNum ;
|
||||
WhichsDet : Det = WhichNumDet NoNum ;
|
||||
SomesDet : Det = SomeNumDet NoNum ;
|
||||
AnysDet : Det = AnyNumDet NoNum ;
|
||||
NosDet : Det = NoNumDet NoNum ;
|
||||
TheseDet : Det = TheseNumDet NoNum ;
|
||||
ThoseDet : Det = ThoseNumDet NoNum ;
|
||||
|
||||
} ;
|
||||
@@ -1,91 +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, AllMassDet, -- 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
|
||||
|
||||
AllNumDet, WhichNumDet, -- pl all, which (86)
|
||||
SomeNumDet, AnyNumDet, NoNumDet, -- pl some, any, no
|
||||
TheseNumDet, ThoseNumDet : Num -> Det ; -- these, those (86)
|
||||
|
||||
ThisNP, ThatNP : NP ; -- this, that
|
||||
TheseNumNP, ThoseNumNP : Num -> NP ; -- these, those (86)
|
||||
INP, ThouNP, HeNP, SheNP, ItNP : NP ; -- personal pronouns in singular
|
||||
WeNumNP, YeNumNP : 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 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
|
||||
PossessPrep : Prep ; -- possessive/genitive
|
||||
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
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
abstract TestHTML = Structural ** {
|
||||
|
||||
-- a random sample of lexicon to test resource grammar with
|
||||
|
||||
cat HTMLdoc; HTMLtag;
|
||||
|
||||
fun
|
||||
htmlText: HTMLtag -> HTMLtag -> HTMLdoc;
|
||||
head, body: HTMLtag;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -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 ;
|
||||
} ;
|
||||
@@ -1,5 +0,0 @@
|
||||
abstract TestResourceNum = TestResource, Numerals ** {
|
||||
|
||||
fun UseNumeral : Numeral -> Num ;
|
||||
|
||||
} ;
|
||||
@@ -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
|
||||
|
||||
@@ -1,382 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<i> Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
|
||||
</i>
|
||||
<p>
|
||||
<h1> Abstract Syntax for Multilingual Resource Grammar</h1>
|
||||
|
||||
<p>
|
||||
Aarne Ranta 2002 -- 2003
|
||||
<p>
|
||||
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:
|
||||
<p>
|
||||
<li><tt>Eng</tt>lish
|
||||
<li><tt>Fin</tt>nish
|
||||
<li><tt>Fre</tt>nch
|
||||
<li><tt>Ger</tt>man
|
||||
<li><tt>Ita</tt>lian
|
||||
<li><tt>Rus</tt>sian
|
||||
<li><tt>Swe</tt>dish
|
||||
<p>
|
||||
The three-letter prefixes are used in file names all over the resource
|
||||
grammar library; we refer to them commonly as <tt>X</tt> below.
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
The grammar has been applied to define language
|
||||
fragments on technical or near-to-technical domains: database queries,
|
||||
video recorder dialogue systems, software specifications, and a
|
||||
health-related phrase book. Each new application helped to identify some
|
||||
missing structures in the resource and suggested some additions, but the
|
||||
number of required additions was usually small.
|
||||
|
||||
To use the resource in applications, you need the following
|
||||
<tt>cat</tt> and <tt>fun</tt> rules in <tt>oper</tt> form, completed by taking the
|
||||
<tt>lincat</tt> and <tt>lin</tt> judgements of a particular language. This is done
|
||||
by using, instead of this module, the <tt>reuse</tt> module which has the name
|
||||
<tt>ResourceX</tt>. It is located in the subdirectory
|
||||
<tt>grammars/resource/lang</tt> where <tt>lang</tt> is the full name of the language.
|
||||
<pre>
|
||||
abstract Combinations = PredefAbs ** {
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h2> Categories</h2>
|
||||
<p>
|
||||
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.
|
||||
<p>
|
||||
Categories that may look special are <tt>Adj2</tt>, <tt>Fun</tt>, and <tt>TV</tt>. 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
|
||||
<tt>AdV</tt> of adverbials.
|
||||
<p>
|
||||
In each group below, some categories are <b>lexical</b> 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 <tt>ParadigmsX</tt> grammars provide ways of defining
|
||||
lexical elements.
|
||||
<p>
|
||||
Lexical categories are listed before other categories
|
||||
in each group and divided by an empty line.
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Nouns and noun phrases</h3>
|
||||
<p>
|
||||
<pre>
|
||||
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"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Adjectives and adjectival phrases</h3>
|
||||
<p>
|
||||
<pre>
|
||||
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"
|
||||
</pre>
|
||||
|
||||
The difference between <tt>Adj1</tt> and <tt>AdjDeg</tt> is that the former has no
|
||||
comparison forms.
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Verbs and verb phrases</h3>
|
||||
<p>
|
||||
<pre>
|
||||
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"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Adverbials</h3>
|
||||
<p>
|
||||
This group has no lexical categories.
|
||||
<pre>
|
||||
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
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Sentences and relative clauses</h3>
|
||||
<p>
|
||||
This group has no lexical categories.
|
||||
<pre>
|
||||
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"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Questions and imperatives</h3>
|
||||
<p>
|
||||
This group has no lexical categories.
|
||||
<pre>
|
||||
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!"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Coordination and subordination</h3>
|
||||
<p>
|
||||
<pre>
|
||||
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
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Complete utterances</h3>
|
||||
<p>
|
||||
This group has no lexical categories.
|
||||
<pre>
|
||||
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."
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h2> Rules</h2>
|
||||
<p>
|
||||
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.
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Nouns and noun phrases</h3>
|
||||
<p>
|
||||
<pre>
|
||||
fun
|
||||
UseN : N -> CN ; -- "car"
|
||||
UsePN : PN -> NP ; -- "John"
|
||||
UseFun : Fun -> CN ; -- "successor"
|
||||
UseInt : Int -> Num ; -- "32" --- assumes i > 1
|
||||
|
||||
SymbPN : String -> PN ; -- "x"
|
||||
SymbCN : CN -> String -> CN ; -- "number x"
|
||||
|
||||
ModAdj : AP -> CN -> CN ; -- "red car"
|
||||
DetNP : Det -> CN -> NP ; -- "every car"
|
||||
MassNP : CN -> NP ; -- "wine"
|
||||
IndefOneNP : CN -> NP ; -- "a car", "cars"
|
||||
IndefNumNP : Num -> CN -> NP ; -- "houses", "86 houses"
|
||||
DefOneNP : CN -> NP ; -- "the car"
|
||||
DefNumNP : Num -> CN -> NP ; -- "the cars", "the 86 cars"
|
||||
ModGenOne : NP -> CN -> NP ; -- "John's car"
|
||||
ModGenNum : 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
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Adjectives and adjectival phrases</h3>
|
||||
<p>
|
||||
<pre>
|
||||
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"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Verbs and verb phrases</h3>
|
||||
<p>
|
||||
The principal way of forming sentences (<tt>S</tt>) is by combining a noun phrase
|
||||
with a verb phrase (the <tt>PredVP</tt> 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
|
||||
(<tt>VG</tt>), which have both positive and negative forms.
|
||||
<pre>
|
||||
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 ; --
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Adverbs</h3>
|
||||
<p>
|
||||
Here is how complex adverbs can be formed and used.
|
||||
<pre>
|
||||
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"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Sentences and relative clauses</h3>
|
||||
<p>
|
||||
<pre>
|
||||
PredVP : NP -> VP -> S ; -- "John walks"
|
||||
PosSlashTV,NegSlashTV : NP -> TV -> Slash ; -- "John sees", "John doesn't see"
|
||||
OneVP : VP -> S ; -- "one walks"
|
||||
ThereNP : NP -> S ; -- "there is a bar","there are 86 bars"
|
||||
|
||||
IdRP : RP ; -- "which"
|
||||
FunRP : 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"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Questions and imperatives</h3>
|
||||
<p>
|
||||
<pre>
|
||||
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"
|
||||
IsThereNP : NP -> Qu ; -- "is there a bar", "are there (86) bars"
|
||||
|
||||
ImperVP : VP -> Imp ; -- "be a man"
|
||||
|
||||
IndicPhrase : S -> Phr ; -- "I walk."
|
||||
QuestPhrase : Qu -> Phr ; -- "Do I walk?"
|
||||
ImperOne, ImperMany : Imp -> Phr ; -- "Be a man!", "Be men!"
|
||||
|
||||
AdvS : AdS -> S -> Phr ; -- "Therefore, 2 is prime."
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Coordination</h3>
|
||||
<p>
|
||||
We consider <i>n</i>-ary coordination, with <i>n</i> > 1. To this end, we have introduced
|
||||
a <b>list category</b> <tt>ListX</tt> for each category <tt>X</tt> whose expressions we want to
|
||||
conjoin. Each list category has two constructors, the base case being <tt>TwoX</tt>.
|
||||
We have not defined coordination of all possible categories here,
|
||||
since it can be tricky in many languages. For instance, <tt>VP</tt> coordination
|
||||
is linguistically problematic in German because <tt>VP</tt> is a discontinuous
|
||||
category.
|
||||
<pre>
|
||||
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 ;
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h3> Subordination</h3>
|
||||
<p>
|
||||
Subjunctions are different from conjunctions, but form
|
||||
a uniform category among themselves.
|
||||
<pre>
|
||||
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"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h2> One-word utterances</h2>
|
||||
<p>
|
||||
These are, more generally, <b>one-phrase utterances</b>. The list below
|
||||
is very incomplete.
|
||||
<pre>
|
||||
PhrNP : NP -> Phr ; -- "Some man.", "John."
|
||||
PhrOneCN, PhrManyCN : CN -> Phr ; -- "A car.", "Cars."
|
||||
PhrIP : IAdv -> Phr ; -- "Who?"
|
||||
PhrIAdv : IAdv -> Phr ; -- "Why?"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h2> Text formation</h2>
|
||||
<p>
|
||||
A text is a sequence of phrases. It is defined like a non-empty list.
|
||||
<pre>
|
||||
OnePhr : Phr -> Text ;
|
||||
ConsPhr : Phr -> Text -> Text ;
|
||||
|
||||
} ;
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,211 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<i> Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
|
||||
</i>
|
||||
<p>
|
||||
<h1></h1>
|
||||
|
||||
# -path=.:../abstract:../../prelude
|
||||
<h1> English Lexical Paradigms</h1>
|
||||
<p>
|
||||
Aarne Ranta 2003
|
||||
<p>
|
||||
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, <tt>Structural.gf</tt>.
|
||||
<p>
|
||||
The main difference with <tt>MorphoEng.gf</tt> is that the types
|
||||
referred to are compiled resource grammar types. We have moreover
|
||||
had the design principle of always having existing forms, rather
|
||||
than stems, as string
|
||||
arguments of the paradigms.
|
||||
<p>
|
||||
The following modules are presupposed:
|
||||
<pre>
|
||||
resource ParadigmsEng = open (Predef=Predef), Prelude, SyntaxEng, ResourceEng in {
|
||||
</pre>
|
||||
|
||||
<h2> Parameters </h2>
|
||||
<p>
|
||||
To abstract over gender names, we define the following identifiers.
|
||||
<pre>
|
||||
oper
|
||||
human : Gender ;
|
||||
nonhuman : Gender ;
|
||||
</pre>
|
||||
|
||||
To abstract over number names, we define the following.
|
||||
<pre>
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
</pre>
|
||||
|
||||
To abstract over case names, we define the following.
|
||||
<pre>
|
||||
nominative : Case ;
|
||||
genitive : Case ;
|
||||
</pre>
|
||||
|
||||
<h2> Nouns</h2>
|
||||
Worst case: give all four forms and the semantic gender.
|
||||
In practice the worst case is just: give singular and plural nominative.
|
||||
<pre>
|
||||
oper
|
||||
mkN : (man,men,man's,men's : Str) -> Gender -> N ;
|
||||
nMan : (man,men : Str) -> Gender -> N ;
|
||||
</pre>
|
||||
|
||||
Regular nouns, nouns ending with <i>s</i>, <i>y</i>, or <i>o</i>, and nouns with the same
|
||||
plural form as the singular.
|
||||
<pre>
|
||||
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
|
||||
</pre>
|
||||
|
||||
These use general heuristics, that recognizes the last letter. <b>N.B</b> it
|
||||
does not get right with <i>boy</i>, <i>rush</i>, since it only looks at one letter.
|
||||
<pre>
|
||||
nHuman : Str -> N ; -- gambler/actress/nanny
|
||||
nNonhuman : Str -> N ; -- dog/kiss/fly
|
||||
</pre>
|
||||
|
||||
Nouns used as functions need a preposition. The most common is <i>of</i>.
|
||||
<pre>
|
||||
mkFun : N -> Preposition -> Fun ;
|
||||
|
||||
funHuman : Str -> Fun ; -- the father/mistress/daddy of
|
||||
funNonhuman : Str -> Fun ; -- the successor/address/copy of
|
||||
</pre>
|
||||
|
||||
Proper names, with their regular genitive.
|
||||
<pre>
|
||||
pnReg : (John : Str) -> PN ; -- John, John's
|
||||
</pre>
|
||||
|
||||
The most common cases on the higher-level category <tt>CN</tt> have shortcuts.
|
||||
The regular <i>y</i>/<i>s</i> variation is taken into account.
|
||||
<pre>
|
||||
cnNonhuman : Str -> CN ;
|
||||
cnHuman : Str -> CN ;
|
||||
npReg : Str -> NP ;
|
||||
</pre>
|
||||
|
||||
In some cases, you may want to make a complex <tt>CN</tt> into a function.
|
||||
<pre>
|
||||
mkFunCN : CN -> Preposition -> Fun ;
|
||||
funOfCN : CN -> Fun ;
|
||||
</pre>
|
||||
|
||||
<h2> Adjectives</h2>
|
||||
Non-comparison one-place adjectives just have one form.
|
||||
<pre>
|
||||
mkAdj1 : (even : Str) -> Adj1 ;
|
||||
</pre>
|
||||
|
||||
Two-place adjectives need a preposition as second argument.
|
||||
<pre>
|
||||
mkAdj2 : (divisible, by : Str) -> Adj2 ;
|
||||
</pre>
|
||||
|
||||
Comparison adjectives have three forms. The common irregular
|
||||
cases are ones ending with <i>y</i> and a consonant that is duplicated;
|
||||
the <i>y</i> ending is recognized by the function <tt>aReg</tt>.
|
||||
<pre>
|
||||
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
|
||||
</pre>
|
||||
|
||||
On higher level, there are adjectival phrases. The most common case is
|
||||
just to use a one-place adjective.
|
||||
<pre>
|
||||
apReg : Str -> AP ;
|
||||
</pre>
|
||||
|
||||
<h2> Adverbs</h2>
|
||||
Adverbs are not inflected. Most lexical ones have position not
|
||||
before the verb. Some can be preverbal (e.g. <i>always</i>).
|
||||
<pre>
|
||||
mkAdv : Str -> AdV ;
|
||||
mkAdvPre : Str -> AdV ;
|
||||
</pre>
|
||||
|
||||
Adverbs modifying adjectives and sentences can also be formed.
|
||||
<pre>
|
||||
mkAdA : Str -> AdA ;
|
||||
mkAdS : Str -> AdS ;
|
||||
</pre>
|
||||
|
||||
Prepositional phrases are another productive form of adverbials.
|
||||
<pre>
|
||||
mkPP : Str -> NP -> AdV ;
|
||||
</pre>
|
||||
|
||||
<h2> Verbs</h2>
|
||||
<p>
|
||||
The fragment now has all verb forms, except the gerund/present participle.
|
||||
Except for <i>be</i>, the worst case needs four forms: the infinitive and
|
||||
the third person singular present, the past indicative, and the past participle.
|
||||
<pre>
|
||||
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 !)
|
||||
</pre>
|
||||
|
||||
This generic function recognizes the special cases where the last
|
||||
character is <i>y</i>, <i>s</i>, or <i>z</i>. It is not right for <i>finish</i> and <i>convey</i>.
|
||||
<pre>
|
||||
vGen : Str -> V ; -- walk/kiss/fly
|
||||
</pre>
|
||||
|
||||
The verbs <i>be</i> and <i>have</i> are special.
|
||||
<pre>
|
||||
vBe : V ;
|
||||
vHave : V ;
|
||||
</pre>
|
||||
|
||||
Verbs with a particle.
|
||||
<pre>
|
||||
vPart : (go, goes, went, gone, up : Str) -> V ;
|
||||
vPartReg : (get, up : Str) -> V ;
|
||||
</pre>
|
||||
|
||||
Two-place verbs, and the special case with direct object.
|
||||
Notice that a particle can already be included in <tt>V</tt>.
|
||||
<pre>
|
||||
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
|
||||
</pre>
|
||||
|
||||
Regular two-place verbs with a particle.
|
||||
<pre>
|
||||
tvPartReg : Str -> Str -> Str -> TV ; -- get, along, with
|
||||
</pre>
|
||||
|
||||
Ditransitive verbs.
|
||||
<pre>
|
||||
mkV3 : V -> Str -> Str -> V3 ; -- speak, with, about
|
||||
v3Dir : V -> Str -> V3 ; -- give,_,to
|
||||
v3DirDir : V -> V3 ; -- give,_,_
|
||||
</pre>
|
||||
|
||||
The definitions should not bother the user of the API. So they are
|
||||
hidden from the document.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,268 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<i> Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
|
||||
</i>
|
||||
<p>
|
||||
<h1> Finnish Lexical Paradigms</h1>
|
||||
|
||||
<p>
|
||||
Aarne Ranta 2003
|
||||
<p>
|
||||
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, <tt>Structural.gf</tt>.
|
||||
<p>
|
||||
The main difference with <tt>MorphoFin.gf</tt> is that the types
|
||||
referred to are compiled resource grammar types. We have moreover
|
||||
had the design principle of always having existing forms, not
|
||||
stems, as string arguments of the paradigms, not stems.
|
||||
<p>
|
||||
This is the path to read the grammar from the same directory.
|
||||
# -path=.:../abstract:../../prelude
|
||||
<p>
|
||||
The following modules are presupposed:
|
||||
<pre>
|
||||
resource ParadigmsFin = open Prelude, SyntaxFin, ResourceFin in {
|
||||
</pre>
|
||||
|
||||
<h2> Parameters </h2>
|
||||
<p>
|
||||
To abstract over gender, number, and (some) case names,
|
||||
we define the following identifiers.
|
||||
<pre>
|
||||
oper
|
||||
human : Gender ;
|
||||
nonhuman : Gender ;
|
||||
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
|
||||
nominative : Case ;
|
||||
genitive : Case ;
|
||||
partitive : Case ;
|
||||
inessive : Case ;
|
||||
elative : Case ;
|
||||
illative : Case ;
|
||||
adessive : Case ;
|
||||
ablative : Case ;
|
||||
allative : Case ;
|
||||
</pre>
|
||||
|
||||
<h2> Nouns</h2>
|
||||
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.
|
||||
<pre>
|
||||
oper
|
||||
mkN :
|
||||
(talo,talon,talona,taloa,taloon,taloina,taloissa,talojen,taloja,taloihin
|
||||
: Str) -> Gender -> N ;
|
||||
</pre>
|
||||
|
||||
Nouns with partitive <i>a</i>/<i>ä</i> are a large group.
|
||||
To determine for grade and vowel alternation, three forms are usually needed:
|
||||
singular nominative and genitive, and plural partitive.
|
||||
Examples: <i>talo</i>, <i>kukko</i>, <i>huippu</i>, <i>koira</i>, <i>kukka</i>, <i>syylä</i>, <i>särki</i>...
|
||||
<pre>
|
||||
nKukko : (kukko,kukon,kukkoja : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
For convenience, we define 1-argument paradigms as producing the
|
||||
nonhuman gender; the following function changes this:
|
||||
<pre>
|
||||
humanN : N -> N ;
|
||||
</pre>
|
||||
|
||||
A special case are nouns with no alternations:
|
||||
the vowel harmony is inferred from the last letter,
|
||||
which must be one of <i>o</i>, <i>u</i>, <i>ö</i>, <i>y</i>.
|
||||
<pre>
|
||||
nTalo : (talo : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
Another special case are nouns where the last two consonants
|
||||
undergo regular weak-grade alternation:
|
||||
<i>kukko - kukon</i>, <i>rutto - ruton</i>, <i>hyppy - hypyn</i>, <i>sampo - sammon</i>,
|
||||
<i>kunto - kunnon</i>, <i>sisältö - sisällön</i>, .
|
||||
<pre>
|
||||
nLukko : (lukko : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
<i>arpi - arven</i>, <i>sappi - sapen</i>, <i>kampi - kammen</i>;<i>sylki - syljen</i>
|
||||
<pre>
|
||||
nArpi : (arpi : Str) -> N ;
|
||||
nSylki : (sylki : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
Foreign words ending in consonants are actually similar to words like
|
||||
<i>malli</i>/<i>mallin</i>/<i>malleja</i>, with the exception that the <i>i</i> is not attached
|
||||
to the singular nominative. Examples: <i>linux</i>, <i>savett</i>, <i>screen</i>.
|
||||
The singular partitive form is used to get the vowel harmony. (N.B. more than
|
||||
1-syllabic words ending in <i>n</i> would have variant plural genitive and
|
||||
partitive forms, like <i>sultanien</i>/<i>sultaneiden</i>, which are not covered.)
|
||||
<pre>
|
||||
nLinux : (linuxia : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
Nouns of at least 3 syllables ending with <i>a</i> or <i>ä</i>, like <i>peruna</i>, <i>tavara</i>,
|
||||
<i>rytinä</i>.
|
||||
<pre>
|
||||
nPeruna : (peruna : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
The following paradigm covers both nouns ending in an aspirated <i>e</i>, such as
|
||||
<i>rae</i>, <i>perhe</i>, <i>savuke</i>, and also many ones ending in a consonant
|
||||
(<i>rengas</i>, <i>kätkyt</i>). The singular nominative and essive are given.
|
||||
<pre>
|
||||
nRae : (rae, rakeena : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
The following covers nouns with partitive <i>ta</i>/<i>tä</i>, such as
|
||||
<i>susi</i>, <i>vesi</i>, <i>pieni</i>. To get all stems and the vowel harmony, it takes
|
||||
the singular nominative, genitive, and essive.
|
||||
<pre>
|
||||
nSusi : (susi,suden,sutta : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
Nouns ending with a long vowel, such as <i>puu</i>, <i>pää</i>, <i>pii</i>, <i>leikkuu</i>,
|
||||
are inflected according to the following.
|
||||
<pre>
|
||||
nPuu : (puu : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
One-syllable diphthong nouns, such as <i>suo</i>, <i>tie</i>, <i>työ</i>, are inflected by
|
||||
the following.
|
||||
<pre>
|
||||
nSuo : (suo : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
Many adjectives but also nouns have the nominative ending <i>nen</i> which in other
|
||||
cases becomes <i>s</i>: <i>nainen</i>, <i>ihminen</i>, <i>keltainen</i>.
|
||||
To capture the vowel harmony, we use the partitive form as the argument.
|
||||
<pre>
|
||||
nNainen : (naista : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
The following covers some nouns ending with a consonant, e.g.
|
||||
<i>tilaus</i>, <i>kaulin</i>, <i>paimen</i>, <i>laidun</i>.
|
||||
<pre>
|
||||
nTilaus : (tilaus,tilauksena : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
Special case:
|
||||
<pre>
|
||||
nKulaus : (kulaus : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
The following covers nouns like <i>nauris</i> and adjectives like <i>kallis</i>, <i>tyyris</i>.
|
||||
The partitive form is taken to get the vowel harmony.
|
||||
<pre>
|
||||
nNauris : (naurista : Str) -> N ;
|
||||
</pre>
|
||||
|
||||
Separately-written compound nouns, like <i>sambal oelek</i>, <i>Urho Kekkonen</i>,
|
||||
have only their last part inflected.
|
||||
<pre>
|
||||
nComp : Str -> N -> N ;
|
||||
</pre>
|
||||
|
||||
Nouns used as functions need a case, of which by far the commonest is
|
||||
the genitive.
|
||||
<pre>
|
||||
mkFun : N -> Case -> Fun ;
|
||||
fGen : N -> Fun ;
|
||||
</pre>
|
||||
|
||||
Proper names can be formed by using declensions for nouns.
|
||||
The plural forms are filtered away by the compiler.
|
||||
<pre>
|
||||
mkPN : N -> PN ;
|
||||
</pre>
|
||||
|
||||
<h2> Adjectives</h2>
|
||||
Non-comparison one-place adjectives are just like nouns.
|
||||
<pre>
|
||||
mkAdj1 : N -> Adj1 ;
|
||||
</pre>
|
||||
|
||||
Two-place adjectives need a case for the second argument.
|
||||
<pre>
|
||||
mkAdj2 : N -> Case -> Adj2 ;
|
||||
</pre>
|
||||
|
||||
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 <i>paras</i> of <i>hyvä</i>).
|
||||
<pre>
|
||||
mkAdjDeg : (kiva : N) -> (kivempaa,kivinta : Str) -> AdjDeg ;
|
||||
</pre>
|
||||
|
||||
<h2> Verbs</h2>
|
||||
<p>
|
||||
The fragment only has present tense so far, but in all persons.
|
||||
The worst case needs five forms, as shown in the following.
|
||||
<pre>
|
||||
mkV : (tulla,tulen,tulee,tulevat,tulkaa,tullaan : Str) -> V ;
|
||||
</pre>
|
||||
|
||||
A simple special case is the one with just one stem and no grade alternation.
|
||||
It covers e.g. <i>sanoa</i>, <i>valua</i>, <i>kysyä</i>.
|
||||
<pre>
|
||||
vValua : (valua : Str) -> V ;
|
||||
</pre>
|
||||
|
||||
With two forms, the following function covers a variety of verbs, such as
|
||||
<i>ottaa</i>, <i>käyttää</i>, <i>löytää</i>, <i>huoltaa</i>, <i>hiihtää</i>, <i>siirtää</i>.
|
||||
<pre>
|
||||
vKattaa : (kattaa, katan : Str) -> V ;
|
||||
</pre>
|
||||
|
||||
When grade alternation is not present, just a one-form special case is needed
|
||||
(<i>poistaa</i>, <i>ryystää</i>).
|
||||
<pre>
|
||||
vOstaa : (ostaa : Str) -> V ;
|
||||
</pre>
|
||||
|
||||
The following covers
|
||||
<i>juosta</i>, <i>piestä</i>, <i>nousta</i>, <i>rangaista</i>, <i>kävellä</i>, <i>surra</i>, <i>panna</i>.
|
||||
<pre>
|
||||
vNousta : (nousta, nousen : Str) -> V ;
|
||||
</pre>
|
||||
|
||||
This is for one-syllable diphthong verbs like <i>juoda</i>, <i>syödä</i>.
|
||||
<pre>
|
||||
vTuoda : (tuoda : Str) -> V ;
|
||||
</pre>
|
||||
|
||||
The verbs <i>be</i> and the negative auxiliary are special.
|
||||
<pre>
|
||||
vOlla : V ;
|
||||
vEi : V ;
|
||||
</pre>
|
||||
|
||||
Two-place verbs need a case, and can have a pre- or postposition.
|
||||
At least one of the latter is empty, <tt>[]</tt>.
|
||||
<pre>
|
||||
mkTV : V -> Case -> (prep,postp : Str) -> TV ;
|
||||
</pre>
|
||||
|
||||
If both are empty, the following special function can be used.
|
||||
<pre>
|
||||
tvCase : V -> Case -> TV ;
|
||||
</pre>
|
||||
|
||||
Verbs with a direct (accusative) object
|
||||
are special, since their complement case is finally decided in syntax.
|
||||
<pre>
|
||||
tvDir : V -> TV ;
|
||||
</pre>
|
||||
|
||||
The definitions should not bother the user of the API. So they are
|
||||
hidden from the document.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,175 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<i> Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
|
||||
</i>
|
||||
<p>
|
||||
<h1></h1>
|
||||
|
||||
# -path=.:../romance:../abstract:../../prelude
|
||||
<h1> French Lexical Paradigms</h1>
|
||||
<p>
|
||||
Aarne Ranta 2003
|
||||
<p>
|
||||
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, <tt>resource.Abs.gf</tt>.
|
||||
<p>
|
||||
The main difference with <tt>MorphoFre.gf</tt> is that the types
|
||||
referred to are compiled resource grammar types. We have moreover
|
||||
had the design principle of always having existing forms, not stems, as string
|
||||
arguments of the paradigms.
|
||||
<p>
|
||||
The following modules are presupposed:
|
||||
<pre>
|
||||
resource ParadigmsFre =
|
||||
open Prelude, (Types = TypesFre), SyntaxFre, MorphoFre,
|
||||
ResourceFre in {
|
||||
</pre>
|
||||
|
||||
<h2> Parameters </h2>
|
||||
<p>
|
||||
To abstract over gender names, we define the following identifiers.
|
||||
<pre>
|
||||
oper
|
||||
masculine : Gender ;
|
||||
feminine : Gender ;
|
||||
</pre>
|
||||
|
||||
To abstract over number names, we define the following.
|
||||
<pre>
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
</pre>
|
||||
|
||||
To abstract over case names, we define the following. (Except for
|
||||
some pronouns, the accusative is equal to the nominative, the
|
||||
dative is formed by the preposition <i>à</i>, and the genitive by the
|
||||
preposition <i>de</i>.)
|
||||
<pre>
|
||||
nominative : Case ;
|
||||
accusative : Case ;
|
||||
dative : Case ;
|
||||
genitive : Case ;
|
||||
</pre>
|
||||
|
||||
<h2> Nouns</h2>
|
||||
Worst case: two forms (singular + plural),
|
||||
and the gender.
|
||||
<pre>
|
||||
mkN : (_,_ : Str) -> Gender -> N ; -- oeil, yeux, masculine
|
||||
</pre>
|
||||
|
||||
Often it is enough with one form. Some of them have a typical gender.
|
||||
<pre>
|
||||
nReg : Str -> Gender -> N ; -- regular, e.g. maison, (maisons,) feminine
|
||||
nEau : Str -> Gender -> N ; -- eau, (eaux,) feminine
|
||||
nCas : Str -> Gender -> N ; -- cas, (cas,) masculine
|
||||
nCheval : Str -> N ; -- cheval, (chevaux, masculine)
|
||||
</pre>
|
||||
|
||||
Nouns used as functions need a case and a preposition. The most common is <i>de</i>.
|
||||
<pre>
|
||||
funPrep : N -> Preposition -> Fun ;
|
||||
funCase : N -> Case -> Fun ;
|
||||
funDe : N -> Fun ;
|
||||
</pre>
|
||||
|
||||
Proper names, with their gender.
|
||||
<pre>
|
||||
mkPN : Str -> Gender -> PN ; -- Jean, masculine
|
||||
</pre>
|
||||
|
||||
On the top level, it is maybe <tt>CN</tt> that is used rather than <tt>N</tt>, and
|
||||
<tt>NP</tt> rather than <tt>PN</tt>.
|
||||
<pre>
|
||||
mkCN : N -> CN ;
|
||||
mkNP : Str -> Gender -> NP ;
|
||||
</pre>
|
||||
|
||||
<h2> Adjectives</h2>
|
||||
Non-comparison one-place adjectives need three forms in the worst case.
|
||||
A parameter tells if they are pre- or postpositions in modification.
|
||||
<pre>
|
||||
Position : Type ;
|
||||
prepos : Position ;
|
||||
postpos : Position ;
|
||||
|
||||
mkAdj1 : (bon, bonne, bons, bien : Str) -> Position -> Adj1 ;
|
||||
</pre>
|
||||
|
||||
Usually it is enough to give the two singular forms. Fully regular adjectives
|
||||
only need the masculine singular form.
|
||||
<pre>
|
||||
adj1Reg : Str -> Position -> Adj1 ;
|
||||
adj1Cher : (cher, chère : Str) -> Position -> Adj1 ;
|
||||
</pre>
|
||||
|
||||
Two-place adjectives need a preposition and a case as extra arguments.
|
||||
<pre>
|
||||
mkAdj2 : Adj1 -> Preposition -> Case -> Adj2 ; -- divisible par
|
||||
</pre>
|
||||
|
||||
Comparison adjectives may need two adjectives, corresponding to the
|
||||
positive and other forms.
|
||||
<pre>
|
||||
mkAdjDeg : (bon, meilleur : Adj1) -> AdjDeg ;
|
||||
</pre>
|
||||
|
||||
In the completely regular case, the comparison forms are constructed by
|
||||
the particle <i>plus</i>.
|
||||
<pre>
|
||||
aReg : Str -> Position -> AdjDeg ; -- lent (, plus lent)
|
||||
</pre>
|
||||
|
||||
On top level, there are adjectival phrases. The most common case is
|
||||
just to use a one-place adjective.
|
||||
<pre>
|
||||
apReg : Str -> Position -> AP ;
|
||||
</pre>
|
||||
|
||||
<h2> Verbs</h2>
|
||||
<p>
|
||||
The fragment only has present tense so far, but in all persons.
|
||||
These are examples of standard conjugations are available. The full list
|
||||
of Bescherelle conjugations is given in <tt>MorphoFra.gf</tt>, with all forms
|
||||
(their type is <tt>Verbum</tt>). The present-tense forms can be extracted by the
|
||||
function <tt>extractVerb</tt>.
|
||||
<pre>
|
||||
vAimer : Str -> V ;
|
||||
vFinir : Str -> V ;
|
||||
vDormir : Str -> V ;
|
||||
vCourir : Str -> V ;
|
||||
vVenir : Str -> V ;
|
||||
|
||||
extractVerb : Verbum -> V ;
|
||||
</pre>
|
||||
|
||||
The verbs 'be' and 'have' are special.
|
||||
<pre>
|
||||
vEtre : V ;
|
||||
vAvoir : V ;
|
||||
</pre>
|
||||
|
||||
Two-place verbs, and the special case with direct object. Notice that
|
||||
a particle can be included in a <tt>V</tt>.
|
||||
<pre>
|
||||
mkTV : V -> Preposition -> Case -> TV ;
|
||||
tvDir : V -> TV ;
|
||||
</pre>
|
||||
|
||||
The idiom with <i>avoir</i> and an invariable noun, such as <i>peur</i>, <i>faim</i>,
|
||||
and a two-place variant with <i>de</i> + complement.
|
||||
<pre>
|
||||
avoirChose : Str -> V ;
|
||||
avoirChoseDe : Str -> TV ;
|
||||
</pre>
|
||||
|
||||
The definitions should not bother the user of the API. So they are
|
||||
hidden from the document.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,273 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<i> Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
|
||||
</i>
|
||||
<p>
|
||||
<h1></h1>
|
||||
|
||||
# -path=.:../abstract:../../prelude
|
||||
<h1> German Lexical Paradigms</h1>
|
||||
<p>
|
||||
Aarne Ranta 2003
|
||||
<p>
|
||||
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, <tt>Resource.gf</tt>.
|
||||
Their original typings via abstract syntax are in
|
||||
<tt>Structural.gf</tt>, which also contains documentation.
|
||||
<p>
|
||||
The main difference with <tt>MorphoGer.gf</tt> is that the types
|
||||
referred to are compiled resource grammar types. We have moreover
|
||||
had the design principle of always having existing forms, not stems, as string
|
||||
arguments of the paradigms.
|
||||
<p>
|
||||
The following modules are presupposed:
|
||||
<pre>
|
||||
resource ParadigmsGer =
|
||||
open Prelude, (Morpho=MorphoGer), SyntaxGer, ResourceGer in {
|
||||
</pre>
|
||||
|
||||
<h2> Parameters </h2>
|
||||
<p>
|
||||
To abstract over gender names, we define the following identifiers.
|
||||
<pre>
|
||||
oper
|
||||
masculine : Gender ;
|
||||
feminine : Gender ;
|
||||
neuter : Gender ;
|
||||
</pre>
|
||||
|
||||
To abstract over case names, we define the following.
|
||||
<pre>
|
||||
nominative : Case ;
|
||||
accusative : Case ;
|
||||
dative : Case ;
|
||||
genitive : Case ;
|
||||
</pre>
|
||||
|
||||
To abstract over number names, we define the following.
|
||||
<pre>
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
</pre>
|
||||
|
||||
<h2> Nouns</h2>
|
||||
Worst case: give all four singular forms, two plural forms (others + dative),
|
||||
and the gender.
|
||||
<pre>
|
||||
mkN : (_,_,_,_,_,_ : Str) -> Gender -> N ;
|
||||
-- mann, mann, manne, mannes, männer, männern
|
||||
</pre>
|
||||
|
||||
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 <i>n</i> or <i>s</i>, otherwise <i>n</i> is added.
|
||||
<pre>
|
||||
nGen : Str -> Str -> Str -> Gender -> N ; -- punkt,punktes,punkt
|
||||
</pre>
|
||||
|
||||
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 <tt>nSoldat</tt> avoids duplicating the final <i>e</i>.
|
||||
<pre>
|
||||
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)
|
||||
</pre>
|
||||
|
||||
Neuter patterns.
|
||||
<pre>
|
||||
nBuch : (_,_ : Str) -> N ; -- Buch, (Buches, Bücher) (neut)
|
||||
nMesser : Str -> N ; -- Messer, (Messers, Messer) (neut)
|
||||
nAuto : Str -> N ; -- Auto, (Autos, Autos) (neut)
|
||||
</pre>
|
||||
|
||||
Feminine patterns. Duplicated <i>e</i> is avoided in <tt>nFrau</tt>.
|
||||
<pre>
|
||||
nHand : (_,_ : Str) -> N ; -- Hand, Hände; Mutter, Mütter (fem)
|
||||
nFrau : Str -> N ; -- Frau (, Frauen) ; Wiese (, Wiesen) (fem)
|
||||
</pre>
|
||||
|
||||
Nouns used as functions need a preposition. The most common is <i>von</i>.
|
||||
<pre>
|
||||
mkFun : N -> Preposition -> Case -> Fun ;
|
||||
funVon : N -> Fun ;
|
||||
</pre>
|
||||
|
||||
Proper names, with their possibly
|
||||
irregular genitive. The regular genitive is <i>s</i>, omitted after <i>s</i>.
|
||||
<pre>
|
||||
mkPN : (karolus, karoli : Str) -> PN ; -- karolus, karoli
|
||||
pnReg : (Johann : Str) -> PN ; -- Johann, Johanns ; Johannes, Johannes
|
||||
</pre>
|
||||
|
||||
On the top level, it is maybe <tt>CN</tt> that is used rather than <tt>N</tt>, and
|
||||
<tt>NP</tt> rather than <tt>PN</tt>.
|
||||
<pre>
|
||||
mkCN : N -> CN ;
|
||||
mkNP : (karolus,karoli : Str) -> NP ;
|
||||
|
||||
npReg : Str -> NP ; -- Johann, Johanns
|
||||
</pre>
|
||||
|
||||
In some cases, you may want to make a complex <tt>CN</tt> into a function.
|
||||
<pre>
|
||||
mkFunCN : CN -> Preposition -> Case -> Fun ;
|
||||
funVonCN : CN -> Fun ;
|
||||
</pre>
|
||||
|
||||
<h2> Adjectives</h2>
|
||||
Non-comparison one-place adjectives need two forms in the worst case:
|
||||
the one in predication and the one before the ending <i>e</i>.
|
||||
<pre>
|
||||
mkAdj1 : (teuer,teur : Str) -> Adj1 ;
|
||||
</pre>
|
||||
|
||||
Invariable adjective are a special case.
|
||||
<pre>
|
||||
adjInvar : Str -> Adj1 ; -- prima
|
||||
</pre>
|
||||
|
||||
The following heuristic recognizes the the end of the word, and builds
|
||||
the second form depending on if it is <i>e</i>, <i>er</i>, or something else.
|
||||
N.B. a contraction is made with <i>er</i>, which works for <i>teuer</i> but not
|
||||
for <i>bitter</i>.
|
||||
<pre>
|
||||
adjGen : Str -> Adj1 ; -- gut; teuer; böse
|
||||
</pre>
|
||||
|
||||
Two-place adjectives need a preposition and a case as extra arguments.
|
||||
<pre>
|
||||
mkAdj2 : Adj1 -> Str -> Case -> Adj2 ; -- teilbar, durch, acc
|
||||
</pre>
|
||||
|
||||
Comparison adjectives may need three adjective, corresponding to the
|
||||
three comparison forms.
|
||||
<pre>
|
||||
mkAdjDeg : (gut,besser,best : Adj1) -> AdjDeg ;
|
||||
</pre>
|
||||
|
||||
In many cases, each of these adjectives is itself regular. Then we only
|
||||
need three strings. Notice that contraction with <i>er</i> is not performed
|
||||
(<i>bessere</i>, not <i>bessre</i>).
|
||||
<pre>
|
||||
aDeg3 : (gut,besser,best : Str) -> AdjDeg ;
|
||||
</pre>
|
||||
|
||||
In the completely regular case, the comparison forms are constructed by
|
||||
the endings <i>er</i> and <i>st</i>.
|
||||
<pre>
|
||||
aReg : Str -> AdjDeg ; -- billig, billiger, billigst
|
||||
</pre>
|
||||
|
||||
The past participle of a verb can be used as an adjective.
|
||||
<pre>
|
||||
aPastPart : V -> Adj1 ; -- gefangen
|
||||
</pre>
|
||||
|
||||
On top level, there are adjectival phrases. The most common case is
|
||||
just to use a one-place adjective. The variation in <tt>adjGen</tt> is taken
|
||||
into account.
|
||||
<pre>
|
||||
apReg : Str -> AP ;
|
||||
</pre>
|
||||
|
||||
<h2> Verbs</h2>
|
||||
<p>
|
||||
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 <i>s</i> or <i>t</i> and performs the
|
||||
appropriate contractions.
|
||||
<pre>
|
||||
mkV : (_,_,_,_ : Str) -> V ; -- geben, gibt, gib, gegeben
|
||||
</pre>
|
||||
|
||||
Regular verbs are those where no Umlaut occurs.
|
||||
<pre>
|
||||
vReg : Str -> V ; -- führen
|
||||
</pre>
|
||||
|
||||
The verbs 'be' and 'have' are special.
|
||||
<pre>
|
||||
vSein : V ;
|
||||
vHaben : V ;
|
||||
</pre>
|
||||
|
||||
Some irregular verbs.
|
||||
<pre>
|
||||
vFahren : V ;
|
||||
</pre>
|
||||
|
||||
Verbs with a detachable particle, with regular ones as a special case.
|
||||
<pre>
|
||||
vPart : (_,_,_,_,_ : Str) -> V ; -- sehen, sieht, sieh, gesehen, aus
|
||||
vPartReg : (_,_ : Str) -> V ; -- bringen, um
|
||||
mkVPart : V -> Str -> V ; -- vFahren, aus
|
||||
</pre>
|
||||
|
||||
Two-place verbs, and the special case with direct object. Notice that
|
||||
a particle can be included in a <tt>V</tt>.
|
||||
<pre>
|
||||
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
|
||||
</pre>
|
||||
|
||||
Three-place verbs require two prepositions and cases.
|
||||
<pre>
|
||||
mkV3 : V -> Str -> Case -> Str -> Case -> V3 ; -- geben,[],dative,[],accusative
|
||||
</pre>
|
||||
|
||||
Sentence-complement verbs are just verbs.
|
||||
<pre>
|
||||
mkVS : V -> VS ;
|
||||
</pre>
|
||||
|
||||
Verb-complement verbs either need the <i>zu</i> particle or don't.
|
||||
The ones that don't are usually auxiliary verbs.
|
||||
<pre>
|
||||
vsAux : V -> VV ;
|
||||
vsZu : V -> VV ;
|
||||
</pre>
|
||||
|
||||
<h2> Adverbials</h2>
|
||||
<p>
|
||||
Adverbials for modifying verbs, adjectives, and sentences can be formed
|
||||
from strings.
|
||||
<pre>
|
||||
mkAdV : Str -> AdV ;
|
||||
mkAdA : Str -> AdA ;
|
||||
mkAdS : Str -> AdS ;
|
||||
</pre>
|
||||
|
||||
Prepositional phrases are another productive form of adverbials.
|
||||
<pre>
|
||||
mkPP : Case -> Str -> NP -> AdV ;
|
||||
</pre>
|
||||
|
||||
One can also use the function <tt>ResourceGer.PrepNP</tt> with one of the given
|
||||
prepositions or a preposition formed by giving a string and a case:
|
||||
<pre>
|
||||
mkPrep : Str -> Case -> Prep ;
|
||||
</pre>
|
||||
|
||||
The definitions should not bother the user of the API. So they are
|
||||
hidden from the document.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,192 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<i> Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
|
||||
</i>
|
||||
<p>
|
||||
<h1></h1>
|
||||
|
||||
# -path=.:../romance:../abstract:../../prelude
|
||||
<h1> Italian Lexical Paradigms</h1>
|
||||
<p>
|
||||
Aarne Ranta 2003
|
||||
<p>
|
||||
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, <tt>resource.Abs.gf</tt>.
|
||||
<p>
|
||||
The main difference with <tt>MorphoIta.gf</tt> is that the types
|
||||
referred to are compiled resource grammar types. We have moreover
|
||||
had the design principle of always having existing forms, not stems, as string
|
||||
arguments of the paradigms.
|
||||
<p>
|
||||
The following modules are presupposed:
|
||||
<pre>
|
||||
resource ParadigmsIta =
|
||||
open Prelude, (Types = TypesIta), SyntaxIta, MorphoIta,
|
||||
ResourceIta in {
|
||||
</pre>
|
||||
|
||||
<h2> Parameters </h2>
|
||||
<p>
|
||||
To abstract over gender names, we define the following identifiers.
|
||||
<pre>
|
||||
oper
|
||||
masculine : Gender ;
|
||||
feminine : Gender ;
|
||||
</pre>
|
||||
|
||||
To abstract over number names, we define the following.
|
||||
<pre>
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
</pre>
|
||||
|
||||
To abstract over case names, we define the following. (Except for
|
||||
some pronouns, the accusative is equal to the nominative, the
|
||||
dative is formed by the preposition <i>a</i>, and the genitive by the
|
||||
preposition <i>di</i>.)
|
||||
<pre>
|
||||
nominative : Case ;
|
||||
accusative : Case ;
|
||||
dative : Case ;
|
||||
genitive : Case ;
|
||||
|
||||
prep_a : Case ;
|
||||
prep_di : Case ;
|
||||
prep_da : Case ;
|
||||
prep_in : Case ;
|
||||
prep_su : Case ;
|
||||
prep_con : Case ;
|
||||
</pre>
|
||||
|
||||
<h2> Nouns</h2>
|
||||
Worst case: two forms (singular + plural),
|
||||
and the gender.
|
||||
<pre>
|
||||
mkN : (_,_ : Str) -> Gender -> N ; -- uomo, uomini, masculine
|
||||
</pre>
|
||||
|
||||
Often it is enough with one form. If it ends with
|
||||
<i>o</i> or <i>a</i>, no gender is needed; if with something else,
|
||||
the gender must be given.
|
||||
<pre>
|
||||
nVino : Str -> N ; -- vino (, vini, masculine)
|
||||
nRana : Str -> N ; -- rana (, rane, feminine)
|
||||
nSale : Str -> Gender -> N ; -- sale (, sali), masculine
|
||||
nTram : Str -> Gender -> N ; -- tram (, tram), masculine
|
||||
</pre>
|
||||
|
||||
Nouns used as functions need a case and a preposition. The most common is <i>di</i>.
|
||||
Recall that the prepositions <i>a</i>, <i>di</i>, <i>da</i>, <i>in</i>, <i>su</i>, <i>con</i> are treated
|
||||
as part of the case (cf. above).
|
||||
<pre>
|
||||
funPrep : N -> Preposition -> Fun ;
|
||||
funCase : N -> Case -> Fun ;
|
||||
funDi : N -> Fun ;
|
||||
</pre>
|
||||
|
||||
Proper names, with their gender.
|
||||
<pre>
|
||||
mkPN : Str -> Gender -> PN ; -- Giovanni, masculine
|
||||
</pre>
|
||||
|
||||
On the top level, it is maybe <tt>CN</tt> that is used rather than <tt>N</tt>, and
|
||||
<tt>NP</tt> rather than <tt>PN</tt>.
|
||||
<pre>
|
||||
mkCN : N -> CN ;
|
||||
mkNP : Str -> Gender -> NP ;
|
||||
</pre>
|
||||
|
||||
<h2> Adjectives</h2>
|
||||
Non-comparison one-place adjectives need four forms in the worst case.
|
||||
A parameter tells if they are pre- or postpositions in modification.
|
||||
<pre>
|
||||
Position : Type ;
|
||||
prepos : Position ;
|
||||
postpos : Position ;
|
||||
|
||||
mkAdj1 : (solo,sola,soli,sole,solamente : Str) -> Position -> Adj1 ;
|
||||
</pre>
|
||||
|
||||
Adjectives ending with <i>o</i> and <i>e</i>, and invariable adjectives,
|
||||
are the most important regular patterns.
|
||||
<pre>
|
||||
adj1Solo : (solo : Str) -> Bool -> Adj1 ;
|
||||
adj1Tale : (tale : Str) -> Bool -> Adj1 ;
|
||||
adj1Blu : (blu : Str) -> Bool -> Adj1 ;
|
||||
</pre>
|
||||
|
||||
Two-place adjectives need a preposition and a case as extra arguments.
|
||||
<pre>
|
||||
mkAdj2 : Adj1 -> Preposition -> Case -> Adj2 ; -- divisibile per
|
||||
</pre>
|
||||
|
||||
Comparison adjectives may need two adjectives, corresponding to the
|
||||
positive and other forms.
|
||||
<pre>
|
||||
mkAdjDeg : (buono, migliore : Adj1) -> AdjDeg ;
|
||||
</pre>
|
||||
|
||||
In the completely regular case, the comparison forms are constructed by
|
||||
the particle <i>più</i>.
|
||||
<pre>
|
||||
aSolo : Str -> Position -> AdjDeg ; -- lento (, più lento)
|
||||
aTale : Str -> Position -> AdjDeg ; -- grave (, più grave)
|
||||
aBlu : Str -> Position -> AdjDeg ; -- blu (, più blu)
|
||||
</pre>
|
||||
|
||||
On top level, there are adjectival phrases. The most common case is
|
||||
just to use a one-place adjective.
|
||||
<pre>
|
||||
apSolo : Str -> Position -> AP ;
|
||||
apTale : Str -> Position -> AP ;
|
||||
apBlu : Str -> Position -> AP ;
|
||||
</pre>
|
||||
|
||||
<h2> Verbs</h2>
|
||||
<p>
|
||||
The fragment only has present tense so far, but in all persons.
|
||||
The worst case needs nine forms (and is not very user-friendly).
|
||||
<pre>
|
||||
mkV : (_,_,_,_,_,_,_,_,_ : Str) -> V ;
|
||||
</pre>
|
||||
|
||||
These are examples of standard conjugations. Other conjugations
|
||||
can be extracted from the Italian functional morphology, which has full
|
||||
<i>Bescherelle</i> tables.
|
||||
<pre>
|
||||
vAmare : Str -> V ;
|
||||
vDormire : Str -> V ;
|
||||
vFinire : Str -> V ;
|
||||
vCorrere : (_,_ : Str) -> V ;
|
||||
</pre>
|
||||
|
||||
The verbs 'be' and 'have' are special.
|
||||
<pre>
|
||||
vEssere : V ;
|
||||
vAvere : V ;
|
||||
</pre>
|
||||
|
||||
Two-place verbs, and the special case with direct object. Notice that
|
||||
a particle can be included in a <tt>V</tt>.
|
||||
<pre>
|
||||
mkTV : V -> Preposition -> Case -> TV ;
|
||||
tvDir : V -> TV ;
|
||||
</pre>
|
||||
|
||||
The idiom with <i>avere</i> and an invariable noun, such as <i>paura</i>, <i>fame</i>,
|
||||
and a two-place variant with <i>di</i> + complement.
|
||||
<pre>
|
||||
averCosa : Str -> V ;
|
||||
averCosaDi : Str -> TV ;
|
||||
</pre>
|
||||
|
||||
The definitions should not bother the user of the API. So they are
|
||||
hidden from the document.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,238 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<i> Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
|
||||
</i>
|
||||
<p>
|
||||
<h1></h1>
|
||||
|
||||
# -path=.:../abstract:../../prelude
|
||||
<h1> Russian Lexical Paradigms
|
||||
</h1>
|
||||
|
||||
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, <tt>resource.Abs.gf</tt>.
|
||||
|
||||
|
||||
The following files are presupposed:
|
||||
<pre>
|
||||
resource ParadigmsRus = open (Predef=Predef), Prelude, SyntaxRus, ResourceRus in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
</pre>
|
||||
|
||||
<h2> Parameters
|
||||
</h2>
|
||||
|
||||
To abstract over gender names, we define the following identifiers.
|
||||
<pre>
|
||||
oper
|
||||
masculine : Gender ;
|
||||
feminine : Gender ;
|
||||
neuter : Gender ;
|
||||
</pre>
|
||||
|
||||
To abstract over case names, we define the following.
|
||||
<pre>
|
||||
nominative : Case ;
|
||||
genitive : Case ;
|
||||
dative : Case ;
|
||||
accusative : Case ;
|
||||
instructive : Case ;
|
||||
prepositional : Case ;
|
||||
</pre>
|
||||
|
||||
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.
|
||||
<pre>
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
</pre>
|
||||
|
||||
<h2> Nouns
|
||||
</h2>
|
||||
Best case: indeclinabe nouns: <i>кофе</i>, <i>пальто</i>, <i>ВУЗ</i>.
|
||||
<pre>
|
||||
mkIndeclinableNoun: Str -> Gender -> Animacy -> N ;
|
||||
</pre>
|
||||
|
||||
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.
|
||||
<pre>
|
||||
mkN : (_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> Gender -> Animacy -> N ;
|
||||
|
||||
-- мужчина, мужчины, мужчине, мужчину, мужчиной, мужчине
|
||||
-- мужчины, мужчин, мужчинам, мужчин, мужчинами, мужчинах
|
||||
</pre>
|
||||
|
||||
Here are some common patterns. The list is far from complete.
|
||||
Feminine patterns.
|
||||
<pre>
|
||||
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)
|
||||
</pre>
|
||||
|
||||
Neuter patterns.
|
||||
<pre>
|
||||
nObezbolivauchee : Str -> N ; -- neutral, inanimate, ending with "-ee"
|
||||
nProizvedenie : Str -> N ; -- neutral, inanimate, ending with "-e"
|
||||
nChislo : Str -> N ; -- neutral, inanimate, ending with "-o"
|
||||
</pre>
|
||||
|
||||
Masculine patterns.
|
||||
<pre>
|
||||
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 "-ень"
|
||||
</pre>
|
||||
|
||||
Nouns used as functions need a preposition. The most common is with Genitive.
|
||||
<pre>
|
||||
mkFun : N -> Preposition -> Case -> Fun ;
|
||||
funGen : N -> Fun ;
|
||||
</pre>
|
||||
|
||||
Proper names.
|
||||
<pre>
|
||||
mkPN : Str -> Gender -> Animacy -> PN ; -- "Иван", "Маша"
|
||||
</pre>
|
||||
|
||||
On the top level, it is maybe <tt>CN</tt> that is used rather than <tt>N</tt>, and
|
||||
<tt>NP</tt> rather than <tt>PN</tt>.
|
||||
<pre>
|
||||
mkCN : N -> CN ;
|
||||
mkNP : Str -> Gender -> Animacy -> NP ;
|
||||
</pre>
|
||||
|
||||
<h2> Adjectives
|
||||
</h2>
|
||||
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.
|
||||
<pre>
|
||||
adjInvar : Str -> Adj1 ; -- khaki, mini, hindi, netto
|
||||
</pre>
|
||||
|
||||
Some regular patterns depending on the ending.
|
||||
<pre>
|
||||
adj1Staruyj : Str -> Adj1 ; -- ending with "-ый"
|
||||
adj1Malenkij : Str -> Adj1 ; -- endign with "-ий"
|
||||
adj1Molodoj : Str -> Adj1 ; -- ending with "-ой",
|
||||
-- plural - молод-ые"
|
||||
adj1Kakoj_Nibud : Str -> Str -> Adj1 ; -- ending with "-ой",
|
||||
-- plural - "как-ие"
|
||||
</pre>
|
||||
|
||||
Two-place adjectives need a preposition and a case as extra arguments.
|
||||
<pre>
|
||||
mkAdj2 : Adj1 -> Str -> Case -> Adj2 ; -- "делим на"
|
||||
</pre>
|
||||
|
||||
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.
|
||||
<pre>
|
||||
mkAdjDeg : Adj1 -> Str -> AdjDeg ;
|
||||
</pre>
|
||||
|
||||
On top level, there are adjectival phrases. The most common case is
|
||||
just to use a one-place adjective.
|
||||
<pre>
|
||||
ap : Adj1 -> IsPostfixAdj -> AP ;
|
||||
</pre>
|
||||
|
||||
<h2> Verbs
|
||||
</h2>
|
||||
|
||||
In our lexicon description (<i>Verbum</i>) 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
|
||||
(<i>я бегу</i>, <i>ты бежишь</i>, <i>он бежит</i>, <i>мы бежим</i>, <i>вы бежите</i>, <i>они бегут</i>),
|
||||
a past form (singular, masculine: <i>я бежал</i>), an imperative form
|
||||
(singular, second person: <i>беги</i>), an infinitive (<i>бежать</i>).
|
||||
Inherent aspect should also be specified.
|
||||
<pre>
|
||||
mkVerbum : Aspect -> (_,_,_,_,_,_,_,_,_ : Str) -> Verbum ;
|
||||
</pre>
|
||||
|
||||
Common conjugation patterns are two conjugations:
|
||||
first - verbs ending with <i>-ать/-ять</i> and second - <i>-ить/-еть</i>.
|
||||
Instead of 6 present forms of the worst case, we only need
|
||||
a present stem and one ending (singular, first person):
|
||||
<i>я люб-лю</i>, <i>я жд-у</i>, etc. To determine where the border
|
||||
between stem and ending lies it is sufficient to compare
|
||||
first person from with second person form:
|
||||
<i>я люб-лю</i>, <i>ты люб-ишь</i>. Stems shoud be the same.
|
||||
So the definition for verb <i>любить</i> looks like:
|
||||
mkRegVerb Imperfective Second <i>люб</i> <i>лю</i> <i>любил</i> <i>люби</i> <i>любить</i>;
|
||||
<pre>
|
||||
mkRegVerb :Aspect -> Conjugation -> (_,_,_,_,_ : Str) -> Verbum ;
|
||||
</pre>
|
||||
|
||||
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 <i>V</i> type, that have these parameters fixed.
|
||||
We can extract the <i>V</i> from the lexicon.
|
||||
<pre>
|
||||
mkV: Verbum -> Voice -> Tense -> V ;
|
||||
mkPresentV: Verbum -> Voice -> V ;
|
||||
</pre>
|
||||
|
||||
Two-place verbs, and the special case with direct object. Notice that
|
||||
a particle can be included in a <tt>V</tt>.
|
||||
<pre>
|
||||
mkTV : V -> Str -> Case -> TV ; -- "войти в дом"; "в", accusative
|
||||
tvDir : V -> TV ; -- "видеть", "любить"
|
||||
</pre>
|
||||
@@ -1,217 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<i> Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
|
||||
</i>
|
||||
<p>
|
||||
<h1></h1>
|
||||
|
||||
# -path=.:../abstract:../../prelude
|
||||
<h1> Swedish Lexical Paradigms</h1>
|
||||
<p>
|
||||
Aarne Ranta 2003
|
||||
<p>
|
||||
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, <tt>Structural.gf</tt>.
|
||||
<p>
|
||||
The main difference with <tt>MorphoSwe.gf</tt> is that the types
|
||||
referred to are compiled resource grammar types. We have moreover
|
||||
had the design principle of always having existing forms, not stems, as string
|
||||
arguments of the paradigms.
|
||||
<p>
|
||||
The following modules are presupposed:
|
||||
<pre>
|
||||
resource ParadigmsSwe = open (Predef=Predef), Prelude, SyntaxSwe, ResourceSwe in {
|
||||
</pre>
|
||||
|
||||
<h2> Parameters </h2>
|
||||
<p>
|
||||
To abstract over gender names, we define the following identifiers.
|
||||
<pre>
|
||||
oper
|
||||
utrum : Gender ;
|
||||
neutrum : Gender ;
|
||||
|
||||
masculine : Sex ;
|
||||
nonmasculine : Sex ;
|
||||
</pre>
|
||||
|
||||
To abstract over case names, we define the following.
|
||||
<pre>
|
||||
nominative : Case ;
|
||||
genitive : Case ;
|
||||
</pre>
|
||||
|
||||
To abstract over number names, we define the following.
|
||||
<pre>
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
</pre>
|
||||
|
||||
<h2> Nouns</h2>
|
||||
Worst case: give all nominative forms and the gender.
|
||||
The genitive is formed automatically, even when the nominative
|
||||
ends with an <i>s</i>.
|
||||
<pre>
|
||||
mkN : (_,_,_,_ : Str) -> Gender -> Sex -> N ;
|
||||
-- man, mannen, män, männen
|
||||
</pre>
|
||||
|
||||
Here are some common patterns, corresponding to school-gramamr declensions.
|
||||
Except <tt>nPojke</tt>, <tt>nKarl</tt>, and <tt>nMurare</tt>,
|
||||
they are defined to be <tt>nonmasculine</tt>, which means that they don't create
|
||||
the definite adjective form with <i>e</i> but with <i>a</i>.
|
||||
<pre>
|
||||
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
|
||||
</pre>
|
||||
|
||||
Nouns used as functions need a preposition. The most common ones are <i>av</i>,
|
||||
<i>på</i>, and <i>till</i>. A preposition is a string.
|
||||
<pre>
|
||||
mkFun : N -> Str -> Fun ;
|
||||
funAv : N -> Fun ;
|
||||
funPaa : N -> Fun ;
|
||||
funTill : N -> Fun ;
|
||||
</pre>
|
||||
|
||||
Proper names, with their possibly
|
||||
irregular genitive. The regular genitive is <i>s</i>, omitted after <i>s</i>.
|
||||
<pre>
|
||||
mkPN : (_,_ : Str) -> Gender -> Sex -> PN ; -- Karolus, Karoli
|
||||
pnReg : Str -> Gender -> Sex -> PN ; -- Johan,Johans ; Johannes, Johannes
|
||||
pnS : Str -> Gender -> Sex -> PN ; -- "Burger King(s)"
|
||||
</pre>
|
||||
|
||||
On the top level, it is maybe <tt>CN</tt> that is used rather than <tt>N</tt>, and
|
||||
<tt>NP</tt> rather than <tt>PN</tt>.
|
||||
<pre>
|
||||
mkCN : N -> CN ;
|
||||
mkNP : (Karolus, Karoli : Str) -> Gender -> NP ;
|
||||
|
||||
npReg : Str -> Gender -> NP ; -- Johann, Johanns
|
||||
</pre>
|
||||
|
||||
<h2> Adjectives</h2>
|
||||
Non-comparison one-place adjectives need four forms in the worst case:
|
||||
strong singular, weak singular, plural.
|
||||
<pre>
|
||||
mkAdj1 : (_,_,_,_ : Str) -> Adj1 ; -- liten, litet, lilla, små
|
||||
</pre>
|
||||
|
||||
Special cases needing one form each are: regular adjectives,
|
||||
adjectives with unstressed <i>e</i> in the last syllable, those
|
||||
ending with <i>n</i> as a further special case, and invariable
|
||||
adjectives.
|
||||
<pre>
|
||||
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
|
||||
</pre>
|
||||
|
||||
Two-place adjectives need a preposition and a case as extra arguments.
|
||||
<pre>
|
||||
mkAdj2 : Adj1 -> Str -> Adj2 ; -- delbar, med
|
||||
mkAdj2Reg : Str -> Str -> Adj2 ; --
|
||||
</pre>
|
||||
|
||||
Comparison adjectives may need the three four forms for the positive case, plus
|
||||
three more forms for the comparison cases.
|
||||
<pre>
|
||||
mkAdjDeg : (liten, litet, lilla, sma, mindre, minst, minsta : Str) -> AdjDeg ;
|
||||
</pre>
|
||||
|
||||
Some comparison adjectives are completely regular.
|
||||
<pre>
|
||||
aReg : Str -> AdjDeg ;
|
||||
</pre>
|
||||
|
||||
On top level, there are adjectival phrases. The most common case is
|
||||
just to use a one-place adjective. The variation in <tt>adjGen</tt> is taken
|
||||
into account.
|
||||
<pre>
|
||||
apReg : Str -> AP ;
|
||||
</pre>
|
||||
|
||||
<h2> Adverbs</h2>
|
||||
Adverbs are not inflected. Most lexical ones have position not
|
||||
before the verb. Some can be preverbal (e.g. <i>alltid</i>).
|
||||
<pre>
|
||||
mkAdv : Str -> AdV ;
|
||||
mkAdvPre : Str -> AdV ;
|
||||
</pre>
|
||||
|
||||
Adverbs modifying adjectives and sentences can also be formed.
|
||||
<pre>
|
||||
mkAdA : Str -> AdA ;
|
||||
mkAdS : Str -> AdS ;
|
||||
</pre>
|
||||
|
||||
Prepositional phrases are another productive form of adverbials.
|
||||
<pre>
|
||||
mkPP : Str -> NP -> AdV ;
|
||||
</pre>
|
||||
|
||||
<h2> Verbs</h2>
|
||||
<p>
|
||||
The fragment only has present tense so far.
|
||||
The worst case needs three forms: the infinitive, the indicative, and the
|
||||
imperative.
|
||||
<pre>
|
||||
mkV : (_,_,_ : Str) -> V ; -- vara, är, var; trivas, trivs, trivs
|
||||
</pre>
|
||||
|
||||
The main conjugations need one string each.
|
||||
<pre>
|
||||
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)
|
||||
</pre>
|
||||
|
||||
The verbs 'be' and 'have' are special.
|
||||
<pre>
|
||||
vVara : V ;
|
||||
vHa : V ;
|
||||
</pre>
|
||||
|
||||
Particle verbs are formed by putting together a verb and a particle.
|
||||
If the verb already has a particle, it is replaced by the new one.
|
||||
<pre>
|
||||
mkPartV : V -> Str -> V ; -- stänga av ;
|
||||
</pre>
|
||||
|
||||
Two-place verbs, and the special case with direct object.
|
||||
<pre>
|
||||
mkTV : V -> Str -> TV ; -- tycka, om
|
||||
tvDir : V -> TV ; -- gilla
|
||||
</pre>
|
||||
|
||||
Ditransitive verbs.
|
||||
<pre>
|
||||
mkV3 : V -> Str -> Str -> V3 ; -- prata, med, om
|
||||
v3Dir : V -> Str -> V3 ; -- ge,_,till
|
||||
v3DirDir : V -> V3 ; -- ge,_,_
|
||||
</pre>
|
||||
|
||||
The definitions should not bother the user of the API. So they are
|
||||
hidden from the document.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,106 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<i> Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
|
||||
</i>
|
||||
<p>
|
||||
<h1></h1>
|
||||
|
||||
<h1> A Small Predication Library</h1>
|
||||
<p>
|
||||
(c) Aarne Ranta 2003 under Gnu GPL.
|
||||
<p>
|
||||
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.
|
||||
<pre>
|
||||
incomplete resource Predication = open Resource, ResourceExt in {
|
||||
</pre>
|
||||
|
||||
We first define a set of predication patterns.
|
||||
<pre>
|
||||
oper
|
||||
predV1 : V -> NP -> S ; -- one-place verb: "John walks"
|
||||
predV2 : TV -> NP -> NP -> S ; -- two-place verb: "John loves Mary"
|
||||
predV3 : V3 -> NP -> NP -> NP -> S ;-- three-place verb: "John prefers Mary to Jane"
|
||||
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"
|
||||
predAdv : AdV -> NP -> S ; -- adverb: "Joh is outside"
|
||||
</pre>
|
||||
|
||||
Individual-valued function applications.
|
||||
<pre>
|
||||
appFun1 : Fun -> NP -> NP ; -- one-place function: "the successor of x"
|
||||
appFun2 : Fun2 -> NP -> NP -> NP ; -- two-place function: "the distance from x to y"
|
||||
appFunColl : Fun -> NP -> NP -> NP ; -- collective function: "the sum of x and y"
|
||||
</pre>
|
||||
|
||||
Families of types, expressed by common nouns depending on arguments.
|
||||
<pre>
|
||||
appFam1 : Fun -> NP -> CN ; -- one-place family: "divisor of x"
|
||||
appFamColl : Fun -> NP -> NP -> CN ; -- collective family: "path between x and y"
|
||||
</pre>
|
||||
|
||||
Type constructor, similar to a family except that the argument is a type.
|
||||
<pre>
|
||||
constrTyp1 : Fun -> CN -> CN ;
|
||||
</pre>
|
||||
|
||||
Logical connectives on two sentences.
|
||||
<pre>
|
||||
conjS : S -> S -> S ;
|
||||
disjS : S -> S -> S ;
|
||||
implS : S -> S -> S ;
|
||||
</pre>
|
||||
|
||||
As an auxiliary, we need two-place conjunction of names (<i>John and Mary</i>),
|
||||
used in collective predication.
|
||||
<pre>
|
||||
conjNP : NP -> NP -> NP ;
|
||||
</pre>
|
||||
|
||||
---------------------------
|
||||
-- what follows should be an implementation of the preceding
|
||||
<pre>
|
||||
oper
|
||||
predV1 = \F, x -> PredVP x (PosV F) ;
|
||||
predV2 = \F, x, y -> PredVP x (PosTV F y) ;
|
||||
predV3 = \F, x, y, z -> PredVP x (PosVG (PredV3 F y z)) ;
|
||||
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)) ;
|
||||
predAdv = \F, x -> PredVP x (PosVG (PredAdV F)) ;
|
||||
|
||||
appFun1 = \f, x -> DefOneNP (AppFun f x) ;
|
||||
appFun2 = \f, x, y -> DefOneNP (AppFun (AppFun2 f y) 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) ;
|
||||
|
||||
} ;
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,114 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<i> Produced by
|
||||
gfdoc - a rudimentary GF document generator.
|
||||
(c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
|
||||
</i>
|
||||
<p>
|
||||
<h1> GF Resource Grammar API for Structural Words</h1>
|
||||
|
||||
|
||||
AR 21/11/2003
|
||||
<p>
|
||||
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. <tt>TheyNP</tt> in French
|
||||
should really be replaced by masculine and feminine variants.
|
||||
<pre>
|
||||
abstract Structural = Combinations ** {
|
||||
|
||||
fun
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h2> Determiners and noun phrases</h2>
|
||||
<p>
|
||||
Many plural determiners can take a numeral modifier. So can the plural
|
||||
pronouns <i>we</i> and <i>you</i>.
|
||||
<pre>
|
||||
EveryDet, WhichDet, AllMassDet, -- 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
|
||||
|
||||
AllNumDet, WhichNumDet, -- pl all, which (86)
|
||||
SomeNumDet, AnyNumDet, NoNumDet, -- pl some, any, no
|
||||
TheseNumDet, ThoseNumDet : Num -> Det ; -- these, those (86)
|
||||
|
||||
ThisNP, ThatNP : NP ; -- this, that
|
||||
TheseNumNP, ThoseNumNP : Num -> NP ; -- these, those (86)
|
||||
INP, ThouNP, HeNP, SheNP, ItNP : NP ; -- personal pronouns in singular
|
||||
WeNumNP, YeNumNP : 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
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h2> Auxiliary verbs</h2>
|
||||
<p>
|
||||
Depending on language, all, some, or none of there verbs belong to
|
||||
a separate class of <b>auxiliary</b> verbs. The list is incomplete.
|
||||
<pre>
|
||||
CanVV, CanKnowVV, MustVV : VV ; -- can (pouvoir,savoir), must
|
||||
WantVV : VV ; -- want (to do)
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h2> Adverbials</h2>
|
||||
<p>
|
||||
<pre>
|
||||
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
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h2> Conjunctions and subjunctions</h2>
|
||||
<p>
|
||||
<pre>
|
||||
AndConj, OrConj : Conj ; -- and, or
|
||||
BothAnd, EitherOr, NeitherNor : ConjD ; -- both-and, either-or, neither-nor
|
||||
IfSubj, WhenSubj, AlthoughSubj : Subj ; -- if, when, although
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h2> Prepositions</h2>
|
||||
<p>
|
||||
We have 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.
|
||||
<pre>
|
||||
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
|
||||
PossessPrep : Prep ; -- possessive/genitive
|
||||
PartPrep : Prep ; -- partitive "of" ("bottle of wine")
|
||||
AgentPrep : Prep ; -- agent "by" in passive constructions
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
<!-- NEW -->
|
||||
<h2> Affirmation and negation</h2>
|
||||
<p>
|
||||
The negative-positive (French <i>si</i>, German <i>doch</i>) is missing.
|
||||
<pre>
|
||||
PhrYes, PhrNo : Phr ; -- yes, no
|
||||
|
||||
}
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,515 +0,0 @@
|
||||
<html>
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000" >
|
||||
|
||||
<center>
|
||||
<img SRC="./gf-logo.gif">
|
||||
|
||||
<h1>The GF Resource Grammar Library</h1>
|
||||
|
||||
|
||||
<a href="http://www.cs.chalmers.se/~aarne">Aarne Ranta</a>
|
||||
2002-2004
|
||||
|
||||
<p>
|
||||
|
||||
Version 0.7: <a href="gf-resource.tgz">source package</a>.
|
||||
|
||||
<p>
|
||||
|
||||
Current languages: English, Finnish, French, German, Italian, Russian, Swedish.
|
||||
|
||||
</center>
|
||||
|
||||
<font size=2>
|
||||
<b>News</b> <br>
|
||||
|
||||
24/6/2004 Version 0.7 released together with the release of GF 2.0.
|
||||
|
||||
<br>
|
||||
|
||||
13/4/2004 Version 0.6 completed using the module system of GF 2. Also an
|
||||
extended coverage. The files are placed in separate subdirectories (one
|
||||
per language) and have different names than before, so that file names
|
||||
(without the extension <tt>.gf</tt>) are also legal module names.
|
||||
|
||||
<br>
|
||||
|
||||
15/8/2003 Version 0.4 with Finnish added. Some updates of the Russian modules.
|
||||
|
||||
<br>
|
||||
|
||||
25/6/2003 Release of GF 1.2 making it more efficient to work with
|
||||
resource grammars. See
|
||||
<a href="http://www.cs.chalmers.se/~aarne/GF/doc/gf-1.2.html">highlights</a>.
|
||||
Also <a href="gf-resource-0.3.tgz">source package version 0.3</a>
|
||||
with some bug fixes.
|
||||
|
||||
<br>
|
||||
|
||||
5/6/2003. Russian resource modules by
|
||||
<a href="http://www.cs.chalmers.se/~janna">Janna Khegai</a>.
|
||||
Cyrillic strings in the files <tt>*.RusU.gf</tt> use UTF-8 encoding,
|
||||
which is automatically detected by the Java GUI to GF. However, in web
|
||||
browsers the encoding must be set manually.
|
||||
|
||||
<br>
|
||||
|
||||
3/6/2003. New version of this document, with separate sections
|
||||
on application and resource grammarians' views and
|
||||
added documentation
|
||||
on the type system of each language <tt>X</tt>
|
||||
in <tt>CombinationsX.gf</tt>.
|
||||
|
||||
<br>
|
||||
|
||||
23/5/2003. High-level lexicon access also in
|
||||
French,
|
||||
Italian,
|
||||
and
|
||||
Swedish.
|
||||
|
||||
<br>
|
||||
|
||||
23/5/2003.
|
||||
Italian grammar based on generic Romance modules, shared with French.
|
||||
|
||||
<br>
|
||||
|
||||
14/4/2003. High-level access to define a lexicon in
|
||||
English and German.
|
||||
|
||||
<p>
|
||||
|
||||
<i>
|
||||
<b>Notice</b>. You need GF Version 2.0 or later
|
||||
to work with these resource grammars.
|
||||
It is available from the
|
||||
<a href="http://www.cs.chalmers.se/~aarne/GF/">GF home page</a>.
|
||||
</i>
|
||||
</font>
|
||||
|
||||
<p>
|
||||
|
||||
|
||||
<h2>Introduction</h2>
|
||||
|
||||
As programs in general can be divided into
|
||||
application programs and library programs,
|
||||
GF grammars can be divided into
|
||||
<b>application grammars</b> and
|
||||
<b>resource grammars</b>.
|
||||
An application grammar is typically built around
|
||||
a semantic model, which is formalized as the abstract
|
||||
syntax of the language. Concrete syntax defines
|
||||
a mapping from the abstract syntax into English or
|
||||
Swedish or some other language.
|
||||
A resource grammar is not based on semantics, but its
|
||||
purpose is to define the linguistic "surface" structures
|
||||
of some language. The availability of these structures makes it easier to
|
||||
write application grammars.
|
||||
|
||||
|
||||
|
||||
<h3>Abstraction level</h3>
|
||||
|
||||
Resource grammars
|
||||
<b>raise the level of abstraction in concrete syntax</b>.
|
||||
The author of an application grammar is freed from thinking
|
||||
about inflection, word order, etc, but can use structured
|
||||
tree-like objects in linearization rules. For instance, to
|
||||
express the linearization of the arithmetical predicate <i>even</i>
|
||||
in French, she no longer has to write
|
||||
<pre>
|
||||
lin Even x = {s =
|
||||
table {
|
||||
m => x.s ++
|
||||
table {Ind => "est" ; Subj => "soit"} ! m ++
|
||||
table {Masc => "pair" ; Fem => "paire"} ! x.g
|
||||
}
|
||||
} ;
|
||||
</pre>
|
||||
but simply
|
||||
<pre>
|
||||
lin Even = predA1 (adjReg "pair") ;
|
||||
</pre>
|
||||
The author of the French resource grammar will have defined the
|
||||
functions <tt>predAdj</tt> and <tt>adjReg</tt> in such a way that
|
||||
they can be used in all applications. The type checker of the GF grammar
|
||||
compiler guarantees that only grammatically correct combinations
|
||||
can be formed by the resource grammar functions.
|
||||
|
||||
|
||||
|
||||
<h3>Unity of language</h3>
|
||||
|
||||
In addition to high abstraction level, reusability, and the division
|
||||
of labour, resource grammars have the virtue of making sense of the
|
||||
<b>unity of a language</b> such as English: while application grammars
|
||||
depend on applications, resource grammars depend on language.
|
||||
What is more, resource grammars for related languages can
|
||||
share much of their code: to what degree this can be done gives
|
||||
a measure of how related the languages are.
|
||||
Thus we find resource grammars to be an interesting linguistic
|
||||
project in its own right.
|
||||
|
||||
|
||||
<h3>Semantics</h3>
|
||||
|
||||
We leave it open if we can also explain the <b>semantics</b>
|
||||
of resource grammar on the general level. The philosophy of GF,
|
||||
inherited from logical frameworks,
|
||||
is that semantics is only given to
|
||||
application grammars. (You can also compare application grammars to Wittgenstein's
|
||||
"language games").
|
||||
This view gives us a lot of freedom in formulating resource grammars.
|
||||
When describing them, we sometimes say that such-and-such a construction
|
||||
is likely to be ruled out by semantic reasons; what we mean is that
|
||||
this will actually happen in application grammars; we do <i>not</i>
|
||||
mean that GF has no semantic rules.
|
||||
An example is the question
|
||||
<i>From which city is every number even or odd?</i>.
|
||||
The resource grammar makes it possible to form this question,
|
||||
but it can hardly be correct in any application grammar that has
|
||||
a rigorous semantics.
|
||||
|
||||
|
||||
|
||||
<h2>Programmer's view on resource grammars</h2>
|
||||
|
||||
The resource grammar library a hierarchical structure. Its main layers are
|
||||
<ul>
|
||||
<li> The language-independent <b>core resource API</b>,
|
||||
<a href="Combinations.html"><tt>Combinations.gf</tt></a>.
|
||||
<a href="Structural.html"><tt>Structural.gf</tt></a>.
|
||||
<li> The language-dependent lexical paradigm modules
|
||||
<tt>ParadigmsX.gf</tt></a>.
|
||||
<li> The <b>derived resource libraries</b>, some of which are
|
||||
language-dependent, some of which aren't.
|
||||
<li> The language-dependent <b>resource infrastructure</b>, to be described below.
|
||||
</ul>
|
||||
The resource infrastructure should not be needed by application grammarians: it should
|
||||
be enough to use the core resource API, the paradigm modules, and the derived libraries. If
|
||||
this is not the case, the best solution is to extend the derived resource
|
||||
libraries or create new ones.
|
||||
|
||||
|
||||
|
||||
<h3>Grammaticality guarantee via data abstraction</h3>
|
||||
|
||||
An important principle is that
|
||||
<ul>
|
||||
<li> the core resource API and the derived resource libraries guarantee
|
||||
that all type-correct uses of them preserve grammaticality.
|
||||
</ul>
|
||||
This principle is simultaneously a guidance for resource grammarians
|
||||
and an argument for the application grammarian to use these libraries.
|
||||
What we mean by "only using the libraries" is that
|
||||
<ul>
|
||||
<li> all <tt>lin</tt> and
|
||||
<tt>lincat</tt> rules are built solely from library functions and
|
||||
argument variables.
|
||||
</ul>
|
||||
Thus for instance no records, tables, selections or projections should appear
|
||||
in the rules. What we have achieved then is <b>total data abstraction</b>,
|
||||
and the grammaticality guarantee can be given.
|
||||
|
||||
<p>
|
||||
|
||||
Since the resource grammars are work in progress, their coverage is not
|
||||
yet sufficient for complete data abstraction. In addition, there may of course
|
||||
be bugs in the resource grammars that destroy grammaticality. The GF group is
|
||||
grateful for bug reports, requests, and contributions!
|
||||
|
||||
<p>
|
||||
|
||||
The most important exception to total data abstraction in practice
|
||||
concerns resource lexica. Since it is impossible to have a
|
||||
full coverage of all the words in a language, users often have to introduce
|
||||
their own lexical entries, and thereby use literal strings in their GF code.
|
||||
The safest and most convenient way of using this is via functions
|
||||
defined in <tt>ParadigmsX.gf</tt> files. Using these functions guarantees
|
||||
that the lexical entries created are type-correct. But nothing guards
|
||||
against misspelling a word, picking a wrong inflectional pattern, or
|
||||
a wrong inherent feature (such as the gender of a French noun).
|
||||
|
||||
|
||||
|
||||
<h3>The resource grammar documentation in <tt>gfdoc</tt></h3>
|
||||
|
||||
All documented GF grammars linked from this page
|
||||
have been written in GF and then translated to HTML
|
||||
using a light-weight documentation tool,
|
||||
<tt>gfdoc</tt>. The tool is available as a part of the GF
|
||||
package. The program also has the
|
||||
flag <tt>-latex</tt>, which produces output in Latex instead of
|
||||
HTML.
|
||||
|
||||
|
||||
|
||||
<h3>The core resource API</h3>
|
||||
|
||||
The API is divided into two modules, <tt>Combiantions</tt> and
|
||||
its extension <tt>Structural</tt>.
|
||||
|
||||
<p>
|
||||
|
||||
The module <a href="Combinations.html"><tt>Combinations</tt></a>
|
||||
gives the core resource type signatures of phrasal categories and
|
||||
syntactic combination rules, together with some explanations
|
||||
and examples. The examples are so far only in English, but their
|
||||
equivalents are available in all of the languages for which the
|
||||
API has been implemented.
|
||||
|
||||
<p>
|
||||
|
||||
The module <a href="Structural.html"><tt>Structural</tt></a>
|
||||
defines structural words such as determiners, pronouns,
|
||||
prepositions, and conjunctions.
|
||||
|
||||
<p>
|
||||
|
||||
The file <tt>Structural.gf</tt> cannot be imported directly, but
|
||||
via the generated files <tt>ResourceX.gf</tt> for each language <tt>X</tt>.
|
||||
In these files, the <tt>fun/lin</tt> and <tt>cat/lincat</tt> judgements have been
|
||||
translated into <tt>oper</tt> judgements.
|
||||
|
||||
|
||||
|
||||
<h3>The lexical paradigm modules</h3>
|
||||
|
||||
The lexical paradigm modules define, for
|
||||
each lexical category, a <b>worst-case macro</b> for adding words
|
||||
of that category by giving a sufficient number of characteristic
|
||||
forms. In addition, the most common <b>regular paradigms</b> are
|
||||
included, where it is enough just to give one form to generate
|
||||
all the others.
|
||||
|
||||
<p>
|
||||
|
||||
For example, the English paradigm module has the worst-case macro for nouns,
|
||||
<pre>
|
||||
mkN : (man,men,man's,men's : Str) -> Gender -> N ;
|
||||
</pre>
|
||||
taking four forms and a gender (<tt>human</tt> or <tt>nonhuman</tt>,
|
||||
as is also explained in the module). Its application
|
||||
<pre>
|
||||
mkN "mouse" "mice" "mouse's" "mice's" nonhuman
|
||||
</pre>
|
||||
defines all information that is needed for the noun <i>mouse</i>.
|
||||
There are also some regular patterns, for instance,
|
||||
<pre>
|
||||
nReg : Str -> Gender -> N ; -- dog, dogs
|
||||
nKiss : Str -> Gender -> N ; -- kiss, kisses
|
||||
</pre>
|
||||
examples of which are
|
||||
<pre>
|
||||
nReg "car" nonhuman
|
||||
nKiss "waitress" human
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
|
||||
Here are the documented versions of the paradigm modules:
|
||||
<ul>
|
||||
<li> English: <a href="ParadigmsEng.html"><tt>ParadigmsEng.gf</tt></a>
|
||||
<li> Finnish: <a href="ParadigmsFin.html"><tt>ParadigmsFin.gf</tt></a>
|
||||
<li> French: <a href="ParadigmsFra.html"><tt>ParadigmsFra.gf</tt></a>
|
||||
<li> German: <a href="ParadigmsGer.html"><tt>ParadigmsDeu.gf</tt></a>
|
||||
<li> Italian: <a href="ParadigmsIta.html"><tt>ParadigmsIta.gf</tt></a>
|
||||
<li> Russian: <a href="ParadigmsRus.html"><tt>ParadigmsRus.gf</tt></a>
|
||||
<li> Swedish: <a href="ParadigmsSwe.html"><tt>ParadigmsSwe.gf</tt></a>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>The derived resource libraries</h3>
|
||||
|
||||
The core resource grammar is minimal in the sense that it defines the
|
||||
smallest syntactic combinations and has no redundancy. For applications, it
|
||||
is usually more convenient to use combinations of the minimal rules.
|
||||
Some such combinations are given in the <b>predication library</b>,
|
||||
which defines the simultaneous applications of one- and two-place
|
||||
verbs and adjectives to all their argument noun phrases. It also
|
||||
defines some other constructions useful for logical and mathematical
|
||||
applications.
|
||||
|
||||
<p>
|
||||
|
||||
The API of the predication library is the module
|
||||
<a href="Predication.html"><tt>Predication</tt></a>.
|
||||
What is imported is one of the language-dependent modules,
|
||||
<tt>X/PredicationX</tt> for each language <tt>X</tt>.
|
||||
|
||||
|
||||
|
||||
<h3>The language-dependent type systems</h3>
|
||||
|
||||
Sometimes it is useful for the application grammarian to know what the
|
||||
language-dependent linearizations types are for each category in the
|
||||
core resource. These types are defined in the files <tt>CombinationsX.gf</tt>.
|
||||
They can be translated to documents by <tt>gfdoc</tt> if desired.
|
||||
<!--
|
||||
|
||||
<ul>
|
||||
<li> English: <a href="CombinationsEng.html"><tt>CombinationsEng.gf</tt></a>
|
||||
<li> Finnish: <a href="CombinationsFin.html"><tt>CombinationsFin.gf</tt></a>
|
||||
<li> French: <a href="CombinationsFra.html"><tt>CombinationsFra.gf</tt></a>
|
||||
<li> German: <a href="CombinationsDeu.html"><tt>CombinationsDeu.gf</tt></a>
|
||||
<li> Italian: <a href="CombinationsIta.html"><tt>CombinationsIta.gf</tt></a>
|
||||
<li> Russian: <a href="CombinationsRus.html"><tt>CombinationsRusU.gf</tt></a>
|
||||
<li> Swedish: <a href="CombinationsSwe.html"><tt>CombinationsSwe.gf</tt></a>
|
||||
</ul>
|
||||
-->
|
||||
|
||||
<p>
|
||||
|
||||
For the sake of uniformity, we have tried to use the same names
|
||||
of parameter types when applicable. For instance, the gender parameter
|
||||
is called <tt>Gender</tt> in every grammar, even though its values
|
||||
differ. The definitions of the parameter
|
||||
types are given in the modules <tt>TypesX</tt>.
|
||||
The application grammarian following the complete abstraction principle
|
||||
does not open these modules and cannot hence
|
||||
use the parameter constructors directly, but rather the
|
||||
names defined in <tt>ParadigmsX</tt>.
|
||||
|
||||
|
||||
|
||||
<h2>Linguist's view on resource grammars</h2>
|
||||
|
||||
<h3>GF and other grammar formalisms</h3>
|
||||
|
||||
Linguists in particular might be interested in resource
|
||||
grammars for their own sake, not as basis of applications.
|
||||
Since few linguists are so far familiar with GF, we refer to the
|
||||
<a href="http://www.cs.chalmers.se/~aarne/GF/">GF Homepage</a>
|
||||
and especially to the
|
||||
<a href="http://www.cs.chalmers.se/~aarne/GF/Tutorial/">GF Tutorial</a>.
|
||||
What comes here is a brief summary of the relation of GF to
|
||||
other record-based formalisms.
|
||||
|
||||
<p>
|
||||
|
||||
The records of GF are much like feature structures in PATR or HPSG.
|
||||
The main differences are that
|
||||
<ul>
|
||||
<li> GF has a type system inherited from
|
||||
functional programming languages;
|
||||
<li> GF records are primarily obtained as linearizations of trees, not
|
||||
as parses of strings.
|
||||
</ul>
|
||||
The latter difference explains why a GF record typically carries more
|
||||
information than a feature structure. For instance, the record describing
|
||||
the French noun <i>cheval</i> is
|
||||
<pre>
|
||||
{s = table {Sg => "cheval" ; Pl => "chevaux"} ; g = Masc} ;
|
||||
</pre>
|
||||
showing the full inflection table of the (abstract) noun <i>cheval</i>.
|
||||
A PATR record
|
||||
for the French word <i>cheval</i> would be
|
||||
<pre>
|
||||
{s = "cheval" ; n = Sg ; g = Masc} ;
|
||||
</pre>
|
||||
showing just the information that can be gathered from the (concrete)
|
||||
string <i>cheval</i>.
|
||||
There is a rather straightforward sense in which the PATR record is an
|
||||
<b>instance</b> of the GF record.
|
||||
|
||||
<p>
|
||||
|
||||
When generating language from syntax trees (or from logical formulas via
|
||||
syntax trees), the record containing full inflection tables is an efficient
|
||||
(linear-time) method of producing the correct forms.
|
||||
This is important when text is generated in real time in
|
||||
an interactive system.
|
||||
|
||||
|
||||
|
||||
<h2>The resource grammar infrastructure</h2>
|
||||
|
||||
As explained above, the application grammarian's view on resource grammars
|
||||
is through API modules. They are collections of type signatures of functions.
|
||||
It is the task of linguists to define these functions.
|
||||
The definitions are in the end given
|
||||
in the <b>resource grammar infrastructure</b>.
|
||||
|
||||
<p>
|
||||
|
||||
We have divided the core resource grammar for each language <tt>X</tt>
|
||||
into the following parts:
|
||||
<ul>
|
||||
<li> Type system: <tt>TypesX.gf</tt>
|
||||
<li> Morphology: <tt>MorphoX.gf</tt>
|
||||
<li> Syntax: <tt>SyntaxX.gf</tt>
|
||||
</ul>
|
||||
To get the most powerful resource grammar for each language, one can use
|
||||
these files directly. To view these modules, documents can be generated
|
||||
by <tt>gfdoc</tt>.
|
||||
|
||||
|
||||
<h2>Compiling and using the resource</h2>
|
||||
|
||||
If you want to use the resource grammars,
|
||||
you should download and unpack the
|
||||
<a href="gf-resource.tgz">GF grammar package</a> and go to the
|
||||
directory <tt>newresource</tt>.
|
||||
At Chalmers, however, we keep the resource grammars in the
|
||||
GF CVS archive, in the directory <tt>grammars/newresource/</tt>,
|
||||
and you'd better take them that way. The package accessible through www
|
||||
is usually not quite up to date.
|
||||
|
||||
<p>
|
||||
|
||||
To compile the resource into precompiled modules, for all languages, type
|
||||
<pre>
|
||||
make
|
||||
</pre>
|
||||
in the <tt>resource/</tt> directory.
|
||||
What you get is a set of <tt>gfr</tt> and <tt>gfc</tt> files.
|
||||
You need never consult any of these files,
|
||||
but mostly look into <tt>resource.Abs.gf</tt> for the type
|
||||
signatures of syntactic structures.
|
||||
|
||||
|
||||
|
||||
<h2>Examples of using the resource grammars</h2>
|
||||
|
||||
<h3>A test suite</h3>
|
||||
|
||||
The grammars <tt>TestX</tt> define a few expressions of each
|
||||
lexical category and make it possible to test linearization, parsing,
|
||||
random generation, and editing.
|
||||
|
||||
|
||||
<h3>A database query language</h3>
|
||||
|
||||
The grammars <tt>database/(Database|Restaurant)X.gf</tt>
|
||||
make use of the resource. The <tt>RestaurantX.gf</tt>
|
||||
grammars are just one possible application building on the generic
|
||||
<tt>DatabaseX.gf</tt> grammars.
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Functional morphology</h2>
|
||||
|
||||
Even though GF is a useful language for describing syntax and semantics, it
|
||||
is not the optimal choice for morphology.
|
||||
One reason is the absence of low-level
|
||||
programming, such as string matching. Another reason is efficiency.
|
||||
In connection with the resource grammar project, we have started another
|
||||
project, <b>functional morphology</b>, which uses Haskell to implement
|
||||
morphology. See the
|
||||
<a href="http://www.cs.chalmers.se/~markus/FM"><tt>Functional Morphology Homepage</tt></a>
|
||||
for more information.
|
||||
|
||||
|
||||
|
||||
<h2>Further reading</h2>
|
||||
|
||||
The paper Modular Grammar Engineering in GF and
|
||||
a set of slides on the same topic.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
instance AtomEng of Atom = ResourceExtEng ** open ResourceEng in {
|
||||
oper SBranch = Str ;
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
--1 The Top-Level English Resource Grammar: Combination Rules
|
||||
--
|
||||
-- Aarne Ranta 2002 -- 2003
|
||||
--
|
||||
-- This is the English concrete syntax of the multilingual resource
|
||||
-- grammar. Most of the work is done in the file $syntax.Eng.gf$.
|
||||
-- However, for the purpose of documentation, we make here explicit the
|
||||
-- linearization types of each category, so that their structures and
|
||||
-- dependencies can be seen.
|
||||
-- Another substantial part are the linearization rules of some
|
||||
-- structural words.
|
||||
--
|
||||
-- The users of the resource grammar should not look at this file for the
|
||||
-- linearization rules, which are in fact hidden in the document version.
|
||||
-- They should use $resource.Abs.gf$ to access the syntactic rules.
|
||||
-- This file can be consulted in those, hopefully rare, occasions in which
|
||||
-- one has to know how the syntactic categories are
|
||||
-- implemented. The parameter types are defined in $TypesEng.gf$.
|
||||
|
||||
concrete CombinationsEng of Combinations = open Prelude, SyntaxEng in {
|
||||
|
||||
flags
|
||||
startcat=Phr ;
|
||||
lexer=text ;
|
||||
unlexer=text ;
|
||||
|
||||
lincat
|
||||
N = CommNoun ;
|
||||
-- = {s : Number => Case => Str}
|
||||
CN = CommNounPhrase ;
|
||||
-- = CommNoun ** {g : Gender}
|
||||
NP = {s : NPForm => Str ; n : Number ; p : Person} ;
|
||||
PN = {s : Case => Str} ;
|
||||
Det = {s : Str ; n : Number} ;
|
||||
Fun = Function ;
|
||||
-- = CommNounPhrase ** {s2 : Preposition} ;
|
||||
Fun2 = Function ** {s3 : Preposition} ;
|
||||
Num = {s : Case => Str} ;
|
||||
|
||||
Adj1 = Adjective ;
|
||||
-- = {s : AForm => Str}
|
||||
Adj2 = Adjective ** {s2 : Preposition} ;
|
||||
AdjDeg = {s : Degree => AForm => Str} ;
|
||||
AP = Adjective ** {p : Bool} ;
|
||||
|
||||
V = Verb ;
|
||||
-- = {s : VForm => Str ; s1 : Particle}
|
||||
VG = {s : Bool => VForm => Str ; s2 : Bool => Number => Str ;
|
||||
isAuxT, isAuxF : Bool} ;
|
||||
VP = {s : VForm => Str ; s2 : Number => Str ; isAux : Bool} ;
|
||||
TV = TransVerb ;
|
||||
-- = Verb ** {s3 : Preposition} ;
|
||||
V3 = TransVerb ** {s4 : Preposition} ;
|
||||
VS = Verb ;
|
||||
VV = Verb ** {isAux : Bool} ;
|
||||
|
||||
AdV = {s : Str ; p : Bool} ;
|
||||
|
||||
S = {s : Str} ;
|
||||
Slash = {s : Bool => Str ; s2 : Preposition} ;
|
||||
RP = {s : Gender => Number => NPForm => Str} ;
|
||||
RC = {s : Gender => Number => Str} ;
|
||||
|
||||
IP = {s : NPForm => Str ; n : Number} ;
|
||||
Qu = {s : QuestForm => Str} ;
|
||||
Imp = {s : Number => Str} ;
|
||||
Phr = {s : Str} ;
|
||||
Text = {s : Str} ;
|
||||
|
||||
Conj = {s : Str ; n : Number} ;
|
||||
ConjD = {s1 : Str ; s2 : Str ; n : Number} ;
|
||||
|
||||
ListS = {s1 : Str ; s2 : Str} ;
|
||||
ListAP = {s1,s2 : AForm => Str ; p : Bool} ;
|
||||
ListNP = {s1,s2 : NPForm => Str ; n : Number ; p : Person} ;
|
||||
|
||||
--.
|
||||
|
||||
lin
|
||||
UseN = noun2CommNounPhrase ;
|
||||
ModAdj = modCommNounPhrase ;
|
||||
ModGenOne = npGenDet singular noNum ;
|
||||
ModGenNum = npGenDet plural ;
|
||||
UsePN = nameNounPhrase ;
|
||||
UseFun = funAsCommNounPhrase ;
|
||||
AppFun = appFunComm ;
|
||||
AppFun2 = appFun2 ;
|
||||
AdjP1 = adj2adjPhrase ;
|
||||
ComplAdj = complAdj ;
|
||||
PositAdjP = positAdjPhrase ;
|
||||
ComparAdjP = comparAdjPhrase ;
|
||||
SuperlNP = superlNounPhrase ;
|
||||
|
||||
DetNP = detNounPhrase ;
|
||||
IndefOneNP = indefNounPhrase singular ;
|
||||
IndefNumNP = indefNounPhraseNum plural ;
|
||||
DefOneNP = defNounPhrase singular ;
|
||||
DefNumNP = defNounPhraseNum plural ;
|
||||
MassNP = detNounPhrase (mkDeterminer Sg []) ;
|
||||
|
||||
CNthatS = nounThatSentence ;
|
||||
UseInt i = {s = table {Nom => i.s ; Gen => i.s ++ "'s"}} ; ---
|
||||
NoNum = noNum ;
|
||||
|
||||
SymbPN i = {s = table {Nom => i.s ; Gen => i.s ++ "'s"}} ; ---
|
||||
SymbCN cn s =
|
||||
{s = \\n,c => cn.s ! n ! c ++ s.s ;
|
||||
g = cn.g} ;
|
||||
|
||||
PredVP = predVerbPhrase ;
|
||||
PosVG = predVerbGroup True ;
|
||||
NegVG = predVerbGroup False ;
|
||||
|
||||
PredV = predVerb ;
|
||||
PredAP = predAdjective ;
|
||||
PredCN = predCommNoun ;
|
||||
PredTV = complTransVerb ;
|
||||
PredV3 = complDitransVerb ;
|
||||
PredPassV = passVerb ;
|
||||
PredNP = predNounPhrase ;
|
||||
PredAdV = predAdverb ;
|
||||
PredVS = complSentVerb ;
|
||||
PredVV = complVerbVerb ;
|
||||
VTrans = transAsVerb ;
|
||||
|
||||
AdjAdv a = advPost (a.s ! AAdv) ;
|
||||
PrepNP p = prepPhrase p.s ; ---
|
||||
AdvVP = adVerbPhrase ;
|
||||
AdvCN = advCommNounPhrase ;
|
||||
AdvAP = advAdjPhrase ;
|
||||
|
||||
PosSlashTV = slashTransVerb True ;
|
||||
NegSlashTV = slashTransVerb False ;
|
||||
OneVP = predVerbPhrase (nameNounPhrase (nameReg "one")) ;
|
||||
ThereNP = thereIs ;
|
||||
|
||||
IdRP = identRelPron ;
|
||||
FunRP = funRelPron ;
|
||||
RelVP = relVerbPhrase ;
|
||||
RelSlash = relSlash ;
|
||||
ModRC = modRelClause ;
|
||||
RelSuch = relSuch ;
|
||||
|
||||
WhoOne = intPronWho singular ;
|
||||
WhoMany = intPronWho plural ;
|
||||
WhatOne = intPronWhat singular ;
|
||||
WhatMany = intPronWhat plural ;
|
||||
FunIP = funIntPron ;
|
||||
NounIPOne = nounIntPron singular ;
|
||||
NounIPMany = nounIntPron plural ;
|
||||
|
||||
QuestVP = questVerbPhrase ;
|
||||
IntVP = intVerbPhrase ;
|
||||
IntSlash = intSlash ;
|
||||
QuestAdv = questAdverbial ;
|
||||
IsThereNP = isThere ;
|
||||
|
||||
ImperVP = imperVerbPhrase ;
|
||||
|
||||
IndicPhrase = indicUtt ;
|
||||
QuestPhrase = interrogUtt ;
|
||||
ImperOne = imperUtterance singular ;
|
||||
ImperMany = imperUtterance plural ;
|
||||
|
||||
AdvS = advSentence ;
|
||||
|
||||
TwoS = twoSentence ;
|
||||
ConsS = consSentence ;
|
||||
ConjS = conjunctSentence ;
|
||||
ConjDS = conjunctDistrSentence ;
|
||||
|
||||
TwoAP = twoAdjPhrase ;
|
||||
ConsAP = consAdjPhrase ;
|
||||
ConjAP = conjunctAdjPhrase ;
|
||||
ConjDAP = conjunctDistrAdjPhrase ;
|
||||
|
||||
TwoNP = twoNounPhrase ;
|
||||
ConsNP = consNounPhrase ;
|
||||
ConjNP = conjunctNounPhrase ;
|
||||
ConjDNP = conjunctDistrNounPhrase ;
|
||||
|
||||
SubjS = subjunctSentence ;
|
||||
SubjImper = subjunctImperative ;
|
||||
SubjQu = subjunctQuestion ;
|
||||
SubjVP = subjunctVerbPhrase ;
|
||||
|
||||
PhrNP = useNounPhrase ;
|
||||
PhrOneCN = useCommonNounPhrase singular ;
|
||||
PhrManyCN = useCommonNounPhrase plural ;
|
||||
PhrIP ip = ip ;
|
||||
PhrIAdv ia = ia ;
|
||||
|
||||
OnePhr p = p ;
|
||||
ConsPhr = cc2 ;
|
||||
|
||||
} ;
|
||||
@@ -1,6 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
resource LogicEng = Logic with
|
||||
(Atom = AtomEng), (Resource = ResourceEng) ;
|
||||
|
||||
-- this is the standard form of a derived resource. AR 12/1/2004
|
||||
@@ -1,215 +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'") ;
|
||||
|
||||
nounGen : Str -> CommonNoun = \dog -> case last dog of {
|
||||
"y" => nounY "dog" ;
|
||||
"s" => nounS (init "dog") ;
|
||||
_ => nounReg "dog"
|
||||
} ;
|
||||
|
||||
--3 Proper names
|
||||
--
|
||||
-- Regular proper names are inflected with "'s" in the genitive.
|
||||
|
||||
nameReg : Str -> ProperName = \john ->
|
||||
{s = table {Nom => john ; Gen => john + "'s"}} ;
|
||||
|
||||
|
||||
--2 Pronouns
|
||||
--
|
||||
-- Here we define personal and relative pronouns.
|
||||
|
||||
mkPronoun : (_,_,_,_ : Str) -> Number -> Person -> Pronoun = \I,me,my,mine,n,p ->
|
||||
{s = table {NomP => I ; AccP => me ; GenP => my ; GenSP => mine} ;
|
||||
n = n ; p = p} ;
|
||||
|
||||
pronI = mkPronoun "I" "me" "my" "mine" Sg P1 ;
|
||||
pronYouSg = mkPronoun "you" "you" "your" "yours" Sg P2 ; -- verb form still OK
|
||||
pronHe = mkPronoun "he" "him" "his" "his" Sg P3 ;
|
||||
pronShe = mkPronoun "she" "her" "her" "hers" Sg P3 ;
|
||||
pronIt = mkPronoun "it" "it" "its" "it" Sg P3 ;
|
||||
|
||||
pronWe = mkPronoun "we" "us" "our" "ours" Pl P1 ;
|
||||
pronYouPl = mkPronoun "you" "you" "your" "yours" Pl P2 ;
|
||||
pronThey = mkPronoun "they" "them" "their" "theirs" Pl P3 ;
|
||||
|
||||
-- Relative pronouns in the accusative have the 'no pronoun' variant.
|
||||
-- The simple pronouns do not really depend on number.
|
||||
|
||||
relPron : RelPron = {s = table {
|
||||
NoHum => \\_ => table {
|
||||
NomP => variants {"that" ; "which"} ;
|
||||
AccP => variants {"that" ; "which" ; []} ;
|
||||
GenP => variants {"whose"} ;
|
||||
GenSP => variants {"which"}
|
||||
} ;
|
||||
Hum => \\_ => table {
|
||||
NomP => variants {"that" ; "who"} ;
|
||||
AccP => variants {"that" ; "who" ; "whom" ; []} ;
|
||||
GenP => variants {"whose"} ;
|
||||
GenSP => variants {"whom"}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
--3 Determiners
|
||||
--
|
||||
-- We have just a heuristic definition of the indefinite article.
|
||||
-- There are lots of exceptions: consonantic "e" ("euphemism"), consonantic
|
||||
-- "o" ("one-sided"), vocalic "u" ("umbrella").
|
||||
|
||||
artIndef = pre {"a" ;
|
||||
"an" / strs {"a" ; "e" ; "i" ; "o" ; "A" ; "E" ; "I" ; "O" }} ;
|
||||
|
||||
artDef = "the" ;
|
||||
|
||||
--2 Adjectives
|
||||
--
|
||||
-- To form the adjectival and the adverbial forms, two strings are needed
|
||||
-- in the worst case.
|
||||
|
||||
mkAdjective : Str -> Str -> Adjective = \free,freely -> {
|
||||
s = table {
|
||||
AAdj => free ;
|
||||
AAdv => freely
|
||||
}
|
||||
} ;
|
||||
|
||||
-- However, the ending "iy" is sufficient for most cases. This function
|
||||
-- automatically changes the word-final "y" to "i" ("happy" - "happily").
|
||||
-- N.B. this is not correct for "shy", but $mkAdjective$ has to be used.
|
||||
|
||||
regAdjective : Str -> Adjective = \free ->
|
||||
let
|
||||
y = Predef.dp 1 free
|
||||
in mkAdjective
|
||||
free
|
||||
(ifTok Str y "y" (Predef.tk 1 free + ("ily")) (free + "ly")) ;
|
||||
|
||||
-- For the comparison of adjectives, six forms are needed to cover all cases.
|
||||
-- But there is no adjective that actually needs all these.
|
||||
|
||||
mkAdjDegrWorst : (_,_,_,_,_,_ : Str) -> AdjDegr =
|
||||
\good,well,better,betterly,best,bestly ->
|
||||
{s = table {
|
||||
Pos => (mkAdjective good well).s ;
|
||||
Comp => (mkAdjective better betterly).s ;
|
||||
Sup => (mkAdjective best bestly).s
|
||||
}
|
||||
} ;
|
||||
|
||||
-- What is usually needed for irregular comparisons are just three forms,
|
||||
-- since the adverbial form is the same (in comparative or superlative)
|
||||
-- or formed in the regular way (positive).
|
||||
|
||||
adjDegrIrreg : (_,_,_ : Str) -> AdjDegr = \bad,worse,worst ->
|
||||
let badly = (regAdjective bad).s ! AAdv
|
||||
in mkAdjDegrWorst bad badly worse worse worst worst ;
|
||||
|
||||
-- Like above, the regular formation takes account of final "y".
|
||||
|
||||
adjDegrReg : Str -> AdjDegr = \happy ->
|
||||
let happi = ifTok Str (Predef.dp 1 happy) "y" (Predef.tk 1 happy + "i") happy
|
||||
in adjDegrIrreg happy (happi + "er") (happi + "est") ;
|
||||
|
||||
-- Many adjectives are 'inflected' by adding a comparison word.
|
||||
|
||||
adjDegrLong : Str -> AdjDegr = \ridiculous ->
|
||||
adjDegrIrreg ridiculous ("more" ++ ridiculous) ("most" ++ ridiculous) ;
|
||||
|
||||
|
||||
--3 Verbs
|
||||
--
|
||||
-- Except for "be", the worst case needs four forms.
|
||||
|
||||
mkVerbP3 : (_,_,_,_: Str) -> VerbP3 = \go,goes,went,gone ->
|
||||
{s = table {
|
||||
InfImp => go ;
|
||||
Indic P3 => goes ;
|
||||
Indic _ => go ;
|
||||
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") ;
|
||||
|
||||
verbGen : Str -> VerbP3 = \kill -> case last kill of {
|
||||
"y" => verbP3y (init "kill") ;
|
||||
"e" => verbP3y (init "kill") ;
|
||||
"s" => verbP3s (init "kill") ;
|
||||
_ => regVerbP3 "kill"
|
||||
} ;
|
||||
|
||||
verbP3Have = mkVerbP3 "have" "has" "had" "had" ;
|
||||
|
||||
verbP3Do = mkVerbP3 "do" "does" "did" "done" ;
|
||||
|
||||
verbBe : VerbP3 = {s = table {
|
||||
InfImp => "be" ;
|
||||
Indic P1 => "am" ;
|
||||
Indic P2 => "are" ;
|
||||
Indic P3 => "is" ;
|
||||
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) ;
|
||||
} ;
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
concrete NumeralsEng of Numerals = open NumeralsResEng in {
|
||||
|
||||
lincat Digit = {s : DForm => Str} ;
|
||||
lincat Sub10 = {s : DForm => Str} ;
|
||||
|
||||
lin num x = x ;
|
||||
lin n2 = mkNum "two" "twelve" "twenty" ;
|
||||
lin n3 = mkNum "three" "thirteen" "thirty" ;
|
||||
lin n4 = mkNum "four" "fourteen" "forty" ;
|
||||
lin n5 = mkNum "five" "fifteen" "fifty" ;
|
||||
lin n6 = regNum "six" ;
|
||||
lin n7 = regNum "seven" ;
|
||||
lin n8 = mkNum "eight" "eighteen" "eighty" ;
|
||||
lin n9 = regNum "nine" ;
|
||||
|
||||
lin pot01 = {s = table {f => "one"}} ;
|
||||
lin pot0 d = {s = table {f => d.s ! f}} ;
|
||||
lin pot110 = ss "ten" ;
|
||||
lin pot111 = ss "eleven" ;
|
||||
lin pot1to19 d = {s = d.s ! teen} ;
|
||||
lin pot0as1 n = {s = n.s ! unit} ;
|
||||
lin pot1 d = {s = d.s ! ten} ;
|
||||
lin pot1plus d e = {s = d.s ! ten ++ "-" ++ e.s ! unit} ;
|
||||
lin pot1as2 n = n ;
|
||||
lin pot2 d = {s = d.s ! unit ++ "hundred"} ;
|
||||
lin pot2plus d e = {s = d.s ! unit ++ "hundred" ++ "and" ++ e.s} ;
|
||||
lin pot2as3 n = n ;
|
||||
lin pot3 n = {s = n.s ++ "thousand"} ;
|
||||
lin pot3plus n m = {s = n.s ++ "thousand" ++ m.s} ;
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
resource NumeralsResEng = {
|
||||
|
||||
param DForm = unit | teen | ten ;
|
||||
|
||||
oper mkNum : Str -> Str -> Str -> {s : DForm => Str} =
|
||||
\two -> \twelve -> \twenty ->
|
||||
{s = table {unit => two ; teen => twelve ; ten => twenty}} ;
|
||||
oper regNum : Str -> {s : DForm => Str} =
|
||||
\six -> mkNum six (six + "teen") (six + "ty") ;
|
||||
oper ss : Str -> {s : Str} = \s -> {s = s} ;
|
||||
|
||||
}
|
||||
@@ -1,301 +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, $Structural.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, rather
|
||||
-- than stems, as string
|
||||
-- arguments of the paradigms.
|
||||
--
|
||||
-- The following modules are presupposed:
|
||||
|
||||
resource ParadigmsEng = open (Predef=Predef), Prelude, SyntaxEng, ResourceEng in {
|
||||
|
||||
--2 Parameters
|
||||
--
|
||||
-- To abstract over gender names, we define the following identifiers.
|
||||
|
||||
oper
|
||||
Gender : Type ;
|
||||
|
||||
human : Gender ;
|
||||
nonhuman : Gender ;
|
||||
|
||||
-- To abstract over number names, we define the following.
|
||||
Number : Type ;
|
||||
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
|
||||
-- To abstract over case names, we define the following.
|
||||
Case : Type ;
|
||||
|
||||
nominative : Case ;
|
||||
genitive : Case ;
|
||||
|
||||
|
||||
--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 higher-level category $CN$ have shortcuts.
|
||||
-- The regular "y"/"s" variation is taken into account.
|
||||
|
||||
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 higher level, there are adjectival phrases. The most common case is
|
||||
-- just to use a one-place adjective.
|
||||
|
||||
apReg : Str -> AP ;
|
||||
|
||||
--2 Adverbs
|
||||
|
||||
-- Adverbs are not inflected. Most lexical ones have position not
|
||||
-- before the verb. Some can be preverbal (e.g. "always").
|
||||
|
||||
mkAdv : Str -> AdV ;
|
||||
mkAdvPre : Str -> AdV ;
|
||||
|
||||
-- Adverbs modifying adjectives and sentences can also be formed.
|
||||
|
||||
mkAdA : Str -> AdA ;
|
||||
mkAdS : Str -> AdS ;
|
||||
|
||||
-- Prepositional phrases are another productive form of adverbials.
|
||||
|
||||
mkPP : Str -> NP -> AdV ;
|
||||
|
||||
--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
|
||||
|
||||
-- Ditransitive verbs.
|
||||
|
||||
mkV3 : V -> Str -> Str -> V3 ; -- speak, with, about
|
||||
v3Dir : V -> Str -> V3 ; -- give,_,to
|
||||
v3DirDir : V -> V3 ; -- give,_,_
|
||||
|
||||
-- The definitions should not bother the user of the API. So they are
|
||||
-- hidden from the document.
|
||||
--.
|
||||
|
||||
Gender = SyntaxEng.Gender ;
|
||||
Number = SyntaxEng.Number ;
|
||||
Case = SyntaxEng.Case ;
|
||||
human = Hum ;
|
||||
nonhuman = NoHum ;
|
||||
singular = Sg ;
|
||||
plural = Pl ;
|
||||
|
||||
nominative = Nom ;
|
||||
genitive = 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) ;
|
||||
|
||||
aGen : Str -> AdjDeg = \s -> case last s of {
|
||||
"y" => mkAdjDeg s (init s + "ier") (init s + "iest") ;
|
||||
"e" => mkAdjDeg s (s + "r") (s + "st") ;
|
||||
_ => aReg s
|
||||
} ;
|
||||
|
||||
mkAdv a = advPost a ** {lock_AdV = <>} ;
|
||||
mkAdvPre a = advPre a ** {lock_AdV = <>} ;
|
||||
mkPP x y = prepPhrase x y ** {lock_AdV = <>} ;
|
||||
mkAdA a = ss a ** {lock_AdA = <>} ;
|
||||
mkAdS a = ss a ** {lock_AdS = <>} ;
|
||||
|
||||
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 (vGen 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) ;
|
||||
|
||||
mkV3 x y z = mkDitransVerb x y z ** {lock_V3 = <>} ;
|
||||
v3Dir x y = mkV3 x [] y ;
|
||||
v3DirDir x = v3Dir x [] ;
|
||||
|
||||
-- these are used in the generated lexicon
|
||||
noun : Str -> N = nNonhuman ;
|
||||
|
||||
verb2 : Str -> Str -> TV = \v -> mkTV (vGen v) ;
|
||||
verb3 : Str -> Str -> Str -> V3 = \v -> mkV3 (vGen v) ;
|
||||
|
||||
} ;
|
||||
@@ -1,6 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
resource PredicationEng = Predication with
|
||||
(Resource = ResourceEng), (ResourceExt = ResourceExtEng) ;
|
||||
|
||||
-- this is the standard form of a derived resource. AR 12/1/2004
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,3 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
instance ResourceEng of Resource = reuse StructuralEng ;
|
||||
@@ -1,4 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
resource ResourceExtEng = ResourceExt with (Resource = ResourceEng) ;
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
--1 The Top-Level English Resource Grammar: Structural Words
|
||||
--
|
||||
-- Aarne Ranta 2002 -- 2003
|
||||
--
|
||||
concrete StructuralEng of Structural =
|
||||
CombinationsEng ** open Prelude, SyntaxEng in {
|
||||
lin
|
||||
INP = pronI ;
|
||||
ThouNP = pronYouSg ;
|
||||
HeNP = pronHe ;
|
||||
SheNP = pronShe ;
|
||||
ItNP = pronIt ;
|
||||
WeNumNP = pronWithNum pronWe ;
|
||||
YeNumNP = pronWithNum pronYouPl ;
|
||||
YouNP = pronYouSg ;
|
||||
TheyNP = pronThey ;
|
||||
|
||||
EveryDet = everyDet ;
|
||||
AllMassDet = mkDeterminer Sg "all" ; --- all the missing
|
||||
AllNumDet = mkDeterminerNum Pl "all" ;
|
||||
WhichDet = whichDet ;
|
||||
WhichNumDet = mkDeterminerNum Pl "which" ;
|
||||
MostsDet = mostDet ;
|
||||
MostDet = mkDeterminer Sg "most" ;
|
||||
SomeDet = mkDeterminer Sg "some" ;
|
||||
SomeNumDet = mkDeterminerNum Pl "some" ;
|
||||
AnyDet = mkDeterminer Sg "any" ;
|
||||
AnyNumDet = mkDeterminerNum Pl "any" ;
|
||||
NoDet = mkDeterminer Sg "no" ;
|
||||
NoNumDet = mkDeterminerNum Pl "no" ;
|
||||
ManyDet = mkDeterminer Pl "many" ;
|
||||
MuchDet = mkDeterminer Sg ["a lot of"] ; ---
|
||||
ThisDet = mkDeterminer Sg "this" ;
|
||||
TheseNumDet = mkDeterminerNum Pl "these" ;
|
||||
ThatDet = mkDeterminer Sg "that" ;
|
||||
ThoseNumDet = mkDeterminerNum Pl "those" ;
|
||||
|
||||
ThisNP = nameNounPhrase (nameReg "this") ;
|
||||
ThatNP = nameNounPhrase (nameReg "that") ;
|
||||
TheseNumNP n = nameNounPhrasePl {s = \\c => "these" ++ n.s ! c} ;
|
||||
ThoseNumNP n = nameNounPhrasePl {s = \\c => "those" ++ n.s ! c} ;
|
||||
|
||||
EverybodyNP = nameNounPhrase (nameReg "everybody") ;
|
||||
SomebodyNP = nameNounPhrase (nameReg "somebody") ;
|
||||
NobodyNP = nameNounPhrase (nameReg "nobody") ;
|
||||
EverythingNP = nameNounPhrase (nameReg "everything") ;
|
||||
SomethingNP = nameNounPhrase (nameReg "something") ;
|
||||
NothingNP = nameNounPhrase (nameReg "nothing") ;
|
||||
|
||||
CanVV = vvCan ;
|
||||
CanKnowVV = vvCan ;
|
||||
MustVV = vvMust ;
|
||||
WantVV = verbNoPart (regVerbP3 "want") ** {isAux = False} ;
|
||||
|
||||
HowIAdv = ss "how" ;
|
||||
WhenIAdv = ss "when" ;
|
||||
WhereIAdv = ss "where" ;
|
||||
WhyIAdv = ss "why" ;
|
||||
EverywhereNP = advPost "everywhere" ;
|
||||
SomewhereNP = advPost "somewhere" ;
|
||||
NowhereNP = advPost "nowhere" ;
|
||||
|
||||
AndConj = ss "and" ** {n = Pl} ;
|
||||
OrConj = ss "or" ** {n = Sg} ;
|
||||
BothAnd = sd2 "both" "and" ** {n = Pl} ;
|
||||
EitherOr = sd2 "either" "or" ** {n = Sg} ;
|
||||
NeitherNor = sd2 "neither" "nor" ** {n = Sg} ;
|
||||
IfSubj = ss "if" ;
|
||||
WhenSubj = ss "when" ;
|
||||
AlthoughSubj = ss "although" ;
|
||||
|
||||
PhrYes = ss "Yes." ;
|
||||
PhrNo = ss "No." ;
|
||||
|
||||
VeryAdv = ss "very" ;
|
||||
TooAdv = ss "too" ;
|
||||
AlmostAdv = ss "almost" ;
|
||||
QuiteAdv = ss "quite" ;
|
||||
OtherwiseAdv = ss "otherwise" ;
|
||||
ThereforeAdv = ss "therefore" ;
|
||||
|
||||
InPrep = ss "in" ;
|
||||
OnPrep = ss "on" ;
|
||||
ToPrep = ss "to" ;
|
||||
ThroughPrep = ss "through" ;
|
||||
AbovePrep = ss "above" ;
|
||||
UnderPrep = ss "under" ;
|
||||
InFrontPrep = ss ["in front of"] ;
|
||||
BehindPrep = ss "behind" ;
|
||||
BetweenPrep = ss "between" ;
|
||||
FromPrep = ss "from" ;
|
||||
BeforePrep = ss "before" ;
|
||||
DuringPrep = ss "during" ;
|
||||
AfterPrep = ss "after" ;
|
||||
WithPrep = ss "with" ;
|
||||
WithoutPrep = ss "without" ;
|
||||
ByMeansPrep = ss "by" ;
|
||||
PossessPrep = ss "of" ;
|
||||
PartPrep = ss "of" ;
|
||||
AgentPrep = ss "by" ;
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,50 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
concrete TestResourceEng of TestResource = StructuralEng ** open SyntaxEng, ParadigmsEng in {
|
||||
|
||||
flags startcat=Phr ; lexer=textlit ; 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" human ;
|
||||
Uncle = funOfReg "uncle" human ;
|
||||
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" ;
|
||||
|
||||
} ;
|
||||
@@ -1,7 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
concrete TestResourceNumEng of TestResourceNum = TestResourceEng, NumeralsEng ** {
|
||||
|
||||
lin UseNumeral n = {s = \\_ => n.s} ; ---- Case
|
||||
|
||||
} ;
|
||||
@@ -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 = {s : VForm => Str} ;
|
||||
|
||||
-- A full verb can moreover have a particle.
|
||||
|
||||
Particle : Type = Str ;
|
||||
Verb = VerbP3 ** {s1 : Particle} ;
|
||||
|
||||
--
|
||||
--3 Pronouns
|
||||
--
|
||||
-- For pronouns, we need four case forms: "I" - "me" - "my" - "mine".
|
||||
|
||||
param
|
||||
NPForm = NomP | AccP | GenP | GenSP ;
|
||||
|
||||
oper
|
||||
Pronoun : Type = {s : NPForm => Str ; n : Number ; p : Person} ;
|
||||
|
||||
-- Coercions between pronoun cases and ordinaty cases.
|
||||
|
||||
toCase : NPForm -> Case = \c -> case c of {GenP => Gen ; _ => Nom} ;
|
||||
toNPForm : Case -> NPForm = \c -> case c of {Gen => GenP ; _ => NomP} ; ---
|
||||
|
||||
--3 Proper names
|
||||
--
|
||||
-- Proper names only need two cases.
|
||||
|
||||
ProperName : Type = SS1 Case ;
|
||||
|
||||
--3 Relative pronouns
|
||||
--
|
||||
-- Relative pronouns are inflected in gender (human/nonhuman), number, and case.
|
||||
|
||||
RelPron : Type = {s : Gender => Number => NPForm => Str} ;
|
||||
} ;
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
abstract ResourceExamples = TestResource ** {
|
||||
|
||||
-- sentence examples to test resource grammar with
|
||||
|
||||
fun
|
||||
ex1,ex2,ex3,ex4,ex5,ex6,ex7,ex8,ex9,ex10,ex11:Text;
|
||||
ex12,ex13,ex14,ex15,ex16,ex17,ex18,ex19,ex20,ex21,ex22: Text;
|
||||
|
||||
def
|
||||
ex1 = OnePhr (IndicPhrase (PredVP (ModGenNum NoNum (YeNumNP NoNum)
|
||||
(AdvCN (UseFun
|
||||
Mother) Always)) (PosVG (PredVS Prove (PredVP (YeNumNP NoNum) (PosVG
|
||||
(PredAP (PositAdjP Small))))))));
|
||||
ex2 = OnePhr (ImperMany (SubjImper WhenSubj (PredVP (YeNumNP
|
||||
NoNum)(PosVG (PredAP
|
||||
(PositAdjP Young)))) (ImperVP (PosVG (PredV Walk)))));
|
||||
|
||||
ex3 = OnePhr (QuestPhrase (QuestAdv WhyIAdv TheyNP (NegVG (PredTV Love
|
||||
(UsePN Mary)))));
|
||||
ex4 = OnePhr (QuestPhrase (QuestVP (WeNumNP NoNum) (PosVG (PredNP (IndefNumNP
|
||||
NoNum (UseN Man))))));
|
||||
ex5 = OnePhr (IndicPhrase (PredVP INP (PosVG (PredTV Love (ConjNP AndConj
|
||||
(TwoNP (IndefNumNP NoNum (ModAdj (PositAdjP Old) (UseN House)))
|
||||
(IndefNumNP NoNum (ModAdj (PositAdjP Young) (UseN Woman)))))))));
|
||||
ex6 = OnePhr (ImperOne (ImperVP (PosVG (PredNP (IndefOneNP (UseN Man))))));
|
||||
ex7 = ConsPhr PhrYes (ConsPhr (PhrOneCN (ModAdj (AdjP1 American) (ModRC
|
||||
(UseN Wine) (RelSlash IdRP (PosSlashTV INP Wait)))))
|
||||
(ConsPhr (PhrNP (DefNumNP (UseInt 2) (UseN Bottle)))
|
||||
(ConsPhr (PhrIAdv WhereIAdv) (ConsPhr (PhrIAdv HowIAdv)
|
||||
(OnePhr (PhrIP WhenIAdv))))));
|
||||
ex8 = OnePhr (IndicPhrase (OneVP (PosVG (PredV3 Prefer (IndefOneNP (AppFun (AppFun2 Connection
|
||||
(DefOneNP (UseN House))) (IndefOneNP (UseN Bar))))(ModGenNum
|
||||
(UseInt 2) (MassNP (UseN Wine)) (UseN Bottle))))));
|
||||
ex9 = OnePhr (QuestPhrase (IntVP WhoOne (AdvVP (SubjVP (PosVG (PredAP (AdvAP
|
||||
VeryAdv (PositAdjP Happy)))) WhenSubj (ThereNP (DetNP
|
||||
ManyDet (UseN Light)))) Always)));
|
||||
|
||||
ex10 = OnePhr (IndicPhrase (PredVP (ModGenOne INP (UseFun Mother)) (NegVG
|
||||
(PredAP (ComplAdj Married (ModGenOne (UsePN John) (UseFun Uncle)))))));
|
||||
|
||||
ex11 = OnePhr (QuestPhrase (IsThereNP (SuperlNP Happy (UseN Man))));
|
||||
|
||||
ex12 = OnePhr (PhrOneCN (CNthatS (UseN Woman) (PredVP SheNP (PosVG (PredCN
|
||||
(ModRC (UseN Woman) (RelVP IdRP (PosVG (PredVV WantVV
|
||||
(PredAdV (AdjAdv (ComparAdjP Big EverythingNP))))))))))));
|
||||
|
||||
ex13 = OnePhr (IndicPhrase (SubjS IfSubj (PredVP SomebodyNP (PosVG
|
||||
(PredTV Send (MassNP (UseN Wine))))) (PredVP
|
||||
EverybodyNP (PosVG (PredV (VTrans Drink))))));
|
||||
ex14 = OnePhr (IndicPhrase (SubjS IfSubj (PredVP SomebodyNP (PosVG
|
||||
(PredTV Send (MassNP (UseN Wine))))) (PredVP
|
||||
EverybodyNP (PosVG (PredV (VTrans Drink))))));
|
||||
ex15 = OnePhr (AdvS ThereforeAdv (PredVP ThisNP (PosVG (PredNP (IndefOneNP (ModRC
|
||||
(UseN House)(RelSuch (PredVP TheyNP (NegVG (PredVV CanKnowVV
|
||||
(PredAdV (PrepNP WithPrep YouNP))))))))))));
|
||||
ex16 = OnePhr (IndicPhrase (PredVP ThatNP (PosVG (PredCN (ModRC (UseN Woman)
|
||||
(RelVP (FunRP Uncle IdRP) (PosVG (PredVS Say (PredVP (UsePN John)
|
||||
(PosVG (PredTV Love (UsePN Mary))))))))))));
|
||||
ex17 = OnePhr (QuestPhrase (IntVP (FunIP Mother (NounIPOne (UseN Woman)))
|
||||
(PosVG (PredV Run))));
|
||||
ex18 = OnePhr (IndicPhrase (ConjS AndConj (ConsS (TwoS (OneVP (PosVG
|
||||
(PredV Run))) (OneVP (PosVG (PredV Walk)))) (OneVP (PosVG
|
||||
(PredV (VTrans Wait)))))));
|
||||
ex19 = OnePhr (IndicPhrase (ConjDS EitherOr (TwoS (PredVP (UsePN John) (PosVG (PredV Walk))) (PredVP
|
||||
(UsePN Mary ) (PosVG (PredV Run))))));
|
||||
|
||||
ex20 = OnePhr (QuestPhrase (QuestVP SomebodyNP (PosVG (PredVV CanKnowVV (PredAP (ConjAP
|
||||
OrConj (ConsAP (TwoAP (PositAdjP Young) (PositAdjP Big))
|
||||
(PositAdjP Happy))))))));
|
||||
ex21 = OnePhr (IndicPhrase (PredVP (IndefOneNP (UseN House))(PosVG (PredVV
|
||||
CanVV (PredAP (ConjDAP BothAnd (TwoAP (PositAdjP Big) (PositAdjP
|
||||
Small))))))));
|
||||
ex22 = OnePhr (IndicPhrase ( PredVP HeNP (NegVG (PredV3 Give (ConjDNP NeitherNor (ConsNP (TwoNP (IndefNumNP
|
||||
NoNum (UseN Woman)) (IndefOneNP (UseN Wine))) (IndefOneNP (UseN Car))))
|
||||
NobodyNP))));
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -1,199 +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 CombinationsFin of Combinations = 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 ; isNum : Bool} ;
|
||||
Num = {s : NPForm => Str ; isNum : Bool} ;
|
||||
Fun = Function ;
|
||||
-- = CommNounPhrase ** {c : NPForm} ;
|
||||
Fun2 = Function ** {c2 : NPForm} ;
|
||||
|
||||
Adj1 = Adjective ;
|
||||
-- = CommonNoun
|
||||
Adj2 = Adjective ** {c : NPForm} ;
|
||||
AdjDeg = {s : Degree => AForm => Str} ;
|
||||
AP = {s : AdjPos => AForm => Str} ;
|
||||
|
||||
V = Verb ;
|
||||
-- = {s : VForm => Str}
|
||||
VP = Verb ** {s2 : VForm => Str ; c : ComplCase} ;
|
||||
VG = {s,s2 : Bool => VForm => Str ; c : ComplCase} ;
|
||||
TV = TransVerb ;
|
||||
-- = Verb ** {s3, s4 : Str ; c : ComplCase} ;
|
||||
V3 = TransVerb ** {s5, s6 : Str ; c2 : ComplCase} ;
|
||||
VS = Verb ;
|
||||
VV = Verb ** {c : ComplCase} ;
|
||||
|
||||
AdV = {s : Str} ;
|
||||
Prep = {s : Str ; c : Case ; isPrep : Bool} ;
|
||||
|
||||
|
||||
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 => AForm => Str} ;
|
||||
ListNP = {s1,s2 : NPForm => Str ; n : Number ; p : NPPerson} ;
|
||||
|
||||
--.
|
||||
|
||||
lin
|
||||
UseN = noun2CommNounPhrase ;
|
||||
ModAdj = modCommNounPhrase ;
|
||||
ModGenOne = npGenDet singular ;
|
||||
ModGenNum = npGenDetNum ;
|
||||
UsePN = nameNounPhrase ;
|
||||
UseFun = funAsCommNounPhrase ;
|
||||
AppFun = appFunComm ;
|
||||
AppFun2 = appFun2 ;
|
||||
AdjP1 = adj2adjPhrase ;
|
||||
ComplAdj = complAdj ;
|
||||
PositAdjP = positAdjPhrase ;
|
||||
ComparAdjP = comparAdjPhrase ;
|
||||
SuperlNP = superlNounPhrase ;
|
||||
|
||||
DetNP = detNounPhrase ;
|
||||
IndefOneNP = indefNounPhrase singular ;
|
||||
IndefNumNP = nounPhraseNum False ;
|
||||
DefOneNP = defNounPhrase singular ;
|
||||
DefNumNP = nounPhraseNum True ;
|
||||
MassNP = partNounPhrase singular ;
|
||||
NoNum = noNum ;
|
||||
UseInt i = {s = \\_ => i.s ; isNum = True} ; --- case endings sometimes needed
|
||||
|
||||
SymbPN i = {s = \\_ => i.s} ; --- case endings often needed
|
||||
SymbCN cn s =
|
||||
{s = \\f,n,c => cn.s ! f ! n ! c ++ s.s ;
|
||||
g = cn.g} ;
|
||||
|
||||
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 = ss (a.s ! AAttr ! AAdv) ; --- also APred?
|
||||
AdvVP = adVerbPhrase ;
|
||||
PrepNP = prepPhrase ;
|
||||
AdvCN = advCommNounPhrase ;
|
||||
AdvAP = advAdjPhrase ;
|
||||
|
||||
PosSlashTV = slashTransVerb True ;
|
||||
NegSlashTV = slashTransVerb False ;
|
||||
OneVP = passPredVerbPhrase ;
|
||||
ThereNP = onNounPhrase ;
|
||||
|
||||
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 ;
|
||||
IsThereNP = onkoNounPhrase ;
|
||||
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 ;
|
||||
|
||||
|
||||
} ;
|
||||
@@ -1,881 +0,0 @@
|
||||
--# -path=.:../../prelude
|
||||
|
||||
--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 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 Sg Abess => vede + ("tt" + a) ;
|
||||
|
||||
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" ;
|
||||
NCase Pl Abess => vesii + ("tt" + a) ;
|
||||
|
||||
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") ;
|
||||
|
||||
sLukko : Str -> CommonNoun = \lukko ->
|
||||
let a = getHarmony (last lukko)
|
||||
in
|
||||
sKukko lukko (weakGrade lukko + "n") (lukko + "j" + a) ;
|
||||
|
||||
-- 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)) ;
|
||||
|
||||
sBaari : Str -> CommonNoun = \baaria ->
|
||||
let
|
||||
baari = Predef.tk 1 baaria ;
|
||||
baar = Predef.tk 1 baari ;
|
||||
a = getHarmony (Predef.dp 1 baaria)
|
||||
in
|
||||
sKukko baari (baari + "n") (baar + ("ej" + a)) ;
|
||||
|
||||
sKorpi : (_,_,_ : Str) -> CommonNoun = \korpi,korven,korpena ->
|
||||
let {
|
||||
a = Predef.dp 1 korpena ;
|
||||
korpe = Predef.tk 2 korpena ;
|
||||
korve = Predef.tk 1 korven ;
|
||||
korvi = Predef.tk 1 korve + "i"
|
||||
}
|
||||
in
|
||||
mkSubst a
|
||||
korpi
|
||||
korve
|
||||
korpe
|
||||
(korpe + a)
|
||||
(korpe + "en")
|
||||
korpi
|
||||
korvi
|
||||
(korpi + "en")
|
||||
(korpi + a)
|
||||
(korpi + "in") ;
|
||||
|
||||
sArpi : Str -> CommonNoun = \arpi ->
|
||||
sKorpi arpi (init (weakGrade arpi) + "en") (init arpi + "ena") ;
|
||||
sSylki : Str -> CommonNoun = \sylki ->
|
||||
sKorpi sylki (init (weakGrade sylki) + "en") (init sylki + "enä") ;
|
||||
|
||||
--- This is not quite right.
|
||||
|
||||
sKoira : Str -> CommonNoun = \koira ->
|
||||
let a = getHarmony (last koira) in
|
||||
sKorpi koira (koira + "n") (koira + "n" + 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 ;
|
||||
i = Predef.dp 1 nauri ;
|
||||
naurii = nauri + i ;
|
||||
naurei = nauri + "i"
|
||||
}
|
||||
in
|
||||
mkSubst a
|
||||
nauris
|
||||
naurii
|
||||
naurii
|
||||
(nauris + ("t" + a))
|
||||
(naurii + "seen")
|
||||
naurei
|
||||
naurei
|
||||
(naurei + "den")
|
||||
(naurei + ("t" + a))
|
||||
(naurei + "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 -> case u of {
|
||||
"a" => "a" ;
|
||||
"o" => "a" ;
|
||||
"u" => "a" ;
|
||||
_ => "ä"
|
||||
} ;
|
||||
|
||||
|
||||
-- The following function defines how grade alternation works if it is active.
|
||||
-- In general, *whether there is* grade alternation must be given in the lexicon
|
||||
-- (cf. "auto" - "auton", not "audon").
|
||||
|
||||
weakGrade : Str -> Str = \kukko ->
|
||||
let {
|
||||
kukk = init kukko ;
|
||||
ku = Predef.tk 3 kukko ;
|
||||
kul = Predef.tk 2 kukko ;
|
||||
kk = init (Predef.dp 3 kukko) ;
|
||||
k = last kk ;
|
||||
o = last kukko ;
|
||||
kuk = case kk of {
|
||||
"kk" => ku + "k" ;
|
||||
"pp" => ku + "p" ;
|
||||
"tt" => ku + "t" ;
|
||||
"nk" => ku + "ng" ;
|
||||
"nt" => ku + "nn" ;
|
||||
"mp" => ku + "mm" ;
|
||||
"rt" => ku + "rr" ;
|
||||
"lt" => ku + "ll" ;
|
||||
"lk" => kul + case o of {
|
||||
"i" => "j" ;
|
||||
_ => ""
|
||||
} ;
|
||||
"rk" => kul + case o of {
|
||||
"i" => "j" ;
|
||||
_ => ""
|
||||
} ;
|
||||
"hk" => kukk ; -- *tahko-tahon
|
||||
"sk" => kukk ; -- *lasku-lasvun
|
||||
"sp" => kukk ; -- *raspi-rasvin
|
||||
"st" => kukk ; -- *lastu-lasdun
|
||||
_ => case k of {
|
||||
"k" => case o of {
|
||||
"u" => kul + "v" ;
|
||||
_ => kul
|
||||
};
|
||||
"p" => kul + "v" ;
|
||||
"t" => kul + "d" ;
|
||||
_ => kukk
|
||||
}
|
||||
}
|
||||
}
|
||||
in kuk + 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" ;
|
||||
PCase Abess => minu + ("tt" + a) ;
|
||||
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 ;
|
||||
|
||||
pronTama = mkPronoun "tämä" "tämän" "tätä" "tänä" "tähän" Sg P3 ;
|
||||
pronNama = mkPronoun "nämä" "näiden" "näitä" "näinä" "näihin" Pl P3 ;
|
||||
pronTuo = mkPronoun "tuo" "tuon" "tuota" "tuona" "tuohon" Sg P3 ;
|
||||
pronNuo = mkPronoun "nuo" "noiden" "noita" "noina" "noihin" 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" ;
|
||||
Abess => "sittä"
|
||||
} ;
|
||||
} ;
|
||||
|
||||
-- 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
|
||||
}
|
||||
} ;
|
||||
|
||||
mikaanPron : Number => Case => Str = \\n,c =>
|
||||
case <n,c> of {
|
||||
<Sg,Nom> => "mikään" ;
|
||||
<_,Part> => "mitään" ;
|
||||
<Sg,Gen> => "minkään" ;
|
||||
<Pl,Nom> => "mitkään" ;
|
||||
<Pl,Gen> => "mittenkään" ;
|
||||
<_,Ess> => "minään" ;
|
||||
<_,Iness> => "missään" ;
|
||||
<_,Elat> => "mistään" ;
|
||||
<_,Adess> => "millään" ;
|
||||
<_,Ablat> => "miltään" ;
|
||||
_ => mikaInt ! n ! c + "kään"
|
||||
} ;
|
||||
|
||||
kukaanPron : Number => Case => Str =
|
||||
table {
|
||||
Sg => table {
|
||||
Nom => "kukaan" ;
|
||||
Part => "ketään" ;
|
||||
Ess => "kenään" ;
|
||||
Iness => "kessään" ;
|
||||
Elat => "kestään" ;
|
||||
Illat => "kehenkään" ;
|
||||
Adess => "kellään" ;
|
||||
Ablat => "keltään" ;
|
||||
c => kukaInt ! Sg ! c + "kään"
|
||||
} ;
|
||||
Pl => table {
|
||||
Nom => "ketkään" ;
|
||||
Part => "keitään" ;
|
||||
Ess => "keinään" ;
|
||||
Iness => "keissään" ;
|
||||
Elat => "keistään" ;
|
||||
Adess => "keillään" ;
|
||||
Ablat => "keiltään" ;
|
||||
c => kukaInt ! Pl ! c + "kään"
|
||||
}
|
||||
} ;
|
||||
|
||||
jokuPron : Number => Case => Str =
|
||||
let
|
||||
ku = sPuu "ku" ;
|
||||
kui = sPuu "kuu"
|
||||
in
|
||||
table {
|
||||
Sg => table {
|
||||
Nom => "joku" ;
|
||||
Gen => "jonkun" ;
|
||||
c => relPron.s ! Sg ! c + ku.s ! NCase Sg c
|
||||
} ;
|
||||
Pl => table {
|
||||
Nom => "jotkut" ;
|
||||
c => relPron.s ! Pl ! c + kui.s ! NCase Pl c
|
||||
}
|
||||
} ;
|
||||
|
||||
jokinPron : Number => Case => Str =
|
||||
table {
|
||||
Sg => table {
|
||||
Nom => "jokin" ;
|
||||
Gen => "jonkin" ;
|
||||
c => relPron.s ! Sg ! c + "kin"
|
||||
} ;
|
||||
Pl => table {
|
||||
Nom => "jotkin" ;
|
||||
c => relPron.s ! Pl ! c + "kin"
|
||||
}
|
||||
} ;
|
||||
|
||||
moniPron : Case => Str = caseTable singular (sSusi "moni" "monen" "monena") ;
|
||||
|
||||
caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
||||
\\c => cn.s ! NCase n c ;
|
||||
|
||||
|
||||
--2 Adjectives
|
||||
--
|
||||
-- To form an adjective, it is usually enough to give a noun declension: the
|
||||
-- adverbial form is regular.
|
||||
|
||||
noun2adj : CommonNoun -> Adjective = noun2adjComp True ;
|
||||
|
||||
noun2adjComp : Bool -> CommonNoun -> Adjective = \isPos,tuore ->
|
||||
let
|
||||
tuoreesti = Predef.tk 1 (tuore.s ! NCase Sg Gen) + "sti" ;
|
||||
tuoreemmin = Predef.tk 2 (tuore.s ! NCase Sg Gen) + "in"
|
||||
in {s = table {
|
||||
AN f => tuore.s ! f ;
|
||||
AAdv => if_then_Str isPos tuoreesti tuoreemmin
|
||||
}
|
||||
} ;
|
||||
|
||||
-- For the comparison of adjectives, three noun declensions
|
||||
-- are needed in the worst case.
|
||||
|
||||
mkAdjDegr : (_,_,_ : Adjective) -> 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
|
||||
(noun2adj kiva)
|
||||
(noun2adjComp False (sSuurempi kivempaa))
|
||||
(noun2adjComp False (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 "harppoa", "hukkua", "löytyä", with grade alternation.
|
||||
|
||||
vHukkua : (_,_ : Str) -> Verb = \hukkua,huku ->
|
||||
let {
|
||||
a = Predef.dp 1 hukkua ;
|
||||
hukku = Predef.tk 1 hukkua ;
|
||||
u = Predef.dp 1 huku
|
||||
} in
|
||||
mkVerb
|
||||
hukkua
|
||||
(huku + "n")
|
||||
(hukku + u)
|
||||
(hukku + (("v" + a) + "t"))
|
||||
(hukku + (("k" + a) + a))
|
||||
(huku + ((("t" + a) + a) + "n")) ;
|
||||
|
||||
-- For cases without alternation: "sanoa", "valua", "kysyä".
|
||||
|
||||
vSanoa : Str -> Verb = \sanoa ->
|
||||
vHukkua sanoa (Predef.tk 1 sanoa) ;
|
||||
|
||||
-- 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 "osata", "lisätä"
|
||||
|
||||
vOsata : Str -> Verb = \osata ->
|
||||
let {
|
||||
a = Predef.dp 1 osata ;
|
||||
osa = Predef.tk 2 osata
|
||||
} in
|
||||
mkVerb
|
||||
osata
|
||||
(osa + (a + "n"))
|
||||
(osa + a)
|
||||
(osa + ((("a" + "v") + a) + "t"))
|
||||
(osa + ((("t" + "k") + a) + a))
|
||||
(osata + (a + "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 : Number -> Case => Str = \n ->
|
||||
let {kaiket = caseTable n (sKorpi "kaikki" "kaiken" "kaikkena")} in
|
||||
table {
|
||||
Nom => "kaikki" ;
|
||||
c => kaiket ! c
|
||||
} ;
|
||||
|
||||
stopPunct = "." ;
|
||||
commaPunct = "," ;
|
||||
questPunct = "?" ;
|
||||
exclPunct = "!" ;
|
||||
|
||||
koPart = suff "ko" ;
|
||||
|
||||
} ;
|
||||
@@ -1,300 +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, $Structural.gf$.
|
||||
--
|
||||
-- The main difference with $MorphoFin.gf$ is that the types
|
||||
-- referred to are compiled resource grammar types. We have moreover
|
||||
-- had the design principle of always having existing forms, not
|
||||
-- stems, 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 Prelude, SyntaxFin, ResourceFin in {
|
||||
|
||||
--2 Parameters
|
||||
--
|
||||
-- To abstract over gender, number, and (some) case names,
|
||||
-- we define the following identifiers.
|
||||
|
||||
oper
|
||||
Gender : Type;
|
||||
|
||||
human : Gender ;
|
||||
nonhuman : Gender ;
|
||||
|
||||
Number : Type;
|
||||
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
|
||||
Case : Type ;
|
||||
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) -> N ;
|
||||
|
||||
-- For convenience, we define 1-argument paradigms as producing the
|
||||
-- nonhuman gender; the following function changes this:
|
||||
|
||||
humanN : N -> 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) -> N ;
|
||||
|
||||
-- Another special case are nouns where the last two consonants
|
||||
-- undergo regular weak-grade alternation:
|
||||
-- "kukko - kukon", "rutto - ruton", "hyppy - hypyn", "sampo - sammon",
|
||||
-- "kunto - kunnon", "sisältö - sisällön", .
|
||||
|
||||
nLukko : (lukko : Str) -> N ;
|
||||
|
||||
-- "arpi - arven", "sappi - sapen", "kampi - kammen";"sylki - syljen"
|
||||
|
||||
nArpi : (arpi : Str) -> N ;
|
||||
nSylki : (sylki : Str) -> 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) -> N ;
|
||||
|
||||
-- Nouns of at least 3 syllables ending with "a" or "ä", like "peruna", "tavara",
|
||||
-- "rytinä".
|
||||
|
||||
nPeruna : (peruna : Str) -> 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) -> 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) -> N ;
|
||||
|
||||
-- Nouns ending with a long vowel, such as "puu", "pää", "pii", "leikkuu",
|
||||
-- are inflected according to the following.
|
||||
|
||||
nPuu : (puu : Str) -> N ;
|
||||
|
||||
-- One-syllable diphthong nouns, such as "suo", "tie", "työ", are inflected by
|
||||
-- the following.
|
||||
|
||||
nSuo : (suo : Str) -> 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) -> N ;
|
||||
|
||||
-- The following covers some nouns ending with a consonant, e.g.
|
||||
-- "tilaus", "kaulin", "paimen", "laidun".
|
||||
|
||||
nTilaus : (tilaus,tilauksena : Str) -> N ;
|
||||
|
||||
-- Special case:
|
||||
|
||||
nKulaus : (kulaus : Str) -> 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) -> 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.
|
||||
-- The plural forms are filtered away by the compiler.
|
||||
|
||||
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.
|
||||
--.
|
||||
Gender = SyntaxFin.Gender ;
|
||||
Case = SyntaxFin.Case ;
|
||||
Number = SyntaxFin.Number ;
|
||||
|
||||
singular = Sg ;
|
||||
plural = Pl ;
|
||||
|
||||
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 -> sKukko a b c ** {g = nonhuman ; lock_N = <>} ;
|
||||
|
||||
humanN = \n -> {s = n.s ; lock_N = n.lock_N ; g = human} ;
|
||||
|
||||
nLukko = \a -> sLukko a ** {g = nonhuman ; lock_N = <>} ;
|
||||
nTalo = \a -> sTalo a ** {g = nonhuman ; lock_N = <>} ;
|
||||
nArpi = \a -> sArpi a ** {g = nonhuman ; lock_N = <>} ;
|
||||
nSylki = \a -> sSylki a ** {g = nonhuman ; lock_N = <>} ;
|
||||
nLinux = \a -> sLinux a ** {g = nonhuman ; lock_N = <>} ;
|
||||
nPeruna = \a -> sPeruna a ** {g = nonhuman ; lock_N = <>} ;
|
||||
nRae = \a,b -> sRae a b ** {g = nonhuman ; lock_N = <>} ;
|
||||
nSusi = \a,b,c -> sSusi a b c ** {g = nonhuman ; lock_N = <>} ;
|
||||
nPuu = \a -> sPuu a ** {g = nonhuman ; lock_N = <>} ;
|
||||
nSuo = \a -> sSuo a ** {g = nonhuman ; lock_N = <>} ;
|
||||
nNainen = \a -> sNainen a ** {g = nonhuman ; lock_N = <>} ;
|
||||
nTilaus = \a,b -> sTilaus a b ** {g = nonhuman ; lock_N = <>} ;
|
||||
nKulaus = \a -> nTilaus a (init a + "ksen" + getHarmony (last
|
||||
(init a))) ;
|
||||
nNauris = \a -> sNauris a ** {g = nonhuman ; 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 -> noun2adj x ** {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 = <>} ;
|
||||
} ;
|
||||
@@ -1,6 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
resource PredicationFin = Predication with
|
||||
(Resource = ResourceFin), (ResourceExt = ResourceExtFin) ;
|
||||
|
||||
-- this is the standard form of a derived resource. AR 12/1/2004
|
||||
@@ -1,4 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
resource ResourceExtFin = ResourceExt with (Resource = ResourceFin) ;
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
instance ResourceFin of Resource = reuse StructuralFin ;
|
||||
@@ -1,149 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
--1 The Top-Level Finnish Resource Grammar: Structural Words
|
||||
--
|
||||
-- Aarne Ranta 2002 -- 2003
|
||||
--
|
||||
concrete StructuralFin of Structural =
|
||||
CombinationsFin ** open Prelude, SyntaxFin in {
|
||||
lin
|
||||
|
||||
INP = pronNounPhrase pronMina ;
|
||||
ThouNP = pronNounPhrase pronSina ;
|
||||
HeNP = pronNounPhrase pronHan ;
|
||||
SheNP = pronNounPhrase pronHan ;
|
||||
WeNumNP = pronWithNum pronMe ;
|
||||
YeNumNP = pronWithNum pronTe ;
|
||||
YouNP = pronNounPhrase pronTe ;
|
||||
TheyNP = pronNounPhrase pronHe ; --- ne
|
||||
|
||||
ItNP = nameNounPhrase pronSe ;
|
||||
ThisNP = pronNounPhraseNP pronTama ;
|
||||
ThatNP = pronNounPhraseNP pronTuo ;
|
||||
TheseNumNP = pronWithNum pronNama ;
|
||||
ThoseNumNP = pronWithNum pronNuo ;
|
||||
|
||||
EverybodyNP = {
|
||||
s = \\f => kaikkiPron Pl ! (npForm2Case Pl f) ; -- näin kaikki
|
||||
n = Pl ;
|
||||
p = NP3
|
||||
} ;
|
||||
EverythingNP = {
|
||||
s = \\f => kaikkiPron Sg ! (npForm2Case Sg f) ; -- näin kaiken
|
||||
n = Sg ;
|
||||
p = NP3
|
||||
} ;
|
||||
|
||||
SomebodyNP = {
|
||||
s = \\f => jokuPron ! Sg ! (npForm2Case Sg f) ;
|
||||
n = Sg ;
|
||||
p = NP3
|
||||
} ;
|
||||
SomethingNP = {
|
||||
s = \\f => jokinPron ! Sg ! (npForm2Case Sg f) ; -- näin kaiken
|
||||
n = Sg ;
|
||||
p = NP3
|
||||
} ;
|
||||
|
||||
--- This two don't work in Finnish except out of context
|
||||
--- ("kenet tapasitte - emme ketään").
|
||||
|
||||
NobodyNP = {
|
||||
s = \\f => "ei" ++ kukaanPron ! Sg ! (npForm2Case Sg f) ;
|
||||
n = Sg ;
|
||||
p = NP3
|
||||
} ;
|
||||
NothingNP = {
|
||||
s = \\f => "ei" ++ mikaanPron ! Sg ! (npForm2Case Sg f) ;
|
||||
n = Sg ;
|
||||
p = NP3
|
||||
} ;
|
||||
|
||||
EveryDet = jokainenDet ;
|
||||
AllMassDet = mkDeterminer singular (kaikkiPron Sg) ;
|
||||
AllNumDet = kaikkiDet ;
|
||||
WhichDet = mikaDet ;
|
||||
WhichNumDet n = mkDeterminerGenNum n (mikaInt ! Pl) (kukaInt ! Pl) ;
|
||||
MostDet = mkDeterminer singular (caseTable singular (sSuurin "enintä")) ;
|
||||
MostsDet = useimmatDet ;
|
||||
ManyDet = mkDeterminer singular moniPron ;
|
||||
MuchDet = mkDeterminer singular (caseTable singular (sNauris "runsasta")) ;
|
||||
|
||||
--- The following 4 only work this way in Finnish if used outside sentences
|
||||
--- with a verb.
|
||||
|
||||
AnyDet = mkDeterminerGen Sg (mikaanPron ! Sg) (kukaanPron ! Sg) ;
|
||||
AnyNumDet n = mkDeterminerGenNum n (mikaanPron ! Pl) (kukaanPron ! Pl) ;
|
||||
NoDet = mkDeterminerGen Sg
|
||||
(\\c => "ei" ++ mikaanPron ! Sg ! c)
|
||||
(\\c => "ei" ++ kukaanPron ! Sg ! c) ;
|
||||
NoNumDet n = mkDeterminerGenNum n
|
||||
(\\c => "ei" ++ mikaanPron ! Pl ! c)
|
||||
(\\c => "ei" ++ kukaanPron ! Pl ! c) ;
|
||||
|
||||
ThisDet = mkDeterminer Sg (\\c => pronTama.s ! PCase c) ;
|
||||
ThatDet = mkDeterminer Sg (\\c => pronTuo.s ! PCase c) ;
|
||||
TheseNumDet n = mkDeterminerNum n (\\c => pronNama.s ! PCase c) ;
|
||||
ThoseNumDet n = mkDeterminerNum n (\\c => pronNuo.s ! PCase c) ;
|
||||
|
||||
SomeDet = mkDeterminerGen Sg (jokinPron ! Sg) (jokuPron ! Sg) ;
|
||||
SomeNumDet n = mkDeterminerGenNum n (jokinPron ! Pl) (jokuPron ! Pl) ;
|
||||
|
||||
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" ;
|
||||
AlthoughSubj = ss "vaikka" ;
|
||||
|
||||
PhrYes = ss ("Kyllä" ++ stopPunct) ;
|
||||
PhrNo = ss ("Ei" ++ stopPunct) ;
|
||||
|
||||
VeryAdv = ss "hyvin" ;
|
||||
TooAdv = ss "liian" ;
|
||||
|
||||
OtherwiseAdv = ss "muuten" ;
|
||||
ThereforeAdv = ss "siksi" ;
|
||||
|
||||
CanVV = nomVerbVerb (vJuoda "voida") ;
|
||||
CanKnowVV = nomVerbVerb (vOsata "osata") ;
|
||||
MustVV = vHukkua "täytyä" "täydy" ** {c = CCase Gen} ;
|
||||
WantVV = nomVerbVerb (vOsata "haluta") ;
|
||||
|
||||
EverywhereNP = ss "kaikkialla" ;
|
||||
SomewhereNP = ss "jossain" ;
|
||||
NowhereNP = ss ["ei missään"] ;
|
||||
|
||||
AlthoughSubj = ss "vaikka" ;
|
||||
|
||||
AlmostAdv = ss "melkein" ;
|
||||
QuiteAdv = ss "aika" ;
|
||||
|
||||
InPrep = prepCase Iness ;
|
||||
OnPrep = prepCase Adess ;
|
||||
ToPrep = prepCase Illat ; --- allat
|
||||
ThroughPrep = prepPostpGen "kautta" ;
|
||||
AbovePrep = prepPostpGen "yläpuolella" ;
|
||||
UnderPrep = prepPostpGen "alla" ;
|
||||
InFrontPrep = prepPostpGen "edessä" ;
|
||||
BehindPrep = prepPostpGen "takana" ;
|
||||
BetweenPrep = prepPostpGen "välissä" ;
|
||||
FromPrep = prepCase Elat ; --- ablat
|
||||
BeforePrep = prepPrep "ennen" Part ;
|
||||
DuringPrep = prepPostpGen "aikana" ;
|
||||
AfterPrep = prepPostpGen "jälkeen" ;
|
||||
WithPrep = prepPostpGen "kanssa" ;
|
||||
WithoutPrep = prepPrep "ilman" Part ;
|
||||
ByMeansPrep = prepPostpGen "avulla" ;
|
||||
PossessPrep = prepCase Gen ;
|
||||
PartPrep = prepCase Part ;
|
||||
AgentPrep = prepPostpGen "toimesta" ;
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,60 +0,0 @@
|
||||
-- use this path to read the grammar from the same directory
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
concrete TestResourceFin of TestResource =
|
||||
StructuralFin ** 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 = noun2adj (sNainen "amerikkalaista") ;
|
||||
Finnish = noun2adj (sNainen "suomalaista") ;
|
||||
Happy = regAdjDegr (sNainen "onnellista") "onnellisempaa" "onnellisinta" ;
|
||||
|
||||
Married = noun2adj (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") ;
|
||||
Bottle = cnNoHum (sTalo "pullo") ;
|
||||
Car = cnNoHum (sTalo "auto") ;
|
||||
House = cnNoHum (sTalo "talo") ;
|
||||
Bar = cnNoHum (sBaari "baaria") ;
|
||||
Wine = cnNoHum (sBaari "viiniä") ;
|
||||
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") ;
|
||||
Drink = mkTransVerbDir (vJuoda "juoda") ;
|
||||
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") ;
|
||||
|
||||
} ;
|
||||
@@ -1,130 +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. 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
|
||||
| Abess ; ---- | Comit | Instruct ;
|
||||
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, except for the adverbial form.
|
||||
|
||||
param
|
||||
AForm = AN NForm | AAdv ;
|
||||
|
||||
oper
|
||||
Adjective : Type = {s : AForm => Str} ;
|
||||
AdjDegr : Type = {s : Degree => AForm => 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} ;
|
||||
|
||||
} ;
|
||||
@@ -1,4 +0,0 @@
|
||||
--# -path=.:../romance:../abstract:../../prelude
|
||||
|
||||
concrete CombinationsFre of Combinations =
|
||||
CombinationsRomance with (SyntaxRomance=SyntaxFre) ;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,231 +0,0 @@
|
||||
--# -path=.:../romance:../abstract:../../prelude
|
||||
|
||||
--1 French 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 $MorphoFre.gf$ is that the types
|
||||
-- referred to are compiled resource grammar types. We have moreover
|
||||
-- had the design principle of always having existing forms, not stems, as string
|
||||
-- arguments of the paradigms.
|
||||
--
|
||||
-- The following modules are presupposed:
|
||||
|
||||
resource ParadigmsFre =
|
||||
open Prelude, (Types = TypesFre), SyntaxFre, MorphoFre,
|
||||
ResourceFre in {
|
||||
|
||||
--2 Parameters
|
||||
--
|
||||
-- To abstract over gender names, we define the following identifiers.
|
||||
|
||||
oper
|
||||
Bool : Type ;
|
||||
|
||||
Gender : Type ;
|
||||
|
||||
masculine : Gender ;
|
||||
feminine : Gender ;
|
||||
|
||||
-- To abstract over number names, we define the following.
|
||||
|
||||
Number : Type ;
|
||||
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
|
||||
-- To abstract over case names, we define the following. (Except for
|
||||
-- some pronouns, the accusative is equal to the nominative, the
|
||||
-- dative is formed by the preposition "à", and the genitive by the
|
||||
-- preposition "de".)
|
||||
|
||||
Case : Type ;
|
||||
|
||||
nominative : Case ;
|
||||
accusative : Case ;
|
||||
dative : Case ;
|
||||
genitive : Case ;
|
||||
|
||||
|
||||
--2 Nouns
|
||||
|
||||
-- Worst case: two forms (singular + plural),
|
||||
-- and the gender.
|
||||
|
||||
mkN : (_,_ : Str) -> Gender -> N ; -- oeil, yeux, masculine
|
||||
|
||||
-- Often it is enough with one form. Some of them have a typical gender.
|
||||
|
||||
nReg : Str -> Gender -> N ; -- regular, e.g. maison, (maisons,) feminine
|
||||
nEau : Str -> Gender -> N ; -- eau, (eaux,) feminine
|
||||
nCas : Str -> Gender -> N ; -- cas, (cas,) masculine
|
||||
nCheval : Str -> N ; -- cheval, (chevaux, masculine)
|
||||
|
||||
-- Nouns used as functions need a case and a preposition. The most common is "de".
|
||||
|
||||
funPrep : N -> Preposition -> Fun ;
|
||||
funCase : N -> Case -> Fun ;
|
||||
funDe : N -> Fun ;
|
||||
|
||||
-- Functions can also be built from compunt nouns ("le numéro téléphonique de")
|
||||
|
||||
funCNCase : CN -> Case -> Fun ;
|
||||
|
||||
-- Proper names, with their gender.
|
||||
|
||||
mkPN : Str -> Gender -> PN ; -- Jean, masculine
|
||||
|
||||
-- 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 -> NP ;
|
||||
|
||||
|
||||
--2 Adjectives
|
||||
|
||||
-- Non-comparison one-place adjectives need three forms in the worst case.
|
||||
-- A parameter tells if they are pre- or postpositions in modification.
|
||||
|
||||
Position : Type ;
|
||||
prepos : Position ;
|
||||
postpos : Position ;
|
||||
|
||||
mkAdj1 : (bon, bonne, bons, bien : Str) -> Position -> Adj1 ;
|
||||
|
||||
-- Usually it is enough to give the two singular forms. Fully regular adjectives
|
||||
-- only need the masculine singular form.
|
||||
|
||||
adj1Reg : Str -> Position -> Adj1 ;
|
||||
adj1Sale : Str -> Position -> Adj1 ;
|
||||
adj1Anglais : Str -> Position -> Adj1 ;
|
||||
adj1Italien : Str -> Position -> Adj1 ;
|
||||
adj1Cher : (cher, chère : Str) -> Position -> Adj1 ;
|
||||
|
||||
-- Two-place adjectives need a preposition and a case as extra arguments.
|
||||
|
||||
mkAdj2 : Adj1 -> Preposition -> Case -> Adj2 ; -- divisible par
|
||||
|
||||
-- Comparison adjectives may need two adjectives, corresponding to the
|
||||
-- positive and other forms.
|
||||
|
||||
mkAdjDeg : (bon, meilleur : Adj1) -> AdjDeg ;
|
||||
|
||||
-- In the completely regular case, the comparison forms are constructed by
|
||||
-- the particle "plus".
|
||||
|
||||
aReg : Str -> Position -> AdjDeg ; -- lent (, plus lent)
|
||||
|
||||
-- On top level, there are adjectival phrases. The most common case is
|
||||
-- just to use a one-place adjective.
|
||||
|
||||
apReg : Str -> Position -> AP ;
|
||||
|
||||
|
||||
--2 Verbs
|
||||
--
|
||||
-- The fragment only has present tense so far, but in all persons.
|
||||
-- These are examples of standard conjugations are available. The full list
|
||||
-- of Bescherelle conjugations is given in $MorphoFra.gf$, with all forms
|
||||
-- (their type is $Verbum$). The present-tense forms can be extracted by the
|
||||
-- function $extractVerb$.
|
||||
|
||||
vAimer : Str -> V ;
|
||||
vFinir : Str -> V ;
|
||||
vDormir : Str -> V ;
|
||||
vCourir : Str -> V ;
|
||||
vVenir : Str -> V ;
|
||||
|
||||
extractVerb : Verbum -> V ;
|
||||
|
||||
-- The verbs 'be' and 'have' are special.
|
||||
|
||||
vEtre : V ;
|
||||
vAvoir : V ;
|
||||
|
||||
-- Two-place verbs, and the special case with direct object. Notice that
|
||||
-- a particle can be included in a $V$.
|
||||
|
||||
mkTV : V -> Preposition -> Case -> TV ;
|
||||
tvDir : V -> TV ;
|
||||
|
||||
-- The idiom with "avoir" and an invariable noun, such as "peur", "faim",
|
||||
-- and a two-place variant with "de" + complement.
|
||||
|
||||
avoirChose : Str -> V ;
|
||||
avoirChoseDe : Str -> TV ;
|
||||
|
||||
-- The definitions should not bother the user of the API. So they are
|
||||
-- hidden from the document.
|
||||
--.
|
||||
Bool = Prelude.Bool ;
|
||||
|
||||
Gender = SyntaxFre.Gender ;
|
||||
Case = SyntaxFre.Case ;
|
||||
Number = SyntaxFre.Number ;
|
||||
|
||||
masculine = Types.Masc ;
|
||||
feminine = Types.Fem ;
|
||||
|
||||
nominative = Types.nominative ;
|
||||
accusative = Types.accusative ;
|
||||
genitive = Types.genitive ;
|
||||
dative = Types.dative ;
|
||||
|
||||
singular = Types.singular ;
|
||||
plural = Types.plural ;
|
||||
|
||||
mkN a b c = mkCNomIrreg a b c ** {lock_N = <>} ;
|
||||
|
||||
nEau = \eau -> mkN eau (eau + "z") ;
|
||||
nCas = \cas -> mkN cas cas ;
|
||||
nReg = \cas -> mkN cas (cas + "s") ;
|
||||
nCheval = \cheval -> mkN cheval (Predef.tk 1 cheval + "ux") masculine ;
|
||||
|
||||
funPrep = \n,p -> n ** complement p ** {lock_Fun = <>} ;
|
||||
funCase = \n,p -> n ** complementCas p ** {lock_Fun = <>} ;
|
||||
funCNCase = \n,p -> n ** complementCas p ** {lock_Fun = <>} ;
|
||||
funDe x = funCase x genitive ;
|
||||
mkPN s g = mkProperName s g ** {lock_PN = <>} ;
|
||||
mkCN = UseN ;
|
||||
mkNP s g = UsePN (mkPN s g) ;
|
||||
|
||||
Position = Prelude.Bool ;
|
||||
prepos = adjPre ;
|
||||
postpos = adjPost ;
|
||||
mkAdj1 = \x,y,z,u,p -> mkAdjective (mkAdj x z y u) p ** {lock_Adj1 = <>} ;
|
||||
adj1Reg = \lent -> mkAdj1 lent (lent+"e") (lent+"s") (lent+"ement") ;
|
||||
adj1Sale = \sale -> mkAdj1 sale sale (sale+"s") (sale+"ment") ;
|
||||
adj1Anglais = \anglais -> mkAdj1 anglais (anglais+"e") anglais (anglais+"ement") ;
|
||||
adj1Italien = \italien -> mkAdj1 italien (italien+"ne") (italien+"s") (italien+"nement") ;
|
||||
adj1Cher = \cher,chere -> mkAdj1 cher chere (cher+"s") (chere + "ment") ;
|
||||
|
||||
mkAdj2 = \a,p,c -> mkAdjCompl a postpos {s2 = p ; c = c} ** {lock_Adj2 = <>} ;
|
||||
mkAdjDeg = \b,m -> mkAdjDegr (mkAdjComp b.s m.s) b.p ** {lock_AdjDeg = <>} ;
|
||||
aReg = \a,p -> mkAdjDegrLong (adj1Reg a p) p ** {lock_AdjDeg = <>} ;
|
||||
apReg a p = adj1Reg a p ** {lock_AP = <>} ;
|
||||
|
||||
vAimer = \s -> verbPres (conj1aimer s) ** {lock_V = <>} ;
|
||||
vFinir = \s -> verbPres (conj2finir s) ** {lock_V = <>} ;
|
||||
vDormir = \s -> verbPres (conj3dormir s) ** {lock_V = <>} ;
|
||||
vCourir = \s -> verbPres (conj3courir s) ** {lock_V = <>} ;
|
||||
vVenir = \s -> verbPres (conj3tenir s) ** {lock_V = <>} ;
|
||||
extractVerb v = verbPres v ** {lock_V = <>} ;
|
||||
vEtre = verbEtre ** {lock_V = <>} ;
|
||||
vAvoir = verbPres (conjAvoir "avoir") ** {lock_V = <>} ;
|
||||
|
||||
mkTV v p c = mkTransVerb v p c ** {lock_TV = <>} ;
|
||||
tvDir v = mkTransVerbDir v ** {lock_TV = <>} ;
|
||||
|
||||
avoirChose = \faim ->
|
||||
{s = let {avoir = vAvoir.s} in \\v => avoir ! v ++ faim} ** {lock_V = <>} ;
|
||||
avoirChoseDe = \faim -> mkTV (avoirChose faim) [] genitive ** {lock_TV = <>} ;
|
||||
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
--# -path=.:../abstract:../romance:../../prelude
|
||||
|
||||
resource PredicationFre = Predication with
|
||||
(Resource = ResourceFre), (ResourceExt = ResourceExtFre) ;
|
||||
|
||||
-- this is the standard form of a derived resource. AR 12/1/2004
|
||||
@@ -1,4 +0,0 @@
|
||||
--# -path=.:../abstract:../romance:../../prelude
|
||||
|
||||
resource ResourceExtFre = ResourceExt with (Resource = ResourceFre) ;
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
--# -path=.:../romance:../abstract:../../prelude
|
||||
|
||||
instance ResourceFre of Resource = reuse StructuralFre ;
|
||||
@@ -1,111 +0,0 @@
|
||||
--# -path=.:../romance:../abstract:../../prelude
|
||||
|
||||
concrete StructuralFre of Structural = CombinationsFre **
|
||||
open SyntaxFre, MorphoFre, Prelude in {
|
||||
|
||||
lin
|
||||
INP = pronNounPhrase pronJe ;
|
||||
ThouNP = pronNounPhrase pronTu ;
|
||||
HeNP = pronNounPhrase pronIl ;
|
||||
SheNP = pronNounPhrase pronElle ;
|
||||
WeNumNP n = pronNounPhrase (pronWithNum pronNous n) ;
|
||||
YeNumNP n = pronNounPhrase (pronWithNum pronVous n) ;
|
||||
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}) ;
|
||||
|
||||
ThisNP = mkNameNounPhrase ["ceci"] Masc ;
|
||||
ThatNP = mkNameNounPhrase ["ça"] Masc ;
|
||||
TheseNumNP n = mkNameNounPhrase ("ceux" ++ n.s ! Masc ++ "ci") Masc ;
|
||||
ThoseNumNP n = mkNameNounPhrase ("ceux" ++ n.s ! Masc ++ "là") Masc ;
|
||||
|
||||
ItNP = pronNounPhrase pronIl ;
|
||||
|
||||
EveryDet = chaqueDet ;
|
||||
AllMassDet = toutDet ;
|
||||
AllNumDet = tousDet ;
|
||||
WhichDet = quelDet ;
|
||||
WhichNumDet = mkDeterminerNum plural "quels" "quelles" ;
|
||||
MostsDet = plupartDet ;
|
||||
MostDet = mkDeterminer1 singular (["la plupart"] ++ elisDe) ; --- de
|
||||
SomeDet = mkDeterminer1 singular "quelque" ;
|
||||
SomeNumDet = mkDeterminerNum plural "quelques" "quelques" ;
|
||||
NoDet = mkDeterminer singular "aucun" "aucune" ; --- ne
|
||||
NoNumDet = mkDeterminerNum plural ("aucun" ++ "des") ("aucune" ++ "des") ; --- ne
|
||||
AnyDet = mkDeterminer1 singular "quelque" ; ---
|
||||
AnyNumDet = mkDeterminerNum plural "quelques" "quelques" ; ---
|
||||
ManyDet = mkDeterminer1 plural "plusieurs" ;
|
||||
MuchDet = mkDeterminer1 singular ("beaucoup" ++ elisDe) ; --- de
|
||||
ThisDet = mkDeterminer singular (pre {"ce" ; "cet" / voyelle}) "cette" ; --- ci
|
||||
ThatDet = mkDeterminer singular (pre {"ce" ; "cet" / voyelle}) "cette" ; --- là
|
||||
TheseNumDet = mkDeterminerNum plural "ces" "ces" ; --- ci
|
||||
ThoseNumDet = mkDeterminerNum plural "ces" "ces" ; --- là
|
||||
|
||||
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!
|
||||
|
||||
VeryAdv = ss "très" ;
|
||||
TooAdv = ss "trop" ;
|
||||
OtherwiseAdv = ss "autrement" ;
|
||||
ThereforeAdv = ss "donc" ;
|
||||
|
||||
EverybodyNP = mkNameNounPhrase ["tout le monde"] Masc ;
|
||||
SomebodyNP = mkNameNounPhrase ["quelqu'un"] Masc ;
|
||||
NobodyNP = mkNameNounPhrase ["personne"] Masc ; --- ne
|
||||
EverythingNP = mkNameNounPhrase ["tout"] Masc ;
|
||||
SomethingNP = mkNameNounPhrase ["quelque chose"] Masc ;
|
||||
NothingNP = mkNameNounPhrase ["rien"] Masc ; --- ne
|
||||
|
||||
CanVV = mkVerbVerbDir (verbPres (conj3pouvoir "pouvoir")) ;
|
||||
CanKnowVV = mkVerbVerbDir (verbPres (conj3savoir "savoir")) ;
|
||||
MustVV = mkVerbVerbDir (verbPres (conj3devoir "devoir")) ;
|
||||
WantVV = mkVerbVerbDir (verbPres (conj3vouloir "vouloir")) ;
|
||||
|
||||
EverywhereNP = ss "partout" ;
|
||||
SomewhereNP = ss ["quelque part"] ; --- ne - pas
|
||||
NowhereNP = ss ["nulle part"] ;
|
||||
|
||||
AlthoughSubj = ss ("bien" ++ elisQue) ** {m = Con} ;
|
||||
|
||||
AlmostAdv = ss "presque" ;
|
||||
QuiteAdv = ss "assez" ;
|
||||
|
||||
InPrep = justPrep "dans" ;
|
||||
OnPrep = justPrep "sur" ;
|
||||
ToPrep = justCase dative ; ---
|
||||
ThroughPrep = justPrep "par" ;
|
||||
AbovePrep = {s = ["au dessus"] ; c = genitive} ;
|
||||
UnderPrep = justPrep "sous" ;
|
||||
InFrontPrep = justPrep "devant" ;
|
||||
BehindPrep = justPrep "derrière" ;
|
||||
BetweenPrep = justPrep "entre" ;
|
||||
FromPrep = justCase genitive ; ---
|
||||
BeforePrep = justPrep "avant" ;
|
||||
DuringPrep = justPrep "pendant" ;
|
||||
AfterPrep = justPrep "après" ;
|
||||
WithPrep = justPrep "avec" ;
|
||||
WithoutPrep = justPrep "sans" ;
|
||||
ByMeansPrep = justPrep "par" ;
|
||||
PossessPrep = justCase genitive ;
|
||||
PartPrep = justCase genitive ; ---
|
||||
AgentPrep = justPrep "par" ;
|
||||
|
||||
}
|
||||
@@ -1,334 +0,0 @@
|
||||
--# -path=.:../romance:../../prelude
|
||||
|
||||
instance SyntaxFre of SyntaxRomance = TypesFre ** open Prelude, (CO=Coordination), MorphoFre in {
|
||||
|
||||
oper
|
||||
nameNounPhrase = \jean ->
|
||||
normalNounPhrase
|
||||
(\\c => prepCase c ++ jean.s)
|
||||
jean.g
|
||||
Sg ;
|
||||
|
||||
nounPhraseOn = mkNameNounPhrase "on" Masc ;
|
||||
|
||||
partitiveNounPhrase = \n,vin ->
|
||||
normalNounPhrase
|
||||
(table {
|
||||
Gen => elisDe ++ vin.s ! n ;
|
||||
c => prepCase c ++ artDef vin.g n Gen ++ vin.s ! n
|
||||
}
|
||||
)
|
||||
vin.g
|
||||
n ;
|
||||
|
||||
chaqueDet = mkDeterminer1 Sg "chaque" ;
|
||||
|
||||
toutDet : Determiner =
|
||||
{s = \\g => genForms "tout" "toute" ! g ++ artDef g Sg nominative ;
|
||||
n = Pl
|
||||
} ;
|
||||
tousDet : Numeral -> Determiner = \nu ->
|
||||
{s = \\g => genForms "tous" "toutes" ! g ++ artDef g Pl nominative ++ nu.s ! g ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
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 ;
|
||||
|
||||
npGenPossNum = \nu,ton,mec ->
|
||||
\\c => prepCase c ++ ton.s ! Poss Pl mec.g ++ nu.s ! mec.g ++ mec.s ! Pl ;
|
||||
|
||||
existNounPhrase = \duvin -> {
|
||||
s = \\m =>
|
||||
case m of {
|
||||
Ind => ["il y a"] ;
|
||||
Con => ["il y ait"]
|
||||
} ++ duvin.s ! stressed accusative --- il y en a ; have to define "y"
|
||||
} ;
|
||||
|
||||
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 ;
|
||||
Dat => True ;
|
||||
_ => False
|
||||
} ;
|
||||
|
||||
-- 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
|
||||
|
||||
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
|
||||
}
|
||||
} ;
|
||||
|
||||
existNounPhraseQuest = \duvin -> {
|
||||
s = \\m =>
|
||||
case m of {
|
||||
DirQ => optStr (estCeQue Acc) ++ ["il y a"] ;
|
||||
IndirQ => elisSi ++ ["il y a"]
|
||||
}
|
||||
++ duvin.s ! stressed accusative --- il y en a ; have to define "y"
|
||||
} ;
|
||||
|
||||
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 ** {m = Ind} ;
|
||||
quandSubj = ss "quand" ** {m = Ind} ;
|
||||
|
||||
ouiPhr = ss ["Oui ."] ;
|
||||
nonPhr = ss ["Non ."] ; --- and also Si!
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
--# -path=.:../romance:../abstract:../../prelude
|
||||
|
||||
concrete TestResourceFre of TestResource = StructuralFre ** open Prelude, TypesFre, MorphoFre, SyntaxFre in {
|
||||
|
||||
flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ;
|
||||
|
||||
lin
|
||||
Big = mkAdjDegrReg "grand" adjPre ;
|
||||
American = mkAdjective (adjGrand "américain") adjPost ;
|
||||
Finnish = mkAdjective (adjGrand "finlandais") adjPost ;
|
||||
Married = mkAdjCompl (adjJoli "marié") adjPost (complementCas dative) ;
|
||||
Small = mkAdjDegrReg "petit" adjPre ;
|
||||
Old = mkAdjDegrLong (mkAdj "vieux" "vieux" "vieille" "vieillement") adjPre ;
|
||||
Young = mkAdjDegrLong (adjJeune "jeune") adjPre ;
|
||||
Happy = mkAdjDegrLong (adjHeureux "heureux") adjPre ;
|
||||
Wine = mkCNomReg "vin" Masc ;
|
||||
Bar = mkCNomReg "bar" Masc ;
|
||||
Man = mkCNomReg "homme" Masc ;
|
||||
Woman = mkCNomReg "femme" Fem ;
|
||||
Car = mkCNomReg "voiture" Fem ;
|
||||
Light = mkCNomReg "lumière" Fem ;
|
||||
House = mkCNomReg "maison" Fem ;
|
||||
Bottle = mkCNomReg "bouteille" Fem ;
|
||||
Walk = verbPres (conj1aimer "marcher") ;
|
||||
Run = verbPres (conj3courir "courir") ;
|
||||
Send = mkTransVerbDir (verbPres (conj1envoyer "envoyer")) ;
|
||||
Love = mkTransVerbDir (verbPres (conj1aimer "aimer")) ;
|
||||
Drink = mkTransVerbDir (verbPres (conj3boire "boire")) ;
|
||||
Wait = mkTransVerbDir (verbPres (conj3rendre "attendre")) ;
|
||||
Give = mkDitransVerb (verbPres (conj1aimer "donner")) [] dative [] accusative ;
|
||||
Prefer = mkDitransVerb (verbPres (conj1aimer "preférer")) [] accusative [] dative ;
|
||||
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) ;
|
||||
Connection = mkCNomReg "connection" Fem **
|
||||
{s2 = [] ; c = genitive ; s3 = [] ; c3 = dative} ;
|
||||
|
||||
Well = ss "bien" ;
|
||||
Always = ss "toujours" ;
|
||||
|
||||
John = mkProperName "Jean" Masc ;
|
||||
Mary = mkProperName "Marie" Fem ;
|
||||
}
|
||||
@@ -1,169 +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 TypesFre 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 ;
|
||||
prepositional = accusative ;
|
||||
|
||||
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
|
||||
(\\a => "plus" ++ cher.s ! a) ;
|
||||
|
||||
-- Comparative adjectives are only sometimes formed morphologically
|
||||
-- (actually: by different morphemes).
|
||||
|
||||
mkAdjComp : (_,_ : AForm => 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
|
||||
} ;
|
||||
|
||||
case2pformClit = \c -> case c of {
|
||||
Nom => Aton Nom ;
|
||||
Acc => Aton Acc ;
|
||||
Dat => Aton Dat ;
|
||||
_ => 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 ;
|
||||
VPart g n => aller ! Part (PPasse g n)
|
||||
}} ;
|
||||
|
||||
-- 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 ;
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
instance AtomGer of Atom = ResourceExtGer ** open ResourceGer, TypesGer in {
|
||||
oper SBranch = Order => Str ;
|
||||
}
|
||||
@@ -1,203 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
--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 $TypesGer.gf$.
|
||||
|
||||
concrete CombinationsGer of Combinations = open Prelude, SyntaxGer 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} ;
|
||||
Num = {s : Str} ;
|
||||
Prep = {s : Str ; c : 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} ;
|
||||
VG = {s : VForm => Str ; s2 : Str ; s3 : Bool => Number => Str ; s4 : Str} ;
|
||||
VP = Verb ** {s3 : Number => Str ; s4 : Str} ;
|
||||
TV = TransVerb ;
|
||||
-- = Verb ** {s3 : Preposition ; c : Case} ;
|
||||
V3 = TransVerb ** {s4 : Preposition ; c2 : Case} ;
|
||||
VS = Verb ;
|
||||
VV = Verb ** {isAux : Bool} ;
|
||||
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 noNum ;
|
||||
ModGenNum = npGenDet plural ;
|
||||
UsePN = nameNounPhrase ;
|
||||
UseFun = funAsCommNounPhrase ;
|
||||
AppFun = appFunComm ;
|
||||
AppFun2 = appFun2 ;
|
||||
AdjP1 = adj2adjPhrase ;
|
||||
ComplAdj = complAdj ;
|
||||
PositAdjP = positAdjPhrase ;
|
||||
ComparAdjP = comparAdjPhrase ;
|
||||
SuperlNP = superlNounPhrase ;
|
||||
|
||||
DetNP = detNounPhrase ;
|
||||
IndefOneNP = indefNounPhrase singular ;
|
||||
IndefNumNP = plurDetNum ;
|
||||
DefOneNP = defNounPhrase singular ;
|
||||
DefNumNP nu = defNounPhraseNum nu plural ;
|
||||
MassNP = massNounPhrase ;
|
||||
UseInt i = i ;
|
||||
NoNum = noNum ;
|
||||
|
||||
CNthatS = nounThatSentence ;
|
||||
PredVP = predVerbPhrase ;
|
||||
PosVG = predVerbGroup True ;
|
||||
NegVG = predVerbGroup False ;
|
||||
|
||||
SymbPN i = {s = \\_ => i.s} ;
|
||||
SymbCN cn s =
|
||||
{s = \\a,n,c => cn.s ! a ! n ! c ++ s.s ;
|
||||
g = cn.g} ;
|
||||
|
||||
PredV = predVerb ;
|
||||
PredAP = predAdjective ;
|
||||
PredCN = predCommNoun ;
|
||||
PredTV = complTransVerb ;
|
||||
PredV3 = complDitransVerb ;
|
||||
PredPassV = passVerb ;
|
||||
PredNP = predNounPhrase ;
|
||||
PredAdV = predAdverb ;
|
||||
PredVS = complSentVerb ;
|
||||
PredVV = complVerbVerb ;
|
||||
VTrans = transAsVerb ;
|
||||
|
||||
AdjAdv a = ss (a.s ! APred) ;
|
||||
PrepNP = prepPhrase ;
|
||||
AdvVP = adVerbPhrase ;
|
||||
AdvCN = advCommNounPhrase ;
|
||||
AdvAP = advAdjPhrase ;
|
||||
|
||||
ThereNP A = predVerbPhrase (pronNounPhrase pronEs)
|
||||
(predVerbGroup True (complTransVerb (transDir verbGeben) A)) ;
|
||||
IsThereNP A = questVerbPhrase (pronNounPhrase pronEs)
|
||||
(predVerbGroup True (complTransVerb (transDir verbGeben) A)) ;
|
||||
|
||||
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 ;
|
||||
|
||||
} ;
|
||||
@@ -1,6 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
resource LogicGer = Logic with
|
||||
(Atom = AtomGer), (Resource = ResourceGer) ;
|
||||
|
||||
-- this is the standard form of a derived resource. AR 12/1/2004
|
||||
@@ -1,574 +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 MorphoGer = TypesGer ** 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 masculines:
|
||||
|
||||
declN1 : Str -> CommNoun = \zahl ->
|
||||
mkNoun2n zahl (zahl + "en") Fem ;
|
||||
|
||||
declN1in : Str -> CommNoun = \studentin ->
|
||||
mkNoun2n studentin (studentin + "nen") 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 ;
|
||||
|
||||
declN2n : Str -> CommNoun = \bein ->
|
||||
mkNoun2es bein (bein+"e") Neut ;
|
||||
|
||||
declN2i : Str -> CommNoun = \onkel ->
|
||||
mkNoun2s onkel onkel Masc ;
|
||||
|
||||
declN2in : Str -> CommNoun = \segel ->
|
||||
mkNoun2s segel segel Neut ;
|
||||
|
||||
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,meiner,mein,n,p -> {
|
||||
s = table {
|
||||
NPCase c => caselist ich mich mir meiner ! 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" "meiner" "mein" Sg P1 ;
|
||||
pronDu = mkPronPers "du" "dich" "dir" "deiner" "dein" Sg P2 ;
|
||||
pronEr = mkPronPers "er" "ihn" "ihm" "seiner" "sein" Sg P3 ;
|
||||
pronSie = mkPronPers "sie" "sie" "ihr" "ihrer" "ihr" Sg P3 ;
|
||||
pronEs = mkPronPers "es" "es" "ihm" "seiner" "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") ;
|
||||
|
||||
|
||||
--OLD:
|
||||
--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.
|
||||
|
||||
--NEW (By Harald Hammarström):
|
||||
--2 Verbs
|
||||
-- The worst-case macro needs six forms:
|
||||
-- x Infinitive,
|
||||
-- x 3p sg pres. indicative,
|
||||
-- x 2p sg imperative,
|
||||
-- x 1/3p sg imperfect indicative,
|
||||
-- x 1/3p sg imperfect subjunctive (because this uncommon form can have umlaut)
|
||||
-- x the perfect participle
|
||||
|
||||
-- But you'll only want to use one of the five macros:
|
||||
-- x weakVerb -- For a regular verb like legen
|
||||
-- x verbGratulieren -- For a regular verb without ge- in the perfect
|
||||
-- particple. Like gratulieren, beweisen etc
|
||||
-- x verbStrongSingen -- A strong verb without umlauting present tense.
|
||||
-- You'll need to supply the strong imperfect forms
|
||||
-- as well as the participle.
|
||||
-- x verbStrongSehen -- A strong verb that umlauts in the 2/3p sg pres
|
||||
-- indicative as well as the imperative. You'll
|
||||
-- need to give (only) the 3rd p sg pres ind. in
|
||||
-- addition to the strong imperfect forms and the
|
||||
-- part participle.
|
||||
-- x verbStrongLaufen -- A strong verb that umlauts in the 2/3p sg pres
|
||||
-- indicative but NOT the imperative. You'll
|
||||
-- need to give (only) the 3rd p sg pres ind. in
|
||||
-- addition to the strong imperfect forms and the
|
||||
-- part participle.
|
||||
--
|
||||
-- Things that are handled automatically
|
||||
-- x Imperative e (although optional forms are not given)
|
||||
-- x Extra e in verbs like arbeitete, regnet, findet, atmet.
|
||||
-- NOTE: If pres. umlauting strong verbs are defined through the verbumStrong
|
||||
-- macro (which they should) it is automatically handled so they avoid
|
||||
-- falling into this rule e.g er tritt (rather than *er tritet)
|
||||
-- x s is dropped in the 2p sg if appropriate du setzt
|
||||
-- x verbs that end in -rn, -ln rather than -en
|
||||
|
||||
-- Things that are not handled:
|
||||
-- x -ß-/-ss-
|
||||
-- x Optional dropping of -e- in e.g wand(e)re etc
|
||||
-- x Optional indicative forms instead of pres. subj. 2p sg. and 2p pl.
|
||||
-- x (Weak) verbs without the ge- on the participle (in wait for a systematic
|
||||
-- treatment of the insep. prefixes and stress). You have to manually use
|
||||
-- the verbGratulieren for this. E.g do verbGratulieren "beweisen" -
|
||||
-- verbWeak "beweisen" would yield *gebeweist.
|
||||
|
||||
impe : Str -> Str = \stem ->
|
||||
let
|
||||
e = ifTok Str (Predef.dp 2 stem) "ig" "e" [] ;
|
||||
e2 = (adde stem)
|
||||
in
|
||||
e + e2 ;
|
||||
|
||||
adde : Str -> Str = \stem ->
|
||||
let
|
||||
eVowelorLiquid : Str -> Str = \u -> case u of {
|
||||
"l" => "e" ;
|
||||
"r" => "e" ;
|
||||
"a" => "e" ;
|
||||
"o" => "e" ;
|
||||
"u" => "e" ;
|
||||
"e" => "e" ;
|
||||
"i" => "e" ;
|
||||
"ü" => "e" ;
|
||||
"ä" => "e" ;
|
||||
"ö" => "e" ;
|
||||
_ => []
|
||||
} ;
|
||||
|
||||
eConsonantmn : Str -> Str -> Str = \nl, l ->
|
||||
case l of {"m" => eVowelorLiquid nl ;
|
||||
"n" => eVowelorLiquid nl ;
|
||||
_ => []} ;
|
||||
|
||||
|
||||
twolast = Predef.dp 2 stem ;
|
||||
nl = Predef.tk 1 twolast ;
|
||||
l = Predef.dp 1 stem ;
|
||||
e = case l of {
|
||||
"d" => "e" ;
|
||||
"t" => "e" ;
|
||||
_ => eConsonantmn nl l
|
||||
} ;
|
||||
in
|
||||
e ;
|
||||
|
||||
|
||||
mkVerbum : (_,_,_,_,_,_ : Str) -> Verbum = \geben,gibt,gib,gab,gäbe,gegeben ->
|
||||
let {
|
||||
ifSibilant : Str -> Str -> Str -> Str = \u,b1,b2 -> case u of {
|
||||
"s" => b1 ;
|
||||
"x" => b1 ;
|
||||
"z" => b1 ;
|
||||
"ß" => b1 ;
|
||||
_ => b2
|
||||
} ;
|
||||
en = Predef.dp 2 geben ;
|
||||
geb = ifTok Tok (Predef.tk 1 en) "e" (Predef.tk 2 geben)(Predef.tk 1 geben) ;
|
||||
gebt = geb + (adde geb) + "t" ;
|
||||
gebte = ifTok Tok (Predef.dp 1 gab) "e" gab (gab + "e") ;
|
||||
gibst = ifSibilant (Predef.dp 1 gib) (gib + "t") (gib + "st") ;
|
||||
gegebener = (adjReg gegeben).s ;
|
||||
} in table {
|
||||
VInf => geben ;
|
||||
VInd Sg P1 => geb + "e" ;
|
||||
VInd Sg P2 => gibst ;
|
||||
VInd Sg P3 => gibt ;
|
||||
VInd Pl P2 => gebt ;
|
||||
VInd Pl _ => geben ; -- the famous law
|
||||
VImp Sg => gib + (impe gib) ;
|
||||
VImp Pl => gebt ;
|
||||
VSubj Sg P1 => geb + "e" ;
|
||||
VSubj Sg P2 => geb + "est" ;
|
||||
VSubj Sg P3 => geb + "e" ;
|
||||
VSubj Pl P2 => geb + "et" ;
|
||||
VSubj Pl _ => geben ;
|
||||
VPresPart a => (adjReg (geben + "d")).s ! a ;
|
||||
|
||||
VImpfInd Sg P1 => gab ;
|
||||
VImpfInd Sg P2 => gab + (adde gab) + "st" ;
|
||||
VImpfInd Sg P3 => gab ;
|
||||
VImpfInd Pl P2 => gab + (adde gab) + "t" ;
|
||||
VImpfInd Pl _ => gebte + "n" ;
|
||||
|
||||
VImpfSubj Sg P1 => gäbe ;
|
||||
VImpfSubj Sg P2 => gäbe + "st" ;
|
||||
VImpfSubj Sg P3 => gäbe ;
|
||||
VImpfSubj Pl P2 => gäbe + "t" ;
|
||||
VImpfSubj Pl _ => gäbe + "n" ;
|
||||
|
||||
VPart a => gegebener ! a
|
||||
} ;
|
||||
|
||||
-- Weak verbs:
|
||||
verbumWeak : Str -> Verbum = \legen ->
|
||||
let
|
||||
leg = (Predef.tk 2 legen) ;
|
||||
legte = leg + "te" ;
|
||||
in
|
||||
mkVerbum legen (leg + (adde leg) + "t") leg legte legte ("ge" + (leg + "t")) ;
|
||||
|
||||
regVerb = verbumWeak ;
|
||||
|
||||
|
||||
-- Weak verbs that don't have ge- in the participle
|
||||
verbumGratulieren : Str -> Verbum = \gratulieren ->
|
||||
let
|
||||
gratulier = (Predef.tk 2 gratulieren) ;
|
||||
gratulierte = gratulier + "te" ;
|
||||
in
|
||||
mkVerbum gratulieren (gratulier + (adde gratulier) + "t") gratulier gratulierte gratulierte (gratulier + "t") ;
|
||||
|
||||
|
||||
|
||||
-- Strong verbs (non-present-tense umlauting):
|
||||
verbumStrongSingen : (_,_,_,_ : Str) -> Verbum = \singen, sang, sänge, gesungen ->
|
||||
let
|
||||
sing = (Predef.tk 2 singen)
|
||||
in
|
||||
mkVerbum singen (sing + (adde sing) + "t") sing sang sänge gesungen ;
|
||||
|
||||
-- Verbs with Umlaut in the 2nd and 3rd person singular and imperative:
|
||||
verbumStrongSehen : (_,_,_,_,_ : Str) -> Verbum = \sehen,sieht,sah,sähe,gesehen ->
|
||||
let
|
||||
sieh = Predef.tk 1 sieht ;
|
||||
in
|
||||
mkVerbum sehen sieht sieh sah sähe gesehen ;
|
||||
|
||||
-- Verbs with Umlaut in the 2nd and 3rd person singular but not imperative:
|
||||
-- (or any verb where the 3rd p sg pres ind is "special" and the 2p sg pres ind -- uses its stem.)
|
||||
verbumStrongLaufen : (_,_,_,_,_ : Str) -> Verbum = \laufen,läuft,lief,liefe,gelaufen ->
|
||||
let
|
||||
lauf = Predef.dp 2 laufen ;
|
||||
in
|
||||
mkVerbum laufen läuft lauf lief liefe gelaufen ;
|
||||
|
||||
|
||||
-- The verb "be":
|
||||
|
||||
verbumSein : Verbum = let {
|
||||
sein = verbumStrongSingen "sein" "war" "wäre" "gewesen" ;
|
||||
} 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 => "seid" ;
|
||||
|
||||
VSubj Sg P1 => "sei" ;
|
||||
VSubj Sg P2 => (variants {"seiest" ; "seist"}) ;
|
||||
VSubj Sg P3 => "sei" ;
|
||||
VSubj Pl P2 => "seien" ;
|
||||
VSubj Pl _ => "seiet" ;
|
||||
VPresPart a => ((adjReg "seiend").s) ! a ;
|
||||
|
||||
v => sein ! v
|
||||
|
||||
} ;
|
||||
|
||||
-- Modal auxiliary verbs
|
||||
verbumAux : (_,_,_,_,_ : Str) -> Verbum = \können,kann,konnte,könnte,gekonnt ->
|
||||
let k = mkVerbum können kann kann konnte könnte gekonnt ;--- (verbumStrongLaufen können kann konnte könnte gekonnt)
|
||||
in
|
||||
table {
|
||||
VInd Sg P1 => kann ;
|
||||
v => k ! v
|
||||
} ;
|
||||
|
||||
verbumKönnen = verbumAux "können" "kann" "konnte" "könnte" "gekonnt" ;
|
||||
verbumDürfen = verbumAux "dürfen" "darf" "durfte" "dürfte" "gedurft" ;
|
||||
verbumMögen = verbumAux "mögen" "mag" "mochte" "möchte" "gemocht" ;
|
||||
verbumMüssen = verbumAux "müssen" "muss" "musste" "müsste" "gemusst" ;
|
||||
verbumSollen = verbumAux "sollen" "soll" "sollte" "söllte" "gesollt" ;
|
||||
verbumWollen = verbumAux "wollen" "will" "wollte" "wöllte" "gewollt" ;
|
||||
verbumWissen = verbumAux "wissen" "weiss" "wusste" "wüsste" "gewusst" ;
|
||||
|
||||
-- The verb "have":
|
||||
|
||||
verbumHaben : Verbum = let {
|
||||
haben = (verbumStrongSingen "haben" "hatte" "hätte" "gehabt")
|
||||
} 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 = (verbumStrongSingen "werden" "wurde" "würde" "geworden") ;
|
||||
} in
|
||||
table {
|
||||
VInd Sg P2 => "wirst" ;
|
||||
VInd Sg P3 => "wird" ;
|
||||
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 ;
|
||||
|
||||
-- Apparently needed for "es gibt" etc
|
||||
verbGeben = mkVerbSimple (verbumStrongSehen "geben" "gibt" "gab" "gäbe" "gegeben") ;
|
||||
|
||||
|
||||
{-
|
||||
-- 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 => "seid" ;
|
||||
VPart a => (adjReg "gewesen").s ! a
|
||||
} ;
|
||||
|
||||
verbumHaben2 : Verbum =
|
||||
table {
|
||||
VInd Sg P2 => "hast" ;
|
||||
VInd Sg P3 => "hat" ;
|
||||
v => regVerb "haben" ! v
|
||||
} ;
|
||||
-}
|
||||
|
||||
} ;
|
||||
@@ -1,420 +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.gf$.
|
||||
-- Their original typings via abstract syntax are in
|
||||
-- $Structural.gf$, which also contains documentation.
|
||||
--
|
||||
-- The main difference with $MorphoGer.gf$ is that the types
|
||||
-- referred to are compiled resource grammar types. We have moreover
|
||||
-- had the design principle of always having existing forms, not stems, as string
|
||||
-- arguments of the paradigms.
|
||||
--
|
||||
-- The following modules are presupposed:
|
||||
|
||||
resource ParadigmsGer =
|
||||
open Prelude, (Morpho=MorphoGer), SyntaxGer, ResourceGer in {
|
||||
|
||||
|
||||
--2 Parameters
|
||||
--
|
||||
-- To abstract over gender names, we define the following identifiers.
|
||||
|
||||
oper
|
||||
Gender : Type ;
|
||||
|
||||
masculine : Gender ;
|
||||
feminine : Gender ;
|
||||
neuter : Gender ;
|
||||
|
||||
-- To abstract over case names, we define the following.
|
||||
|
||||
Case : Type ;
|
||||
|
||||
nominative : Case ;
|
||||
accusative : Case ;
|
||||
dative : Case ;
|
||||
genitive : Case ;
|
||||
|
||||
-- To abstract over number names, we define the following.
|
||||
|
||||
Number : Type ;
|
||||
|
||||
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)
|
||||
nBein : Str -> N ; -- Bein, (Beins, Beine) (neut)
|
||||
nAuto : Str -> N ; -- Auto, (Autos, Autos) (neut)
|
||||
|
||||
-- Feminine patterns. Duplicated "e" is avoided in $nFrau$.
|
||||
|
||||
nStudentin : Str -> N ; -- Studentin (Studentinne)
|
||||
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 ;
|
||||
|
||||
--OLD:
|
||||
--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.
|
||||
|
||||
--NEW (By Harald Hammarström):
|
||||
--2 Verbs
|
||||
-- The worst-case macro needs six forms:
|
||||
-- x Infinitive,
|
||||
-- x 3p sg pres. indicative,
|
||||
-- x 2p sg imperative,
|
||||
-- x 1/3p sg imperfect indicative,
|
||||
-- x 1/3p sg imperfect subjunctive (because this uncommon form can have umlaut)
|
||||
-- x the perfect participle
|
||||
|
||||
-- But you'll only want to use one of the five macros:
|
||||
-- x weakVerb -- For a regular verb like legen
|
||||
-- x verbGratulieren -- For a regular verb without ge- in the perfect
|
||||
-- particple. Like gratulieren, beweisen etc
|
||||
-- x verbStrongSingen -- A strong verb without umlauting present tense.
|
||||
-- You'll need to supply the strong imperfect forms
|
||||
-- as well as the participle.
|
||||
-- x verbStrongSehen -- A strong verb that umlauts in the 2/3p sg pres
|
||||
-- indicative as well as the imperative. You'll
|
||||
-- need to give (only) the 3rd p sg pres ind. in
|
||||
-- addition to the strong imperfect forms and the
|
||||
-- part participle.
|
||||
-- x verbStrongLaufen -- A strong verb that umlauts in the 2/3p sg pres
|
||||
-- indicative but NOT the imperative. You'll
|
||||
-- need to give (only) the 3rd p sg pres ind. in
|
||||
-- addition to the strong imperfect forms and the
|
||||
-- part participle.
|
||||
--
|
||||
-- Things that are handled automatically
|
||||
-- x Imperative e (although optional forms are not given)
|
||||
-- x Extra e in verbs like arbeitete, regnet, findet, atmet.
|
||||
-- NOTE: If pres. umlauting strong verbs are defined through the verbumStrong
|
||||
-- macro (which they should) it is automatically handled so they avoid
|
||||
-- falling into this rule e.g er tritt (rather than *er tritet)
|
||||
-- x s is dropped in the 2p sg if appropriate du setzt
|
||||
-- x verbs that end in -rn, -ln rather than -en
|
||||
|
||||
-- Things that are not handled:
|
||||
-- x -ß-/-ss-
|
||||
-- x Optional dropping of -e- in e.g wand(e)re etc
|
||||
-- x Optional indicative forms instead of pres. subj. 2p sg. and 2p pl.
|
||||
-- x (Weak) verbs without the ge- on the participle (in wait for a systematic
|
||||
-- treatment of the insep. prefixes and stress). You have to manually use
|
||||
-- the verbGratulieren for this. E.g do verbGratulieren "beweisen" -
|
||||
-- verbWeak "beweisen" would yield *gebeweist.
|
||||
|
||||
mkV : (_,_,_,_,_,_ : Str) -> V ; -- geben, gibt, gib, gab, gäbe, gegeben
|
||||
|
||||
-- Weak verbs are sometimes called regular verbs.
|
||||
|
||||
vWeak : Str -> V ; -- führen
|
||||
|
||||
vGratulieren : Str -> V ; -- gratulieren
|
||||
vSehen : (_,_,_,_,_ : Str) -> V ; -- sehen, sieht, sah, sähe, gesehen
|
||||
vLaufen : (_,_,_,_,_ : Str) -> V ; -- laufen, lauft, liefe, liefe, gelaufen
|
||||
|
||||
-- The verbs 'be' and 'have' are special.
|
||||
|
||||
vSein : V ;
|
||||
vHaben : V ;
|
||||
|
||||
-- Some irregular verbs.
|
||||
|
||||
vFahren : V ;
|
||||
|
||||
-- Verbs with a detachable particle, with regular ones as a special case.
|
||||
|
||||
vPartWeak : (_,_ : Str) -> V ; -- führen, aus
|
||||
|
||||
-- vPartGratulieren (_,_ : Str) -> V ;
|
||||
vPartSehen : (_,_,_,_,_,_ : Str) -> V ; -- sehen, sieht, sah, sähe, gesehen
|
||||
vPartLaufen : (_,_,_,_,_,_ : Str) -> V ; -- laufen, lauft, liefe, liefe, gelaufen
|
||||
mkVPart : V -> Str -> V ; -- vFahren, aus
|
||||
|
||||
-- Obsolete; use vPartWeak etc instead
|
||||
--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
|
||||
|
||||
tvWeak : 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
|
||||
|
||||
-- Sentence-complement verbs are just verbs.
|
||||
|
||||
mkVS : V -> VS ;
|
||||
|
||||
-- Verb-complement verbs either need the "zu" particle or don't.
|
||||
-- The ones that don't are usually auxiliary verbs.
|
||||
|
||||
vsAux : V -> VV ;
|
||||
vsZu : V -> VV ;
|
||||
|
||||
--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 ;
|
||||
|
||||
-- One can also use the function $ResourceGer.PrepNP$ with one of the given
|
||||
-- prepositions or a preposition formed by giving a string and a case:
|
||||
|
||||
mkPrep : Str -> Case -> Prep ;
|
||||
|
||||
-- The definitions should not bother the user of the API. So they are
|
||||
-- hidden from the document.
|
||||
--.
|
||||
|
||||
Gender = SyntaxGer.Gender ;
|
||||
Case = SyntaxGer.Case ;
|
||||
Number = SyntaxGer.Number ;
|
||||
|
||||
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 ;
|
||||
|
||||
nBein = \bein -> declN2n bein ** {lock_N = <>};
|
||||
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 = <>} ;
|
||||
|
||||
nStudentin = \studentin -> declN1in studentin ** {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 a b c d e f = mkVerbSimple (mkVerbum a b c d e f) ** {lock_V = <>} ;
|
||||
vWeak a = mkVerbSimple (verbumWeak a) ** {lock_V = <>} ;
|
||||
vGratulieren a = mkVerbSimple (verbumGratulieren a) ** {lock_V = <>} ;
|
||||
vSehen a b c d e = mkVerbSimple (verbumStrongSehen a b c d e) ** {lock_V = <>} ;
|
||||
vLaufen a b c d e = mkVerbSimple (verbumStrongLaufen a b c d e) ** {lock_V = <>} ;
|
||||
|
||||
-- vReg = \s -> mkVerbSimple (regVerb s) ** {lock_V = <>} ;
|
||||
vSein = verbSein ** {lock_V = <>} ;
|
||||
vHaben = verbHaben ** {lock_V = <>} ;
|
||||
vFahren = mkVerbSimple (verbumStrongLaufen "fahren" "fährt" "fuhr" "führe" "gefahren") ** {lock_V = <>} ;
|
||||
|
||||
vPartWeak = \führen, aus -> (mkVerb (verbumWeak führen) aus) ** {lock_V = <>} ;
|
||||
--vGratulieren = verbumGratulieren ** {lock_V = <>} ;
|
||||
vPartSehen a b c d e aus = (mkVerb (verbumStrongSehen a b c d e) aus) ** {lock_V = <>} ;
|
||||
vPartLaufen a b c d e aus = (mkVerb (verbumStrongLaufen a b c d e) aus) ** {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 = <>} ;
|
||||
mkVPart v p = mkVerb v.s p ** {lock_V = <>} ;
|
||||
|
||||
mkTV v p c = mkTransVerb v p c ** {lock_TV = <>} ;
|
||||
tvWeak = \hören, zu, dat -> mkTV (vWeak hören) zu dat ;
|
||||
tvDir = \v -> mkTV v [] accusative ;
|
||||
tvDirReg = \v -> tvWeak v [] accusative ;
|
||||
mkV3 v s c t d = mkDitransVerb v s c t d ** {lock_V3 = <>} ;
|
||||
|
||||
mkVS v = v ** {lock_VS = <>} ;
|
||||
vsAux v = v ** {isAux = True ; lock_VV = <>} ;
|
||||
vsZu v = v ** {isAux = True ; lock_VV = <>} ;
|
||||
|
||||
mkAdV a = ss a ** {lock_AdV = <>} ;
|
||||
mkPP x y = PrepNP {s = y ; c = x ; lock_Prep = <>} ;
|
||||
mkAdA a = ss a ** {lock_AdA = <>} ;
|
||||
mkAdS a = ss a ** {lock_AdS = <>} ;
|
||||
mkPrep s c = {s = s ; c = c ; lock_Prep = <>} ;
|
||||
|
||||
} ;
|
||||
@@ -1,6 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
resource PredicationGer = Predication with
|
||||
(Resource = ResourceGer), (ResourceExt = ResourceExtGer) ;
|
||||
|
||||
-- this is the standard form of a derived resource. AR 12/1/2004
|
||||
@@ -1,4 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
resource ResourceExtGer = ResourceExt with (Resource = ResourceGer) ;
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
instance ResourceGer of Resource = reuse StructuralGer ;
|
||||
@@ -1,133 +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 StructuralGer of Structural = CombinationsGer ** open Prelude, SyntaxGer in {
|
||||
|
||||
lin
|
||||
INP = pronNounPhrase pronIch ;
|
||||
ThouNP = pronNounPhrase pronDu ;
|
||||
HeNP = pronNounPhrase pronEr ;
|
||||
SheNP = pronNounPhrase pronSie ;
|
||||
WeNumNP n = pronNounPhrase (pronWithNum pronWir n) ;
|
||||
YeNumNP n = pronNounPhrase (pronWithNum pronIhr n) ;
|
||||
TheyNP = pronNounPhrase pronSiePl ;
|
||||
|
||||
YouNP = pronNounPhrase pronSSie ;
|
||||
|
||||
ItNP = pronNounPhrase pronEs ;
|
||||
ThisNP = nameNounPhrase {s = dieserDet.s ! Neut} ; ---
|
||||
ThatNP = nameNounPhrase {s = jenerDet.s ! Neut} ; ---
|
||||
TheseNumNP nu = let diese = caselist "diese" "diese" "diesen" "diesen" in
|
||||
normalNounPhrase (\\c => diese ! c ++ nu.s) plural ;
|
||||
ThoseNumNP nu = let jene = caselist "jene" "jene" "jenen" "jenen" in
|
||||
normalNounPhrase (\\c => jene ! c ++ nu.s) plural ;
|
||||
|
||||
AnyDet = detLikeAdj "irgendwelch" ;
|
||||
AnyNumDet nu = mkDeterminerNumReg nu "irgendwelche" Weak ;
|
||||
EveryDet = jederDet ;
|
||||
AllMassDet = allesDet ;
|
||||
AllNumDet = alleDet ;
|
||||
WhichDet = welcherDet ;
|
||||
WhichNumDet = welcheDet ;
|
||||
MostDet = meistDet ;
|
||||
MostsDet = meisteDet ;
|
||||
ManyDet = mkDeterminerPl (caselist "viele" "viele" "vielen" "vieler") Strong ;
|
||||
MuchDet = detLikeAdj "viel" ;
|
||||
NoDet = keinDet ;
|
||||
NoNumDet nu = mkDeterminerNumReg nu "keine" Strong ;
|
||||
SomeDet = einDet ; ---
|
||||
SomeNumDet nu = mkDeterminerNumReg nu "einige" Strong ;
|
||||
ThatDet = detLikeAdj "jen" ;
|
||||
ThisDet = detLikeAdj "dies" ;
|
||||
TheseNumDet nu = mkDeterminerNumReg nu "diese" Strong ;
|
||||
ThoseNumDet nu = mkDeterminerNumReg nu "jene" Strong ;
|
||||
|
||||
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" ;
|
||||
|
||||
EverybodyNP = nameNounPhrase
|
||||
{s = caselist "jeder" "jeden" "jedem" "jedes"} ;
|
||||
SomebodyNP = nameNounPhrase
|
||||
{s = caselist "jemand" "jemanden" "jemandem" "jemands"} ;
|
||||
NobodyNP = nameNounPhrase
|
||||
{s = caselist "niemand" "niemanden" "niemandem" "niemands"} ;
|
||||
EverythingNP = nameNounPhrase
|
||||
{s = caselist "alles" "alles" "allem" "alles"} ;
|
||||
SomethingNP = nameNounPhrase {s = \\_ => "etwas"} ;
|
||||
NothingNP = nameNounPhrase {s = \\_ => "nichts"} ;
|
||||
|
||||
|
||||
CanVV =
|
||||
mkVerbSimple (verbumKönnen) ** {isAux = True} ;
|
||||
CanKnowVV =
|
||||
mkVerbSimple (verbumKönnen) ** {isAux = True} ;
|
||||
MustVV =
|
||||
mkVerbSimple (verbumMüssen) ** {isAux = True} ;
|
||||
WantVV =
|
||||
mkVerbSimple (verbumWollen) ** {isAux = True} ;
|
||||
|
||||
|
||||
EverywhereNP = ss "überall" ;
|
||||
SomewhereNP = ss "irgendwo" ;
|
||||
NowhereNP = ss "nirgends" ;
|
||||
|
||||
AlthoughSubj = ss "obwohl" ;
|
||||
|
||||
AlmostAdv = ss "fast" ;
|
||||
QuiteAdv = ss "ziemlich" ;
|
||||
|
||||
InPrep = mkPrep "in" Dat ;
|
||||
OnPrep = mkPrep "auf" Dat ;
|
||||
ToPrep = mkPrep "nach" Dat ;
|
||||
ThroughPrep = mkPrep "durch" Acc ;
|
||||
AbovePrep = mkPrep "über" Dat ;
|
||||
UnderPrep = mkPrep "unter" Dat ;
|
||||
InFrontPrep = mkPrep "vor" Dat ;
|
||||
BehindPrep = mkPrep "hinter" Dat ;
|
||||
BetweenPrep = mkPrep "zwischen" Dat ;
|
||||
FromPrep = mkPrep "aus" Dat ;
|
||||
BeforePrep = mkPrep "vor" Dat ;
|
||||
DuringPrep = mkPrep "während" Gen ;
|
||||
AfterPrep = mkPrep "nach" Dat ;
|
||||
WithPrep = mkPrep "mit" Dat ;
|
||||
WithoutPrep = mkPrep "ohne" Acc ;
|
||||
ByMeansPrep = mkPrep "mit" Dat ;
|
||||
PartPrep = mkPrep "von" Dat ;
|
||||
PossessPrep = mkPrep "von" Dat ;
|
||||
AgentPrep = mkPrep "durch" Acc ;
|
||||
|
||||
} ;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,54 +0,0 @@
|
||||
-- use this path to read the grammar from the same directory
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
concrete TestResourceGer of TestResource = StructuralGer ** open SyntaxGer in {
|
||||
|
||||
flags startcat=Phr ; lexer=text ; unlexer=text ;
|
||||
|
||||
-- a random sample from the lexicon
|
||||
|
||||
lin
|
||||
Big = adjCompReg3 "gross" "grösser" "grösst";
|
||||
Small = adjCompReg "klein" ;
|
||||
Happy = adjCompReg "glücklich" ;
|
||||
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" ;
|
||||
Bottle = declN1e "Flasche" ;
|
||||
Wine = declN2 "Wein" ;
|
||||
Car = declNs "Auto" ;
|
||||
House = declN3uS "Haus" "Häuser" ;
|
||||
Light = declN3 "Licht" ;
|
||||
Bar = declNs "Bar" ;
|
||||
Walk = mkVerbSimple (verbumStrongSingen "gehen" "ging" "ginge" "gegangen") ;
|
||||
Run = mkVerbSimple (verbumStrongLaufen "laufen" "läuft" "lief" "liefe" "gelaufen") ;
|
||||
Say = mkVerbSimple (verbumWeak "sagen") ;
|
||||
Prove = mkVerbSimple (verbumGratulieren "beweisen") ; --without ge
|
||||
Send = mkTransVerb (mkVerbSimple (verbumStrongSingen "senden" "sandte" "sändte" "gesandt")) [] Acc;
|
||||
Drink = transDir (mkVerbSimple (verbumStrongSingen "trinken" "trank" "tränke" "getrunken")) ;
|
||||
Love = mkTransVerb (mkVerbSimple (verbumWeak "lieben")) [] Acc ;
|
||||
Wait = mkTransVerb (mkVerbSimple (verbumWeak "warten")) "auf" Acc ;
|
||||
Give = mkDitransVerb
|
||||
(mkVerbSimple (verbumStrongSehen "geben" "gibt" "gab" "gäbe" "gegeben")) [] Dat [] Acc ;
|
||||
Prefer = mkDitransVerb
|
||||
(mkVerb (verbumStrongSingen "ziehen" "zog" "zöge" "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 (verbumWeak "schalten") "auf") [] Acc ;
|
||||
SwitchOff = mkTransVerb (mkVerb (verbumWeak "schalten") "aus") [] Acc ;
|
||||
|
||||
John = mkProperName "Johann" ;
|
||||
Mary = mkProperName "Maria" ;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -1,115 +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 TypesGer = 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 |
|
||||
VSubj Number Person |
|
||||
VImpfInd Number Person |
|
||||
VImpfSubj Number Person |
|
||||
VPresPart AForm |
|
||||
VPart AForm ;
|
||||
|
||||
{--
|
||||
param Tense = Pres | Impf ;
|
||||
VInf |
|
||||
VInd Tense Number Person |
|
||||
VSubj Tense Number Person |
|
||||
VImp Number |
|
||||
VPresPart AForm |
|
||||
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 ;
|
||||
|
||||
} ;
|
||||
@@ -1,486 +0,0 @@
|
||||
<html>
|
||||
|
||||
<body bgcolor="#FFFFFF" text="#000000" >
|
||||
|
||||
<center>
|
||||
<img SRC="../../doc/gf-logo.gif">
|
||||
|
||||
<h1>The GF Resource Grammar Library</h1>
|
||||
|
||||
|
||||
<a href="http://www.cs.chalmers.se/~aarne">Aarne Ranta</a>
|
||||
2002-2004
|
||||
|
||||
<p>
|
||||
|
||||
Version 0.6: <a href="../../download/gf-lib.tgz">source package</a>.
|
||||
|
||||
<p>
|
||||
|
||||
Current languages: English, Finnish, French, German, Italian, Russian, Swedish.
|
||||
|
||||
</center>
|
||||
|
||||
<font size=2>
|
||||
<b>News</b>. <br>
|
||||
|
||||
10/8/2004 This document updated as a revision of the
|
||||
<a href="http://tournesol.cs.chalmers.se/aarne/GF/resource/">old resource page</a>.
|
||||
|
||||
<br>
|
||||
|
||||
13/4/2004 Version 0.6 written using the module system of GF 2. Also an
|
||||
extended coverage. The files are placed in separate subdirectories (one
|
||||
per language) and have different names than before, so that file names
|
||||
(without the extension <tt>.gf</tt>) are also legal module names.
|
||||
</font>
|
||||
|
||||
<p>
|
||||
|
||||
<i>
|
||||
<b>Notice</b>. You need GF Version 2.0beta or later
|
||||
to work with these resource grammars.
|
||||
It is available from the
|
||||
<a href="http://www.cs.chalmers.se/~aarne/GF/">GF home page</a>.
|
||||
</i>
|
||||
|
||||
|
||||
<p>
|
||||
|
||||
|
||||
<h2>Introduction</h2>
|
||||
|
||||
As programs in general can be divided into
|
||||
<ul>
|
||||
<li> application programs
|
||||
<li> library programs
|
||||
</ul>
|
||||
GF grammars can be divided into
|
||||
<ul>
|
||||
<li> <b>application grammars</b>
|
||||
<li> <b>resource grammars</b>
|
||||
</ul>
|
||||
An application grammar is typically built around
|
||||
a semantic model, which is formalized as the abstract
|
||||
syntax of the language. Concrete syntax defines
|
||||
a mapping from the abstract syntax into English or
|
||||
Swedish or some other language.
|
||||
|
||||
<p>
|
||||
|
||||
A resource grammar is not based on semantics, but its
|
||||
purpose is to define the linguistic "surface" structures
|
||||
of some language. The availability of these structures makes it easier to
|
||||
write application grammars.
|
||||
|
||||
<p>
|
||||
|
||||
With resource grammars, we aim to achieve <b>division of labour</b> in
|
||||
grammar writing:
|
||||
<ul>
|
||||
<li> application grammars are written by domain experts
|
||||
<li> resource grammars are written by linguists
|
||||
</ul>
|
||||
By using resource grammars, experts of application domains can take
|
||||
linguistic details for granted. For instance, to
|
||||
express the linearization of the arithmetical predicate <i>even</i>
|
||||
in French, she does not have to write
|
||||
<pre>
|
||||
lin Even x = {s =
|
||||
table {
|
||||
m => x.s ++
|
||||
table {Ind => "est" ; Subj => "soit"} ! m ++
|
||||
table {Masc => "pair" ; Fem => "paire"} ! x.g
|
||||
}
|
||||
} ;
|
||||
</pre>
|
||||
but simply
|
||||
<pre>
|
||||
lin Even = predA1 (adjReg "pair") ;
|
||||
</pre>
|
||||
The author of the French resource grammar will have defined the
|
||||
functions <tt>predAdj</tt> and <tt>adjReg</tt> in such a way that
|
||||
they can be used in all applications.
|
||||
|
||||
<p>
|
||||
|
||||
What is more, the resource grammar has a <b>language-independent
|
||||
API</b>, which makes it possible to write the corresponding rule
|
||||
for other languages in a very similar way. For instance, the
|
||||
German rule is
|
||||
<pre>
|
||||
lin Even = predA1 (adjReg "gerade") ;
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
<h2>Coverage</h2>
|
||||
|
||||
The ultimate goal of the resource grammar library is a full coverage of the linguistic
|
||||
structures of each language. As of Version 0.6, we still have some way
|
||||
to go to reach that goal. But we do have
|
||||
<ul>
|
||||
<li> fairly complete sets of inflection paradigms for each language
|
||||
<li> a representative fragment of syntax covering present-tense
|
||||
indicative, interrogative, and imperative sentence.
|
||||
<li> lexica of structural words such as pronouns, articles, conjunctions.
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Demo</h2>
|
||||
|
||||
To get an idea of the coverage of the resource library, and also
|
||||
to help finding the right functions for your applications, you
|
||||
can do
|
||||
<pre>
|
||||
make test
|
||||
jgf TestAll.gfcm
|
||||
</pre>
|
||||
This opens the syntax editor with all the seven resource grammars
|
||||
extended with a small lexicon.
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Programmer's view on resource grammars</h2>
|
||||
|
||||
The resource grammar library a hierarchical structure. Its main layers are
|
||||
<ul>
|
||||
<li> The language-dependent <b>core resources</b>, to be described below.
|
||||
<li> The language-independent <b>core resource API</b>,
|
||||
<a href="doc/Combinations.html"><tt>Combinations.gf</tt></a>.
|
||||
<a href="doc/Structural.html"><tt>Structural.gf</tt></a>.
|
||||
<li> The <b>derived resource libraries</b>, some of which are
|
||||
language-dependent, some of which aren't. The most important
|
||||
ones are the language-dependent lexical paradigm modules
|
||||
<tt>ParadigmsX.gf</tt>.
|
||||
</ul>
|
||||
The core resources should not be needed by application grammarians: it should
|
||||
be enough to use the core resource API and the derived libraries. If
|
||||
this is not the case, the best solution is to extend the derived resource
|
||||
libraries or create new ones.
|
||||
|
||||
|
||||
|
||||
<h3>Grammaticality guarantee via data abstraction</h3>
|
||||
|
||||
An important principle is that
|
||||
<ul>
|
||||
<li> the core resource API and the derived resource libraries guarantee
|
||||
that all type-correct uses of them preserve grammaticality.
|
||||
</ul>
|
||||
This principle is simultaneously a guidance for resource grammarians
|
||||
and an argument for the application grammarian to use these libraries.
|
||||
What we mean by "only using the libraries" is that
|
||||
<ul>
|
||||
<li> all <tt>lin</tt> and
|
||||
<tt>lincat</tt> rules are built solely from library functions and
|
||||
argument variables.
|
||||
</ul>
|
||||
Thus for instance no records, tables, selections or projections should appear
|
||||
in the rules. What we have achieved then is <b>total data abstraction</b>,
|
||||
and the grammaticality guarantee can be given.
|
||||
|
||||
<p>
|
||||
|
||||
Since the resource grammars are work in progress, their coverage is not
|
||||
yet sufficient for complete data abstraction. In addition, there may of course
|
||||
be bugs in the resource grammars that destroy grammaticality. The GF group is
|
||||
grateful for bug reports, requests, and contributions!
|
||||
|
||||
<p>
|
||||
|
||||
The most important exception to total data abstraction in practice is the
|
||||
incompleteness of resource lexica. Since it is impossible to have
|
||||
full coverage of all the words in a language, users often have to introduce
|
||||
their own lexical entries, and thereby use literal strings in their GF code.
|
||||
The safest and most convenient way of using this is via functions
|
||||
defined in <tt>ParadigmsX.gf</tt> files. Using these functions guarantees
|
||||
that the lexical entries created are type-correct. But nothing guards
|
||||
against misspelling a word, picking a wrong inflectional pattern, or
|
||||
a wrong inherent feature (such as gender).
|
||||
|
||||
|
||||
|
||||
<h3>The resource grammar documentation in <tt>gfdoc</tt></h3>
|
||||
|
||||
All documented GF grammars linked from this page
|
||||
have been written in GF and then translated to HTML
|
||||
using a light-weight documentation tool,
|
||||
<tt>gfdoc</tt>. The tool is available as a part of the GF
|
||||
source code package, in the Haskell file
|
||||
<tt>util/GFDoc.hs</tt> that can be run in the Hugs interpreter
|
||||
by the script <tt>util/gfdoc</tt>. The program also has the
|
||||
flag <tt>+latex</tt>, which produces output in Latex instead of
|
||||
HTML.
|
||||
|
||||
|
||||
|
||||
<h3>The core resource API</h3>
|
||||
|
||||
The API is divided into two modules, <tt>Combiantions</tt> and
|
||||
its extension <tt>Structural</tt>.
|
||||
|
||||
<p>
|
||||
|
||||
The file <a href="doc/Combinations.html"><tt>Combinations.gf</tt></a>
|
||||
gives the core resource type signatures of phrasal categories and
|
||||
syntactic combination rules, together with some explanations
|
||||
and examples. The examples are so far only in English, but their
|
||||
equivalents are available in all of the languages for which the
|
||||
API has been implemented.
|
||||
|
||||
<p>
|
||||
|
||||
The file <a href="doc/Structural.html"><tt>Structurals.gf</tt></a>
|
||||
gives a list of structural words such as determiners, pronouns,
|
||||
prepositions, and conjunctions.
|
||||
|
||||
<p>
|
||||
|
||||
The file <tt>Structural.gf</tt> cannot be imported directly, but
|
||||
via the generated files <tt>ResourceX.gf</tt> for each language <tt>X</tt>.
|
||||
In these files, the <tt>fun/lin</tt> and <tt>cat/lincat</tt> judgements have been
|
||||
translated into <tt>oper</tt> judgements.
|
||||
|
||||
|
||||
|
||||
<h3>The lexical paradigm modules</h3>
|
||||
|
||||
The lexical paradigm modules define, for
|
||||
each lexical category, a <b>worst-case macro</b> for adding words
|
||||
of that category by giving a sufficient number of characteristic
|
||||
forms. In addition, the most common <b>regular paradigms</b> are
|
||||
included, where it is enough just to give one form to generate
|
||||
all the others.
|
||||
|
||||
<p>
|
||||
|
||||
For example, the English paradigm module has the worst-case macro for nouns,
|
||||
<pre>
|
||||
mkN : (man,men,man's,men's : Str) -> Gender -> N ;
|
||||
</pre>
|
||||
taking four forms and a gender (<tt>human</tt> or <tt>nonhuman</tt>,
|
||||
as is also explained in the module). Its application
|
||||
<pre>
|
||||
mkN "mouse" "mice" "mouse's" "mice's" nonhuman
|
||||
</pre>
|
||||
defines all information that is needed for the noun <i>mouse</i>.
|
||||
There are also some regular patterns, for instance,
|
||||
<pre>
|
||||
nReg : Str -> Gender -> N ; -- dog, dogs
|
||||
nKiss : Str -> Gender -> N ; -- kiss, kisses
|
||||
</pre>
|
||||
examples of which are
|
||||
<pre>
|
||||
nReg "car" nonhuman
|
||||
nKiss "waitress" human
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
|
||||
Here are the documented versions of the paradigm modules:
|
||||
<ul>
|
||||
<li> English: <a href="doc/ParadigmsEng.html"><tt>ParadigmsEng.gf</tt></a>
|
||||
<li> Finnish: <a href="doc/ParadigmsFin.html"><tt>ParadigmsFin.gf</tt></a>
|
||||
<li> French: <a href="doc/ParadigmsFre.html"><tt>ParadigmsFre.gf</tt></a>
|
||||
<li> German: <a href="doc/ParadigmsGer.html"><tt>ParadigmsGer.gf</tt></a>
|
||||
<li> Italian: <a href="doc/ParadigmsIta.html"><tt>ParadigmsIta.gf</tt></a>
|
||||
<li> Russian: <a href="doc/ParadigmsRus.html"><tt>ParadigmsRus.gf</tt></a>
|
||||
<li> Swedish: <a href="doc/ParadigmsSwe.html"><tt>ParadigmsSwe.gf</tt></a>
|
||||
</ul>
|
||||
|
||||
|
||||
<h3>The derived resource libraries</h3>
|
||||
|
||||
The core resource grammar is minimal in the sense that it defines the
|
||||
smallest syntactic combinations and has no redundancy. For applications, it
|
||||
is usually more convenient to use combinations of the minimal rules.
|
||||
Some such combinations are given in the <b>predication library</b>,
|
||||
which defines the simultaneous applications of one- and two-place
|
||||
verbs and adjectives to all their argument noun phrases. It also
|
||||
defines some other constructions useful for logical and mathematical
|
||||
applications.
|
||||
|
||||
<p>
|
||||
|
||||
The API of the predication library is in the file
|
||||
<a href="doc/Predication.html"><tt>Predication.gf</tt></a>.
|
||||
What is imported is one of the language-dependent files,
|
||||
<tt>X/PredicationX.gf</tt> for each language <tt>X</tt>.
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>Linguist's view on resource grammars</h2>
|
||||
|
||||
<h3>GF and other grammar formalisms</h3>
|
||||
|
||||
Linguists in particular might be interested in resource
|
||||
grammars for their own sake, not as basis of applications.
|
||||
Since few linguists are so far familiar with GF, we refer to the
|
||||
<a href="http://www.cs.chalmers.se/~aarne/GF/">GF Homepage</a>
|
||||
and especially to the
|
||||
<a href="http://www.cs.chalmers.se/~aarne/GF/Tutorial/">GF Tutorial</a>.
|
||||
What comes here is a brief summary of the relation of GF to
|
||||
other record-based formalisms.
|
||||
|
||||
<p>
|
||||
|
||||
The records of GF are much like feature structures in PATR or HPSG.
|
||||
The main differences are that
|
||||
<ul>
|
||||
<li> GF has a type system inherited from
|
||||
functional programming languages;
|
||||
<li> GF records are primarily obtained as linearizations of trees, not
|
||||
as parses of strings.
|
||||
</ul>
|
||||
The latter difference explains why a GF record typically carries more
|
||||
information than a feature structure. For instance, the record describing
|
||||
the French noun <i>cheval</i> is
|
||||
<pre>
|
||||
{s = table {Sg => "cheval" ; Pl => "chevaux"} ; g = Masc} ;
|
||||
</pre>
|
||||
showing the full inflection table of the (abstract) noun <i>cheval</i>.
|
||||
A PATR record
|
||||
for the French word <i>cheval</i> would be
|
||||
<pre>
|
||||
{s = "cheval" ; n = Sg ; g = Masc} ;
|
||||
</pre>
|
||||
showing just the information that can be gathered from the (concrete)
|
||||
string <i>cheval</i>.
|
||||
There is a rather straightforward sense in which the PATR record is an
|
||||
<b>instance</b> of the GF record.
|
||||
|
||||
<p>
|
||||
|
||||
When generating language from syntax trees (or from logical formulas via
|
||||
syntax trees), the record containing full inflection tables is an efficient
|
||||
(linear-time) method of producing the correct forms.
|
||||
This is important when text is generated in real time in
|
||||
an interactive system.
|
||||
|
||||
|
||||
|
||||
<h2>The structure of core resource grammars</h2>
|
||||
|
||||
As explained above, the application grammarian's view on resource grammars
|
||||
is through API modules. They are collections of type signatures of functions.
|
||||
It is the task of linguists to define these functions.
|
||||
The definitions are in the end given
|
||||
in the <b>core resource grammars</b>.
|
||||
|
||||
<p>
|
||||
|
||||
We have divided the core resource grammar for each language <tt>X</tt>
|
||||
into the following parts:
|
||||
<ul>
|
||||
<li> Type system: <tt>TypesX.gf</tt>
|
||||
<li> Morphology: <tt>MorphoX.gf</tt>
|
||||
<li> Syntax: <tt>SyntaxX.gf</tt>
|
||||
</ul>
|
||||
To get the most powerful resource grammar for each language, one can use
|
||||
these files directly.
|
||||
|
||||
<p>
|
||||
|
||||
However, the languages we have studied have so much in common
|
||||
that we have gathered a considerable set of categories and rules
|
||||
in a <b>multilingual resource grammar</b>. Its parts are
|
||||
<ul>
|
||||
<li> Abstract syntax: <tt>Resource.gf</tt></a>
|
||||
<li> Language-dependent concrete syntax: <tt>ResourceX.gf</tt></a> for
|
||||
each language.
|
||||
</ul>
|
||||
The advantage of using this API in application grammars is that
|
||||
<b>their concrete syntax looks the same for all languages</b>
|
||||
up to non-structural words. Thus it is possible to produce concrete syntaxes
|
||||
for new languages without knowing almost anything about them.
|
||||
The abstract syntax serves as a common API to the core resource grammar.
|
||||
|
||||
|
||||
<h3>The code for the core resource grammars</h3>
|
||||
|
||||
Each language has its resource code in a separate directory.
|
||||
You can view the code as it is, or download it and run <tt>gfdoc</tt>
|
||||
on each file.
|
||||
<ul>
|
||||
<li> English:
|
||||
<a href="english"><tt>english</tt></a>
|
||||
<li> Finnish:
|
||||
<a href="finnish"><tt>Finnish</tt></a>
|
||||
<li> Shared Romance:
|
||||
<a href="romance"><tt>romance</tt></a>
|
||||
<li> French (building on Romance):
|
||||
<a href="french"><tt>French</tt></a>
|
||||
<li> Italian (building on Romance):
|
||||
<a href="italian"><tt>italian</tt></a>
|
||||
<li> Russian:
|
||||
<a href="russian"><tt>russian</tt></a>
|
||||
<li> German:
|
||||
<a href="german"><tt>german</tt></a>
|
||||
<li> Swedish:
|
||||
<a href="swedish"><tt>swedish</tt></a>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Compiling and using the resource</h2>
|
||||
|
||||
To compile the resource into reusable operations, for all languages, type
|
||||
<pre>
|
||||
make
|
||||
</pre>
|
||||
in the <tt>resource/</tt> directory.
|
||||
This requires that you have a recent version of GF (>= 2.0).
|
||||
What you get is a set of files with names <tt>ResourceX.gfr</tt>,
|
||||
<tt>ResourceX.gfc</tt>, <tt>ParadigmsX.gfr</tt>, and <tt>ParadigmsX.gfc</tt>.
|
||||
You need never consult any of these files,
|
||||
but only look into the <a href="doc">documentation</a>.
|
||||
|
||||
|
||||
|
||||
<h2>Examples of using the resource grammars</h2>
|
||||
|
||||
<h3>A test suite</h3>
|
||||
|
||||
The grammars <tt>TestResourceX.gf</tt> define a few expressions of each
|
||||
lexical category and make it possible to test linearization, parsing,
|
||||
random generation, and editing.
|
||||
|
||||
|
||||
<h3>A database query language</h3>
|
||||
|
||||
The grammars
|
||||
<a href="../database/">
|
||||
<tt>database/(Database | Restaurant)X.gf</tt></a>
|
||||
make use of the resource. The <tt>RestaurantX.gf</tt>
|
||||
grammars are just one possible application building on the generic
|
||||
<tt>DatabaseX.gf</tt> grammars.
|
||||
Notice that the
|
||||
<tt>DatabaseX</tt> gramamrs are defined as instantiations of
|
||||
the parametrized module <tt>DatabaseI</tt>.
|
||||
|
||||
|
||||
<h2>Functional morphology</h2>
|
||||
|
||||
Even though GF is a useful language for describing syntax and semantics, it
|
||||
is not the optimal choice for morphology.
|
||||
One reason is the absence of low-level
|
||||
programming, such as string matching. Another reason is efficiency.
|
||||
In connection with the resource grammar project, we have started another
|
||||
project, <a href="http://www.cs.chalmers.se/%7Emarkus/FM">
|
||||
functional morphology</a>,
|
||||
which uses Haskell to implement
|
||||
morphology. Haskell morphologies can then be used for generating
|
||||
GF morphologies.
|
||||
|
||||
|
||||
<h2>Further reading</h2>
|
||||
|
||||
<a
|
||||
href="http://www.cs.chalmers.se/~aarne/slides/multi-eng-slides.pdf">
|
||||
Slides on modular grammar engineering</a>.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
--# -path=.:../romance:../abstract:../../prelude
|
||||
|
||||
concrete CombinationsIta of Combinations =
|
||||
CombinationsRomance with (SyntaxRomance=SyntaxIta) ;
|
||||
@@ -1,303 +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} ;
|
||||
|
||||
elisQue = "che" ; --- no elision in Italian
|
||||
elisDe = "de" ;
|
||||
|
||||
--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,solamente ->
|
||||
{s = table {
|
||||
AF Masc n => numForms solo soli ! n ;
|
||||
AF Fem n => numForms sola sole ! n ;
|
||||
AA => solamente
|
||||
}
|
||||
} ;
|
||||
|
||||
-- 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") (sol + "amente") ;
|
||||
|
||||
adjTale : Str -> Adj = \tale ->
|
||||
let
|
||||
tal = Predef.tk 1 tale ;
|
||||
tali = tal + "i" ;
|
||||
tala = if_then_Str (pbool2bool (Predef.occur (Predef.dp 1 tal) "lr")) tal tale
|
||||
in
|
||||
mkAdj tale tale tali tali (tala + "mente") ;
|
||||
|
||||
adjBlu : Str -> Adj = \blu ->
|
||||
mkAdj blu blu blu blu blu ; ---
|
||||
|
||||
|
||||
--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 => il ; ---- [] ;
|
||||
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 ! AF 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, venuto ->
|
||||
let
|
||||
vien = Predef.tk 1 vieni ;
|
||||
venut = (adjSolo venuto).s
|
||||
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 ;
|
||||
VPart g n => venut ! AF g n
|
||||
}
|
||||
} ;
|
||||
|
||||
-- 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 (ama + "to") ;
|
||||
|
||||
verbDormire : Str -> VerbPres = \dormire ->
|
||||
let {dorm = troncVerb dormire} in
|
||||
mkVerbPres
|
||||
dorm (dorm + "e") dorm (dorm + "ite") (dorm + "ino") (dorm+"a")
|
||||
(dorm + "i") dormire (dorm + "ito") ;
|
||||
|
||||
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 (fini + "to") ;
|
||||
|
||||
verbCorrere : Str -> Str -> VerbPres = \correre,corso ->
|
||||
let {corr = troncVerb correre ; corre = corr + "e"} in
|
||||
mkVerbPres corr corre corr (corre + "te") (corr + "ono") (corr+"a") (corr+"i")
|
||||
correre corso ;
|
||||
|
||||
-- Some irregular verbs.
|
||||
|
||||
verbPresSpegnere : VerbPres =
|
||||
mkVerbPres "speng" "spegne" "spegn" "spegnete" "spengono"
|
||||
"spenga" "spegni" "spegnere" "spento" ;
|
||||
|
||||
verbPresDire : VerbPres =
|
||||
mkVerbPres "dic" "dice" "dic" "dite" "dicono"
|
||||
"dica" "di" "dire" "detto" ;
|
||||
|
||||
|
||||
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
|
||||
}} ;
|
||||
|
||||
}
|
||||
@@ -1,245 +0,0 @@
|
||||
--# -path=.:../romance:../abstract:../../prelude
|
||||
|
||||
--1 Italian 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 $MorphoIta.gf$ is that the types
|
||||
-- referred to are compiled resource grammar types. We have moreover
|
||||
-- had the design principle of always having existing forms, not stems, as string
|
||||
-- arguments of the paradigms.
|
||||
--
|
||||
-- The following modules are presupposed:
|
||||
|
||||
resource ParadigmsIta =
|
||||
open Prelude, (Types = TypesIta), SyntaxIta, MorphoIta,
|
||||
ResourceIta in {
|
||||
|
||||
--2 Parameters
|
||||
--
|
||||
-- To abstract over gender names, we define the following identifiers.
|
||||
|
||||
oper
|
||||
Bool : Type ;
|
||||
Gender : Type ;
|
||||
|
||||
masculine : Gender ;
|
||||
feminine : Gender ;
|
||||
|
||||
-- To abstract over number names, we define the following.
|
||||
|
||||
Number : Type ;
|
||||
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
|
||||
-- To abstract over case names, we define the following. (Except for
|
||||
-- some pronouns, the accusative is equal to the nominative, the
|
||||
-- dative is formed by the preposition "a", and the genitive by the
|
||||
-- preposition "di".)
|
||||
|
||||
Case : Type ;
|
||||
|
||||
nominative : Case ;
|
||||
accusative : Case ;
|
||||
dative : Case ;
|
||||
genitive : Case ;
|
||||
|
||||
prep_a : Case ;
|
||||
prep_di : Case ;
|
||||
prep_da : Case ;
|
||||
prep_in : Case ;
|
||||
prep_su : Case ;
|
||||
prep_con : Case ;
|
||||
|
||||
|
||||
--2 Nouns
|
||||
|
||||
-- Worst case: two forms (singular + plural),
|
||||
-- and the gender.
|
||||
|
||||
mkN : (_,_ : Str) -> Gender -> N ; -- uomo, uomini, masculine
|
||||
|
||||
-- Often it is enough with one form. If it ends with
|
||||
-- "o" or "a", no gender is needed; if with something else,
|
||||
-- the gender must be given.
|
||||
|
||||
nVino : Str -> N ; -- vino (, vini, masculine)
|
||||
nRana : Str -> N ; -- rana (, rane, feminine)
|
||||
nSale : Str -> Gender -> N ; -- sale (, sali), masculine
|
||||
nTram : Str -> Gender -> N ; -- tram (, tram), masculine
|
||||
|
||||
-- Nouns used as functions need a case and a preposition. The most common is "di".
|
||||
-- Recall that the prepositions "a", "di", "da", "in", "su", "con" are treated
|
||||
-- as part of the case (cf. above).
|
||||
|
||||
funPrep : N -> Preposition -> Fun ;
|
||||
funCase : N -> Case -> Fun ;
|
||||
funDi : N -> Fun ;
|
||||
|
||||
-- Proper names, with their gender.
|
||||
|
||||
mkPN : Str -> Gender -> PN ; -- Giovanni, masculine
|
||||
|
||||
-- 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 -> NP ;
|
||||
|
||||
|
||||
--2 Adjectives
|
||||
|
||||
-- Non-comparison one-place adjectives need four forms in the worst case.
|
||||
-- A parameter tells if they are pre- or postpositions in modification.
|
||||
|
||||
Position : Type ;
|
||||
prepos : Position ;
|
||||
postpos : Position ;
|
||||
|
||||
mkAdj1 : (solo,sola,soli,sole,solamente : Str) -> Position -> Adj1 ;
|
||||
|
||||
-- Adjectives ending with "o" and "e", and invariable adjectives,
|
||||
-- are the most important regular patterns.
|
||||
|
||||
adj1Solo : (solo : Str) -> Bool -> Adj1 ;
|
||||
adj1Tale : (tale : Str) -> Bool -> Adj1 ;
|
||||
adj1Blu : (blu : Str) -> Bool -> Adj1 ;
|
||||
|
||||
|
||||
-- Two-place adjectives need a preposition and a case as extra arguments.
|
||||
|
||||
mkAdj2 : Adj1 -> Preposition -> Case -> Adj2 ; -- divisibile per
|
||||
|
||||
-- Comparison adjectives may need two adjectives, corresponding to the
|
||||
-- positive and other forms.
|
||||
|
||||
mkAdjDeg : (buono, migliore : Adj1) -> AdjDeg ;
|
||||
|
||||
-- In the completely regular case, the comparison forms are constructed by
|
||||
-- the particle "più".
|
||||
|
||||
aSolo : Str -> Position -> AdjDeg ; -- lento (, più lento)
|
||||
aTale : Str -> Position -> AdjDeg ; -- grave (, più grave)
|
||||
aBlu : Str -> Position -> AdjDeg ; -- blu (, più blu)
|
||||
|
||||
-- On top level, there are adjectival phrases. The most common case is
|
||||
-- just to use a one-place adjective.
|
||||
|
||||
apSolo : Str -> Position -> AP ;
|
||||
apTale : Str -> Position -> AP ;
|
||||
apBlu : Str -> Position -> AP ;
|
||||
|
||||
|
||||
--2 Verbs
|
||||
--
|
||||
-- The fragment only has present tense so far, but in all persons.
|
||||
-- The worst case needs nine forms (and is not very user-friendly).
|
||||
|
||||
mkV : (_,_,_,_,_,_,_,_,_ : Str) -> V ;
|
||||
|
||||
-- These are examples of standard conjugations. Other conjugations
|
||||
-- can be extracted from the Italian functional morphology, which has full
|
||||
-- "Bescherelle" tables.
|
||||
|
||||
vAmare : Str -> V ;
|
||||
vDormire : Str -> V ;
|
||||
vFinire : Str -> V ;
|
||||
vCorrere : (_,_ : Str) -> V ;
|
||||
|
||||
-- The verbs 'be' and 'have' are special.
|
||||
|
||||
vEssere : V ;
|
||||
vAvere : V ;
|
||||
|
||||
-- Two-place verbs, and the special case with direct object. Notice that
|
||||
-- a particle can be included in a $V$.
|
||||
|
||||
mkTV : V -> Preposition -> Case -> TV ;
|
||||
tvDir : V -> TV ;
|
||||
|
||||
-- The idiom with "avere" and an invariable noun, such as "paura", "fame",
|
||||
-- and a two-place variant with "di" + complement.
|
||||
|
||||
averCosa : Str -> V ;
|
||||
averCosaDi : Str -> TV ;
|
||||
|
||||
-- The definitions should not bother the user of the API. So they are
|
||||
-- hidden from the document.
|
||||
--.
|
||||
Bool = Prelude.Bool ;
|
||||
Gender = SyntaxIta.Gender ;
|
||||
Case = SyntaxIta.Case ;
|
||||
Number = SyntaxIta.Number ;
|
||||
|
||||
masculine = Masc ;
|
||||
feminine = Fem ;
|
||||
nominative = Types.nominative ;
|
||||
accusative = Types.accusative ;
|
||||
genitive = Types.genitive ;
|
||||
dative = Types.dative ;
|
||||
|
||||
singular = Types.singular ;
|
||||
plural = Types.plural ;
|
||||
prep_a = Types.CPrep P_a ;
|
||||
prep_di = Types.CPrep Types.P_di ;
|
||||
prep_da = Types.CPrep Types.P_da ;
|
||||
prep_in = Types.CPrep Types.P_in ;
|
||||
prep_su = Types.CPrep Types.P_su ;
|
||||
prep_con = Types.CPrep Types.P_con ;
|
||||
|
||||
singular = Types.singular ;
|
||||
plural = Types.plural ;
|
||||
|
||||
mkN a b g = mkCNomIrreg a b g ** {lock_N = <>} ;
|
||||
|
||||
nVino = \vino -> mkCNom (nomVino vino) masculine ** {lock_N = <>} ;
|
||||
nRana = \rana -> mkCNom (nomRana rana) feminine ** {lock_N = <>} ;
|
||||
nSale = \sale,g -> mkCNom (nomSale sale) g ** {lock_N = <>} ;
|
||||
nTram = \tram,g -> mkCNom (nomTram tram) g ** {lock_N = <>} ;
|
||||
|
||||
funPrep = \n,p -> n ** complement p ** {lock_Fun = <>} ;
|
||||
funCase = \n,p -> n ** complementCas p ** {lock_Fun = <>} ;
|
||||
funDi a = funGen a ** {lock_Fun = <>} ;
|
||||
mkPN s g = mkProperName s g ** {lock_PN = <>} ;
|
||||
mkCN = UseN ;
|
||||
mkNP s g = UsePN (mkPN s g) ;
|
||||
|
||||
Position = Bool ;
|
||||
prepos = adjPre ;
|
||||
postpos = adjPost ;
|
||||
mkAdj1 = \x,y,z,u,v,p -> mkAdjective (mkAdj x y z u v) p ** {lock_Adj1 = <>} ;
|
||||
adj1Solo = \a,p -> mkAdjective (adjSolo a) p ** {lock_Adj1 = <>} ;
|
||||
adj1Tale = \a,p -> mkAdjective (adjTale a) p ** {lock_Adj1 = <>} ;
|
||||
adj1Blu = \a,p -> mkAdjective (adjBlu a) p ** {lock_Adj1 = <>} ;
|
||||
mkAdj2 = \a,p,c -> mkAdjCompl a postpos {s2 = p ; c = c} ** {lock_Adj2 = <>} ;
|
||||
mkAdjDeg = \b,m -> mkAdjDegr (mkAdjComp b.s m.s) b.p ** {lock_AdjDeg = <>} ;
|
||||
aSolo = \a,p -> mkAdjDegrLong (adjSolo a) p ** {lock_AdjDeg = <>} ;
|
||||
aTale = \a,p -> mkAdjDegrLong (adjTale a) p ** {lock_AdjDeg = <>} ;
|
||||
aBlu = \a,p -> mkAdjDegrLong (adjBlu a) p ** {lock_AdjDeg = <>} ;
|
||||
apSolo a p = adj1Solo a p ** {lock_AP = <>} ;
|
||||
apTale a p = adj1Tale a p ** {lock_AP = <>} ;
|
||||
apBlu a p = adj1Blu a p ** {lock_AP = <>} ;
|
||||
|
||||
mkV a b c d e f g h i = mkVerbPres a b c d e f g h i ** {lock_V = <>} ;
|
||||
vAmare x = verbAmare x ** {lock_V = <>} ;
|
||||
vDormire x = verbDormire x ** {lock_V = <>} ;
|
||||
vFinire x = verbFinire x ** {lock_V = <>} ;
|
||||
vCorrere x y = verbCorrere x y ** {lock_V = <>} ;
|
||||
vEssere = verbEssere ** {lock_V = <>} ;
|
||||
vAvere = verbPres avere ** {lock_V = <>} ;
|
||||
mkTV a b c = mkTransVerb a b c ** {lock_TV = <>} ;
|
||||
tvDir c = mkTransVerbDir c ** {lock_TV = <>} ;
|
||||
|
||||
averCosa = \fame ->
|
||||
{s = let {aver = vAvere.s} in \\v => aver ! v ++ fame} ** {lock_V = <>} ;
|
||||
averCosaDi = \fame -> mkTV (averCosa fame) [] prep_di ** {lock_TV = <>} ;
|
||||
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
--# -path=.:../abstract:../romance:../../prelude
|
||||
|
||||
resource PredicationIta = Predication with
|
||||
(Resource = ResourceIta), (ResourceExt = ResourceExtIta) ;
|
||||
|
||||
-- this is the standard form of a derived resource. AR 12/1/2004
|
||||
@@ -1,4 +0,0 @@
|
||||
--# -path=.:../abstract:../romance:../../prelude
|
||||
|
||||
resource ResourceExtIta = ResourceExt with (Resource = ResourceIta) ;
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
--# -path=.:../romance:../abstract:../../prelude
|
||||
|
||||
instance ResourceIta of Resource = reuse StructuralIta ;
|
||||
@@ -1,115 +0,0 @@
|
||||
--# -path=.:../romance:../abstract:../../prelude
|
||||
|
||||
concrete StructuralIta of Structural = CombinationsIta **
|
||||
open SyntaxIta, MorphoIta, Prelude in {
|
||||
|
||||
lin
|
||||
INP = pronNounPhrase pronJe ;
|
||||
ThouNP = pronNounPhrase pronTu ;
|
||||
HeNP = pronNounPhrase pronIl ;
|
||||
SheNP = pronNounPhrase pronElle ;
|
||||
WeNumNP n = pronNounPhrase (pronWithNum pronNous n) ;
|
||||
YeNumNP n = pronNounPhrase (pronWithNum pronVous n) ;
|
||||
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}) ;
|
||||
|
||||
ThisNP = mkNameNounPhrase ["questo"] Masc ;
|
||||
ThatNP = mkNameNounPhrase ["quello"] Masc ;
|
||||
TheseNumNP n = mkNameNounPhrase ("questi" ++ n.s ! Masc) Masc ;
|
||||
ThoseNumNP n = mkNameNounPhrase ("quelli" ++ n.s ! Masc) Masc ;
|
||||
|
||||
ItNP = pronNounPhrase pronIl ;
|
||||
|
||||
EveryDet = chaqueDet ;
|
||||
AllMassDet = mkDeterminer singular "tutto" "tutta" ;
|
||||
AllNumDet = mkDeterminerNum plural ["tutti i"] ["tutte le"] ; --- gli
|
||||
WhichDet = quelDet ;
|
||||
WhichNumDet = mkDeterminerNum plural "quali" "quali" ;
|
||||
MostsDet = plupartDet ;
|
||||
MostDet = mkDeterminer1 singular (["la maggior parte"] ++ elisDe) ; --- de
|
||||
SomeDet = mkDeterminer1 singular "qualche" ;
|
||||
SomeNumDet = mkDeterminerNum plural "alcuni" "alcune" ;
|
||||
NoDet = mkDeterminer singular "nessuno" "nessuna" ; --- non
|
||||
NoNumDet = mkDeterminerNum plural "nessuni" "nessune" ; ---- ??
|
||||
AnyDet = mkDeterminer1 singular "qualche" ; ---
|
||||
AnyNumDet = mkDeterminerNum plural "alcuni" "alcune" ; ---
|
||||
ManyDet = mkDeterminer plural "molti" "molte" ;
|
||||
MuchDet = mkDeterminer1 singular "molto" ;
|
||||
ThisDet = mkDeterminer singular "questo" "questa" ;
|
||||
ThatDet = mkDeterminer singular "quello" "quella" ;
|
||||
TheseNumDet = mkDeterminerNum plural "questi" "queste" ; --- ci
|
||||
ThoseNumDet = mkDeterminerNum plural "quelli" "quelle" ; --- quegli
|
||||
|
||||
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!
|
||||
|
||||
VeryAdv = ss "molto" ;
|
||||
TooAdv = ss "troppo" ;
|
||||
OtherwiseAdv = ss "altramente" ;
|
||||
ThereforeAdv = ss "quindi" ;
|
||||
|
||||
EverybodyNP = mkNameNounPhrase ["tutti"] Masc ;
|
||||
SomebodyNP = mkNameNounPhrase ["qualcuno"] Masc ;
|
||||
NobodyNP = mkNameNounPhrase ["nessuno"] Masc ; --- ne
|
||||
EverythingNP = mkNameNounPhrase ["tutto"] Masc ;
|
||||
SomethingNP = mkNameNounPhrase ["qualche cosa"] Masc ;
|
||||
NothingNP = mkNameNounPhrase ["niente"] Masc ; --- ne
|
||||
|
||||
CanVV = mkVerbVerbDir (mkVerbPres
|
||||
"poss" "può" "poss" "potete" "possono" "possa" "puoi" "potere" "potuto") ;
|
||||
CanKnowVV = mkVerbVerbDir (mkVerbPres
|
||||
"s" "sa" "sapp" "sapete" "sanno" "sappia" "sai" "sapere" "saputo") ;
|
||||
MustVV = mkVerbVerbDir (mkVerbPres
|
||||
"dev" "deve" "dobb" "dovete" "devono" "debba" "devi" "dovere" "dovuto") ;
|
||||
WantVV = mkVerbVerbDir (mkVerbPres
|
||||
"vogli" "vuole" "vogl" "volete" "vogliono" "voglia" "vuoi" "volere" "voluto") ;
|
||||
|
||||
EverywhereNP = ss "dappertutto" ;
|
||||
SomewhereNP = ss ["qualche parte"] ; --- ne - pas
|
||||
NowhereNP = ss ["nessun parte"] ;
|
||||
|
||||
AlthoughSubj = ss "benché" ** {m = Con} ;
|
||||
|
||||
AlmostAdv = ss "quasi" ;
|
||||
QuiteAdv = ss "assai" ;
|
||||
|
||||
InPrep = justCase (CPrep P_in) ;
|
||||
OnPrep = justCase (CPrep P_su) ;
|
||||
ToPrep = justCase dative ; ---
|
||||
ThroughPrep = justPrep "per" ;
|
||||
AbovePrep = justPrep "sopra" ;
|
||||
UnderPrep = justPrep "sotto" ;
|
||||
InFrontPrep = justPrep "davanti" ;
|
||||
BehindPrep = justPrep "dietro" ;
|
||||
BetweenPrep = justPrep "tra" ;
|
||||
FromPrep = justCase (CPrep P_da) ;
|
||||
BeforePrep = justPrep "prima" ;
|
||||
DuringPrep = justPrep "durante" ;
|
||||
AfterPrep = justPrep "dopo" ;
|
||||
WithPrep = justCase (CPrep P_con) ;
|
||||
WithoutPrep = justPrep "senza" ;
|
||||
ByMeansPrep = justPrep "per" ;
|
||||
PossessPrep = justCase genitive ;
|
||||
PartPrep = justCase genitive ; ---
|
||||
AgentPrep = justCase (CPrep P_da) ;
|
||||
|
||||
}
|
||||
@@ -1,313 +0,0 @@
|
||||
--# -path=.:../romance:../../prelude
|
||||
|
||||
instance SyntaxIta of SyntaxRomance =
|
||||
TypesIta ** open Prelude, (CO=Coordination), MorphoIta in {
|
||||
oper
|
||||
nameNounPhrase = \jean ->
|
||||
normalNounPhrase
|
||||
(\\c => prepCase c ++ jean.s)
|
||||
jean.g
|
||||
Sg ;
|
||||
|
||||
nounPhraseOn = mkNameNounPhrase "si" Masc ; --- can be plural dep. on object
|
||||
|
||||
partitiveNounPhrase = \n,vino ->
|
||||
normalNounPhrase
|
||||
(table {
|
||||
CPrep P_di => elisDe ++ vino.s ! n ;
|
||||
c => prepCase c ++ artDef vino.g n (CPrep P_di) ++ vino.s ! n
|
||||
}
|
||||
)
|
||||
vino.g
|
||||
n ;
|
||||
|
||||
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
|
||||
|
||||
npGenPossNum = \nu,ton,mec ->
|
||||
\\c => artDef mec.g Pl c ++ ton.s ! Poss Pl mec.g ++ nu.s ! mec.g ++ mec.s ! Pl ;
|
||||
|
||||
existNounPhrase = \delvino -> {
|
||||
s = \\m =>
|
||||
case m of {
|
||||
Ind => case delvino.n of {Sg => "c'è" ; Pl => ["ci sono"]} ;
|
||||
Con => case delvino.n of {Sg => ["ci sia"] ; Pl => ["ci siano"]}
|
||||
} ++ delvino.s ! stressed accusative --- ce ne sono ; have to define "ci"
|
||||
} ;
|
||||
|
||||
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".
|
||||
|
||||
funGen : 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 ;
|
||||
CPrep P_a => True ; -- dative
|
||||
_ => False
|
||||
} ;
|
||||
|
||||
-- The negation of a verb.
|
||||
|
||||
posNeg = \b,v,c ->
|
||||
if_then_else Str b
|
||||
(v ++ c)
|
||||
("non" ++ v ++ c) ;
|
||||
|
||||
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
|
||||
}
|
||||
} ;
|
||||
|
||||
existNounPhraseQuest = \delvino ->
|
||||
let cedelvino = (existNounPhrase delvino).s ! Ind
|
||||
in {
|
||||
s = \\m => case m of {DirQ => [] ; _ => "se"} ++ cedelvino
|
||||
} ;
|
||||
|
||||
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" --- (variants {"io" ; []}) etc
|
||||
"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" ** {m = Ind} ;
|
||||
quandSubj = ss "quando" ** {m = Ind} ;
|
||||
|
||||
ouiPhr = ss ["Sì ."] ;
|
||||
nonPhr = ss ["No ."] ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
--# -path=.:../romance:../abstract:../../prelude
|
||||
|
||||
concrete TestResourceIta of TestResource =
|
||||
StructuralIta ** 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" "vecchiamente")
|
||||
adjPre ;
|
||||
Young = mkAdjDegrTale "giovane" adjPre ;
|
||||
Happy = mkAdjDegrTale "felice" adjPost ;
|
||||
American = mkAdjective (adjSolo "americano") adjPost ;
|
||||
Finnish = mkAdjective (adjTale "finlandese") adjPost ;
|
||||
Married = mkAdjCompl (adjSolo "sposato") adjPost {s2 = [] ; c = dative} ;
|
||||
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 ;
|
||||
Wine = mkCNom (nomVino "vino") Masc ;
|
||||
Bottle = mkCNom (nomRana "bottiglia") Fem ;
|
||||
Bar = mkCNom (nomTram "bar") Masc ;
|
||||
Walk = verbAmare "camminare" ;
|
||||
Run = verbCorrere "correre" "corso" ;
|
||||
Send = mkTransVerbDir (verbAmare "mandare") ;
|
||||
Love = mkTransVerbDir (verbAmare "amare") ;
|
||||
Wait = mkTransVerbCas (verbAmare "aspettare") dative ;
|
||||
Drink = mkTransVerbDir (mkVerbPres
|
||||
"bev" "beve" "bev" "bevete" "bevono" "beva" "bevi" "bere" "bevuto") ;
|
||||
Give = mkDitransVerb (mkVerbPres
|
||||
"d" "da" "d" "date" "danno" "dia" "dà" "dare" "dato")
|
||||
[] dative [] accusative ;
|
||||
Prefer = mkDitransVerb (verbFinire "preferire") [] accusative [] dative ;
|
||||
Say = verbSent verbPresDire Ind Ind ;
|
||||
Prove = verbSent (verbAmare "dimostrare") Ind Ind ;
|
||||
SwitchOn = mkTransVerbDir (verbAmare "allumare") ;
|
||||
SwitchOff = mkTransVerbDir verbPresSpegnere ;
|
||||
Mother = funGen (mkCNom (nomSale "madre") Fem) ;
|
||||
Uncle = funGen (mkCNom (nomVino "zio") Masc) ;
|
||||
Connection = mkCNom (nomSale "connessione") Fem **
|
||||
{s2 = [] ; c = CPrep P_da ; s3 = [] ; c3 = dative} ;
|
||||
|
||||
Well = ss "bene" ;
|
||||
Always = ss "sempre" ;
|
||||
|
||||
John = mkProperName "Giovanni" Masc ;
|
||||
Mary = mkProperName "Maria" Fem ;
|
||||
}
|
||||
@@ -1,139 +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
|
||||
} ;
|
||||
|
||||
case2pformClit = \c -> case c of {
|
||||
Nom => Aton Nom ;
|
||||
Acc => Aton Acc ;
|
||||
CPrep P_a => Aton c ;
|
||||
_ => Ton c
|
||||
} ;
|
||||
|
||||
-- Comparative adjectives are only sometimes formed morphologically
|
||||
-- (actually: by different morphemes).
|
||||
|
||||
mkAdjComp : (_,_ : AForm => 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
|
||||
(\\gn => "più" ++ caro.s ! gn) ;
|
||||
|
||||
|
||||
-- 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 ;
|
||||
VPart g n => amare.s ! Part PresP g n
|
||||
}} ;
|
||||
|
||||
-- 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} ;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
i english/ParadigmsEng.gf
|
||||
e
|
||||
i finnish/ParadigmsFin.gf
|
||||
e
|
||||
i french/ParadigmsFre.gf
|
||||
e
|
||||
i german/ParadigmsGer.gf
|
||||
e
|
||||
i italian/ParadigmsIta.gf
|
||||
e
|
||||
i russian/ParadigmsRus.gf
|
||||
e
|
||||
i swedish/ParadigmsSwe.gf
|
||||
@@ -1,8 +0,0 @@
|
||||
i english/TestResourceEng.gf
|
||||
i finnish/TestResourceFin.gf
|
||||
i french/TestResourceFre.gf
|
||||
i german/TestResourceGer.gf
|
||||
i italian/TestResourceIta.gf
|
||||
i russian/TestResourceRus.gf
|
||||
i swedish/TestResourceSwe.gf
|
||||
pm | wf TestAll.gfcm
|
||||
@@ -1,200 +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 CombinationsRomance of Combinations =
|
||||
open Prelude, SyntaxRomance in {
|
||||
|
||||
flags
|
||||
startcat=Phr ;
|
||||
|
||||
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 : AForm => Str ; p : Bool} ;
|
||||
Adj2 = Adjective ** {s2 : Preposition ; c : CaseA} ;
|
||||
AdjDeg = {s : Degree => AForm => Str ; p : Bool} ;
|
||||
AP = Adjective ;
|
||||
Fun = Function ;
|
||||
-- = CommNoun ** {s2 : Preposition ; c : CaseA} ;
|
||||
Fun2 = Function ** {s3 : Preposition ; c3 : CaseA} ;
|
||||
Prep = {s : Preposition ; c : CaseA} ;
|
||||
Num = {s : Gender => Str} ;
|
||||
|
||||
V = Verb ;
|
||||
-- = {s : VF => Str} ;
|
||||
VG = {s : Bool => Gender => VF => Str} ;
|
||||
VP = {s : Gender => VF => Str} ;
|
||||
TV = TransVerb ;
|
||||
-- = Verb ** {s2 : Preposition ; c : CaseA} ;
|
||||
V3 = TransVerb ** {s3 : Preposition ; c3 : CaseA} ;
|
||||
VS = Verb ** {mp,mn : Mode} ;
|
||||
VV = Verb ** {c : CaseA} ;
|
||||
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 : AForm => Str ; p : Bool} ;
|
||||
ListNP = {s1,s2 : CaseA => Str ; g : PronGen ; n : Number ; p : Person} ;
|
||||
|
||||
Subj = {s : Str ; m : Mode} ;
|
||||
--.
|
||||
|
||||
lin
|
||||
UseN = noun2CommNounPhrase ;
|
||||
ModAdj = modCommNounPhrase ;
|
||||
ModGenOne = npGenDet singular ;
|
||||
ModGenNum = npGenDetNum ;
|
||||
UsePN = nameNounPhrase ;
|
||||
UseFun = funAsCommNounPhrase ; -- [SyntaxFra.noun2CommNounPhrase]
|
||||
AppFun = appFunComm ;
|
||||
AppFun2 = appFun2 ;
|
||||
AdjP1 = adj2adjPhrase ;
|
||||
ComplAdj = complAdj ;
|
||||
PositAdjP = positAdjPhrase ;
|
||||
ComparAdjP = comparAdjPhrase ;
|
||||
SuperlNP = superlNounPhrase ;
|
||||
|
||||
DetNP = detNounPhrase ;
|
||||
IndefOneNP = indefNounPhrase singular ;
|
||||
IndefNumNP = indefNounPhraseNum ;
|
||||
DefOneNP = defNounPhrase singular ;
|
||||
DefNumNP = defNounPhraseNum ;
|
||||
MassNP = partitiveNounPhrase singular ;
|
||||
UseInt i = {s = \\_ => i.s} ;
|
||||
NoNum = noNum ;
|
||||
|
||||
SymbPN i = {s = i.s ; g = Masc} ; --- cannot know gender
|
||||
SymbCN cn s =
|
||||
{s = \\n => cn.s ! n ++ s.s ;
|
||||
g = cn.g} ;
|
||||
|
||||
CNthatS = nounThatSentence ;
|
||||
|
||||
PredVP = predVerbPhrase ;
|
||||
PosVG = predVerbGroup True ;
|
||||
NegVG = predVerbGroup False ;
|
||||
|
||||
PredV = predVerb ;
|
||||
PredAP = predAdjective ;
|
||||
PredCN = predCommNoun ;
|
||||
PredTV = complTransVerb ;
|
||||
PredV3 = complDitransVerb ;
|
||||
PredNP = predNounPhrase ;
|
||||
PredAdV = predAdverb ;
|
||||
PredVS = complSentVerb ;
|
||||
PredVV = complVerbVerb ;
|
||||
PredPassV = predPassVerb ;
|
||||
VTrans = transAsVerb ;
|
||||
|
||||
AdjAdv a = {s = a.s ! AA} ;
|
||||
AdvVP = adVerbPhrase ;
|
||||
PrepNP = prepNounPhrase ;
|
||||
AdvCN = advCommNounPhrase ;
|
||||
AdvAP = advAdjPhrase ;
|
||||
|
||||
ThereNP = existNounPhrase ;
|
||||
|
||||
PosSlashTV = slashTransVerb True ;
|
||||
NegSlashTV = slashTransVerb False ;
|
||||
OneVP = predVerbPhrase nounPhraseOn ;
|
||||
|
||||
|
||||
IdRP = identRelPron ;
|
||||
FunRP = funRelPron ;
|
||||
RelVP = relVerbPhrase ;
|
||||
RelSlash = relSlash ;
|
||||
ModRC = modRelClause ;
|
||||
RelSuch = relSuch ;
|
||||
|
||||
WhoOne = intPronWho singular ;
|
||||
WhoMany = intPronWho plural ;
|
||||
WhatOne = intPronWhat singular ;
|
||||
WhatMany = intPronWhat plural ;
|
||||
FunIP = funIntPron ;
|
||||
NounIPOne = nounIntPron singular ;
|
||||
NounIPMany = nounIntPron plural ;
|
||||
|
||||
QuestVP = questVerbPhrase ;
|
||||
IntVP = intVerbPhrase ;
|
||||
IntSlash = intSlash ;
|
||||
QuestAdv = questAdverbial ;
|
||||
IsThereNP = existNounPhraseQuest ;
|
||||
|
||||
ImperVP = imperVerbPhrase ;
|
||||
|
||||
IndicPhrase = indicUtt ;
|
||||
QuestPhrase = interrogUtt ;
|
||||
ImperOne = imperUtterance singular ;
|
||||
ImperMany = imperUtterance plural ;
|
||||
|
||||
AdvS = advSentence ;
|
||||
|
||||
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 ;
|
||||
SubjVP = subjunctVerbPhrase ;
|
||||
|
||||
PhrNP = useNounPhrase ;
|
||||
PhrOneCN = useCommonNounPhrase singular ;
|
||||
PhrManyCN = useCommonNounPhrase plural ;
|
||||
PhrIP ip = ip ;
|
||||
PhrIAdv ia = ia ;
|
||||
|
||||
OnePhr p = p ;
|
||||
ConsPhr = cc2 ;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,180 +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 ;
|
||||
prepositional : 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, case2pformClit : 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.
|
||||
--
|
||||
-- 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, and there is also an adverbial form
|
||||
-- (e.g. "infiniment"), which has different paradigms and can even be irregular ("bien").
|
||||
-- Comparative adjectives are moreover inflected in degree
|
||||
-- (which in French and Italian is usually syntactic, though).
|
||||
|
||||
param
|
||||
AForm = AF Gender Number | AA ;
|
||||
|
||||
oper
|
||||
Adj : Type = {s : AForm => Str} ;
|
||||
AdjComp : Type = {s : Degree => AForm => 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
|
||||
| VPart Gender Number
|
||||
| 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 ;
|
||||
}
|
||||
@@ -1,235 +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 CombinationsRus of Combinations = open Prelude, SyntaxRus in {
|
||||
flags
|
||||
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: PronGen ; anim : Animacy ; pron: Bool} ;
|
||||
PN = ProperName ;
|
||||
-- = {s : Case => Str ; g : Gender ; anim : Animacy} ;
|
||||
Adj1 = Adjective ;
|
||||
-- = {s : AdjForm => Str} ;
|
||||
Det = Determiner ;
|
||||
-- = Adjective ** {n: Number; g: PronGen; c: Case} ;
|
||||
Adj2 = AdjCompl ;
|
||||
-- = Adjective ** Complement ;
|
||||
AdjDeg = AdjDegr ;
|
||||
-- = {s : Degree => AdjForm => Str} ;
|
||||
AP = AdjPhrase ;
|
||||
-- = Adjective ** {p : IsPostfixAdj} ;
|
||||
Fun = Function ;
|
||||
-- = CommNounPhrase ** Complement ;
|
||||
Fun2 = Function ** {s3 : Str; c2: Case} ;
|
||||
Num = Numeral ;
|
||||
-- = {s : Case => Gender => Str} ;
|
||||
|
||||
V = Verb ;
|
||||
-- = {s : VF => Str ; t: Tense ; a : Aspect ; w: Voice} ;
|
||||
VG = VerbGroup ;
|
||||
-- = Verb ;
|
||||
VP = VerbPhrase ;
|
||||
-- = Verb ** {s2 : Str ; s3 : Gender => Number => Str ;
|
||||
-- negBefore: Bool} ;
|
||||
TV = TransVerb ;
|
||||
-- = Verb ** {s2 : Str ; c: Case } ;
|
||||
V3 = DitransVerb ;
|
||||
-- = TransVerb ** {s4 : Str; c2: Case} ;
|
||||
VS = SentenceVerb ;
|
||||
-- = Verb ;
|
||||
VV = VerbVerb ;
|
||||
-- = Verb ;
|
||||
AdV = Adverb ;
|
||||
-- = {s : Str} ;
|
||||
Prep = Preposition;
|
||||
-- = {s : Str ; c: Case } ;
|
||||
|
||||
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 noNum ;
|
||||
ModGenNum = npGenDet Pl ;
|
||||
UseFun = funAsCommNounPhrase ;
|
||||
AppFun = appFunComm ;
|
||||
AppFun2 = appFun2 ;
|
||||
PositAdjP = positAdjPhrase ;
|
||||
ComparAdjP = comparAdjPhrase ;
|
||||
SuperlNP = superlNounPhrase ;
|
||||
|
||||
CNthatS = nounThatSentence ;
|
||||
UseInt i = useInt i.s;
|
||||
NoNum = noNum ;
|
||||
|
||||
--- these two by AR 3/6/2004
|
||||
SymbPN i = {s = \\_ => i.s ; g = Neut ; anim = Inanimate} ; ---
|
||||
SymbCN cn s =
|
||||
{s = \\n,c => cn.s ! n ! c ++ s.s ;
|
||||
g = cn.g ;
|
||||
anim = cn.anim
|
||||
} ;
|
||||
|
||||
|
||||
DetNP = detNounPhrase ;
|
||||
IndefOneNP = indefNounPhrase Sg ;
|
||||
IndefNumNP = indefNounPhraseNum Pl ;
|
||||
DefOneNP = indefNounPhrase Sg ;
|
||||
DefNumNP = indefNounPhraseNum Pl ;
|
||||
MassNP = indefNounPhrase Sg;
|
||||
|
||||
PosVG = predVerbGroup True ;
|
||||
NegVG = predVerbGroup False ;
|
||||
|
||||
PredV v = v ;
|
||||
PredAP = predAdjective ;
|
||||
PredCN = predCommNoun ;
|
||||
PredTV = complTransVerb ;
|
||||
PredV3 = complDitransVerb ;
|
||||
PredPassV v = v ;
|
||||
PredNP = predNounPhrase ;
|
||||
PredAdV = predAdverb ;
|
||||
PredVS = complSentVerb ;
|
||||
PredVV = complVerbVerb ;
|
||||
VTrans = verbOfTransVerb ;
|
||||
|
||||
|
||||
AdjAdv a = mkAdverb (a.s ! AdvF) ;
|
||||
PrepNP p = prepPhrase p ;
|
||||
AdvVP = adVerbPhrase ;
|
||||
--LocNP = locativeNounPhrase ;
|
||||
AdvCN = advCommNounPhrase ;
|
||||
AdvAP = advAdjPhrase ;
|
||||
|
||||
PosSlashTV = slashTransVerb True ;
|
||||
NegSlashTV = slashTransVerb False ;
|
||||
OneVP = predVerbPhrase (pron2NounPhrase pronKtoTo Animate) ;
|
||||
ThereNP = thereIs ;
|
||||
|
||||
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 ;
|
||||
IsThereNP = isThere ;
|
||||
|
||||
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 ;
|
||||
SubjVP = subjunctVerbPhrase ;
|
||||
|
||||
PhrNP = useNounPhrase ;
|
||||
PhrOneCN = useCommonNounPhrase Sg ;
|
||||
PhrManyCN = useCommonNounPhrase Pl ;
|
||||
PhrIP ip = postfixSS "?" ip ;
|
||||
PhrIAdv ia = postfixSS "?" ia ;
|
||||
OnePhr p = p ;
|
||||
ConsPhr = cc2 ;
|
||||
} ;
|
||||
@@ -1,61 +0,0 @@
|
||||
concrete DatabaseRus of Database = open Prelude,SyntaxRus,ResourceEng,PredicationRus,ParadigmsRus 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) ;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,404 +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 ParadigmsRus = open (Predef=Predef), Prelude, SyntaxRus, ResourceRus in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
--2 Parameters
|
||||
--
|
||||
-- To abstract over gender names, we define the following identifiers.
|
||||
|
||||
oper
|
||||
Gender : Type ;
|
||||
masculine : Gender ;
|
||||
feminine : Gender ;
|
||||
neuter : Gender ;
|
||||
|
||||
-- To abstract over case names, we define the following.
|
||||
Case : Type ;
|
||||
|
||||
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.
|
||||
Number : Type ;
|
||||
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
|
||||
--2 Nouns
|
||||
|
||||
-- Best case: indeclinabe nouns: "кофе", "пальто", "ВУЗ".
|
||||
Animacy: Type ;
|
||||
|
||||
animate: Animacy;
|
||||
inanimate: Animacy;
|
||||
|
||||
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.
|
||||
Voice: Type;
|
||||
Aspect: Type;
|
||||
Tense : Type;
|
||||
Bool: Type;
|
||||
|
||||
true: Bool;
|
||||
false: Bool;
|
||||
|
||||
active: Voice ;
|
||||
passive: Voice ;
|
||||
imperfective: Aspect;
|
||||
perfective: Aspect ;
|
||||
present : Tense ;
|
||||
past : Tense ;
|
||||
|
||||
|
||||
-- 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.
|
||||
--.
|
||||
Gender = SyntaxRus.Gender ;
|
||||
Case = SyntaxRus.Case ;
|
||||
Number = SyntaxRus.Number ;
|
||||
Animacy = SyntaxRus.Animacy;
|
||||
Aspect = SyntaxRus.Aspect;
|
||||
Voice = SyntaxRus.Voice ;
|
||||
Tense = SyntaxRus.Tense ;
|
||||
Bool = Prelude.Bool ;
|
||||
|
||||
true = True;
|
||||
false = False ;
|
||||
masculine = Masc ;
|
||||
feminine = Fem ;
|
||||
neuter = Neut ;
|
||||
nominative = Nom ;
|
||||
accusative = Acc ;
|
||||
dative = Dat ;
|
||||
genitive = Gen ;
|
||||
instructive = Inst ;
|
||||
prepositional = Prepos ;
|
||||
singular = Sg ;
|
||||
plural = Pl ;
|
||||
animate = Animate ;
|
||||
inanimate = Inanimate ;
|
||||
active = Act ;
|
||||
passive = Pass ;
|
||||
imperfective = Imperfective ;
|
||||
perfective = Perfective ;
|
||||
present = Present ;
|
||||
past = Past ;
|
||||
-- Degree = Pos | Comp | Super ;
|
||||
-- Person = P1 | P2 | P3 ;
|
||||
-- AfterPrep = Yes | No ;
|
||||
-- Possessive = NonPoss | Poss GenNum ;
|
||||
|
||||
-- Noun definitions
|
||||
|
||||
mkIndeclinableNoun = \s,g, anim ->
|
||||
{
|
||||
s = table { SF _ _ => s } ;
|
||||
g = g ;
|
||||
anim = anim
|
||||
} ** {lock_N = <>};
|
||||
|
||||
|
||||
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
|
||||
} ** {lock_N = <>} ;
|
||||
|
||||
nMashina = \s -> aEndInAnimateDecl s ** {lock_N = <>};
|
||||
nEdinica = \s -> ej_aEndInAnimateDecl s ** {lock_N = <>};
|
||||
nZhenchina = \s -> (aEndAnimateDecl s) ** { g = Fem ; anim = Animate } ** {lock_N = <>};
|
||||
nNoga = \s -> aEndG_K_KH_Decl s ** {lock_N = <>};
|
||||
nMalyariya = \s -> i_yaEndDecl s ** {lock_N = <>};
|
||||
nTetya = \s -> (yaEndAnimateDecl s) ** {g = Fem; anim = Animate; lock_N = <>} ;
|
||||
nBol = \s -> softSignEndDeclFem s ** {lock_N = <>};
|
||||
|
||||
-- Neuter patterns.
|
||||
|
||||
nObezbolivauchee = \s -> eeEndInAnimateDecl s ** {lock_N = <>};
|
||||
nProizvedenie = \s -> eEndInAnimateDecl s ** {lock_N = <>};
|
||||
nChislo = \s -> oEndInAnimateDecl s ** {lock_N = <>};
|
||||
|
||||
|
||||
-- Masculine patterns.
|
||||
|
||||
nStomatolog = \s -> nullEndAnimateDecl s ** {lock_N = <>};
|
||||
|
||||
nAdres = \s -> nullEndInAnimateDecl2 s ** {lock_N = <>};
|
||||
nTelefon = \s -> nullEndInAnimateDecl1 s ** {lock_N = <>};
|
||||
|
||||
nNol = \s -> softSignEndDeclMasc s ** {lock_N = <>};
|
||||
nUroven = \s -> EN_softSignEndDeclMasc s ** {lock_N = <>};
|
||||
|
||||
-- mkFun defined in syntax.RusU
|
||||
-- funGen defined in syntax.RusU
|
||||
|
||||
mkPN = \ivan, g, anim ->
|
||||
case g of {
|
||||
Masc => mkProperNameMasc ivan anim ;
|
||||
_ => mkProperNameFem ivan anim
|
||||
} ** {lock_PN =<>};
|
||||
mkCN = UseN ;
|
||||
mkNP = \x,y,z -> UsePN (mkPN x y z) ;
|
||||
|
||||
-- Adjective definitions
|
||||
|
||||
adjInvar = \s -> { s = \\af => s } ** {lock_Adj1= <>};
|
||||
|
||||
adj1Staruyj s = uy_j_EndDecl s ** {lock_Adj1 = <>} ;
|
||||
adj1Malenkij s = ij_EndK_G_KH_Decl s ** {lock_Adj1= <>};
|
||||
adj1Molodoj s = uy_oj_EndDecl s ** {lock_Adj1= <>};
|
||||
adj1Kakoj_Nibud s t = i_oj_EndDecl s t ** {lock_Adj1= <>};
|
||||
|
||||
mkAdj2 a p c= mkAdjective2 a p c ** {lock_Adj2 = <>};
|
||||
-- mkAdjDeg defined in morpho.RusU
|
||||
|
||||
ap a p = mkAdjPhrase a p ** {lock_AP = <>}; -- defined in syntax module
|
||||
|
||||
-- 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 (ASg _) P1 => sgP1 ;
|
||||
PRF (ASg _) P2 => sgP2 ;
|
||||
PRF (ASg _) P3 => sgP3 ;
|
||||
PRF APl P1 => plP1 ;
|
||||
PRF APl P2 => plP2 ;
|
||||
PRF APl P3 => plP3
|
||||
};
|
||||
|
||||
|
||||
mkRegVerb = verbDecl ; -- defined in morpho.RusU.gf
|
||||
|
||||
mkV a b c = extVerb a b c ** {lock_V = <>}; -- 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 ; w = vox ; lock_V = <>} ;
|
||||
|
||||
mkTV a b c = mkTransVerb a b c ** {lock_TV = <>}; -- defined in syntax.RusU.gf
|
||||
tvDir v = mkDirectVerb v ** {lock_TV = <>}; -- defined in syntax.RusU.gf
|
||||
|
||||
} ;
|
||||
@@ -1,6 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
resource PredicationRus = Predication with
|
||||
(Resource = ResourceRus), (ResourceExt = ResourceExtRus) ;
|
||||
|
||||
-- this is the standard form of a derived resource. AR 12/1/2004
|
||||
@@ -1,4 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
resource ResourceExtRus = ResourceExt with (Resource = ResourceRus) ;
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
instance ResourceRus of Resource = reuse StructuralRus ;
|
||||
@@ -1,30 +0,0 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
concrete RestaurantRus of Restaurant =
|
||||
DatabaseRus ** open Prelude,ParadigmsRus 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) ;
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user