forked from GitHub/gf-core
incomplete but valid additions to Finnish
This commit is contained in:
208
lib/resource/finnish/RulesFin.gf
Normal file
208
lib/resource/finnish/RulesFin.gf
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
--# -path=.:../abstract:../../prelude
|
||||||
|
|
||||||
|
--1 The Top-Level Finnish Resource Grammar: Combination Rules
|
||||||
|
--
|
||||||
|
-- Aarne Ranta 2002 -- 2003
|
||||||
|
--
|
||||||
|
-- This is the Finnish concrete syntax of the multilingual resource
|
||||||
|
-- grammar. Most of the work is done in the file $SyntaxFin.gf$.
|
||||||
|
-- However, for the purpose of documentation, we make here explicit the
|
||||||
|
-- linearization types of each category, so that their structures and
|
||||||
|
-- dependencies can be seen.
|
||||||
|
-- Another substantial part are the linearization rules of some
|
||||||
|
-- structural words.
|
||||||
|
--
|
||||||
|
-- The users of the resource grammar should not look at this file for the
|
||||||
|
-- linearization rules, which are in fact hidden in the document version.
|
||||||
|
-- They should use $resource.Abs.gf$ to access the syntactic rules.
|
||||||
|
-- This file can be consulted in those, hopefully rare, occasions in which
|
||||||
|
-- one has to know how the syntactic categories are
|
||||||
|
-- implemented. The parameter types are defined in $TypesFin.gf$.
|
||||||
|
|
||||||
|
concrete RulesFin of Rules = CategoriesFin ** open Prelude, SyntaxFin in {
|
||||||
|
|
||||||
|
flags
|
||||||
|
optimize=all ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
UseN = noun2CommNounPhrase ;
|
||||||
|
UsePN = nameNounPhrase ;
|
||||||
|
|
||||||
|
SymbPN i = {s = \\_ => i.s} ; --- case endings often needed
|
||||||
|
SymbCN cn s =
|
||||||
|
{s = \\f,n,c => cn.s ! f ! n ! c ++ s.s ;
|
||||||
|
g = cn.g} ;
|
||||||
|
IntCN cn s =
|
||||||
|
{s = \\f,n,c => cn.s ! f ! n ! c ++ s.s ;
|
||||||
|
g = cn.g} ;
|
||||||
|
|
||||||
|
IndefOneNP = indefNounPhrase singular ;
|
||||||
|
IndefNumNP = nounPhraseNum False ;
|
||||||
|
DefOneNP = defNounPhrase singular ;
|
||||||
|
DefNumNP = nounPhraseNum True ;
|
||||||
|
|
||||||
|
DetNP = detNounPhrase ;
|
||||||
|
---- NDetNP = numDetNounPhrase ;
|
||||||
|
---- NDetNum = justNumDetNounPhrase ;
|
||||||
|
MassNP = partNounPhrase singular ;
|
||||||
|
|
||||||
|
AppN2 = appFunComm ;
|
||||||
|
AppN3 = appFun2 ;
|
||||||
|
UseN2 = funAsCommNounPhrase ;
|
||||||
|
|
||||||
|
ModAP = modCommNounPhrase ;
|
||||||
|
CNthatS = nounThatSentence ;
|
||||||
|
|
||||||
|
ModGenOne = npGenDet singular ;
|
||||||
|
ModGenNum = npGenDetNum ;
|
||||||
|
|
||||||
|
UseInt i = {s = \\_ => i.s ; isNum = True ; n = Pl} ; --- case endings; Sg for 1
|
||||||
|
NoNum = noNum ;
|
||||||
|
|
||||||
|
UseA = adj2adjPhrase ;
|
||||||
|
ComplA2 = complAdj ;
|
||||||
|
|
||||||
|
---- ComplAV v x = complVerbAdj v x ;
|
||||||
|
---- ComplObjA2V v x y = complVerbAdj2 True v x y ;
|
||||||
|
|
||||||
|
PositADeg = positAdjPhrase ;
|
||||||
|
ComparADeg = comparAdjPhrase ;
|
||||||
|
---- SuperlADeg = superlAdjPhrase ;
|
||||||
|
|
||||||
|
-- verbs and verb prases
|
||||||
|
|
||||||
|
---- PredAS = predAdjSent ;
|
||||||
|
---- PredV0 rain = predVerbClause (pronNounPhrase pronIt) rain (complVerb rain) ;
|
||||||
|
{-
|
||||||
|
-- Partial saturation.
|
||||||
|
|
||||||
|
UseV2 = transAsVerb ;
|
||||||
|
|
||||||
|
ComplA2S = predAdjSent2 ;
|
||||||
|
|
||||||
|
AdjPart = adjPastPart ;
|
||||||
|
|
||||||
|
UseV2V x = verb2aux x ** {isAux = False} ;
|
||||||
|
UseV2S x = x ;
|
||||||
|
UseV2Q x = x ;
|
||||||
|
UseA2S x = x ;
|
||||||
|
UseA2V x = x ;
|
||||||
|
|
||||||
|
UseCl tp cl = {s = tp.s ++ cl.s ! Dir ! tp.b ! VFinite tp.t tp.a} ;
|
||||||
|
UseQCl tp cl = {s = \\q => tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a ! q} ;
|
||||||
|
UseRCl tp cl = {s = \\a => tp.s ++ cl.s ! tp.b ! VFinite tp.t tp.a ! a} ;
|
||||||
|
|
||||||
|
PosTP t a = {s = t.s ++ a.s ; b = True ; t = t.t ; a = a.a} ;
|
||||||
|
NegTP t a = {s = t.s ++ a.s ; b = False ; t = t.t ; a = a.a} ;
|
||||||
|
|
||||||
|
TPresent = {s = [] ; t = Present} ;
|
||||||
|
TPast = {s = [] ; t = Past} ;
|
||||||
|
TFuture = {s = [] ; t = Future} ;
|
||||||
|
TConditional = {s = [] ; t = Conditional} ;
|
||||||
|
|
||||||
|
ASimul = {s = [] ; a = Simul} ;
|
||||||
|
AAnter = {s = [] ; a = Anter} ;
|
||||||
|
-}
|
||||||
|
-- Adverbs.
|
||||||
|
|
||||||
|
---- AdjAdv a = ss (a.s ! AAttr ! AAdv) ; --- also APred?
|
||||||
|
AdvPP p = p ;
|
||||||
|
PrepNP = prepPhrase ;
|
||||||
|
AdvCN = advCommNounPhrase ;
|
||||||
|
AdvAP = advAdjPhrase ;
|
||||||
|
AdvAdv = cc2 ;
|
||||||
|
---- AdvNP pn pp = {s = \\c => pn.s ! c ++ pp.s ; a = pn.a} ;
|
||||||
|
|
||||||
|
--3 Sentences and relative clauses
|
||||||
|
--
|
||||||
|
|
||||||
|
---- SlashV2 = slashTransVerbCl ;
|
||||||
|
---- SlashVV2 = slashVerbVerb ;
|
||||||
|
---- SlashAdv cl p = slashAdverb cl p.s ;
|
||||||
|
|
||||||
|
IdRP = identRelPron ;
|
||||||
|
FunRP = funRelPron ;
|
||||||
|
---- RelSlash = relSlash ;
|
||||||
|
---- ModRS = modRelClause ;
|
||||||
|
---- RelCl = relSuch ;
|
||||||
|
|
||||||
|
|
||||||
|
--!
|
||||||
|
--3 Questions and imperatives
|
||||||
|
--
|
||||||
|
|
||||||
|
---- IDetCN d n = nounPhraseInt (detNounPhrase d n) ;
|
||||||
|
FunIP = funIntPron ;
|
||||||
|
|
||||||
|
---- QuestCl = questClause ;
|
||||||
|
---- IntSlash = intSlash ;
|
||||||
|
---- QuestAdv = questAdverbial ;
|
||||||
|
|
||||||
|
---- PosImpVP = imperVerbPhrase True ;
|
||||||
|
---- NegImpVP = imperVerbPhrase False ;
|
||||||
|
|
||||||
|
IndicPhrase = indicUtt ;
|
||||||
|
QuestPhrase = interrogUtt ;
|
||||||
|
ImperOne = imperUtterance singular ;
|
||||||
|
ImperMany = imperUtterance plural ;
|
||||||
|
|
||||||
|
---- AdvCl = advClause ;
|
||||||
|
---- AdvVPI = advVerbPhrase ;
|
||||||
|
|
||||||
|
AdCPhr = advSentence ;
|
||||||
|
AdvPhr = advSentence ;
|
||||||
|
|
||||||
|
|
||||||
|
--!
|
||||||
|
--3 Coordination
|
||||||
|
--
|
||||||
|
|
||||||
|
TwoS = twoSentence ;
|
||||||
|
ConsS = consSentence ;
|
||||||
|
ConjS = conjunctSentence ;
|
||||||
|
ConjDS = conjunctDistrSentence ;
|
||||||
|
|
||||||
|
TwoAP = twoAdjPhrase ;
|
||||||
|
ConsAP = consAdjPhrase ;
|
||||||
|
ConjAP = conjunctAdjPhrase ;
|
||||||
|
ConjDAP = conjunctDistrAdjPhrase ;
|
||||||
|
|
||||||
|
TwoNP = twoNounPhrase ;
|
||||||
|
ConsNP = consNounPhrase ;
|
||||||
|
ConjNP = conjunctNounPhrase ;
|
||||||
|
ConjDNP = conjunctDistrNounPhrase ;
|
||||||
|
|
||||||
|
TwoAdv = twoSentence ;
|
||||||
|
ConsAdv = consSentence ;
|
||||||
|
ConjAdv = conjunctSentence ;
|
||||||
|
ConjDAdv = conjunctDistrSentence ;
|
||||||
|
|
||||||
|
SubjS = subjunctSentence ;
|
||||||
|
SubjImper = subjunctImperative ;
|
||||||
|
SubjQS = subjunctQuestion ;
|
||||||
|
AdvSubj if A = ss (if.s ++ A.s) ;
|
||||||
|
|
||||||
|
PhrNP = useNounPhrase ;
|
||||||
|
PhrOneCN = useCommonNounPhrase singular ;
|
||||||
|
PhrManyCN = useCommonNounPhrase plural ;
|
||||||
|
PhrIP ip = ip ;
|
||||||
|
PhrIAdv ia = ia ;
|
||||||
|
---- PhrVPI = verbUtterance ;
|
||||||
|
|
||||||
|
OnePhr p = p ;
|
||||||
|
ConsPhr = cc2 ;
|
||||||
|
{-
|
||||||
|
-----------------------
|
||||||
|
-- special constructions
|
||||||
|
|
||||||
|
OneNP = nameNounPhrase (nameReg "one" human) ;
|
||||||
|
|
||||||
|
ExistCN A = predBeGroup
|
||||||
|
(nameNounPhrase (nameReg "there" Neutr))
|
||||||
|
(complNounPhrase (indefNounPhrase singular A)) ;
|
||||||
|
ExistNumCN nu A =
|
||||||
|
predBeGroup
|
||||||
|
(nameNounPhrasePl (nameReg "there" Neutr))
|
||||||
|
(complNounPhrase (indefNounPhraseNum plural nu A)) ;
|
||||||
|
-}
|
||||||
|
} ;
|
||||||
107
lib/resource/finnish/StructuralFin.gf
Normal file
107
lib/resource/finnish/StructuralFin.gf
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
--# -path=.:../abstract:../../prelude
|
||||||
|
|
||||||
|
--1 The Top-Level Finnish Resource Grammar: Structural Words
|
||||||
|
--
|
||||||
|
-- Aarne Ranta 2002 -- 2005
|
||||||
|
--
|
||||||
|
concrete StructuralFin of Structural =
|
||||||
|
CategoriesFin, NumeralsFin ** open Prelude, SyntaxFin in {
|
||||||
|
flags optimize=all ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
|
||||||
|
UseNumeral i = {s = \\np => i.s ! NCase Sg (npForm2Case Sg np) ; n = i.n ; isNum = True} ;
|
||||||
|
|
||||||
|
above_Prep = prepPostpGen "yläpuolella" ;
|
||||||
|
after_Prep = prepPostpGen "jälkeen" ;
|
||||||
|
all8mass_Det = mkDeterminer singular (kaikkiPron Sg) ;
|
||||||
|
---- all_NDet = kaikkiDet ;
|
||||||
|
almost_Adv = ss "melkein" ;
|
||||||
|
although_Subj = ss "vaikka" ;
|
||||||
|
although_Subj = ss "vaikka" ;
|
||||||
|
and_Conj = ss "ja" ** {n = Pl} ;
|
||||||
|
before_Prep = prepPrep "ennen" Part ;
|
||||||
|
behind_Prep = prepPostpGen "takana" ;
|
||||||
|
between_Prep = prepPostpGen "välissä" ;
|
||||||
|
both_AndConjD = sd2 "sekä" "että" ** {n = Pl} ;
|
||||||
|
by8agent_Prep = prepPostpGen "toimesta" ;
|
||||||
|
by8means_Prep = prepPostpGen "avulla" ;
|
||||||
|
can8know_VV = nomVerbVerb (vOsata "osata") ;
|
||||||
|
can_VV = nomVerbVerb (vJuoda "voida" "voi") ;
|
||||||
|
during_Prep = prepPostpGen "aikana" ;
|
||||||
|
either8or_ConjD = sd2 "joko" "tai" ** {n = Sg} ;
|
||||||
|
everybody_NP = {
|
||||||
|
s = \\f => kaikkiPron Pl ! (npForm2Case Pl f) ; -- näin kaikki
|
||||||
|
n = Pl ;
|
||||||
|
p = NP3
|
||||||
|
} ;
|
||||||
|
every_Det = jokainenDet ;
|
||||||
|
everything_NP = {
|
||||||
|
s = \\f => kaikkiPron Sg ! (npForm2Case Sg f) ; -- näin kaiken
|
||||||
|
n = Sg ;
|
||||||
|
p = NP3
|
||||||
|
} ;
|
||||||
|
everywhere_Adv = ss "kaikkialla" ;
|
||||||
|
from_Prep = prepCase Elat ; --- ablat
|
||||||
|
he_NP = pronNounPhrase pronHan ;
|
||||||
|
how_IAdv = ss "kuinka" ;
|
||||||
|
if_Subj = ss "jos" ;
|
||||||
|
in8front_Prep = prepPostpGen "edessä" ;
|
||||||
|
i_NP = pronNounPhrase pronMina ;
|
||||||
|
in_Prep = prepCase Iness ;
|
||||||
|
it_NP = nameNounPhrase pronSe ;
|
||||||
|
many_Det = mkDeterminer singular moniPron ;
|
||||||
|
most8many_Det = useimmatDet ;
|
||||||
|
most_Det = mkDeterminer singular (caseTable singular (sSuurin "enintä")) ;
|
||||||
|
much_Det = mkDeterminer singular (caseTable singular (sNauris "runsasta")) ;
|
||||||
|
must_VV = vHukkua "täytyä" "täydy" ** {c = CCase Gen} ;
|
||||||
|
no_Phr = ss ("Ei" ++ stopPunct) ;
|
||||||
|
on_Prep = prepCase Adess ;
|
||||||
|
or_Conj = ss "tai" ** {n = Sg} ;
|
||||||
|
otherwise_Adv = ss "muuten" ;
|
||||||
|
part_Prep = prepCase Part ;
|
||||||
|
possess_Prep = prepCase Gen ;
|
||||||
|
quite_Adv = ss "aika" ;
|
||||||
|
she_NP = pronNounPhrase pronHan ;
|
||||||
|
somebody_NP = {
|
||||||
|
s = \\f => jokuPron ! Sg ! (npForm2Case Sg f) ;
|
||||||
|
n = Sg ;
|
||||||
|
p = NP3
|
||||||
|
} ;
|
||||||
|
some_Det = mkDeterminerGen Sg (jokinPron ! Sg) (jokuPron ! Sg) ;
|
||||||
|
---- some_NDet n = mkDeterminerGenNum n (jokinPron ! Pl) (jokuPron ! Pl) ;
|
||||||
|
something_NP = {
|
||||||
|
s = \\f => jokinPron ! Sg ! (npForm2Case Sg f) ; -- näin kaiken
|
||||||
|
n = Sg ;
|
||||||
|
p = NP3
|
||||||
|
} ;
|
||||||
|
somewhere_Adv = ss "jossain" ;
|
||||||
|
that_Det = mkDeterminer Sg (\\c => pronTuo.s ! PCase c) ;
|
||||||
|
that_NP = pronNounPhraseNP pronTuo ;
|
||||||
|
therefore_Adv = ss "siksi" ;
|
||||||
|
---- these_NDet n = mkDeterminerNum n (\\c => pronNama.s ! PCase c) ;
|
||||||
|
they_NP = pronNounPhrase pronHe ; --- ne
|
||||||
|
this_Det = mkDeterminer Sg (\\c => pronTama.s ! PCase c) ;
|
||||||
|
this_NP = pronNounPhraseNP pronTama ;
|
||||||
|
---- those_NDet n = mkDeterminerNum n (\\c => pronNuo.s ! PCase c) ;
|
||||||
|
thou_NP = pronNounPhrase pronSina ;
|
||||||
|
through_Prep = prepPostpGen "kautta" ;
|
||||||
|
too_Adv = ss "liian" ;
|
||||||
|
to_Prep = prepCase Illat ; --- allat
|
||||||
|
under_Prep = prepPostpGen "alla" ;
|
||||||
|
very_Adv = ss "hyvin" ;
|
||||||
|
want_VV = nomVerbVerb (vOsata "haluta") ;
|
||||||
|
---- we_NP = pronWithNum pronMe ;
|
||||||
|
when_IAdv = ss "koska" ;
|
||||||
|
when_Subj = ss "kun" ;
|
||||||
|
where_IAdv = ss "missä" ;
|
||||||
|
which8one_IDet = mikaDet ;
|
||||||
|
---- which8many_IDet n = mkDeterminerGenNum n (mikaInt ! Pl) (kukaInt ! Pl) ;
|
||||||
|
why_IAdv = ss "miksi" ;
|
||||||
|
without_Prep = prepPrep "ilman" Part ;
|
||||||
|
with_Prep = prepPostpGen "kanssa" ;
|
||||||
|
---- ye_NP = pronWithNum pronTe ;
|
||||||
|
yes_Phr = ss ("Kyllä" ++ stopPunct) ;
|
||||||
|
you_NP = pronNounPhrase pronTe ;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -130,7 +130,7 @@ oper
|
|||||||
partNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n, cn ->
|
partNounPhrase : Number -> CommNounPhrase -> NounPhrase = \n, cn ->
|
||||||
{s = \\f => cn.s ! False ! n ! (npForm2CasePart f) ; n = n ; p = NP3} ;
|
{s = \\f => cn.s ! False ! n ! (npForm2CasePart f) ; n = n ; p = NP3} ;
|
||||||
|
|
||||||
Numeral : Type = {s : NPForm => Str ; isNum : Bool} ;
|
Numeral : Type = {s : NPForm => Str ; isNum : Bool ; n : Number} ;
|
||||||
|
|
||||||
pronWithNum : Pronoun -> Numeral -> NounPhrase = \me,kaksi ->
|
pronWithNum : Pronoun -> Numeral -> NounPhrase = \me,kaksi ->
|
||||||
let meihin = pronNounPhraseNP me
|
let meihin = pronNounPhraseNP me
|
||||||
@@ -140,7 +140,7 @@ oper
|
|||||||
p = NPP me.p --- meidän kahden talo (*talomme)
|
p = NPP me.p --- meidän kahden talo (*talomme)
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
noNum : Numeral = {s = \\_ => [] ; isNum = False} ;
|
noNum : Numeral = {s = \\_ => [] ; isNum = False ; n = Pl} ;
|
||||||
|
|
||||||
|
|
||||||
--2 Determiners
|
--2 Determiners
|
||||||
|
|||||||
Reference in New Issue
Block a user