mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-22 09:32:53 -06:00
Close to finishing new verisons of Finnish and GErman.
This commit is contained in:
@@ -30,7 +30,8 @@ lincat
|
||||
CN = CommNounPhrase ;
|
||||
NP = {s : NPForm => Str ; n : Number ; p : NPPerson} ;
|
||||
PN = {s : Case => Str} ;
|
||||
Det = {s : Gender => Case => Str ; n : Number} ;
|
||||
Det = {s : Gender => Case => Str ; n : Number ; isNum : Bool} ;
|
||||
Num = {s : NPForm => Str ; isNum : Bool} ;
|
||||
Fun = Function ;
|
||||
-- = CommNounPhrase ** {c : NPForm} ;
|
||||
Fun2 = Function ** {c2 : NPForm} ;
|
||||
@@ -38,18 +39,22 @@ lincat
|
||||
Adj1 = Adjective ;
|
||||
-- = CommonNoun
|
||||
Adj2 = Adjective ** {c : NPForm} ;
|
||||
AdjDeg = {s : Degree => NForm => Str} ;
|
||||
AP = {s : AdjPos => Number => Case => Str} ;
|
||||
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} ;
|
||||
@@ -67,7 +72,7 @@ lincat
|
||||
ConjD = {s1 : Str ; s2 : Str ; n : Number} ;
|
||||
|
||||
ListS = {s1 : Str ; s2 : Str} ;
|
||||
ListAP = {s1,s2 : AdjPos => Number => Case => Str} ;
|
||||
ListAP = {s1,s2 : AdjPos => AForm => Str} ;
|
||||
ListNP = {s1,s2 : NPForm => Str ; n : Number ; p : NPPerson} ;
|
||||
|
||||
--.
|
||||
@@ -76,7 +81,7 @@ lin
|
||||
UseN = noun2CommNounPhrase ;
|
||||
ModAdj = modCommNounPhrase ;
|
||||
ModGenOne = npGenDet singular ;
|
||||
ModGenMany = npGenDet plural ;
|
||||
ModGenMany = npGenDetNum ;
|
||||
UsePN = nameNounPhrase ;
|
||||
UseFun = funAsCommNounPhrase ;
|
||||
AppFun = appFunComm ;
|
||||
@@ -89,9 +94,12 @@ lin
|
||||
|
||||
DetNP = detNounPhrase ;
|
||||
IndefOneNP = indefNounPhrase singular ;
|
||||
IndefManyNP = indefNounPhrase plural ;
|
||||
IndefManyNP = nounPhraseNum False ;
|
||||
DefOneNP = defNounPhrase singular ;
|
||||
DefManyNP = defNounPhrase plural ;
|
||||
DefManyNP = nounPhraseNum True ;
|
||||
MassNP = partNounPhrase singular ;
|
||||
NoNum = noNum ;
|
||||
UseInt i = {s = \\_ => i.s ; isNum = True} ; --- case endings sometimes needed
|
||||
|
||||
CNthatS = nounThatSentence ;
|
||||
|
||||
@@ -111,14 +119,16 @@ lin
|
||||
PredVV = complVerbVerb ;
|
||||
VTrans = transAsVerb ;
|
||||
|
||||
AdjAdv a = ss (a.s ! AAttr ! AAdv) ; --- also APred?
|
||||
AdvVP = adVerbPhrase ;
|
||||
LocNP = locativeNounPhrase ;
|
||||
PrepNP = prepPhrase ;
|
||||
AdvCN = advCommNounPhrase ;
|
||||
AdvAP = advAdjPhrase ;
|
||||
|
||||
PosSlashTV = slashTransVerb True ;
|
||||
NegSlashTV = slashTransVerb False ;
|
||||
OneVP = passPredVerbPhrase ;
|
||||
ThereNP = onNounPhrase ;
|
||||
|
||||
IdRP = identRelPron ;
|
||||
FunRP = funRelPron ;
|
||||
@@ -137,6 +147,7 @@ lin
|
||||
|
||||
QuestVP = questVerbPhrase ;
|
||||
IntVP = intVerbPhrase ;
|
||||
IsThereNP = onkoNounPhrase ;
|
||||
IntSlash = intSlash ;
|
||||
QuestAdv = questAdverbial ;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
--# -path=.:../../prelude
|
||||
|
||||
--1 A Simple Finnish Resource Morphology
|
||||
--
|
||||
-- Aarne Ranta 2002
|
||||
@@ -30,6 +32,7 @@ oper
|
||||
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 ;
|
||||
@@ -42,6 +45,7 @@ oper
|
||||
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 ;
|
||||
@@ -97,6 +101,34 @@ oper
|
||||
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") ;
|
||||
|
||||
-- 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.
|
||||
@@ -300,7 +332,9 @@ oper
|
||||
a = Predef.dp 1 naurista ;
|
||||
nauris = Predef.tk 2 naurista ;
|
||||
nauri = Predef.tk 3 naurista ;
|
||||
naurii = nauri + "i"
|
||||
i = Predef.dp 1 nauri ;
|
||||
naurii = nauri + i ;
|
||||
naurei = nauri + "i"
|
||||
}
|
||||
in
|
||||
mkSubst a
|
||||
@@ -309,11 +343,11 @@ oper
|
||||
naurii
|
||||
(nauris + ("t" + a))
|
||||
(naurii + "seen")
|
||||
naurii
|
||||
naurii
|
||||
(naurii + "den")
|
||||
(naurii + ("t" + a))
|
||||
(naurii + "siin") ;
|
||||
naurei
|
||||
naurei
|
||||
(naurei + "den")
|
||||
(naurei + ("t" + a))
|
||||
(naurei + "siin") ;
|
||||
|
||||
-- The following two are used for adjective comparison.
|
||||
|
||||
@@ -421,6 +455,7 @@ getHarmony : Str -> Str = \u ->
|
||||
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} ;
|
||||
@@ -433,6 +468,11 @@ getHarmony : Str -> Str = \u ->
|
||||
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.
|
||||
@@ -451,7 +491,8 @@ getHarmony : Str -> Str = \u ->
|
||||
Illat => "siihen" ;
|
||||
Adess => "sillä" ;
|
||||
Ablat => "siltä" ;
|
||||
Allat => "sille"
|
||||
Allat => "sille" ;
|
||||
Abess => "sittä"
|
||||
} ;
|
||||
} ;
|
||||
|
||||
@@ -525,16 +566,63 @@ getHarmony : Str -> Str = \u ->
|
||||
}
|
||||
} ;
|
||||
|
||||
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 : (_,_,_ : CommonNoun) -> AdjDegr = \hyva,parempi,paras ->
|
||||
mkAdjDegr : (_,_,_ : Adjective) -> AdjDegr = \hyva,parempi,paras ->
|
||||
{s = table {
|
||||
Pos => hyva.s ;
|
||||
Comp => parempi.s ;
|
||||
@@ -546,7 +634,10 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
||||
-- the characteristic forms of comparative and superlative.
|
||||
|
||||
regAdjDegr : CommonNoun -> Str -> Str -> AdjDegr = \kiva, kivempaa, kivinta ->
|
||||
mkAdjDegr kiva (sSuurempi kivempaa) (sSuurin kivinta) ;
|
||||
mkAdjDegr
|
||||
(noun2adj kiva)
|
||||
(noun2adjComp False (sSuurempi kivempaa))
|
||||
(noun2adjComp False (sSuurin kivinta)) ;
|
||||
|
||||
|
||||
--3 Verbs
|
||||
@@ -574,21 +665,26 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
||||
}
|
||||
} ;
|
||||
|
||||
-- For "sanoa", "valua", "kysyä".
|
||||
-- For "harppoa", "hukkua", "löytyä", with grade alternation.
|
||||
|
||||
vSanoa : Str -> Verb = \sanoa ->
|
||||
vHukkua : (_,_ : Str) -> Verb = \hukkua,huku ->
|
||||
let {
|
||||
a = Predef.dp 1 sanoa ;
|
||||
sano = Predef.tk 1 sanoa ;
|
||||
o = Predef.dp 1 sano
|
||||
a = Predef.dp 1 hukkua ;
|
||||
hukku = Predef.tk 1 hukkua ;
|
||||
u = Predef.dp 1 huku
|
||||
} in
|
||||
mkVerb
|
||||
sanoa
|
||||
(sano + "n")
|
||||
(sano + o)
|
||||
(sano + (("v" + a) + "t"))
|
||||
(sano + (("k" + a) + a))
|
||||
(sano + ((("t" + a) + a) + "n")) ;
|
||||
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ää".
|
||||
|
||||
@@ -612,6 +708,21 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
||||
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 ->
|
||||
@@ -671,8 +782,8 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
||||
Human => kukaInt
|
||||
} ;
|
||||
|
||||
kaikkiPron : Case => Str =
|
||||
let {kaiket = caseTable Pl (sKukko "kaikki" "kaiken" "kaikkia")} in
|
||||
kaikkiPron : Number -> Case => Str = \n ->
|
||||
let {kaiket = caseTable n (sKorpi "kaikki" "kaiken" "kaikkena")} in
|
||||
table {
|
||||
Nom => "kaikki" ;
|
||||
c => kaiket ! c
|
||||
|
||||
@@ -12,16 +12,59 @@ concrete StructuralFin of Structural =
|
||||
ThouNP = pronNounPhrase pronSina ;
|
||||
HeNP = pronNounPhrase pronHan ;
|
||||
SheNP = pronNounPhrase pronHan ;
|
||||
ItNP = nameNounPhrase pronSe ;
|
||||
WeNP = pronNounPhrase pronMe ;
|
||||
YeNP = pronNounPhrase pronTe ;
|
||||
WeNP = pronWithNum pronMe ;
|
||||
YeNP = pronWithNum pronTe ;
|
||||
YouNP = pronNounPhrase pronTe ;
|
||||
TheyNP = pronNounPhrase pronHe ; --- ne
|
||||
|
||||
ItNP = nameNounPhrase pronSe ;
|
||||
ThisNP = pronNounPhraseNP pronTama ;
|
||||
ThatNP = pronNounPhraseNP pronTuo ;
|
||||
TheseNP = pronWithNum pronNama ;
|
||||
ThoseNP = 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
|
||||
} ;
|
||||
|
||||
|
||||
EveryDet = jokainenDet ;
|
||||
AllDet = kaikkiDet ;
|
||||
AllDet = mkDeterminer singular (kaikkiPron Sg) ;
|
||||
AllsDet = kaikkiDet ;
|
||||
WhichDet = mikaDet ;
|
||||
MostDet = useimmatDet ;
|
||||
WhichsDet 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")) ;
|
||||
|
||||
|
||||
ThisDet = mkDeterminer Sg (\\c => pronTama.s ! PCase c) ;
|
||||
ThatDet = mkDeterminer Sg (\\c => pronTuo.s ! PCase c) ;
|
||||
TheseDet n = mkDeterminerNum n (\\c => pronNama.s ! PCase c) ;
|
||||
ThoseDet n = mkDeterminerNum n (\\c => pronNuo.s ! PCase c) ;
|
||||
|
||||
SomeDet = mkDeterminerGen Sg (jokinPron ! Sg) (jokuPron ! Sg) ;
|
||||
SomesDet n = mkDeterminerGenNum n (jokinPron ! Pl) (jokuPron ! Pl) ;
|
||||
|
||||
|
||||
HowIAdv = ss "kuinka" ;
|
||||
WhenIAdv = ss "koska" ;
|
||||
@@ -42,7 +85,41 @@ concrete StructuralFin of Structural =
|
||||
|
||||
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" ;
|
||||
PartPrep = prepCase Part ;
|
||||
AgentPrep = prepPostpGen "toimesta" ;
|
||||
|
||||
}
|
||||
|
||||
@@ -107,6 +107,16 @@ oper
|
||||
pronNounPhrase : Pronoun -> NounPhrase = \pron ->
|
||||
{s = \\f => pron.s ! npForm2PForm f ; n = pron.n ; p = NPP pron.p} ;
|
||||
|
||||
pronNounPhraseNP : Pronoun -> NounPhrase = \pron ->
|
||||
{s = table {
|
||||
NPAccNom => pron.s ! PCase Nom ;
|
||||
NPAccGen => pron.s ! PCase Gen ;
|
||||
f => pron.s ! npForm2PForm f
|
||||
} ;
|
||||
n = pron.n ;
|
||||
p = NP3
|
||||
} ;
|
||||
|
||||
-- *Partitive noun phrases* use the partitive instead of the nominative
|
||||
-- and accusative forms.
|
||||
|
||||
@@ -122,9 +132,11 @@ oper
|
||||
Numeral : Type = {s : NPForm => Str ; isNum : Bool} ;
|
||||
|
||||
pronWithNum : Pronoun -> Numeral -> NounPhrase = \me,kaksi ->
|
||||
{s = \\c => me.s ! npForm2PForm c ++ kaksi.s ! c ;
|
||||
let meihin = pronNounPhraseNP me
|
||||
in
|
||||
{s = \\c => meihin.s ! c ++ kaksi.s ! c ;
|
||||
n = me.n ;
|
||||
p = NPP me.p
|
||||
p = NP3 -- meidän kahden talo (*talomme)
|
||||
} ;
|
||||
|
||||
noNum : Numeral = {s = \\_ => [] ; isNum = False} ;
|
||||
@@ -179,7 +191,7 @@ oper
|
||||
mkDeterminerGenNum n kaikki kaikki ;
|
||||
|
||||
jokainenDet = mkDeterminer Sg (caseTable Sg (sNainen "jokaista")) ;
|
||||
kaikkiDet : Numeral -> Determiner = \n -> mkDeterminerNum n kaikkiPron ;
|
||||
kaikkiDet : Numeral -> Determiner = \n -> mkDeterminerNum n (kaikkiPron Pl) ;
|
||||
useimmatDet = mkDeterminer Pl (caseTable Pl (sSuurin "useinta")) ;
|
||||
mikaDet = mkDeterminerGen Sg (mikaInt ! Sg) (kukaInt ! Sg) ;
|
||||
mitkaDet : Numeral -> Determiner = \n ->
|
||||
@@ -228,6 +240,19 @@ oper
|
||||
p = NP3
|
||||
} ;
|
||||
|
||||
npGenDetNum : Numeral -> NounPhrase -> CommNounPhrase -> NounPhrase =
|
||||
\viisi,jussi,talo ->
|
||||
{s = \\c => jussi.s ! NPCase Gen ++ viisi.s ! c ++
|
||||
ifPossSuffix talo jussi.p jussi.n (
|
||||
case viisi.isNum of {
|
||||
True => Part ;
|
||||
_ => npForm2Case Pl c
|
||||
}
|
||||
) ;
|
||||
n = Pl ;
|
||||
p = NP3
|
||||
} ;
|
||||
|
||||
ifPossSuffix : CommNounPhrase -> NPPerson -> Number -> Case -> Str =
|
||||
\talo,np,n,c -> case np of {
|
||||
NP3 => talo.s ! False ! n ! c ;
|
||||
@@ -248,6 +273,11 @@ oper
|
||||
g = idea.g
|
||||
} ;
|
||||
|
||||
-- The existential structure is simple.
|
||||
|
||||
onNounPhrase : NounPhrase -> Sentence = \kaljaa ->
|
||||
ss (kaljaa.s ! NPCase Nom ++ "on") ;
|
||||
|
||||
--2 Adjectives
|
||||
--
|
||||
-- Adjectival phrases are used either as attributes or in predicative position.
|
||||
@@ -265,10 +295,10 @@ param
|
||||
AdjPos = APred | AAttr ;
|
||||
|
||||
oper
|
||||
AdjPhrase : Type = {s : AdjPos => Number => Case => Str} ;
|
||||
AdjPhrase : Type = {s : AdjPos => AForm => Str} ;
|
||||
|
||||
adj2adjPhrase : Adjective -> AdjPhrase = \uusi ->
|
||||
{s = \\_,n,c => uusi.s ! NCase n c} ;
|
||||
{s = \\_ => uusi.s} ;
|
||||
|
||||
|
||||
--3 Comparison adjectives
|
||||
@@ -284,11 +314,11 @@ oper
|
||||
-- adjectival phrases ("isompi kuin te"/"teitä isompi").
|
||||
|
||||
comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \iso, te ->
|
||||
{s = let {teitaisompi : Number => Case => Str =
|
||||
\\n,c => te.s ! NPCase Part ++ iso.s ! Comp ! NCase n c} in
|
||||
{s = let {teitaisompi : AForm => Str =
|
||||
\\a => te.s ! NPCase Part ++ iso.s ! Comp ! a} in
|
||||
table {
|
||||
APred => variants {
|
||||
\\n,c => iso.s ! Comp ! NCase n c ++ kuinConj ++ te.s ! NPCase Nom ;
|
||||
\\a => iso.s ! Comp ! a ++ kuinConj ++ te.s ! NPCase Nom ;
|
||||
teitaisompi
|
||||
} ;
|
||||
AAttr => teitaisompi
|
||||
@@ -300,7 +330,7 @@ oper
|
||||
|
||||
superlNounPhrase : AdjDegr -> CommNounPhrase -> NounPhrase = \iso,talo ->
|
||||
{s = \\np => let {c = npForm2Case Sg np} in
|
||||
iso.s ! Sup ! NCase Sg c ++ talo.s ! False ! Sg ! c ;
|
||||
iso.s ! Sup ! AN (NCase Sg c) ++ talo.s ! False ! Sg ! c ;
|
||||
n = Sg ;
|
||||
p = NP3
|
||||
} ;
|
||||
@@ -319,20 +349,20 @@ oper
|
||||
|
||||
complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \hyva,paini ->
|
||||
let {
|
||||
hyvat : Number => Case => Str = \\n,c => hyva.s ! NCase n c ;
|
||||
hyvat : AForm => Str = \\a => hyva.s ! a ;
|
||||
painissa : Str = paini.s ! hyva.c
|
||||
}
|
||||
in
|
||||
{s = table {
|
||||
AAttr => \\n,c => painissa ++ hyvat ! n ! c ;
|
||||
APred => \\n,c => if_then_else Str
|
||||
AAttr => \\a => painissa ++ hyvat ! a ;
|
||||
APred => \\a => if_then_else Str
|
||||
(isLocalNPForm hyva.c)
|
||||
(variants {
|
||||
hyvat ! n ! c ++ painissa ;
|
||||
painissa ++ hyvat ! n ! c
|
||||
hyvat ! a ++ painissa ;
|
||||
painissa ++ hyvat ! a
|
||||
}
|
||||
)
|
||||
(painissa ++ hyvat ! n ! c)
|
||||
(painissa ++ hyvat ! a)
|
||||
}
|
||||
} ;
|
||||
|
||||
@@ -358,7 +388,7 @@ oper
|
||||
-- given to the noun.
|
||||
|
||||
modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase = \iso,mies ->
|
||||
{s = \\p,n,c => iso.s ! AAttr ! n ! c ++ mies.s ! p ! n ! c ;
|
||||
{s = \\p,n,c => iso.s ! AAttr ! AN (NCase n c) ++ mies.s ! p ! n ! c ;
|
||||
g = mies.g
|
||||
} ;
|
||||
|
||||
@@ -503,7 +533,11 @@ oper
|
||||
-- in terms of the common noun rule.
|
||||
|
||||
predAdjective : AdjPhrase -> VerbGroup = \iso ->
|
||||
let {isot : CommNounPhrase = {s = \\_ => iso.s ! APred ; g = NonHuman}}
|
||||
let
|
||||
isot : CommNounPhrase = {
|
||||
s = \\_,n,c => iso.s ! APred ! AN (NCase n c) ;
|
||||
g = NonHuman
|
||||
}
|
||||
in predCommNoun isot ;
|
||||
|
||||
predCommNoun : CommNounPhrase -> VerbGroup = \mies ->
|
||||
@@ -589,17 +623,17 @@ oper
|
||||
-- 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) ;
|
||||
passTransVerb : TransVerb -> VerbGroup = \tavata ->
|
||||
{s = \\b,_ => if_then_else Str b (tavata.s ! Pass b) "ei" ;
|
||||
s2 = \\b,_ => 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) ;
|
||||
passVerb : Verb -> VerbGroup = \uida ->
|
||||
passTransVerb (mkTransVerbDir uida) ;
|
||||
|
||||
-- Transitive verbs can be used elliptically as verbs. The semantics
|
||||
-- is left to applications. The definition is trivial, due to record
|
||||
@@ -656,23 +690,28 @@ oper
|
||||
} ;
|
||||
|
||||
advAdjPhrase : Adverb -> AdjPhrase -> AdjPhrase = \liian, iso ->
|
||||
{s = \\p,n,c => liian.s ++ iso.s ! p ! n ! c
|
||||
{s = \\p,a => liian.s ++ iso.s ! p ! a
|
||||
} ;
|
||||
|
||||
-- Adverbials are typically generated by case, prepositions, or postpositions.
|
||||
-- The rule for creating locative noun phrases by the inessive case
|
||||
-- is a shaky, since the adessive is often required.
|
||||
|
||||
prepPhrase : Str -> Case -> NounPhrase -> Adverb = \ennen,c,talvi ->
|
||||
ss (ennen ++ talvi.s ! NPCase c) ;
|
||||
Preposition : Type = {s : Str ; c : Case ; isPrep : Bool} ;
|
||||
|
||||
postpPhrase : Str -> Case -> NounPhrase -> Adverb = \aikana,c,talvi ->
|
||||
ss (talvi.s ! NPCase c ++ aikana) ;
|
||||
prepPrep : Str -> Case -> Preposition = \ennen,gen ->
|
||||
{s = ennen ; c = gen ; isPrep = True} ;
|
||||
|
||||
caseAdv : Case -> NounPhrase -> Adverb = prepPhrase [] ;
|
||||
prepPostp : Str -> Case -> Preposition = \takana,gen ->
|
||||
{s = takana ; c = gen ; isPrep = False} ;
|
||||
|
||||
locativeNounPhrase : NounPhrase -> Adverb = \np -> --- caseAdv Iness ;
|
||||
ss (np.s ! NPCase Iness) ;
|
||||
prepPostpGen : Str -> Preposition = \takana ->
|
||||
prepPostp takana Gen ;
|
||||
|
||||
prepCase : Case -> Preposition = \iness ->
|
||||
{s = [] ; c = iness ; isPrep = False} ;
|
||||
|
||||
prepPhrase : Preposition -> NounPhrase -> Adverb = \takana, talo ->
|
||||
let talon = talo.s ! NPCase takana.c
|
||||
in ss (if_then_Str takana.isPrep (takana.s ++ talon) (talon ++ takana.s)) ;
|
||||
|
||||
-- This is a source of the "mann with a telescope" ambiguity, and may produce
|
||||
-- strange things, like "autot aina" (while "autot tänään" is OK).
|
||||
@@ -732,24 +771,22 @@ oper
|
||||
let
|
||||
hc = haluta.c ;
|
||||
haluan = case hc of {
|
||||
CC Nom => predVerb haluta ;
|
||||
_ => predVerb haluta ----- {s = \\b,v =>
|
||||
}
|
||||
CCase Nom => predVerb haluta ;
|
||||
_ => predVerb {s = table {
|
||||
Imper Sg => haluta.s ! Imper Sg ;
|
||||
ImpNegPl => haluta.s ! ImpNegPl ;
|
||||
_ => haluta.s ! Ind Sg P3
|
||||
}
|
||||
}
|
||||
}
|
||||
in {
|
||||
s = haluan.s ;
|
||||
s2 = \\b,v => haluan.s2 ! b ! v ++ uida.s ;
|
||||
s2 = \\b,v => haluan.s2 ! b ! v ++ uida.s ! True ! Inf ++
|
||||
uida.s2 ! True ! Inf ;
|
||||
c = hc
|
||||
} ;
|
||||
|
||||
{s = vilja.s ;
|
||||
s2 = negation ;
|
||||
s3 = \\g,n =>
|
||||
vilja.s1 ++
|
||||
if_then_Str vilja.isAux [] "att" ++
|
||||
simma.s ! VPres Infinit Act ++ simma.s2 ! True ++ simma.s3 ! g ! n
|
||||
} ;
|
||||
|
||||
|
||||
nomVerbVerb : Verb -> VerbVerb = \v -> v ** {c = CCase Nom} ;
|
||||
|
||||
--2 Sentences missing noun phrases
|
||||
--
|
||||
@@ -899,6 +936,8 @@ oper
|
||||
let {np = Ind jussi.n (np2Person jussi.p)} in
|
||||
ss (ui.s ! np ++ koPart ++ jussi.s ! complementCase True ui.c Inf ++ ui.s2 ! np);
|
||||
|
||||
onkoNounPhrase : NounPhrase -> Question = \kaljaa ->
|
||||
ss ("onko" ++ kaljaa.s ! NPCase Nom) ;
|
||||
|
||||
--3 Wh-questions
|
||||
--
|
||||
@@ -1010,19 +1049,19 @@ oper
|
||||
-- The structure is the same as for sentences. Parameters are passed to components.
|
||||
|
||||
ListAdjPhrase : Type =
|
||||
{s1,s2 : AdjPos => Number => Case => Str} ;
|
||||
{s1,s2 : AdjPos => AForm => Str} ;
|
||||
|
||||
twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y ->
|
||||
CO.twoTable3 AdjPos Number Case x y ;
|
||||
CO.twoTable2 AdjPos AForm x y ;
|
||||
|
||||
consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x ->
|
||||
CO.consTable3 AdjPos Number Case CO.comma xs x ;
|
||||
CO.consTable2 AdjPos AForm CO.comma xs x ;
|
||||
|
||||
conjunctAdjPhrase : Conjunction -> ListAdjPhrase -> AdjPhrase = \c,xs ->
|
||||
CO.conjunctTable3 AdjPos Number Case c xs ;
|
||||
CO.conjunctTable2 AdjPos AForm c xs ;
|
||||
|
||||
conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase = \c,xs ->
|
||||
CO.conjunctDistrTable3 AdjPos Number Case c xs ;
|
||||
CO.conjunctDistrTable2 AdjPos AForm c xs ;
|
||||
|
||||
|
||||
--3 Coordinating noun phrases
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
-- use this path to read the grammar from the same directory
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
concrete TestFin of TestAbs = ResFin ** open Prelude, SyntaxFin in {
|
||||
concrete TestResourceFin of TestResource =
|
||||
StructuralFin ** open Prelude, SyntaxFin in {
|
||||
|
||||
flags startcat=Phr ; lexer=unglue ; unlexer=glue ;
|
||||
|
||||
@@ -12,8 +13,9 @@ 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" ;
|
||||
American = noun2adj (sNainen "amerikkalaista") ;
|
||||
Finnish = noun2adj (sNainen "suomalaista") ;
|
||||
Happy = regAdjDegr (sNainen "onnellista") "onnellisempaa" "onnellisinta" ;
|
||||
|
||||
Married = sKukko "vihitty" "vihityn" "vihittyjä" ** {c = NPCase Illat} ;
|
||||
--- naimisissa !
|
||||
@@ -21,8 +23,11 @@ lin
|
||||
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" ;
|
||||
@@ -30,6 +35,7 @@ lin
|
||||
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") **
|
||||
|
||||
@@ -14,15 +14,15 @@ resource TypesFin = open Prelude in {
|
||||
--2 Enumerated parameter types
|
||||
--
|
||||
-- These types are the ones found in school grammars.
|
||||
-- Their parameter values are atomic. We omit three of the cases, not
|
||||
-- occurring in the resource syntax. The accusative cases are only
|
||||
-- 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 ;
|
||||
| Iness | Elat | Illat | Adess | Ablat | Allat
|
||||
| Abess ; ---- | Comit | Instruct ;
|
||||
Person = P1 | P2 | P3 ;
|
||||
Degree = Pos | Comp | Sup ;
|
||||
Gender = NonHuman | Human ;
|
||||
@@ -66,10 +66,14 @@ oper
|
||||
--
|
||||
-- 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.
|
||||
-- Such adjectives are like common nouns, except for the adverbial form.
|
||||
|
||||
Adjective : Type = CommonNoun ;
|
||||
AdjDegr : Type = {s : Degree => NForm => Str} ;
|
||||
param
|
||||
AForm = AN NForm | AAdv ;
|
||||
|
||||
oper
|
||||
Adjective : Type = {s : AForm => Str} ;
|
||||
AdjDegr : Type = {s : Degree => AForm => Str} ;
|
||||
|
||||
--3 Verbs
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user