forked from GitHub/gf-core
Close to finishing new verisons of Finnish and GErman.
This commit is contained in:
@@ -30,7 +30,8 @@ lincat
|
|||||||
CN = CommNounPhrase ;
|
CN = CommNounPhrase ;
|
||||||
NP = {s : NPForm => Str ; n : Number ; p : NPPerson} ;
|
NP = {s : NPForm => Str ; n : Number ; p : NPPerson} ;
|
||||||
PN = {s : Case => Str} ;
|
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 ;
|
Fun = Function ;
|
||||||
-- = CommNounPhrase ** {c : NPForm} ;
|
-- = CommNounPhrase ** {c : NPForm} ;
|
||||||
Fun2 = Function ** {c2 : NPForm} ;
|
Fun2 = Function ** {c2 : NPForm} ;
|
||||||
@@ -38,18 +39,22 @@ lincat
|
|||||||
Adj1 = Adjective ;
|
Adj1 = Adjective ;
|
||||||
-- = CommonNoun
|
-- = CommonNoun
|
||||||
Adj2 = Adjective ** {c : NPForm} ;
|
Adj2 = Adjective ** {c : NPForm} ;
|
||||||
AdjDeg = {s : Degree => NForm => Str} ;
|
AdjDeg = {s : Degree => AForm => Str} ;
|
||||||
AP = {s : AdjPos => Number => Case => Str} ;
|
AP = {s : AdjPos => AForm => Str} ;
|
||||||
|
|
||||||
V = Verb ;
|
V = Verb ;
|
||||||
-- = {s : VForm => Str}
|
-- = {s : VForm => Str}
|
||||||
VP = Verb ** {s2 : VForm => Str ; c : ComplCase} ;
|
VP = Verb ** {s2 : VForm => Str ; c : ComplCase} ;
|
||||||
|
VG = {s,s2 : Bool => VForm => Str ; c : ComplCase} ;
|
||||||
TV = TransVerb ;
|
TV = TransVerb ;
|
||||||
-- = Verb ** {s3, s4 : Str ; c : ComplCase} ;
|
-- = Verb ** {s3, s4 : Str ; c : ComplCase} ;
|
||||||
V3 = TransVerb ** {s5, s6 : Str ; c2 : ComplCase} ;
|
V3 = TransVerb ** {s5, s6 : Str ; c2 : ComplCase} ;
|
||||||
VS = Verb ;
|
VS = Verb ;
|
||||||
|
VV = Verb ** {c : ComplCase} ;
|
||||||
|
|
||||||
AdV = {s : Str} ;
|
AdV = {s : Str} ;
|
||||||
|
Prep = {s : Str ; c : Case ; isPrep : Bool} ;
|
||||||
|
|
||||||
|
|
||||||
S = Sentence ;
|
S = Sentence ;
|
||||||
-- = {s : Str} ;
|
-- = {s : Str} ;
|
||||||
@@ -67,7 +72,7 @@ lincat
|
|||||||
ConjD = {s1 : Str ; s2 : Str ; n : Number} ;
|
ConjD = {s1 : Str ; s2 : Str ; n : Number} ;
|
||||||
|
|
||||||
ListS = {s1 : Str ; s2 : Str} ;
|
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} ;
|
ListNP = {s1,s2 : NPForm => Str ; n : Number ; p : NPPerson} ;
|
||||||
|
|
||||||
--.
|
--.
|
||||||
@@ -76,7 +81,7 @@ lin
|
|||||||
UseN = noun2CommNounPhrase ;
|
UseN = noun2CommNounPhrase ;
|
||||||
ModAdj = modCommNounPhrase ;
|
ModAdj = modCommNounPhrase ;
|
||||||
ModGenOne = npGenDet singular ;
|
ModGenOne = npGenDet singular ;
|
||||||
ModGenMany = npGenDet plural ;
|
ModGenMany = npGenDetNum ;
|
||||||
UsePN = nameNounPhrase ;
|
UsePN = nameNounPhrase ;
|
||||||
UseFun = funAsCommNounPhrase ;
|
UseFun = funAsCommNounPhrase ;
|
||||||
AppFun = appFunComm ;
|
AppFun = appFunComm ;
|
||||||
@@ -89,9 +94,12 @@ lin
|
|||||||
|
|
||||||
DetNP = detNounPhrase ;
|
DetNP = detNounPhrase ;
|
||||||
IndefOneNP = indefNounPhrase singular ;
|
IndefOneNP = indefNounPhrase singular ;
|
||||||
IndefManyNP = indefNounPhrase plural ;
|
IndefManyNP = nounPhraseNum False ;
|
||||||
DefOneNP = defNounPhrase singular ;
|
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 ;
|
CNthatS = nounThatSentence ;
|
||||||
|
|
||||||
@@ -111,14 +119,16 @@ lin
|
|||||||
PredVV = complVerbVerb ;
|
PredVV = complVerbVerb ;
|
||||||
VTrans = transAsVerb ;
|
VTrans = transAsVerb ;
|
||||||
|
|
||||||
|
AdjAdv a = ss (a.s ! AAttr ! AAdv) ; --- also APred?
|
||||||
AdvVP = adVerbPhrase ;
|
AdvVP = adVerbPhrase ;
|
||||||
LocNP = locativeNounPhrase ;
|
PrepNP = prepPhrase ;
|
||||||
AdvCN = advCommNounPhrase ;
|
AdvCN = advCommNounPhrase ;
|
||||||
AdvAP = advAdjPhrase ;
|
AdvAP = advAdjPhrase ;
|
||||||
|
|
||||||
PosSlashTV = slashTransVerb True ;
|
PosSlashTV = slashTransVerb True ;
|
||||||
NegSlashTV = slashTransVerb False ;
|
NegSlashTV = slashTransVerb False ;
|
||||||
OneVP = passPredVerbPhrase ;
|
OneVP = passPredVerbPhrase ;
|
||||||
|
ThereNP = onNounPhrase ;
|
||||||
|
|
||||||
IdRP = identRelPron ;
|
IdRP = identRelPron ;
|
||||||
FunRP = funRelPron ;
|
FunRP = funRelPron ;
|
||||||
@@ -137,6 +147,7 @@ lin
|
|||||||
|
|
||||||
QuestVP = questVerbPhrase ;
|
QuestVP = questVerbPhrase ;
|
||||||
IntVP = intVerbPhrase ;
|
IntVP = intVerbPhrase ;
|
||||||
|
IsThereNP = onkoNounPhrase ;
|
||||||
IntSlash = intSlash ;
|
IntSlash = intSlash ;
|
||||||
QuestAdv = questAdverbial ;
|
QuestAdv = questAdverbial ;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
--# -path=.:../../prelude
|
||||||
|
|
||||||
--1 A Simple Finnish Resource Morphology
|
--1 A Simple Finnish Resource Morphology
|
||||||
--
|
--
|
||||||
-- Aarne Ranta 2002
|
-- Aarne Ranta 2002
|
||||||
@@ -30,6 +32,7 @@ oper
|
|||||||
NCase Sg Adess => vede + ("ll" + a) ;
|
NCase Sg Adess => vede + ("ll" + a) ;
|
||||||
NCase Sg Ablat => vede + ("lt" + a) ;
|
NCase Sg Ablat => vede + ("lt" + a) ;
|
||||||
NCase Sg Allat => vede + "lle" ;
|
NCase Sg Allat => vede + "lle" ;
|
||||||
|
NCase Sg Abess => vede + ("tt" + a) ;
|
||||||
|
|
||||||
NCase Pl Nom => vede + "t" ;
|
NCase Pl Nom => vede + "t" ;
|
||||||
NCase Pl Gen => vesien ;
|
NCase Pl Gen => vesien ;
|
||||||
@@ -42,6 +45,7 @@ oper
|
|||||||
NCase Pl Adess => vesii + ("ll" + a) ;
|
NCase Pl Adess => vesii + ("ll" + a) ;
|
||||||
NCase Pl Ablat => vesii + ("lt" + a) ;
|
NCase Pl Ablat => vesii + ("lt" + a) ;
|
||||||
NCase Pl Allat => vesii + "lle" ;
|
NCase Pl Allat => vesii + "lle" ;
|
||||||
|
NCase Pl Abess => vesii + ("tt" + a) ;
|
||||||
|
|
||||||
NPossNom => vete ;
|
NPossNom => vete ;
|
||||||
NPossGenPl => Predef.tk 1 vesien ;
|
NPossGenPl => Predef.tk 1 vesien ;
|
||||||
@@ -97,6 +101,34 @@ oper
|
|||||||
let {a = getHarmony (Predef.dp 1 talo)} in
|
let {a = getHarmony (Predef.dp 1 talo)} in
|
||||||
sKukko talo (talo + "n") (talo + ("j" + a)) ;
|
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
|
-- Loan words ending in consonants are actually similar to words like
|
||||||
-- "malli"/"mallin"/"malleja", with the exception that the "i" is not attached
|
-- "malli"/"mallin"/"malleja", with the exception that the "i" is not attached
|
||||||
-- to the singular nominative.
|
-- to the singular nominative.
|
||||||
@@ -300,7 +332,9 @@ oper
|
|||||||
a = Predef.dp 1 naurista ;
|
a = Predef.dp 1 naurista ;
|
||||||
nauris = Predef.tk 2 naurista ;
|
nauris = Predef.tk 2 naurista ;
|
||||||
nauri = Predef.tk 3 naurista ;
|
nauri = Predef.tk 3 naurista ;
|
||||||
naurii = nauri + "i"
|
i = Predef.dp 1 nauri ;
|
||||||
|
naurii = nauri + i ;
|
||||||
|
naurei = nauri + "i"
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
mkSubst a
|
mkSubst a
|
||||||
@@ -309,11 +343,11 @@ oper
|
|||||||
naurii
|
naurii
|
||||||
(nauris + ("t" + a))
|
(nauris + ("t" + a))
|
||||||
(naurii + "seen")
|
(naurii + "seen")
|
||||||
naurii
|
naurei
|
||||||
naurii
|
naurei
|
||||||
(naurii + "den")
|
(naurei + "den")
|
||||||
(naurii + ("t" + a))
|
(naurei + ("t" + a))
|
||||||
(naurii + "siin") ;
|
(naurei + "siin") ;
|
||||||
|
|
||||||
-- The following two are used for adjective comparison.
|
-- The following two are used for adjective comparison.
|
||||||
|
|
||||||
@@ -421,6 +455,7 @@ getHarmony : Str -> Str = \u ->
|
|||||||
PCase Adess => minu + ("ll" + a) ;
|
PCase Adess => minu + ("ll" + a) ;
|
||||||
PCase Ablat => minu + ("lt" + a) ;
|
PCase Ablat => minu + ("lt" + a) ;
|
||||||
PCase Allat => minu + "lle" ;
|
PCase Allat => minu + "lle" ;
|
||||||
|
PCase Abess => minu + ("tt" + a) ;
|
||||||
PAcc => Predef.tk 1 minun + "t"
|
PAcc => Predef.tk 1 minun + "t"
|
||||||
} ;
|
} ;
|
||||||
n = n ; p = p} ;
|
n = n ; p = p} ;
|
||||||
@@ -433,6 +468,11 @@ getHarmony : Str -> Str = \u ->
|
|||||||
pronHe = mkPronoun "he" "heidän" "heitä" "heinä" "heihin" Pl P3 ;
|
pronHe = mkPronoun "he" "heidän" "heitä" "heinä" "heihin" Pl P3 ;
|
||||||
pronNe = mkPronoun "ne" "niiden" "niitä" "niinä" "niihin" 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,
|
-- The non-human pronoun "se" ('it') is even more irregular,
|
||||||
-- Its accusative cases do not
|
-- Its accusative cases do not
|
||||||
-- have a special form with "t", but have the normal genitive/nominative variation.
|
-- have a special form with "t", but have the normal genitive/nominative variation.
|
||||||
@@ -451,7 +491,8 @@ getHarmony : Str -> Str = \u ->
|
|||||||
Illat => "siihen" ;
|
Illat => "siihen" ;
|
||||||
Adess => "sillä" ;
|
Adess => "sillä" ;
|
||||||
Ablat => "siltä" ;
|
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 ->
|
caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
||||||
\\c => cn.s ! NCase n c ;
|
\\c => cn.s ! NCase n c ;
|
||||||
|
|
||||||
|
|
||||||
--2 Adjectives
|
--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
|
-- For the comparison of adjectives, three noun declensions
|
||||||
-- are needed in the worst case.
|
-- are needed in the worst case.
|
||||||
|
|
||||||
mkAdjDegr : (_,_,_ : CommonNoun) -> AdjDegr = \hyva,parempi,paras ->
|
mkAdjDegr : (_,_,_ : Adjective) -> AdjDegr = \hyva,parempi,paras ->
|
||||||
{s = table {
|
{s = table {
|
||||||
Pos => hyva.s ;
|
Pos => hyva.s ;
|
||||||
Comp => parempi.s ;
|
Comp => parempi.s ;
|
||||||
@@ -546,7 +634,10 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
|||||||
-- the characteristic forms of comparative and superlative.
|
-- the characteristic forms of comparative and superlative.
|
||||||
|
|
||||||
regAdjDegr : CommonNoun -> Str -> Str -> AdjDegr = \kiva, kivempaa, kivinta ->
|
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
|
--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 {
|
let {
|
||||||
a = Predef.dp 1 sanoa ;
|
a = Predef.dp 1 hukkua ;
|
||||||
sano = Predef.tk 1 sanoa ;
|
hukku = Predef.tk 1 hukkua ;
|
||||||
o = Predef.dp 1 sano
|
u = Predef.dp 1 huku
|
||||||
} in
|
} in
|
||||||
mkVerb
|
mkVerb
|
||||||
sanoa
|
hukkua
|
||||||
(sano + "n")
|
(huku + "n")
|
||||||
(sano + o)
|
(hukku + u)
|
||||||
(sano + (("v" + a) + "t"))
|
(hukku + (("v" + a) + "t"))
|
||||||
(sano + (("k" + a) + a))
|
(hukku + (("k" + a) + a))
|
||||||
(sano + ((("t" + a) + a) + "n")) ;
|
(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ää".
|
-- For "ottaa", "käyttää", "löytää", "huoltaa", "hiihtää", "siirtää".
|
||||||
|
|
||||||
@@ -612,6 +708,21 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
|||||||
vPoistaa : Str -> Verb = \poistaa ->
|
vPoistaa : Str -> Verb = \poistaa ->
|
||||||
vOttaa poistaa (Predef.tk 1 poistaa + "n") ;
|
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".
|
-- For "juosta", "piestä", "nousta", "rangaista", "kävellä", "surra", "panna".
|
||||||
|
|
||||||
vJuosta : (_,_ : Str) -> Verb = \juosta,juoksen ->
|
vJuosta : (_,_ : Str) -> Verb = \juosta,juoksen ->
|
||||||
@@ -671,8 +782,8 @@ caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
|||||||
Human => kukaInt
|
Human => kukaInt
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
kaikkiPron : Case => Str =
|
kaikkiPron : Number -> Case => Str = \n ->
|
||||||
let {kaiket = caseTable Pl (sKukko "kaikki" "kaiken" "kaikkia")} in
|
let {kaiket = caseTable n (sKorpi "kaikki" "kaiken" "kaikkena")} in
|
||||||
table {
|
table {
|
||||||
Nom => "kaikki" ;
|
Nom => "kaikki" ;
|
||||||
c => kaiket ! c
|
c => kaiket ! c
|
||||||
|
|||||||
@@ -12,16 +12,59 @@ concrete StructuralFin of Structural =
|
|||||||
ThouNP = pronNounPhrase pronSina ;
|
ThouNP = pronNounPhrase pronSina ;
|
||||||
HeNP = pronNounPhrase pronHan ;
|
HeNP = pronNounPhrase pronHan ;
|
||||||
SheNP = pronNounPhrase pronHan ;
|
SheNP = pronNounPhrase pronHan ;
|
||||||
ItNP = nameNounPhrase pronSe ;
|
WeNP = pronWithNum pronMe ;
|
||||||
WeNP = pronNounPhrase pronMe ;
|
YeNP = pronWithNum pronTe ;
|
||||||
YeNP = pronNounPhrase pronTe ;
|
|
||||||
YouNP = pronNounPhrase pronTe ;
|
YouNP = pronNounPhrase pronTe ;
|
||||||
TheyNP = pronNounPhrase pronHe ; --- ne
|
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 ;
|
EveryDet = jokainenDet ;
|
||||||
AllDet = kaikkiDet ;
|
AllDet = mkDeterminer singular (kaikkiPron Sg) ;
|
||||||
|
AllsDet = kaikkiDet ;
|
||||||
WhichDet = mikaDet ;
|
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" ;
|
HowIAdv = ss "kuinka" ;
|
||||||
WhenIAdv = ss "koska" ;
|
WhenIAdv = ss "koska" ;
|
||||||
@@ -42,7 +85,41 @@ concrete StructuralFin of Structural =
|
|||||||
|
|
||||||
VeryAdv = ss "hyvin" ;
|
VeryAdv = ss "hyvin" ;
|
||||||
TooAdv = ss "liian" ;
|
TooAdv = ss "liian" ;
|
||||||
|
|
||||||
OtherwiseAdv = ss "muuten" ;
|
OtherwiseAdv = ss "muuten" ;
|
||||||
ThereforeAdv = ss "siksi" ;
|
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 ->
|
pronNounPhrase : Pronoun -> NounPhrase = \pron ->
|
||||||
{s = \\f => pron.s ! npForm2PForm f ; n = pron.n ; p = NPP pron.p} ;
|
{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
|
-- *Partitive noun phrases* use the partitive instead of the nominative
|
||||||
-- and accusative forms.
|
-- and accusative forms.
|
||||||
|
|
||||||
@@ -122,9 +132,11 @@ oper
|
|||||||
Numeral : Type = {s : NPForm => Str ; isNum : Bool} ;
|
Numeral : Type = {s : NPForm => Str ; isNum : Bool} ;
|
||||||
|
|
||||||
pronWithNum : Pronoun -> Numeral -> NounPhrase = \me,kaksi ->
|
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 ;
|
n = me.n ;
|
||||||
p = NPP me.p
|
p = NP3 -- meidän kahden talo (*talomme)
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
noNum : Numeral = {s = \\_ => [] ; isNum = False} ;
|
noNum : Numeral = {s = \\_ => [] ; isNum = False} ;
|
||||||
@@ -179,7 +191,7 @@ oper
|
|||||||
mkDeterminerGenNum n kaikki kaikki ;
|
mkDeterminerGenNum n kaikki kaikki ;
|
||||||
|
|
||||||
jokainenDet = mkDeterminer Sg (caseTable Sg (sNainen "jokaista")) ;
|
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")) ;
|
useimmatDet = mkDeterminer Pl (caseTable Pl (sSuurin "useinta")) ;
|
||||||
mikaDet = mkDeterminerGen Sg (mikaInt ! Sg) (kukaInt ! Sg) ;
|
mikaDet = mkDeterminerGen Sg (mikaInt ! Sg) (kukaInt ! Sg) ;
|
||||||
mitkaDet : Numeral -> Determiner = \n ->
|
mitkaDet : Numeral -> Determiner = \n ->
|
||||||
@@ -228,6 +240,19 @@ oper
|
|||||||
p = NP3
|
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 =
|
ifPossSuffix : CommNounPhrase -> NPPerson -> Number -> Case -> Str =
|
||||||
\talo,np,n,c -> case np of {
|
\talo,np,n,c -> case np of {
|
||||||
NP3 => talo.s ! False ! n ! c ;
|
NP3 => talo.s ! False ! n ! c ;
|
||||||
@@ -248,6 +273,11 @@ oper
|
|||||||
g = idea.g
|
g = idea.g
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
-- The existential structure is simple.
|
||||||
|
|
||||||
|
onNounPhrase : NounPhrase -> Sentence = \kaljaa ->
|
||||||
|
ss (kaljaa.s ! NPCase Nom ++ "on") ;
|
||||||
|
|
||||||
--2 Adjectives
|
--2 Adjectives
|
||||||
--
|
--
|
||||||
-- Adjectival phrases are used either as attributes or in predicative position.
|
-- Adjectival phrases are used either as attributes or in predicative position.
|
||||||
@@ -265,10 +295,10 @@ param
|
|||||||
AdjPos = APred | AAttr ;
|
AdjPos = APred | AAttr ;
|
||||||
|
|
||||||
oper
|
oper
|
||||||
AdjPhrase : Type = {s : AdjPos => Number => Case => Str} ;
|
AdjPhrase : Type = {s : AdjPos => AForm => Str} ;
|
||||||
|
|
||||||
adj2adjPhrase : Adjective -> AdjPhrase = \uusi ->
|
adj2adjPhrase : Adjective -> AdjPhrase = \uusi ->
|
||||||
{s = \\_,n,c => uusi.s ! NCase n c} ;
|
{s = \\_ => uusi.s} ;
|
||||||
|
|
||||||
|
|
||||||
--3 Comparison adjectives
|
--3 Comparison adjectives
|
||||||
@@ -284,11 +314,11 @@ oper
|
|||||||
-- adjectival phrases ("isompi kuin te"/"teitä isompi").
|
-- adjectival phrases ("isompi kuin te"/"teitä isompi").
|
||||||
|
|
||||||
comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \iso, te ->
|
comparAdjPhrase : AdjDegr -> NounPhrase -> AdjPhrase = \iso, te ->
|
||||||
{s = let {teitaisompi : Number => Case => Str =
|
{s = let {teitaisompi : AForm => Str =
|
||||||
\\n,c => te.s ! NPCase Part ++ iso.s ! Comp ! NCase n c} in
|
\\a => te.s ! NPCase Part ++ iso.s ! Comp ! a} in
|
||||||
table {
|
table {
|
||||||
APred => variants {
|
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
|
teitaisompi
|
||||||
} ;
|
} ;
|
||||||
AAttr => teitaisompi
|
AAttr => teitaisompi
|
||||||
@@ -300,7 +330,7 @@ oper
|
|||||||
|
|
||||||
superlNounPhrase : AdjDegr -> CommNounPhrase -> NounPhrase = \iso,talo ->
|
superlNounPhrase : AdjDegr -> CommNounPhrase -> NounPhrase = \iso,talo ->
|
||||||
{s = \\np => let {c = npForm2Case Sg np} in
|
{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 ;
|
n = Sg ;
|
||||||
p = NP3
|
p = NP3
|
||||||
} ;
|
} ;
|
||||||
@@ -319,20 +349,20 @@ oper
|
|||||||
|
|
||||||
complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \hyva,paini ->
|
complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \hyva,paini ->
|
||||||
let {
|
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
|
painissa : Str = paini.s ! hyva.c
|
||||||
}
|
}
|
||||||
in
|
in
|
||||||
{s = table {
|
{s = table {
|
||||||
AAttr => \\n,c => painissa ++ hyvat ! n ! c ;
|
AAttr => \\a => painissa ++ hyvat ! a ;
|
||||||
APred => \\n,c => if_then_else Str
|
APred => \\a => if_then_else Str
|
||||||
(isLocalNPForm hyva.c)
|
(isLocalNPForm hyva.c)
|
||||||
(variants {
|
(variants {
|
||||||
hyvat ! n ! c ++ painissa ;
|
hyvat ! a ++ painissa ;
|
||||||
painissa ++ hyvat ! n ! c
|
painissa ++ hyvat ! a
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
(painissa ++ hyvat ! n ! c)
|
(painissa ++ hyvat ! a)
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -358,7 +388,7 @@ oper
|
|||||||
-- given to the noun.
|
-- given to the noun.
|
||||||
|
|
||||||
modCommNounPhrase : AdjPhrase -> CommNounPhrase -> CommNounPhrase = \iso,mies ->
|
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
|
g = mies.g
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -503,7 +533,11 @@ oper
|
|||||||
-- in terms of the common noun rule.
|
-- in terms of the common noun rule.
|
||||||
|
|
||||||
predAdjective : AdjPhrase -> VerbGroup = \iso ->
|
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 ;
|
in predCommNoun isot ;
|
||||||
|
|
||||||
predCommNoun : CommNounPhrase -> VerbGroup = \mies ->
|
predCommNoun : CommNounPhrase -> VerbGroup = \mies ->
|
||||||
@@ -589,17 +623,17 @@ oper
|
|||||||
-- Most two-place verbs can be used passively; the object case need not be
|
-- 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.
|
-- the accusative, and it becomes the subject case in the passive sentence.
|
||||||
|
|
||||||
passTransVerb : Bool -> TransVerb -> VerbPhrase = \b,tavata ->
|
passTransVerb : TransVerb -> VerbGroup = \tavata ->
|
||||||
{s = \\_ => if_then_else Str b (tavata.s ! Pass b) "ei" ;
|
{s = \\b,_ => if_then_else Str b (tavata.s ! Pass b) "ei" ;
|
||||||
s2 = \\_ => if_then_else Str b [] (tavata.s ! Pass b) ;
|
s2 = \\b,_ => if_then_else Str b [] (tavata.s ! Pass b) ;
|
||||||
c = tavata.c
|
c = tavata.c
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- The API function does not demand that the verb is two-place.
|
-- The API function does not demand that the verb is two-place.
|
||||||
-- Therefore, we can only give it the accusative case, as default.
|
-- Therefore, we can only give it the accusative case, as default.
|
||||||
|
|
||||||
passVerb : Bool -> Verb -> VerbPhrase = \b,uida ->
|
passVerb : Verb -> VerbGroup = \uida ->
|
||||||
passTransVerb b (mkTransVerbDir uida) ;
|
passTransVerb (mkTransVerbDir uida) ;
|
||||||
|
|
||||||
-- Transitive verbs can be used elliptically as verbs. The semantics
|
-- Transitive verbs can be used elliptically as verbs. The semantics
|
||||||
-- is left to applications. The definition is trivial, due to record
|
-- is left to applications. The definition is trivial, due to record
|
||||||
@@ -656,23 +690,28 @@ oper
|
|||||||
} ;
|
} ;
|
||||||
|
|
||||||
advAdjPhrase : Adverb -> AdjPhrase -> AdjPhrase = \liian, iso ->
|
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.
|
-- 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 ->
|
Preposition : Type = {s : Str ; c : Case ; isPrep : Bool} ;
|
||||||
ss (ennen ++ talvi.s ! NPCase c) ;
|
|
||||||
|
|
||||||
postpPhrase : Str -> Case -> NounPhrase -> Adverb = \aikana,c,talvi ->
|
prepPrep : Str -> Case -> Preposition = \ennen,gen ->
|
||||||
ss (talvi.s ! NPCase c ++ aikana) ;
|
{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 ;
|
prepPostpGen : Str -> Preposition = \takana ->
|
||||||
ss (np.s ! NPCase Iness) ;
|
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
|
-- 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).
|
-- strange things, like "autot aina" (while "autot tänään" is OK).
|
||||||
@@ -732,24 +771,22 @@ oper
|
|||||||
let
|
let
|
||||||
hc = haluta.c ;
|
hc = haluta.c ;
|
||||||
haluan = case hc of {
|
haluan = case hc of {
|
||||||
CC Nom => predVerb haluta ;
|
CCase Nom => predVerb haluta ;
|
||||||
_ => predVerb haluta ----- {s = \\b,v =>
|
_ => predVerb {s = table {
|
||||||
}
|
Imper Sg => haluta.s ! Imper Sg ;
|
||||||
|
ImpNegPl => haluta.s ! ImpNegPl ;
|
||||||
|
_ => haluta.s ! Ind Sg P3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
in {
|
in {
|
||||||
s = haluan.s ;
|
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
|
c = hc
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
{s = vilja.s ;
|
nomVerbVerb : Verb -> VerbVerb = \v -> v ** {c = CCase Nom} ;
|
||||||
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
|
|
||||||
} ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--2 Sentences missing noun phrases
|
--2 Sentences missing noun phrases
|
||||||
--
|
--
|
||||||
@@ -899,6 +936,8 @@ oper
|
|||||||
let {np = Ind jussi.n (np2Person jussi.p)} in
|
let {np = Ind jussi.n (np2Person jussi.p)} in
|
||||||
ss (ui.s ! np ++ koPart ++ jussi.s ! complementCase True ui.c Inf ++ ui.s2 ! np);
|
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
|
--3 Wh-questions
|
||||||
--
|
--
|
||||||
@@ -1010,19 +1049,19 @@ oper
|
|||||||
-- The structure is the same as for sentences. Parameters are passed to components.
|
-- The structure is the same as for sentences. Parameters are passed to components.
|
||||||
|
|
||||||
ListAdjPhrase : Type =
|
ListAdjPhrase : Type =
|
||||||
{s1,s2 : AdjPos => Number => Case => Str} ;
|
{s1,s2 : AdjPos => AForm => Str} ;
|
||||||
|
|
||||||
twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y ->
|
twoAdjPhrase : (_,_ : AdjPhrase) -> ListAdjPhrase = \x,y ->
|
||||||
CO.twoTable3 AdjPos Number Case x y ;
|
CO.twoTable2 AdjPos AForm x y ;
|
||||||
|
|
||||||
consAdjPhrase : ListAdjPhrase -> AdjPhrase -> ListAdjPhrase = \xs,x ->
|
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 ->
|
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 ->
|
conjunctDistrAdjPhrase : ConjunctionDistr -> ListAdjPhrase -> AdjPhrase = \c,xs ->
|
||||||
CO.conjunctDistrTable3 AdjPos Number Case c xs ;
|
CO.conjunctDistrTable2 AdjPos AForm c xs ;
|
||||||
|
|
||||||
|
|
||||||
--3 Coordinating noun phrases
|
--3 Coordinating noun phrases
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
-- use this path to read the grammar from the same directory
|
-- use this path to read the grammar from the same directory
|
||||||
--# -path=.:../abstract:../../prelude
|
--# -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 ;
|
flags startcat=Phr ; lexer=unglue ; unlexer=glue ;
|
||||||
|
|
||||||
@@ -12,8 +13,9 @@ lin
|
|||||||
Small = regAdjDegr (sSusi "pieni" "pienen" "pienenä") "pienempää" "pienintä" ;
|
Small = regAdjDegr (sSusi "pieni" "pienen" "pienenä") "pienempää" "pienintä" ;
|
||||||
Old = regAdjDegr (sKukko "vanha" "vanhan" "vanhoja") "vanhempaa" "vanhinta" ;
|
Old = regAdjDegr (sKukko "vanha" "vanhan" "vanhoja") "vanhempaa" "vanhinta" ;
|
||||||
Young = regAdjDegr (sSusi "nuori" "nuoren" "nuorena") "nuorempaa" "nuorinta" ;
|
Young = regAdjDegr (sSusi "nuori" "nuoren" "nuorena") "nuorempaa" "nuorinta" ;
|
||||||
American = sNainen "amerikkalaista" ;
|
American = noun2adj (sNainen "amerikkalaista") ;
|
||||||
Finnish = sNainen "suomalaista" ;
|
Finnish = noun2adj (sNainen "suomalaista") ;
|
||||||
|
Happy = regAdjDegr (sNainen "onnellista") "onnellisempaa" "onnellisinta" ;
|
||||||
|
|
||||||
Married = sKukko "vihitty" "vihityn" "vihittyjä" ** {c = NPCase Illat} ;
|
Married = sKukko "vihitty" "vihityn" "vihittyjä" ** {c = NPCase Illat} ;
|
||||||
--- naimisissa !
|
--- naimisissa !
|
||||||
@@ -21,8 +23,11 @@ lin
|
|||||||
Man = cnHum (mkNoun "mies" "miehen" "miehenä" "miestä" "mieheen" "miehinä"
|
Man = cnHum (mkNoun "mies" "miehen" "miehenä" "miestä" "mieheen" "miehinä"
|
||||||
"miehissä" "miesten" "miehiä" "miehiin") ;
|
"miehissä" "miesten" "miehiä" "miehiin") ;
|
||||||
Woman = cnHum (sNainen "naista") ;
|
Woman = cnHum (sNainen "naista") ;
|
||||||
|
Bottle = cnNoHum (sTalo "pullo") ;
|
||||||
Car = cnNoHum (sTalo "auto") ;
|
Car = cnNoHum (sTalo "auto") ;
|
||||||
House = cnNoHum (sTalo "talo") ;
|
House = cnNoHum (sTalo "talo") ;
|
||||||
|
Bar = cnNoHum (sBaari "baaria") ;
|
||||||
|
Wine = cnNoHum (sBaari "viiniä") ;
|
||||||
Light = cnNoHum (sTalo "valo") ;
|
Light = cnNoHum (sTalo "valo") ;
|
||||||
|
|
||||||
Walk = vJuosta "kävellä" "kävelen" ;
|
Walk = vJuosta "kävellä" "kävelen" ;
|
||||||
@@ -30,6 +35,7 @@ lin
|
|||||||
Say = vSanoa "sanoa" ;
|
Say = vSanoa "sanoa" ;
|
||||||
Prove = vPoistaa "todistaa" ;
|
Prove = vPoistaa "todistaa" ;
|
||||||
Send = mkTransVerbDir (vOttaa "lähettää" "lähetän") ;
|
Send = mkTransVerbDir (vOttaa "lähettää" "lähetän") ;
|
||||||
|
Drink = mkTransVerbDir (vJuoda "juoda") ;
|
||||||
Love = mkTransVerbCase (vPoistaa "rakastaa") Part ;
|
Love = mkTransVerbCase (vPoistaa "rakastaa") Part ;
|
||||||
Wait = mkTransVerbCase (vOttaa "odottaa" "odotan") Part ;
|
Wait = mkTransVerbCase (vOttaa "odottaa" "odotan") Part ;
|
||||||
Give = mkTransVerbDir (vOttaa "antaa" "annan") **
|
Give = mkTransVerbDir (vOttaa "antaa" "annan") **
|
||||||
|
|||||||
@@ -14,15 +14,15 @@ resource TypesFin = open Prelude in {
|
|||||||
--2 Enumerated parameter types
|
--2 Enumerated parameter types
|
||||||
--
|
--
|
||||||
-- These types are the ones found in school grammars.
|
-- These types are the ones found in school grammars.
|
||||||
-- Their parameter values are atomic. We omit three of the cases, not
|
-- Their parameter values are atomic. The accusative cases are only
|
||||||
-- occurring in the resource syntax. The accusative cases are only
|
|
||||||
-- defined in syntax; in morphology, there is a special accusative for
|
-- defined in syntax; in morphology, there is a special accusative for
|
||||||
-- pronouns.
|
-- pronouns.
|
||||||
|
|
||||||
param
|
param
|
||||||
Number = Sg | Pl ;
|
Number = Sg | Pl ;
|
||||||
Case = Nom | Gen | Part | Transl | Ess
|
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 ;
|
Person = P1 | P2 | P3 ;
|
||||||
Degree = Pos | Comp | Sup ;
|
Degree = Pos | Comp | Sup ;
|
||||||
Gender = NonHuman | Human ;
|
Gender = NonHuman | Human ;
|
||||||
@@ -66,10 +66,14 @@ oper
|
|||||||
--
|
--
|
||||||
-- The major division is between the comparison degrees, but it
|
-- The major division is between the comparison degrees, but it
|
||||||
-- is also good to leave room for adjectives that cannon be compared.
|
-- 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 ;
|
param
|
||||||
AdjDegr : Type = {s : Degree => NForm => Str} ;
|
AForm = AN NForm | AAdv ;
|
||||||
|
|
||||||
|
oper
|
||||||
|
Adjective : Type = {s : AForm => Str} ;
|
||||||
|
AdjDegr : Type = {s : Degree => AForm => Str} ;
|
||||||
|
|
||||||
--3 Verbs
|
--3 Verbs
|
||||||
--
|
--
|
||||||
|
|||||||
198
lib/resource-0.6/german/CombinationsGer.gf
Normal file
198
lib/resource-0.6/german/CombinationsGer.gf
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
--# -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 ;
|
||||||
|
ModGenMany = npGenDet plural ;
|
||||||
|
UsePN = nameNounPhrase ;
|
||||||
|
UseFun = funAsCommNounPhrase ;
|
||||||
|
AppFun = appFunComm ;
|
||||||
|
AppFun2 = appFun2 ;
|
||||||
|
AdjP1 = adj2adjPhrase ;
|
||||||
|
ComplAdj = complAdj ;
|
||||||
|
PositAdjP = positAdjPhrase ;
|
||||||
|
ComparAdjP = comparAdjPhrase ;
|
||||||
|
SuperlNP = superlNounPhrase ;
|
||||||
|
|
||||||
|
DetNP = detNounPhrase ;
|
||||||
|
IndefOneNP = indefNounPhrase singular ;
|
||||||
|
IndefManyNP = plurDetNum ;
|
||||||
|
DefOneNP = defNounPhrase singular ;
|
||||||
|
DefManyNP nu = defNounPhraseNum nu plural ;
|
||||||
|
MassNP = massNounPhrase ;
|
||||||
|
UseInt i = i ;
|
||||||
|
NoNum = noNum ;
|
||||||
|
|
||||||
|
CNthatS = nounThatSentence ;
|
||||||
|
PredVP = predVerbPhrase ;
|
||||||
|
PosVG = predVerbGroup True ;
|
||||||
|
NegVG = predVerbGroup False ;
|
||||||
|
|
||||||
|
PredV = predVerb ;
|
||||||
|
PredAP = predAdjective ;
|
||||||
|
PredCN = predCommNoun ;
|
||||||
|
PredTV = complTransVerb ;
|
||||||
|
PredV3 = complDitransVerb ;
|
||||||
|
PredPassV = passVerb ;
|
||||||
|
PredNP = predNounPhrase ;
|
||||||
|
PredAdV = predAdverb ;
|
||||||
|
PredVS = complSentVerb ;
|
||||||
|
PredVV = complVerbVerb ;
|
||||||
|
VTrans = transAsVerb ;
|
||||||
|
|
||||||
|
AdjAdv a = 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 ;
|
||||||
|
|
||||||
|
} ;
|
||||||
399
lib/resource-0.6/german/MorphoGer.gf
Normal file
399
lib/resource-0.6/german/MorphoGer.gf
Normal file
@@ -0,0 +1,399 @@
|
|||||||
|
--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 masculins:
|
||||||
|
|
||||||
|
declN1 : Str -> CommNoun = \zahl ->
|
||||||
|
mkNoun2n zahl (zahl + "en") Fem ;
|
||||||
|
|
||||||
|
declN1e : Str -> CommNoun = \stufe ->
|
||||||
|
mkNoun2n stufe (stufe + "n") Fem ;
|
||||||
|
|
||||||
|
declN1M : Str -> CommNoun = \junge -> let {jungen = junge + "n"} in
|
||||||
|
mkNoun junge jungen jungen jungen jungen jungen Masc ;
|
||||||
|
|
||||||
|
declN1eM : Str -> CommNoun = \soldat -> let {soldaten = soldat + "en"} in
|
||||||
|
mkNoun soldat soldaten soldaten soldaten soldaten soldaten Masc ;
|
||||||
|
|
||||||
|
-- Second declension, with plural "e":
|
||||||
|
|
||||||
|
declN2 : Str -> CommNoun = \punkt ->
|
||||||
|
mkNoun2es punkt (punkt+"e") Masc ;
|
||||||
|
|
||||||
|
declN2i : Str -> CommNoun = \onkel ->
|
||||||
|
mkNoun2s onkel onkel Masc ;
|
||||||
|
|
||||||
|
declN2u : (_,_ : Str) -> CommNoun = \raum,räume ->
|
||||||
|
mkNoun2es raum räume Masc ;
|
||||||
|
|
||||||
|
declN2uF : (_,_ : Str) -> CommNoun = \kuh,kühe ->
|
||||||
|
mkNoun3 kuh kühe (kühe + "n") Fem ;
|
||||||
|
|
||||||
|
-- Third declension, with plural "er":
|
||||||
|
|
||||||
|
declN3 : Str -> CommNoun = \punkt ->
|
||||||
|
mkNoun2es punkt (punkt+"er") Neut ;
|
||||||
|
|
||||||
|
declN3u : (_,_ : Str) -> CommNoun = \buch,bücher ->
|
||||||
|
mkNoun2ses buch bücher Neut ;
|
||||||
|
|
||||||
|
declN3uS : (_,_ : Str) -> CommNoun = \haus,häuser ->
|
||||||
|
mkNoun2es haus häuser Neut ;
|
||||||
|
|
||||||
|
-- Plural with "s":
|
||||||
|
|
||||||
|
declNs : Str -> CommNoun = \restaurant ->
|
||||||
|
mkNoun3 restaurant (restaurant+"s") (restaurant+"s") Neut ;
|
||||||
|
|
||||||
|
|
||||||
|
--2 Pronouns
|
||||||
|
--
|
||||||
|
-- Here we define personal and relative pronouns.
|
||||||
|
-- All personal pronouns, except "ihr", conform to the simple
|
||||||
|
-- pattern $mkPronPers$.
|
||||||
|
|
||||||
|
ProPN = {s : NPForm => Str ; n : Number ; p : Person} ;
|
||||||
|
|
||||||
|
mkPronPers : (_,_,_,_,_ : Str) -> Number -> Person -> ProPN =
|
||||||
|
\ich,mich,mir,meines,mein,n,p -> {
|
||||||
|
s = table {
|
||||||
|
NPCase c => caselist ich mich mir meines ! c ;
|
||||||
|
NPPoss gn c => mein + pronEnding ! gn ! c
|
||||||
|
} ;
|
||||||
|
n = n ;
|
||||||
|
p = p
|
||||||
|
} ;
|
||||||
|
|
||||||
|
pronEnding : GenNum => Case => Str = table {
|
||||||
|
GSg Masc => caselist "" "en" "em" "es" ;
|
||||||
|
GSg Fem => caselist "e" "e" "er" "er" ;
|
||||||
|
GSg Neut => caselist "" "" "em" "es" ;
|
||||||
|
GPl => caselist "e" "e" "en" "er"
|
||||||
|
} ;
|
||||||
|
|
||||||
|
pronIch = mkPronPers "ich" "mich" "mir" "meines" "mein" Sg P1 ;
|
||||||
|
pronDu = mkPronPers "du" "dich" "dir" "deines" "dein" Sg P2 ;
|
||||||
|
pronEr = mkPronPers "er" "ihn" "ihm" "seines" "sein" Sg P3 ;
|
||||||
|
pronSie = mkPronPers "sie" "sie" "ihr" "ihres" "ihr" Sg P3 ;
|
||||||
|
pronEs = mkPronPers "es" "es" "ihm" "seines" "sein" Sg P3 ;
|
||||||
|
pronWir = mkPronPers "wir" "uns" "uns" "unser" "unser" Pl P1 ;
|
||||||
|
|
||||||
|
pronSiePl = mkPronPers "sie" "sie" "ihnen" "ihrer" "ihr" Pl P3 ;
|
||||||
|
pronSSie = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Pl P3 ; ---
|
||||||
|
|
||||||
|
-- We still have wrong agreement with the complement of the polite "Sie":
|
||||||
|
-- it is in plural, like the verb, although it should be in singular.
|
||||||
|
|
||||||
|
-- The peculiarity with "ihr" is the presence of "e" in forms without an ending.
|
||||||
|
|
||||||
|
pronIhr =
|
||||||
|
{s = table {
|
||||||
|
NPPoss (GSg Masc) Nom => "euer" ;
|
||||||
|
NPPoss (GSg Neut) Nom => "euer" ;
|
||||||
|
NPPoss (GSg Neut) Acc => "euer" ;
|
||||||
|
pf => (mkPronPers "ihr" "euch" "euch" "euer" "eur" Pl P2).s ! pf
|
||||||
|
} ;
|
||||||
|
n = Pl ;
|
||||||
|
p = P2
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- Relative pronouns are like the definite article, except in the genitive and
|
||||||
|
-- the plural dative. The function $artDef$ will be defined right below.
|
||||||
|
|
||||||
|
RelPron : Type = {s : GenNum => Case => Str} ;
|
||||||
|
|
||||||
|
relPron : RelPron = {s = \\gn,c =>
|
||||||
|
case <gn,c> of {
|
||||||
|
<GSg Fem,Gen> => "deren" ;
|
||||||
|
<GSg g,Gen> => "dessen" ;
|
||||||
|
<GPl,Dat> => "denen" ;
|
||||||
|
<GPl,Gen> => "deren" ;
|
||||||
|
_ => artDef ! gn ! c
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
--2 Articles
|
||||||
|
--
|
||||||
|
-- Here are all forms the indefinite and definite article.
|
||||||
|
-- The indefinite article is like a large class of pronouns.
|
||||||
|
-- The definite article is more peculiar; we don't try to
|
||||||
|
-- subsume it to any general rule.
|
||||||
|
|
||||||
|
artIndef : Gender => Case => Str = \\g,c => "ein" + pronEnding ! GSg g ! c ;
|
||||||
|
|
||||||
|
artDef : GenNum => Case => Str = table {
|
||||||
|
GSg Masc => caselist "der" "den" "dem" "des" ;
|
||||||
|
GSg Fem => caselist "die" "die" "der" "der" ;
|
||||||
|
GSg Neut => caselist "das" "das" "dem" "des" ;
|
||||||
|
GPl => caselist "die" "die" "den" "der"
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
--2 Adjectives
|
||||||
|
--
|
||||||
|
-- As explained in $types.Deu.gf$, it
|
||||||
|
-- would be superfluous to use the cross product of gender and number,
|
||||||
|
-- since there is no gender distinction in the plural. But it is handy to have
|
||||||
|
-- a function that constructs gender-number complexes.
|
||||||
|
|
||||||
|
gNumber : Gender -> Number -> GenNum = \g,n ->
|
||||||
|
case n of {
|
||||||
|
Sg => GSg g ;
|
||||||
|
Pl => GPl
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- It's also handy to have a function that finds out the number from such a complex.
|
||||||
|
|
||||||
|
numGenNum : GenNum -> Number = \gn ->
|
||||||
|
case gn of {
|
||||||
|
GSg _ => Sg ;
|
||||||
|
GPl => Pl
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- This function costructs parameters in the complex type of adjective forms.
|
||||||
|
|
||||||
|
aMod : Adjf -> Gender -> Number -> Case -> AForm = \a,g,n,c ->
|
||||||
|
AMod a (gNumber g n) c ;
|
||||||
|
|
||||||
|
-- The worst-case macro for adjectives (positive degree) only needs
|
||||||
|
-- two forms.
|
||||||
|
|
||||||
|
mkAdjective : (_,_ : Str) -> Adjective = \böse,bös -> {s = table {
|
||||||
|
APred => böse ;
|
||||||
|
AMod Strong (GSg Masc) c =>
|
||||||
|
caselist (bös+"er") (bös+"en") (bös+"em") (bös+"es") ! c ;
|
||||||
|
AMod Strong (GSg Fem) c =>
|
||||||
|
caselist (bös+"e") (bös+"e") (bös+"er") (bös+"er") ! c ;
|
||||||
|
AMod Strong (GSg Neut) c =>
|
||||||
|
caselist (bös+"es") (bös+"es") (bös+"em") (bös+"es") ! c ;
|
||||||
|
AMod Strong GPl c =>
|
||||||
|
caselist (bös+"e") (bös+"e") (bös+"en") (bös+"er") ! c ;
|
||||||
|
AMod Weak (GSg g) c => case <g,c> of {
|
||||||
|
<_,Nom> => bös+"e" ;
|
||||||
|
<Masc,Acc> => bös+"en" ;
|
||||||
|
<_,Acc> => bös+"e" ;
|
||||||
|
_ => bös+"en" } ;
|
||||||
|
AMod Weak GPl c => bös+"en"
|
||||||
|
}} ;
|
||||||
|
|
||||||
|
-- Here are some classes of adjectives:
|
||||||
|
|
||||||
|
adjReg : Str -> Adjective = \gut -> mkAdjective gut gut ;
|
||||||
|
adjE : Str -> Adjective = \bös -> mkAdjective (bös+"e") bös ;
|
||||||
|
adjEr : Str -> Adjective = \teu -> mkAdjective (teu+"er") (teu+"r") ;
|
||||||
|
adjInvar : Str -> Adjective = \prima -> {s = table {_ => prima}} ;
|
||||||
|
|
||||||
|
-- The first three classes can be recognized from the end of the word, depending
|
||||||
|
-- on if it is "e", "er", or something else.
|
||||||
|
|
||||||
|
adjGen : Str -> Adjective = \gut -> let {
|
||||||
|
er = Predef.dp 2 gut ;
|
||||||
|
teu = Predef.tk 2 gut ;
|
||||||
|
e = Predef.dp 1 gut ;
|
||||||
|
bös = Predef.tk 1 gut
|
||||||
|
} in
|
||||||
|
ifTok Adjective er "er" (adjEr teu) (
|
||||||
|
ifTok Adjective e "e" (adjE bös) (
|
||||||
|
(adjReg gut))) ;
|
||||||
|
|
||||||
|
|
||||||
|
-- The comparison of adjectives needs three adjectives in the worst case.
|
||||||
|
|
||||||
|
mkAdjComp : (_,_,_ : Adjective) -> AdjComp = \gut,besser,best ->
|
||||||
|
{s = table {Pos => gut.s ; Comp => besser.s ; Sup => best.s}} ;
|
||||||
|
|
||||||
|
-- It can be done by just three strings, if each of the comparison
|
||||||
|
-- forms taken separately is a regular adjective.
|
||||||
|
|
||||||
|
adjCompReg3 : (_,_,_ : Str) -> AdjComp = \gut,besser,best ->
|
||||||
|
mkAdjComp (adjReg gut) (adjReg besser) (adjReg best) ;
|
||||||
|
|
||||||
|
-- If also the comparison forms are regular, one string is enough.
|
||||||
|
|
||||||
|
adjCompReg : Str -> AdjComp = \billig ->
|
||||||
|
adjCompReg3 billig (billig+"er") (billig+"st") ;
|
||||||
|
|
||||||
|
|
||||||
|
--2 Verbs
|
||||||
|
--
|
||||||
|
-- We limit ourselves to verbs in present tense infinitive, indicative,
|
||||||
|
-- and imperative, and past participle. Other forms will be introduced later.
|
||||||
|
--
|
||||||
|
-- The worst-case macro needs three forms: the infinitive, the third person
|
||||||
|
-- singular indicative, and the second person singular imperative.
|
||||||
|
-- We take care of the special cases "ten", "sen", "ln", "rn".
|
||||||
|
--
|
||||||
|
-- A famous law about Germanic languages says that plural first and third person
|
||||||
|
-- are similar.
|
||||||
|
|
||||||
|
mkVerbum : (_,_,_,_ : Str) -> Verbum = \geben, gib, gb, gegeben ->
|
||||||
|
let {
|
||||||
|
en = Predef.dp 2 geben ;
|
||||||
|
geb = ifTok Tok (Predef.tk 1 en) "e" (Predef.tk 2 geben)(Predef.tk 1 geben) ;
|
||||||
|
gebt = ifTok Tok (Predef.dp 1 geb) "t" (geb + "et") (geb + "t") ;
|
||||||
|
gibst = ifTok Tok (Predef.dp 1 gib) "s" (gib + "t") (gib + "st") ;
|
||||||
|
gegebener = (adjReg gegeben).s
|
||||||
|
} in table {
|
||||||
|
VInf => geben ;
|
||||||
|
VInd Sg P1 => geb + "e" ;
|
||||||
|
VInd Sg P2 => gibst ;
|
||||||
|
VInd Sg P3 => gib + "t" ;
|
||||||
|
VInd Pl P2 => gebt ;
|
||||||
|
VInd Pl _ => geben ; -- the famous law
|
||||||
|
VImp Sg => gb ;
|
||||||
|
VImp Pl => gebt ;
|
||||||
|
VPart a => gegebener ! a
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- Regular verbs:
|
||||||
|
|
||||||
|
regVerb : Str -> Verbum = \legen ->
|
||||||
|
let {lege = ifTok Tok (Predef.dp 3 legen) "ten" (Predef.tk 1 legen) (
|
||||||
|
ifTok Tok (Predef.dp 2 legen) "en" (Predef.tk 2 legen) (
|
||||||
|
Predef.tk 1 legen))} in
|
||||||
|
mkVerbum legen lege lege ("ge" + (lege + "t")) ;
|
||||||
|
|
||||||
|
-- Verbs ending with "t"; now recognized in $mkVerbum$.
|
||||||
|
|
||||||
|
verbWarten : Str -> Verbum = regVerb ;
|
||||||
|
|
||||||
|
-- Verbs with Umlaut in the second and third person singular and imperative:
|
||||||
|
|
||||||
|
verbSehen : Str -> Str -> Str -> Verbum = \sehen, sieht, gesehen ->
|
||||||
|
let {sieh = Predef.tk 1 sieht} in mkVerbum sehen sieh sieh gesehen ;
|
||||||
|
|
||||||
|
-- Verbs with Umlaut in the second and third person singular but not imperative:
|
||||||
|
|
||||||
|
verbLaufen : Str -> Str -> Str -> Verbum = \laufen, läuft, gelaufen ->
|
||||||
|
let {läuf = Predef.tk 1 läuft ; laufe = Predef.tk 1 laufen}
|
||||||
|
in mkVerbum laufen läuf laufe gelaufen ;
|
||||||
|
|
||||||
|
-- The verb "be":
|
||||||
|
|
||||||
|
verbumSein : Verbum = let {
|
||||||
|
gewesen = (adjReg "gewesen").s
|
||||||
|
} in
|
||||||
|
table {
|
||||||
|
VInf => "sein" ;
|
||||||
|
VInd Sg P1 => "bin" ;
|
||||||
|
VInd Sg P2 => "bist" ;
|
||||||
|
VInd Sg P3 => "ist" ;
|
||||||
|
VInd Pl P2 => "seid" ;
|
||||||
|
VInd Pl _ => "sind" ;
|
||||||
|
VImp Sg => "sei" ;
|
||||||
|
VImp Pl => "seiet" ;
|
||||||
|
VPart a => gewesen ! a
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- The verb "have":
|
||||||
|
|
||||||
|
verbumHaben : Verbum = let {
|
||||||
|
haben = (regVerb "haben")
|
||||||
|
} in
|
||||||
|
table {
|
||||||
|
VInd Sg P2 => "hast" ;
|
||||||
|
VInd Sg P3 => "hat" ;
|
||||||
|
v => haben ! v
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- The verb "become", used as the passive auxiliary:
|
||||||
|
|
||||||
|
verbumWerden : Verbum = let {
|
||||||
|
werden = regVerb "werden" ;
|
||||||
|
geworden = (adjReg "geworden").s
|
||||||
|
} in
|
||||||
|
table {
|
||||||
|
VInd Sg P2 => "wirst" ;
|
||||||
|
VInd Sg P3 => "wird" ;
|
||||||
|
VPart a => geworden ! a ;
|
||||||
|
v => werden ! v
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- A *full verb* ($Verb$) consists of the inflection forms ($Verbum$) and
|
||||||
|
-- a *particle* (e.g. "aus-sehen"). Simple verbs are the ones that have no
|
||||||
|
-- such particle.
|
||||||
|
|
||||||
|
mkVerb : Verbum -> Particle -> Verb = \v,p -> {s = v ; s2 = p} ;
|
||||||
|
|
||||||
|
mkVerbSimple : Verbum -> Verb = \v -> mkVerb v [] ;
|
||||||
|
|
||||||
|
verbSein = mkVerbSimple verbumSein ;
|
||||||
|
verbHaben = mkVerbSimple verbumHaben ;
|
||||||
|
verbWerden = mkVerbSimple verbumWerden ;
|
||||||
|
verbGeben = mkVerbSimple (verbSehen "geben" "gibt" "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 => "seiet" ;
|
||||||
|
VPart a => (adjReg "gewesen").s ! a
|
||||||
|
} ;
|
||||||
|
|
||||||
|
verbumHaben2 : Verbum =
|
||||||
|
table {
|
||||||
|
VInd Sg P2 => "hast" ;
|
||||||
|
VInd Sg P3 => "hat" ;
|
||||||
|
v => regVerb "haben" ! v
|
||||||
|
} ;
|
||||||
|
-}
|
||||||
|
|
||||||
|
} ;
|
||||||
310
lib/resource-0.6/german/ParadigmsGer.gf
Normal file
310
lib/resource-0.6/german/ParadigmsGer.gf
Normal file
@@ -0,0 +1,310 @@
|
|||||||
|
--# -path=.:../abstract:../../prelude
|
||||||
|
|
||||||
|
--1 German Lexical Paradigms
|
||||||
|
--
|
||||||
|
-- Aarne Ranta 2003
|
||||||
|
--
|
||||||
|
-- This is an API to the user of the resource grammar
|
||||||
|
-- for adding lexical items. It give shortcuts for forming
|
||||||
|
-- expressions of basic categories: nouns, adjectives, verbs.
|
||||||
|
--
|
||||||
|
-- Closed categories (determiners, pronouns, conjunctions) are
|
||||||
|
-- accessed through the resource syntax API, $resource.Abs.gf$.
|
||||||
|
--
|
||||||
|
-- The main difference with $morpho.Deu.gf$ is that the types
|
||||||
|
-- referred to are compiled resource grammar types. We have moreover
|
||||||
|
-- had the design principle of always having existing forms as string
|
||||||
|
-- arguments of the paradigms, not stems.
|
||||||
|
--
|
||||||
|
-- The following modules are presupposed:
|
||||||
|
|
||||||
|
resource Paradigms = open (Predef=Predef), Prelude, (Morpho=Morpho), Syntax, Deutsch in {
|
||||||
|
|
||||||
|
|
||||||
|
--2 Parameters
|
||||||
|
--
|
||||||
|
-- To abstract over gender names, we define the following identifiers.
|
||||||
|
|
||||||
|
oper
|
||||||
|
masculine : Gender ;
|
||||||
|
feminine : Gender ;
|
||||||
|
neuter : Gender ;
|
||||||
|
|
||||||
|
-- To abstract over case names, we define the following.
|
||||||
|
|
||||||
|
nominative : Case ;
|
||||||
|
accusative : Case ;
|
||||||
|
dative : Case ;
|
||||||
|
genitive : Case ;
|
||||||
|
|
||||||
|
-- To abstract over number names, we define the following.
|
||||||
|
|
||||||
|
singular : Number ;
|
||||||
|
plural : Number ;
|
||||||
|
|
||||||
|
|
||||||
|
--2 Nouns
|
||||||
|
|
||||||
|
-- Worst case: give all four singular forms, two plural forms (others + dative),
|
||||||
|
-- and the gender.
|
||||||
|
|
||||||
|
mkN : (_,_,_,_,_,_ : Str) -> Gender -> N ;
|
||||||
|
-- mann, mann, manne, mannes, männer, männern
|
||||||
|
|
||||||
|
-- Often it is enough with singular and plural nominatives, and singular
|
||||||
|
-- genitive. The plural dative
|
||||||
|
-- is computed by the heuristic that it is the same as the nominative this
|
||||||
|
-- ends with "n" or "s", otherwise "n" is added.
|
||||||
|
|
||||||
|
nGen : Str -> Str -> Str -> Gender -> N ; -- punkt,punktes,punkt
|
||||||
|
|
||||||
|
-- Here are some common patterns. Singular nominative or two nominatives are needed.
|
||||||
|
-- Two forms are needed in case of Umlaut, which would be complicated to define.
|
||||||
|
-- For the same reason, we have separate patterns for multisyllable stems.
|
||||||
|
--
|
||||||
|
-- The weak masculine pattern $nSoldat$ avoids duplicating the final "e".
|
||||||
|
|
||||||
|
nRaum : (_,_ : Str) -> N ; -- Raum, (Raumes,) Räume (masc)
|
||||||
|
nTisch : Str -> N ; -- Tisch, (Tisches, Tische) (masc)
|
||||||
|
nVater : (_,_ : Str) -> N ; -- Vater, (Vaters,) Väter (masc)
|
||||||
|
nFehler : Str -> N ; -- Fehler, (fehlers, Fehler) (masc)
|
||||||
|
nSoldat : Str -> N ; -- Soldat (, Soldaten) ; Kunde (, Kunden) (masc)
|
||||||
|
|
||||||
|
-- Neuter patterns.
|
||||||
|
|
||||||
|
nBuch : (_,_ : Str) -> N ; -- Buch, (Buches, Bücher) (neut)
|
||||||
|
nMesser : Str -> N ; -- Messer, (Messers, Messer) (neut)
|
||||||
|
nAuto : Str -> N ; -- Auto, (Autos, Autos) (neut)
|
||||||
|
|
||||||
|
-- Feminine patterns. Duplicated "e" is avoided in $nFrau$.
|
||||||
|
|
||||||
|
nHand : (_,_ : Str) -> N ; -- Hand, Hände; Mutter, Mütter (fem)
|
||||||
|
nFrau : Str -> N ; -- Frau (, Frauen) ; Wiese (, Wiesen) (fem)
|
||||||
|
|
||||||
|
|
||||||
|
-- Nouns used as functions need a preposition. The most common is "von".
|
||||||
|
|
||||||
|
mkFun : N -> Preposition -> Case -> Fun ;
|
||||||
|
funVon : N -> Fun ;
|
||||||
|
|
||||||
|
-- Proper names, with their possibly
|
||||||
|
-- irregular genitive. The regular genitive is "s", omitted after "s".
|
||||||
|
|
||||||
|
mkPN : (karolus, karoli : Str) -> PN ; -- karolus, karoli
|
||||||
|
pnReg : (Johann : Str) -> PN ; -- Johann, Johanns ; Johannes, Johannes
|
||||||
|
|
||||||
|
-- On the top level, it is maybe $CN$ that is used rather than $N$, and
|
||||||
|
-- $NP$ rather than $PN$.
|
||||||
|
|
||||||
|
mkCN : N -> CN ;
|
||||||
|
mkNP : (karolus,karoli : Str) -> NP ;
|
||||||
|
|
||||||
|
npReg : Str -> NP ; -- Johann, Johanns
|
||||||
|
|
||||||
|
-- In some cases, you may want to make a complex $CN$ into a function.
|
||||||
|
|
||||||
|
mkFunCN : CN -> Preposition -> Case -> Fun ;
|
||||||
|
funVonCN : CN -> Fun ;
|
||||||
|
|
||||||
|
|
||||||
|
--2 Adjectives
|
||||||
|
|
||||||
|
-- Non-comparison one-place adjectives need two forms in the worst case:
|
||||||
|
-- the one in predication and the one before the ending "e".
|
||||||
|
|
||||||
|
mkAdj1 : (teuer,teur : Str) -> Adj1 ;
|
||||||
|
|
||||||
|
-- Invariable adjective are a special case.
|
||||||
|
|
||||||
|
adjInvar : Str -> Adj1 ; -- prima
|
||||||
|
|
||||||
|
-- The following heuristic recognizes the the end of the word, and builds
|
||||||
|
-- the second form depending on if it is "e", "er", or something else.
|
||||||
|
-- N.B. a contraction is made with "er", which works for "teuer" but not
|
||||||
|
-- for "bitter".
|
||||||
|
|
||||||
|
adjGen : Str -> Adj1 ; -- gut; teuer; böse
|
||||||
|
|
||||||
|
-- Two-place adjectives need a preposition and a case as extra arguments.
|
||||||
|
|
||||||
|
mkAdj2 : Adj1 -> Str -> Case -> Adj2 ; -- teilbar, durch, acc
|
||||||
|
|
||||||
|
-- Comparison adjectives may need three adjective, corresponding to the
|
||||||
|
-- three comparison forms.
|
||||||
|
|
||||||
|
mkAdjDeg : (gut,besser,best : Adj1) -> AdjDeg ;
|
||||||
|
|
||||||
|
-- In many cases, each of these adjectives is itself regular. Then we only
|
||||||
|
-- need three strings. Notice that contraction with "er" is not performed
|
||||||
|
-- ("bessere", not "bessre").
|
||||||
|
|
||||||
|
aDeg3 : (gut,besser,best : Str) -> AdjDeg ;
|
||||||
|
|
||||||
|
-- In the completely regular case, the comparison forms are constructed by
|
||||||
|
-- the endings "er" and "st".
|
||||||
|
|
||||||
|
aReg : Str -> AdjDeg ; -- billig, billiger, billigst
|
||||||
|
|
||||||
|
-- The past participle of a verb can be used as an adjective.
|
||||||
|
|
||||||
|
aPastPart : V -> Adj1 ; -- gefangen
|
||||||
|
|
||||||
|
-- On top level, there are adjectival phrases. The most common case is
|
||||||
|
-- just to use a one-place adjective. The variation in $adjGen$ is taken
|
||||||
|
-- into account.
|
||||||
|
|
||||||
|
apReg : Str -> AP ;
|
||||||
|
|
||||||
|
|
||||||
|
--2 Verbs
|
||||||
|
--
|
||||||
|
-- The fragment only has present tense so far, but in all persons.
|
||||||
|
-- It also has the infinitive and the past participles.
|
||||||
|
-- The worst case macro needs four forms: : the infinitive and
|
||||||
|
-- the third person singular (where Umlaut may occur), the singular imperative,
|
||||||
|
-- and the past participle.
|
||||||
|
--
|
||||||
|
-- The function recognizes if the stem ends with "s" or "t" and performs the
|
||||||
|
-- appropriate contractions.
|
||||||
|
|
||||||
|
mkV : (_,_,_,_ : Str) -> V ; -- geben, gibt, gib, gegeben
|
||||||
|
|
||||||
|
-- Regular verbs are those where no Umlaut occurs.
|
||||||
|
|
||||||
|
vReg : Str -> V ; -- kommen
|
||||||
|
|
||||||
|
-- The verbs 'be' and 'have' are special.
|
||||||
|
|
||||||
|
vSein : V ;
|
||||||
|
vHaben : V ;
|
||||||
|
|
||||||
|
-- Verbs with a detachable particle, with regular ones as a special case.
|
||||||
|
|
||||||
|
vPart : (_,_,_,_,_ : Str) -> V ; -- sehen, sieht, sieh, gesehen, aus
|
||||||
|
vPartReg : (_,_ : Str) -> V ; -- bringen, um
|
||||||
|
|
||||||
|
-- Two-place verbs, and the special case with direct object. Notice that
|
||||||
|
-- a particle can be included in a $V$.
|
||||||
|
|
||||||
|
mkTV : V -> Str -> Case -> TV ; -- hören, zu, dative
|
||||||
|
|
||||||
|
tvReg : Str -> Str -> Case -> TV ; -- hören, zu, dative
|
||||||
|
tvDir : V -> TV ; -- umbringen
|
||||||
|
tvDirReg : Str -> TV ; -- lieben
|
||||||
|
|
||||||
|
-- Three-place verbs require two prepositions and cases.
|
||||||
|
|
||||||
|
mkV3 : V -> Str -> Case -> Str -> Case -> V3 ; -- geben,[],dative,[],accusative
|
||||||
|
|
||||||
|
|
||||||
|
--2 Adverbials
|
||||||
|
--
|
||||||
|
-- Adverbials for modifying verbs, adjectives, and sentences can be formed
|
||||||
|
-- from strings.
|
||||||
|
|
||||||
|
mkAdV : Str -> AdV ;
|
||||||
|
mkAdA : Str -> AdA ;
|
||||||
|
mkAdS : Str -> AdS ;
|
||||||
|
|
||||||
|
-- Prepositional phrases are another productive form of adverbials.
|
||||||
|
|
||||||
|
mkPP : Case -> Str -> NP -> AdV ;
|
||||||
|
|
||||||
|
-- The definitions should not bother the user of the API. So they are
|
||||||
|
-- hidden from the document.
|
||||||
|
--.
|
||||||
|
|
||||||
|
|
||||||
|
masculine = Masc ;
|
||||||
|
feminine = Fem ;
|
||||||
|
neuter = Neut ;
|
||||||
|
nominative = Nom ;
|
||||||
|
accusative = Acc ;
|
||||||
|
dative = Dat ;
|
||||||
|
genitive = Gen ;
|
||||||
|
-- singular defined in Types
|
||||||
|
-- plural defined in Types
|
||||||
|
|
||||||
|
mkN a b c d e f g = mkNoun a b c d e f g ** {lock_N = <>} ;
|
||||||
|
|
||||||
|
nGen = \punkt, punktes, punkte, g -> let {
|
||||||
|
e = Predef.dp 1 punkte ;
|
||||||
|
eqy = ifTok N e ;
|
||||||
|
noN = mkNoun4 punkt punktes punkte punkte g ** {lock_N = <>}
|
||||||
|
} in
|
||||||
|
eqy "n" noN (
|
||||||
|
eqy "s" noN (
|
||||||
|
mkNoun4 punkt punktes punkte (punkte+"n") g ** {lock_N = <>})) ;
|
||||||
|
|
||||||
|
nRaum = \raum, räume -> nGen raum (raum + "es") räume masculine ;
|
||||||
|
nTisch = \tisch ->
|
||||||
|
mkNoun4 tisch (tisch + "es") (tisch + "e") (tisch +"en") masculine **
|
||||||
|
{lock_N = <>};
|
||||||
|
nVater = \vater, väter -> nGen vater (vater + "s") väter masculine ;
|
||||||
|
nFehler = \fehler -> nVater fehler fehler ;
|
||||||
|
|
||||||
|
nSoldat = \soldat -> let {
|
||||||
|
e = Predef.dp 1 soldat ;
|
||||||
|
soldaten = ifTok Tok e "e" (soldat + "n") (soldat + "en")
|
||||||
|
} in
|
||||||
|
mkN soldat soldaten soldaten soldaten soldaten soldaten masculine ;
|
||||||
|
|
||||||
|
nBuch = \buch, bücher -> nGen buch (buch + "es") bücher neuter ;
|
||||||
|
nMesser = \messer -> nGen messer (messer + "s") messer neuter ;
|
||||||
|
nAuto = \auto -> let {autos = auto + "s"} in
|
||||||
|
mkNoun4 auto autos autos autos neuter ** {lock_N = <>} ;
|
||||||
|
|
||||||
|
nHand = \hand, hände -> nGen hand hand hände feminine ;
|
||||||
|
|
||||||
|
nFrau = \frau -> let {
|
||||||
|
e = Predef.dp 1 frau ;
|
||||||
|
frauen = ifTok Tok e "e" (frau + "n") (frau + "en")
|
||||||
|
} in
|
||||||
|
mkN frau frau frau frau frauen frauen feminine ;
|
||||||
|
|
||||||
|
mkFun n = mkFunCN (UseN n) ;
|
||||||
|
funVon n = funVonCN (UseN n) ;
|
||||||
|
|
||||||
|
mkPN = \karolus, karoli ->
|
||||||
|
{s = table {Gen => karoli ; _ => karolus} ; lock_PN = <>} ;
|
||||||
|
pnReg = \horst ->
|
||||||
|
mkPN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) ;
|
||||||
|
|
||||||
|
mkCN = UseN ;
|
||||||
|
mkNP = \x,y -> UsePN (mkPN x y) ;
|
||||||
|
npReg = \s -> UsePN (pnReg s) ;
|
||||||
|
|
||||||
|
mkFunCN n p c = mkFunC n p c ** {lock_Fun = <>} ;
|
||||||
|
funVonCN n = funVonC n ** {lock_Fun = <>} ;
|
||||||
|
|
||||||
|
mkAdj1 x y = mkAdjective x y ** {lock_Adj1 = <>} ;
|
||||||
|
adjInvar a = Morpho.adjInvar a ** {lock_Adj1 = <>} ;
|
||||||
|
adjGen a = Morpho.adjGen a ** {lock_Adj1 = <>} ;
|
||||||
|
mkAdj2 = \a,p,c -> a ** {s2 = p ; c = c ; lock_Adj2 = <>} ;
|
||||||
|
|
||||||
|
mkAdjDeg a b c = mkAdjComp a b c ** {lock_AdjDeg = <>} ;
|
||||||
|
aDeg3 a b c = adjCompReg3 a b c ** {lock_AdjDeg = <>} ;
|
||||||
|
aReg a = adjCompReg a ** {lock_AdjDeg = <>} ;
|
||||||
|
aPastPart = \v -> {s = table AForm {a => v.s ! VPart a} ; lock_Adj1 = <>} ;
|
||||||
|
apReg = \s -> AdjP1 (adjGen s) ;
|
||||||
|
|
||||||
|
mkV = \sehen, sieht, sieh, gesehen ->
|
||||||
|
mkVerbSimple (mkVerbum sehen (Predef.tk 1 sieht) sieh gesehen) ** {lock_V = <>} ;
|
||||||
|
vReg = \s -> mkVerbSimple (regVerb s) ** {lock_V = <>} ;
|
||||||
|
vSein = verbSein ** {lock_V = <>} ;
|
||||||
|
vHaben = verbHaben ** {lock_V = <>} ;
|
||||||
|
vPart = \sehen, sieht, sieh, gesehen, aus ->
|
||||||
|
mkVerb (mkVerbum sehen sieht sieh gesehen) aus ** {lock_V = <>} ;
|
||||||
|
vPartReg = \sehen, aus -> mkVerb (regVerb sehen) aus ** {lock_V = <>} ;
|
||||||
|
|
||||||
|
mkTV v p c = mkTransVerb v p c ** {lock_TV = <>} ;
|
||||||
|
tvReg = \hören, zu, dat -> mkTV (vReg hören) zu dat ;
|
||||||
|
tvDir = \v -> mkTV v [] accusative ;
|
||||||
|
tvDirReg = \v -> tvReg v [] accusative ;
|
||||||
|
mkV3 v s c t d = mkDitransVerb v s c t d ** {lock_V3 = <>} ;
|
||||||
|
|
||||||
|
mkAdV a = ss a ** {lock_AdV = <>} ;
|
||||||
|
mkPP x y z = prepPhrase x y z ** {lock_AdV = <>};
|
||||||
|
mkAdA a = ss a ** {lock_AdA = <>} ;
|
||||||
|
mkAdS a = ss a ** {lock_AdS = <>} ;
|
||||||
|
} ;
|
||||||
105
lib/resource-0.6/german/StructuralGer.gf
Normal file
105
lib/resource-0.6/german/StructuralGer.gf
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
--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 ;
|
||||||
|
WeNP n = pronNounPhrase (pronWithNum pronWir n) ;
|
||||||
|
YeNP 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} ; ---
|
||||||
|
|
||||||
|
EveryDet = jederDet ;
|
||||||
|
AllDet = allesDet ;
|
||||||
|
AllsDet = alleDet ;
|
||||||
|
WhichDet = welcherDet ;
|
||||||
|
WhichsDet = welcheDet ;
|
||||||
|
MostDet = meistDet ;
|
||||||
|
|
||||||
|
HowIAdv = ss "wie" ;
|
||||||
|
WhenIAdv = ss "wann" ;
|
||||||
|
WhereIAdv = ss "war" ;
|
||||||
|
WhyIAdv = ss "warum" ;
|
||||||
|
|
||||||
|
AndConj = ss "und" ** {n = Pl} ;
|
||||||
|
OrConj = ss "oder" ** {n = Sg} ;
|
||||||
|
BothAnd = sd2 "sowohl" ["als auch"] ** {n = Pl} ;
|
||||||
|
EitherOr = sd2 "entweder" "oder" ** {n = Sg} ;
|
||||||
|
NeitherNor = sd2 "weder" "noch" ** {n = Sg} ;
|
||||||
|
IfSubj = ss "wenn" ;
|
||||||
|
WhenSubj = ss "wenn" ;
|
||||||
|
|
||||||
|
PhrYes = ss ["Ja ."] ;
|
||||||
|
PhrNo = ss ["Nein ."] ;
|
||||||
|
|
||||||
|
VeryAdv = ss "sehr" ;
|
||||||
|
TooAdv = ss "zu" ;
|
||||||
|
OtherwiseAdv = ss "sonst" ;
|
||||||
|
ThereforeAdv = ss "deshalb" ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CanVV =
|
||||||
|
mkVerbSimple (verbSehen "können" "kann" "gekonnt") ** {isAux = True} ; ---
|
||||||
|
CanKnowVV =
|
||||||
|
mkVerbSimple (verbSehen "können" "kann" "gekonnt") ** {isAux = True} ; ---
|
||||||
|
MustVV =
|
||||||
|
mkVerbSimple (verbSehen "müssen" "muss" "gemusst") ** {isAux = True} ; ---
|
||||||
|
WantVV =
|
||||||
|
mkVerbSimple (verbSehen "wollen" "will" "gewollt") ** {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 ;
|
||||||
|
AgentPrep = mkPrep "durch" Acc ;
|
||||||
|
|
||||||
|
} ;
|
||||||
1033
lib/resource-0.6/german/SyntaxGer.gf
Normal file
1033
lib/resource-0.6/german/SyntaxGer.gf
Normal file
File diff suppressed because it is too large
Load Diff
54
lib/resource-0.6/german/TestResourceGer.gf
Normal file
54
lib/resource-0.6/german/TestResourceGer.gf
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
-- 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 ; parser=chart ; 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 (verbLaufen "gehen" "geht" "gegangen") ;
|
||||||
|
Run = mkVerbSimple (verbLaufen "laufen" "läuft" "gelaufen") ;
|
||||||
|
Say = mkVerbSimple (regVerb "sagen") ;
|
||||||
|
Prove = mkVerbSimple (regVerb "beweisen") ;
|
||||||
|
Send = mkTransVerb (mkVerbSimple (verbLaufen "senden" "sendet" "gesandt")) [] Acc;
|
||||||
|
Drink = transDir (mkVerbSimple (verbLaufen "trinken" "trinkt" "getrunken")) ;
|
||||||
|
Love = mkTransVerb (mkVerbSimple (regVerb "lieben")) [] Acc ;
|
||||||
|
Wait = mkTransVerb (mkVerbSimple (verbWarten "warten")) "auf" Acc ;
|
||||||
|
Give = mkDitransVerb
|
||||||
|
(mkVerbSimple (verbLaufen "geben" "gibt" "gegeben")) [] Dat [] Acc ;
|
||||||
|
Prefer = mkDitransVerb
|
||||||
|
(mkVerb (verbLaufen "ziehen" "zieht" "gezogen") "vor") [] Acc "vor" Dat ;
|
||||||
|
Mother = mkFunC (n2n (declN2uF "Mutter" "Mütter")) "von" Dat ;
|
||||||
|
Uncle = mkFunC (n2n (declN2i "Onkel")) "von" Dat ;
|
||||||
|
Connection = mkFunC (n2n (declN1 "Verbindung")) "von" Dat **
|
||||||
|
{s3 = "nach" ; c2 = Dat} ;
|
||||||
|
|
||||||
|
Always = mkAdverb "immer" ;
|
||||||
|
Well = mkAdverb "gut" ;
|
||||||
|
|
||||||
|
SwitchOn = mkTransVerb (mkVerb (verbWarten "schalten") "auf") [] Acc ;
|
||||||
|
SwitchOff = mkTransVerb (mkVerb (verbWarten "schalten") "aus") [] Acc ;
|
||||||
|
|
||||||
|
John = mkProperName "Johann" ;
|
||||||
|
Mary = mkProperName "Maria" ;
|
||||||
|
|
||||||
|
} ;
|
||||||
|
|
||||||
98
lib/resource-0.6/german/TypesGer.gf
Normal file
98
lib/resource-0.6/german/TypesGer.gf
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
--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 | 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 ;
|
||||||
|
|
||||||
|
} ;
|
||||||
@@ -19,6 +19,7 @@ import Operations
|
|||||||
import Zipper
|
import Zipper
|
||||||
|
|
||||||
import Monad
|
import Monad
|
||||||
|
import List (intersperse)
|
||||||
|
|
||||||
-- Linearization for canonical GF. AR 7/6/2003
|
-- Linearization for canonical GF. AR 7/6/2003
|
||||||
|
|
||||||
@@ -143,7 +144,7 @@ allLinsOfTree gr a e = err (singleton . str) id $ do
|
|||||||
|
|
||||||
-- the value is a list of structures arranged as records of tables of terms
|
-- the value is a list of structures arranged as records of tables of terms
|
||||||
allLinsAsRec :: CanonGrammar -> Ident -> A.Tree -> Err [[(Label,[([Patt],Term)])]]
|
allLinsAsRec :: CanonGrammar -> Ident -> A.Tree -> Err [[(Label,[([Patt],Term)])]]
|
||||||
allLinsAsRec gr c t = linearizeNoMark gr c t >>= allLinValues
|
allLinsAsRec gr c t = linearizeNoMark gr c t >>= expandLinTables gr >>= allLinValues
|
||||||
|
|
||||||
-- the value is a list of structures arranged as records of tables of strings
|
-- the value is a list of structures arranged as records of tables of strings
|
||||||
-- only taking into account string fields
|
-- only taking into account string fields
|
||||||
@@ -153,7 +154,8 @@ allLinTables gr c t = do
|
|||||||
mapM (mapM getS) r'
|
mapM (mapM getS) r'
|
||||||
where
|
where
|
||||||
getS (lab,pss) = liftM (curry id lab) $ mapM gets pss
|
getS (lab,pss) = liftM (curry id lab) $ mapM gets pss
|
||||||
gets (ps,t) = liftM (curry id ps . concat . map str2strings) $ strsFromTerm t
|
gets (ps,t) = liftM (curry id ps . cc . map str2strings) $ strsFromTerm t
|
||||||
|
cc = concat . intersperse ["/"]
|
||||||
|
|
||||||
prLinTable :: [[(Label,[([Patt],[String])])]] -> [String]
|
prLinTable :: [[(Label,[([Patt],[String])])]] -> [String]
|
||||||
prLinTable = concatMap prOne . concat where
|
prLinTable = concatMap prOne . concat where
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
module Today where today = "Fri Dec 19 18:43:03 CET 2003"
|
module Today where today = "Mon Jan 5 11:31:04 CET 2004"
|
||||||
|
|||||||
Reference in New Issue
Block a user