summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraarne <unknown>2003-11-04 15:09:48 +0000
committeraarne <unknown>2003-11-04 15:09:48 +0000
commitf6d3b220272277277266c8f0feb367d0349ab191 (patch)
treefe9dac233b0db4dec86214d4152af85ed014741b
parent0dbf258ab53c0b665322cf4862e0872863395fe5 (diff)
COmpleted Finnish resource.
COmpleted Finnish resource. Changed module names.
-rw-r--r--grammars/resource/finnish/MorphoFin.gf (renamed from grammars/resource/finnish/Morpho.gf)64
-rw-r--r--grammars/resource/finnish/ResFin.gf14
-rw-r--r--grammars/resource/finnish/SyntaxFin.gf (renamed from grammars/resource/finnish/Syntax.gf)86
-rw-r--r--grammars/resource/finnish/TestFin.gf13
-rw-r--r--grammars/resource/finnish/TypesFin.gf (renamed from grammars/resource/finnish/Types.gf)15
5 files changed, 150 insertions, 42 deletions
diff --git a/grammars/resource/finnish/Morpho.gf b/grammars/resource/finnish/MorphoFin.gf
index 6aca6be61..1eb43cf7c 100644
--- a/grammars/resource/finnish/Morpho.gf
+++ b/grammars/resource/finnish/MorphoFin.gf
@@ -5,9 +5,9 @@
-- 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$.
+-- We use the parameter types and word classes defined in $TypesFin.gf$.
-resource Morpho = Types ** open (Predef = Predef), Prelude in {
+resource MorphoFin = TypesFin ** open (Predef = Predef), Prelude in {
--2 Nouns
--
@@ -267,6 +267,32 @@ oper
(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 ->
@@ -526,7 +552,8 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
--3 Verbs
--
- mkVerb : (_,_,_,_,_ : Str) -> Verb = \tulla,tulen,tulee,tulevat,tulkaa ->
+ mkVerb : (_,_,_,_,_,_ : Str) -> Verb =
+ \tulla,tulen,tulee,tulevat,tulkaa,tullaan ->
let {
tule = Predef.tk 1 tulen ;
a = Predef.dp 1 tulkaa
@@ -541,7 +568,9 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
Ind Pl P3 => tulevat ;
Imper Sg => tule ;
Imper Pl => tulkaa ;
- ImpNegPl => Predef.tk 2 tulkaa + (ifTok Str a "a" "o" "ö")
+ ImpNegPl => Predef.tk 2 tulkaa + (ifTok Str a "a" "o" "ö") ;
+ Pass True => tullaan ;
+ Pass False => Predef.tk 2 tullaan
}
} ;
@@ -551,14 +580,15 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
let {
a = Predef.dp 1 sanoa ;
sano = Predef.tk 1 sanoa ;
- o = Predef.dp 1 sano
+ o = Predef.dp 1 sano
} in
mkVerb
sanoa
(sano + "n")
(sano + o)
(sano + (("v" + a) + "t"))
- (sano + (("k" + a) + a)) ;
+ (sano + (("k" + a) + a))
+ (sano + ((("t" + a) + a) + "n")) ;
-- For "ottaa", "käyttää", "löytää", "huoltaa", "hiihtää", "siirtää".
@@ -566,14 +596,16 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
let {
a = Predef.dp 1 ottaa ;
ota = Predef.tk 1 otan ;
- otta = Predef.tk 1 ottaa
+ 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)) ;
+ (otta + (("k" + a) + a))
+ (ote + ((("t" + a) + a) + "n")) ;
-- For "poistaa", "ryystää".
@@ -593,7 +625,8 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
juoksen
(juokse + "e")
(juokse + (("v" + a) + "t"))
- (juos + (("k" + a) + a)) ;
+ (juos + (("k" + a) + a))
+ (juosta + (a + "n")) ;
-- For "juoda", "syödä".
@@ -607,16 +640,17 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
(juo + "n")
juo
(juo + (("v" + a) + "t"))
- (juo + (("k" + a) + a)) ;
+ (juo + (("k" + a) + a))
+ (juoda + (a + "n")) ;
- verbOlla : Verb = mkVerb "olla" "olen" "on" "ovat" "olkaa" ;
+ verbOlla : Verb = mkVerb "olla" "olen" "on" "ovat" "olkaa" "ollaan" ;
--- The negating operator "ei" is actually a verb, which has has present
--- indicative and imperative forms, but no infinitive.
+-- 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ää"} in
+ let {ei = mkVerb nonExist "en" "ei" "eivät" "älkää" "ei"} in
{s = table {
Ind Pl P3 => "eivät" ;
v => ei.s ! v
@@ -651,4 +685,4 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
koPart = suff "ko" ;
-} ; \ No newline at end of file
+} ;
diff --git a/grammars/resource/finnish/ResFin.gf b/grammars/resource/finnish/ResFin.gf
index 5493f7ac7..9b154b9b5 100644
--- a/grammars/resource/finnish/ResFin.gf
+++ b/grammars/resource/finnish/ResFin.gf
@@ -15,9 +15,9 @@
-- 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.Fin.gf$.
+-- implemented. The parameter types are defined in $TypesFin.gf$.
-concrete ResFin of ResAbs = open Prelude, Syntax in {
+concrete ResFin of ResAbs = open Prelude, SyntaxFin in {
flags
startcat=Phr ;
@@ -42,7 +42,7 @@ lincat
V = Verb ;
-- = {s : VForm => Str}
- VP = Verb ** {s2 : VForm => Str} ;
+ VP = Verb ** {s2 : VForm => Str ; c : ComplCase} ;
TV = TransVerb ;
-- = Verb ** {s3, s4 : Str ; c : ComplCase} ;
V3 = TransVerb ** {s5, s6 : Str ; c2 : ComplCase} ;
@@ -92,6 +92,8 @@ lin
DefOneNP = defNounPhrase singular ;
DefManyNP = defNounPhrase plural ;
+ CNthatS = nounThatSentence ;
+
PredVP = predVerbPhrase ;
PosV = predVerb True ;
NegV = predVerb False ;
@@ -103,6 +105,8 @@ lin
NegTV = complTransVerb False ;
PosV3 = complDitransVerb True ;
NegV3 = complDitransVerb False ;
+ PosPassV = passVerb True ;
+ NegPassV = passVerb False ;
PosNP = predNounPhrase True ;
NegNP = predNounPhrase False ;
PosVS = complSentVerb True ;
@@ -116,6 +120,7 @@ lin
PosSlashTV = slashTransVerb True ;
NegSlashTV = slashTransVerb False ;
+ OneVP = passPredVerbPhrase ;
IdRP = identRelPron ;
FunRP = funRelPron ;
@@ -165,6 +170,7 @@ lin
SubjS = subjunctSentence ;
SubjImper = subjunctImperative ;
SubjQu = subjunctQuestion ;
+ SubjVP = subjunctVerbPhrase ;
PhrNP = useNounPhrase ;
PhrOneCN = useCommonNounPhrase singular ;
@@ -212,4 +218,4 @@ lin
OtherwiseAdv = ss "muuten" ;
ThereforeAdv = ss "siksi" ;
-} ; \ No newline at end of file
+} ;
diff --git a/grammars/resource/finnish/Syntax.gf b/grammars/resource/finnish/SyntaxFin.gf
index 66977b610..1f7af543b 100644
--- a/grammars/resource/finnish/Syntax.gf
+++ b/grammars/resource/finnish/SyntaxFin.gf
@@ -7,11 +7,11 @@
--
-- The following files are presupposed:
-resource Syntax = Morpho ** open Prelude, (CO = Coordination) in {
+resource SyntaxFin = MorphoFin ** open Prelude, (CO = Coordination) in {
--2 Common Nouns
--
--- Simple common nouns are defined as the type $CommNoun$ in $morpho.Fin.gf$.
+-- Simple common nouns are defined as the type $CommNoun$ in $MorphoFin$.
--3 Common noun phrases
@@ -187,6 +187,14 @@ oper
plurDet : CommNounPhrase -> NounPhrase = pluralNounPhrase ;
+-- Constructions like "huomio että kaksi on parillinen" are formed at the
+-- first place as common nouns, so that one can also have
+-- "kaikki ehdotukset että...".
+
+ nounThatSentence : CommNounPhrase -> Sentence -> CommNounPhrase = \idea,x ->
+ {s = \\p,n,c => idea.s ! p ! n ! c ++ "että" ++ x.s ;
+ g = idea.g
+ } ;
--2 Adjectives
--
@@ -370,8 +378,15 @@ oper
-- Verb phrases are discontinuous: the two parts of a verb phrase are
-- (s) an inflected verb, (s2) a complement.
-- For instance: "on" - "kaunis" ; "ei" - "ole kaunis" ; "sisältää" - "rikkiä".
+-- Moreover, a subject case is needed, because of passive and 'have' verb
+-- phrases ("minä uin" ; "minut valitaan" ; "minua odotetaan" ; "minulla on jano").
+
+ VerbPhrase = Verb ** {s2 : VForm => Str ; c : ComplCase} ;
+
+-- The normal subject case is the nominative.
- VerbPhrase = Verb ** {s2 : VForm => Str} ;
+ nomVerbPhrase : (Verb ** {s2 : VForm => Str}) -> VerbPhrase = \v ->
+ v ** {c = CCase Nom} ;
-- From the inflection table, we select the finite form as function
-- of person and number:
@@ -398,7 +413,10 @@ oper
}
}
}
- in if_then_else VerbPhrase b (walk ** noCompl) (verbEi ** infCompl) ;
+ in
+ if_then_else VerbPhrase b
+ (nomVerbPhrase (walk ** noCompl))
+ (nomVerbPhrase (verbEi ** infCompl)) ;
-- (N.B. local definitions workaround for poor type inference in GF 1.2).
@@ -432,8 +450,8 @@ oper
\\v => verbOlla.s ! vFormNeg ++ miehia ! v
}
in if_then_else VerbPhrase b
- (verbOlla ** {s2 = miehia})
- (verbEi ** {s2 = olemiehia}) ;
+ (nomVerbPhrase (verbOlla ** {s2 = miehia}))
+ (nomVerbPhrase (verbEi ** {s2 = olemiehia})) ;
predNounPhrase : Bool -> NounPhrase -> VerbPhrase = \b,jussi ->
let {jussia : Bool => Number => Case => Str = \\_,_,_ => jussi.s ! NPCase Nom}
@@ -465,7 +483,7 @@ oper
talon : VForm => Str = \\v =>
ostaa.s3 ++ talo.s ! complementCase b ostaa.c v ++ ostaa.s4
}
- in {
+ in nomVerbPhrase {
s = ostan.s ;
s2 = \\v => ostan.s2 ! v ++ talon ! v
} ;
@@ -481,7 +499,9 @@ oper
Inf => NPAccNom ;
Ind _ _ => NPAccGen ;
Imper _ => NPAccNom ;
- ImpNegPl => NPCase Part
+ ImpNegPl => NPCase Part ;
+ Pass True => NPAccNom ;
+ Pass False => NPCase Part
} ;
_ => NPCase Part
}
@@ -498,6 +518,21 @@ oper
mkTransVerbDir : Verb -> TransVerb = \ostaa ->
ostaa ** {s3 = [] ; s4 = [] ; c = CAcc} ;
+-- Most two-place verbs can be used passively; the object case need not be
+-- the accusative, and it becomes the subject case in the passive sentence.
+
+ passTransVerb : Bool -> TransVerb -> VerbPhrase = \b,tavata ->
+ {s = \\_ => if_then_else Str b (tavata.s ! Pass b) "ei" ;
+ s2 = \\_ => if_then_else Str b [] (tavata.s ! Pass b) ;
+ c = tavata.c
+ } ;
+
+-- The API function does not demand that the verb is two-place.
+-- Therefore, we can only give it the accusative case, as default.
+
+ passVerb : Bool -> Verb -> VerbPhrase = \b,uida ->
+ passTransVerb b (mkTransVerbDir uida) ;
+
-- Transitive verbs can be used elliptically as verbs. The semantics
-- is left to applications. The definition is trivial, due to record
-- subtyping.
@@ -505,6 +540,15 @@ oper
transAsVerb : TransVerb -> Verb = \juoda ->
juoda ;
+-- The 'real' Finnish passive is unpersonal, equivalent to the
+-- "man" construction in German. It is formed by inflecting the
+-- bare verb phrase in passive, and putting the complement before
+-- the verb ("auttaa minua" - "minua autetaan").
+
+ passPredVerbPhrase : VerbPhrase -> Sentence = \auttaaminua ->
+ let {p = Pass True} in
+ {s = auttaaminua.s2 ! p ++ auttaaminua.s ! p} ;
+
-- *Ditransitive verbs* are verbs with three argument places.
-- We treat so far only the rule in which the ditransitive
-- verb takes both complements to form a verb phrase.
@@ -521,9 +565,9 @@ oper
meille : VForm => Str = \\v =>
ostaa.s5 ++ me.s ! complementCase b ostaa.c2 v ++ ostaa.s6
}
- in {
+ in nomVerbPhrase {
s = ostan.s ;
- s2 = \\v => ostan.s2 ! v ++ talon ! v ++ meille ! v
+ s2 = \\v => ostan.s2 ! v ++ talon ! v ++ meille ! v
} ;
@@ -539,7 +583,8 @@ oper
adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \laulaa, hyvin ->
{s = laulaa.s ;
- s2 = \\v => bothWays (laulaa.s2 ! v) hyvin.s
+ s2 = \\v => bothWays (laulaa.s2 ! v) hyvin.s ;
+ c = laulaa.c
} ;
advAdjPhrase : Adverb -> AdjPhrase -> AdjPhrase = \liian, iso ->
@@ -581,8 +626,12 @@ oper
-- contain negation.
predVerbPhrase : NounPhrase -> VerbPhrase -> Sentence = \jussi,uida ->
- let {p = np2Person jussi.p} in
- ss (jussi.s ! NPCase Nom ++ uida.s ! Ind jussi.n p ++ uida.s2 ! Ind jussi.n p) ;
+ let {
+ p = np2Person jussi.p ;
+ c = complementCase True uida.c Inf --- True,Inf don't matter here
+ }
+ in
+ ss (jussi.s ! c ++ uida.s ! Ind jussi.n p ++ uida.s2 ! Ind jussi.n p) ;
-- This is a macro for simultaneous predication and complementization.
@@ -603,7 +652,7 @@ oper
let {
sanon = predVerb b sanoa
}
- in {
+ in nomVerbPhrase {
s = sanon.s ;
s2 = \\v => sanon.s2 ! v ++ conjEtta ++ jussiui.s
} ;
@@ -653,7 +702,8 @@ oper
RelClause : Type = {s : Number => Str} ;
relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \joka,ui ->
- {s = \\n => joka.s ! n ! Nom ++ ui.s ! Ind n P3 ++ ui.s2 ! Ind n P3} ;
+ {s = \\n => joka.s ! n ! npForm2Case n (complementCase True ui.c Inf) ++
+ ui.s ! Ind n P3 ++ ui.s2 ! Ind n P3} ;
relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause = \joka,saat ->
{s = \\n => joka.s ! n ! saat.c ++ saat.s2 ++ saat.s} ;
@@ -754,7 +804,7 @@ oper
questVerbPhrase : NounPhrase -> VerbPhrase -> Question = \jussi,ui ->
let {np = Ind jussi.n (np2Person jussi.p)} in
- ss (ui.s ! np ++ koPart ++ jussi.s ! NPCase Nom ++ ui.s2 ! np) ;
+ ss (ui.s ! np ++ koPart ++ jussi.s ! complementCase True ui.c Inf ++ ui.s2 ! np);
--3 Wh-questions
@@ -947,6 +997,10 @@ oper
subjunctVariants : Subjunction -> Str -> Str -> Str = \if,A,B ->
variants {if.s ++ A ++ commaPunct ++ B ; B ++ commaPunct ++ if.s ++ A} ;
+ subjunctVerbPhrase : VerbPhrase -> Subjunction -> Sentence -> VerbPhrase =
+ \V, if, A ->
+ adVerbPhrase V (ss (if.s ++ A.s)) ;
+
--2 One-word utterances
--
-- An utterance can consist of one phrase of almost any category,
diff --git a/grammars/resource/finnish/TestFin.gf b/grammars/resource/finnish/TestFin.gf
index 215ac0b5c..9408e98f3 100644
--- a/grammars/resource/finnish/TestFin.gf
+++ b/grammars/resource/finnish/TestFin.gf
@@ -1,7 +1,7 @@
-- use this path to read the grammar from the same directory
--# -path=.:../abstract:../../prelude
-concrete TestFin of TestAbs = ResFin ** open Prelude, Syntax in {
+concrete TestFin of TestAbs = ResFin ** open Prelude, SyntaxFin in {
flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ;
@@ -12,6 +12,11 @@ lin
Small = regAdjDegr (sSusi "pieni" "pienen" "pienenä") "pienempää" "pienintä" ;
Old = regAdjDegr (sKukko "vanha" "vanhan" "vanhoja") "vanhempaa" "vanhinta" ;
Young = regAdjDegr (sSusi "nuori" "nuoren" "nuorena") "nuorempaa" "nuorinta" ;
+ American = sNainen "amerikkalaista" ;
+ Finnish = sNainen "suomalaista" ;
+
+ Married = sKukko "vihitty" "vihityn" "vihittyjä" ** {c = NPCase Illat} ;
+ --- naimisissa !
Man = cnHum (mkNoun "mies" "miehen" "miehenä" "miestä" "mieheen" "miehinä"
"miehissä" "miesten" "miehiä" "miehiin") ;
@@ -27,9 +32,15 @@ lin
Send = mkTransVerbDir (vOttaa "lähettää" "lähetän") ;
Love = mkTransVerbCase (vPoistaa "rakastaa") Part ;
Wait = mkTransVerbCase (vOttaa "odottaa" "odotan") Part ;
+ Give = mkTransVerbDir (vOttaa "antaa" "annan") **
+ {s5 = [] ; s6 = [] ; c2 = CCase Allat} ;
+ Prefer = mkTransVerbDir (vOttaa "asettaa" "asetan") **
+ {s5 = [] ; s6 = "edelle" ; c2 = CCase Gen} ; --- pitää paremp(a/i)na
Mother = funGen (n2n (cnHum (sKukko "äiti" "äidin" "äitejä"))) ;
Uncle = funGen (n2n (cnHum (sKukko "setä" "sedän" "setiä"))) ; --- eno!
+ Connection = n2n (cnNoHum (sRakkaus "yhteys")) **
+ {c = NPCase Elat ; c2 = NPCase Illat} ; --- Tampereelle !
Always = ss "aina" ;
Well = ss "hyvin" ;
diff --git a/grammars/resource/finnish/Types.gf b/grammars/resource/finnish/TypesFin.gf
index 9c2193d00..86d0645fb 100644
--- a/grammars/resource/finnish/Types.gf
+++ b/grammars/resource/finnish/TypesFin.gf
@@ -8,7 +8,7 @@
--
-- We use the language-independent prelude.
-resource Types = open Prelude in {
+resource TypesFin = open Prelude in {
--
--2 Enumerated parameter types
@@ -74,7 +74,8 @@ oper
--3 Verbs
--
-- We limit the grammar so far to verbs in the infinitive, second-person
--- imperative, and present tense indicative. A special form is needed for
+-- imperative, and present tense indicative active and passive.
+-- A special form is needed for
-- the negated plural imperative.
param
@@ -82,7 +83,9 @@ param
Inf
| Ind Number Person
| Imper Number
- | ImpNegPl ;
+ | ImpNegPl
+ | Pass Bool
+ ;
oper
Verb : Type = SS1 VForm ;
@@ -90,10 +93,10 @@ oper
vFormNeg = Imper Sg ;
vform2number : VForm -> Number = \v -> case v of {
- Inf => Sg ;
Ind n _ => n ;
Imper n => n ;
- ImpNegPl => Pl
+ ImpNegPl => Pl ;
+ _ => Sg ---
} ;
--
@@ -120,4 +123,4 @@ oper
RelPron : Type = {s : Number => Case => Str} ;
-} ; \ No newline at end of file
+} ;