mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-24 03:52:50 -06:00
Starting Finnish for new API
This commit is contained in:
183
lib/resource-0.6/finnish/CombinationsFin.gf
Normal file
183
lib/resource-0.6/finnish/CombinationsFin.gf
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
--1 The Top-Level Finnish Resource Grammar
|
||||||
|
--
|
||||||
|
-- Aarne Ranta 2002 -- 2003
|
||||||
|
--
|
||||||
|
-- This is the Finnish concrete syntax of the multilingual resource
|
||||||
|
-- grammar. Most of the work is done in the file $syntax.Fin.gf$.
|
||||||
|
-- However, for the purpose of documentation, we make here explicit the
|
||||||
|
-- linearization types of each category, so that their structures and
|
||||||
|
-- dependencies can be seen.
|
||||||
|
-- Another substantial part are the linearization rules of some
|
||||||
|
-- structural words.
|
||||||
|
--
|
||||||
|
-- The users of the resource grammar should not look at this file for the
|
||||||
|
-- linearization rules, which are in fact hidden in the document version.
|
||||||
|
-- They should use $resource.Abs.gf$ to access the syntactic rules.
|
||||||
|
-- This file can be consulted in those, hopefully rare, occasions in which
|
||||||
|
-- one has to know how the syntactic categories are
|
||||||
|
-- implemented. The parameter types are defined in $TypesFin.gf$.
|
||||||
|
|
||||||
|
concrete CombinationsFin of Combinations = open Prelude, SyntaxFin in {
|
||||||
|
|
||||||
|
flags
|
||||||
|
startcat=Phr ;
|
||||||
|
lexer=unglue ;
|
||||||
|
unlexer=glue ;
|
||||||
|
|
||||||
|
lincat
|
||||||
|
N = CommNoun ;
|
||||||
|
-- = {s : NForm => Str ; g : Gender}
|
||||||
|
CN = CommNounPhrase ;
|
||||||
|
NP = {s : NPForm => Str ; n : Number ; p : NPPerson} ;
|
||||||
|
PN = {s : Case => Str} ;
|
||||||
|
Det = {s : Gender => Case => Str ; n : Number} ;
|
||||||
|
Fun = Function ;
|
||||||
|
-- = CommNounPhrase ** {c : NPForm} ;
|
||||||
|
Fun2 = Function ** {c2 : NPForm} ;
|
||||||
|
|
||||||
|
Adj1 = Adjective ;
|
||||||
|
-- = CommonNoun
|
||||||
|
Adj2 = Adjective ** {c : NPForm} ;
|
||||||
|
AdjDeg = {s : Degree => NForm => Str} ;
|
||||||
|
AP = {s : AdjPos => Number => Case => Str} ;
|
||||||
|
|
||||||
|
V = Verb ;
|
||||||
|
-- = {s : VForm => Str}
|
||||||
|
VP = Verb ** {s2 : VForm => Str ; c : ComplCase} ;
|
||||||
|
TV = TransVerb ;
|
||||||
|
-- = Verb ** {s3, s4 : Str ; c : ComplCase} ;
|
||||||
|
V3 = TransVerb ** {s5, s6 : Str ; c2 : ComplCase} ;
|
||||||
|
VS = Verb ;
|
||||||
|
|
||||||
|
AdV = {s : Str} ;
|
||||||
|
|
||||||
|
S = Sentence ;
|
||||||
|
-- = {s : Str} ;
|
||||||
|
Slash = Sentence ** {s2 : Str ; c : Case} ;
|
||||||
|
|
||||||
|
RP = {s : Number => Case => Str} ;
|
||||||
|
RC = {s : Number => Str} ;
|
||||||
|
|
||||||
|
IP = {s : NPForm => Str ; n : Number} ;
|
||||||
|
Qu = {s : Str} ;
|
||||||
|
Imp = {s : Number => Str} ;
|
||||||
|
Phr = {s : Str} ;
|
||||||
|
|
||||||
|
Conj = {s : Str ; n : Number} ;
|
||||||
|
ConjD = {s1 : Str ; s2 : Str ; n : Number} ;
|
||||||
|
|
||||||
|
ListS = {s1 : Str ; s2 : Str} ;
|
||||||
|
ListAP = {s1,s2 : AdjPos => Number => Case => Str} ;
|
||||||
|
ListNP = {s1,s2 : NPForm => Str ; n : Number ; p : NPPerson} ;
|
||||||
|
|
||||||
|
--.
|
||||||
|
|
||||||
|
lin
|
||||||
|
UseN = noun2CommNounPhrase ;
|
||||||
|
ModAdj = modCommNounPhrase ;
|
||||||
|
ModGenOne = npGenDet singular ;
|
||||||
|
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 = indefNounPhrase plural ;
|
||||||
|
DefOneNP = defNounPhrase singular ;
|
||||||
|
DefManyNP = defNounPhrase plural ;
|
||||||
|
|
||||||
|
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 ;
|
||||||
|
|
||||||
|
AdvVP = adVerbPhrase ;
|
||||||
|
LocNP = locativeNounPhrase ;
|
||||||
|
AdvCN = advCommNounPhrase ;
|
||||||
|
AdvAP = advAdjPhrase ;
|
||||||
|
|
||||||
|
PosSlashTV = slashTransVerb True ;
|
||||||
|
NegSlashTV = slashTransVerb False ;
|
||||||
|
OneVP = passPredVerbPhrase ;
|
||||||
|
|
||||||
|
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 ;
|
||||||
|
|
||||||
|
|
||||||
|
} ;
|
||||||
688
lib/resource-0.6/finnish/MorphoFin.gf
Normal file
688
lib/resource-0.6/finnish/MorphoFin.gf
Normal file
@@ -0,0 +1,688 @@
|
|||||||
|
--1 A Simple Finnish Resource Morphology
|
||||||
|
--
|
||||||
|
-- Aarne Ranta 2002
|
||||||
|
--
|
||||||
|
-- This resource morphology contains definitions needed in the resource
|
||||||
|
-- syntax. It moreover contains the most usual inflectional patterns.
|
||||||
|
--
|
||||||
|
-- We use the parameter types and word classes defined in $TypesFin.gf$.
|
||||||
|
|
||||||
|
resource MorphoFin = TypesFin ** open (Predef = Predef), Prelude in {
|
||||||
|
|
||||||
|
--2 Nouns
|
||||||
|
--
|
||||||
|
|
||||||
|
oper
|
||||||
|
|
||||||
|
-- worst-case macro
|
||||||
|
|
||||||
|
mkSubst : Str -> (_,_,_,_,_,_,_,_,_,_ : Str) -> CommonNoun =
|
||||||
|
\a,vesi,vede,vete,vetta,veteen,vetii,vesii,vesien,vesia,vesiin ->
|
||||||
|
{s = table {
|
||||||
|
NCase Sg Nom => vesi ;
|
||||||
|
NCase Sg Gen => vede + "n" ;
|
||||||
|
NCase Sg Part => vetta ;
|
||||||
|
NCase Sg Transl => vede + "ksi" ;
|
||||||
|
NCase Sg Ess => vete + ("n" + a) ;
|
||||||
|
NCase Sg Iness => vede + ("ss" + a) ;
|
||||||
|
NCase Sg Elat => vede + ("st" + a) ;
|
||||||
|
NCase Sg Illat => veteen ;
|
||||||
|
NCase Sg Adess => vede + ("ll" + a) ;
|
||||||
|
NCase Sg Ablat => vede + ("lt" + a) ;
|
||||||
|
NCase Sg Allat => vede + "lle" ;
|
||||||
|
|
||||||
|
NCase Pl Nom => vede + "t" ;
|
||||||
|
NCase Pl Gen => vesien ;
|
||||||
|
NCase Pl Part => vesia ;
|
||||||
|
NCase Pl Transl => vesii + "ksi" ;
|
||||||
|
NCase Pl Ess => vetii + ("n" + a) ;
|
||||||
|
NCase Pl Iness => vesii + ("ss" + a) ;
|
||||||
|
NCase Pl Elat => vesii + ("st" + a) ;
|
||||||
|
NCase Pl Illat => vesiin ;
|
||||||
|
NCase Pl Adess => vesii + ("ll" + a) ;
|
||||||
|
NCase Pl Ablat => vesii + ("lt" + a) ;
|
||||||
|
NCase Pl Allat => vesii + "lle" ;
|
||||||
|
|
||||||
|
NPossNom => vete ;
|
||||||
|
NPossGenPl => Predef.tk 1 vesien ;
|
||||||
|
NPossTransl Sg => vede + "kse" ;
|
||||||
|
NPossTransl Pl => vesii + "kse" ;
|
||||||
|
NPossIllat Sg => Predef.tk 1 veteen ;
|
||||||
|
NPossIllat Pl => Predef.tk 1 vesiin
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- A user-friendly variant takes existing forms and infers the vowel harmony.
|
||||||
|
|
||||||
|
mkNoun : (_,_,_,_,_,_,_,_,_,_ : Str) -> CommonNoun =
|
||||||
|
\talo,talon,talona,taloa,taloon,taloina,taloissa,talojen,taloja,taloihin ->
|
||||||
|
mkSubst (ifTok Str (Predef.dp 1 talona) "a" "a" "ä")
|
||||||
|
talo (Predef.tk 1 talon) (Predef.tk 2 talona) taloa taloon
|
||||||
|
(Predef.tk 2 taloina) (Predef.tk 3 taloissa) talojen taloja taloihin ;
|
||||||
|
|
||||||
|
-- Here some useful special cases; more will be given in $paradigms.Fin.gf$.
|
||||||
|
--
|
||||||
|
-- Nouns with partitive "a"/"ä" ;
|
||||||
|
-- to account for grade and vowel alternation, three forms are usually enough
|
||||||
|
-- Examples: "talo", "kukko", "huippu", "koira", "kukka", "syylä",...
|
||||||
|
|
||||||
|
sKukko : (_,_,_ : Str) -> CommonNoun = \kukko,kukon,kukkoja ->
|
||||||
|
let {
|
||||||
|
o = Predef.dp 1 kukko ;
|
||||||
|
a = Predef.dp 1 kukkoja ;
|
||||||
|
kukkoj = Predef.tk 1 kukkoja ;
|
||||||
|
i = Predef.dp 1 kukkoj ;
|
||||||
|
ifi = ifTok Str i "i" ;
|
||||||
|
kukkoi = ifi kukkoj (Predef.tk 1 kukkoj) ;
|
||||||
|
e = Predef.dp 1 kukkoi ;
|
||||||
|
kukoi = Predef.tk 2 kukon + Predef.dp 1 kukkoi
|
||||||
|
}
|
||||||
|
in
|
||||||
|
mkSubst a
|
||||||
|
kukko
|
||||||
|
(Predef.tk 1 kukon)
|
||||||
|
kukko
|
||||||
|
(kukko + a)
|
||||||
|
(kukko + o + "n")
|
||||||
|
(kukkoi + ifi "" "i")
|
||||||
|
(kukoi + ifi "" "i")
|
||||||
|
(ifTok Str e "e" (Predef.tk 1 kukkoi + "ien") (kukkoi + ifi "en" "jen"))
|
||||||
|
kukkoja
|
||||||
|
(kukkoi + ifi "in" "ihin") ;
|
||||||
|
|
||||||
|
-- The special case with no alternations: the vowel harmony is inferred from the
|
||||||
|
-- last letter - which must be one of "o", "u", "ö", "y".
|
||||||
|
|
||||||
|
sTalo : Str -> CommonNoun = \talo ->
|
||||||
|
let {a = getHarmony (Predef.dp 1 talo)} in
|
||||||
|
sKukko talo (talo + "n") (talo + ("j" + a)) ;
|
||||||
|
|
||||||
|
-- Loan words ending in consonants are actually similar to words like
|
||||||
|
-- "malli"/"mallin"/"malleja", with the exception that the "i" is not attached
|
||||||
|
-- to the singular nominative.
|
||||||
|
|
||||||
|
sLinux : Str -> CommonNoun = \linuxia ->
|
||||||
|
let {
|
||||||
|
linux = Predef.tk 2 linuxia ;
|
||||||
|
a = getHarmony (Predef.dp 1 linuxia) ;
|
||||||
|
linuxi = linux + "i"
|
||||||
|
} in
|
||||||
|
mkSubst a
|
||||||
|
linux
|
||||||
|
linuxi
|
||||||
|
linuxi
|
||||||
|
(linuxi + a)
|
||||||
|
(linuxi + "in")
|
||||||
|
(linux + "ei")
|
||||||
|
(linux + "ei")
|
||||||
|
(linux + "ien")
|
||||||
|
(linux + "eja")
|
||||||
|
(linux + "eihin") ;
|
||||||
|
|
||||||
|
-- Nouns of at least 3 syllables ending with "a" or "ä", like "peruna", "rytinä".
|
||||||
|
|
||||||
|
sPeruna : Str -> CommonNoun = \peruna ->
|
||||||
|
let {
|
||||||
|
a = Predef.dp 1 peruna ;
|
||||||
|
perun = Predef.tk 1 peruna ;
|
||||||
|
perunoi = perun + (ifTok Str a "a" "o" "ö" + "i")
|
||||||
|
}
|
||||||
|
in
|
||||||
|
mkSubst a
|
||||||
|
peruna
|
||||||
|
peruna
|
||||||
|
peruna
|
||||||
|
(peruna + a)
|
||||||
|
(peruna + a + "n")
|
||||||
|
perunoi
|
||||||
|
perunoi
|
||||||
|
(perunoi + "den")
|
||||||
|
(perunoi + ("t" + a))
|
||||||
|
(perunoi + "hin") ;
|
||||||
|
|
||||||
|
-- Surpraisingly, making the test for the partitive, this not only covers
|
||||||
|
-- "rae", "perhe", "savuke", but also "rengas", "lyhyt" (except $Sg Illat$), etc.
|
||||||
|
|
||||||
|
sRae : (_,_ : Str) -> CommonNoun = \rae,rakeena ->
|
||||||
|
let {
|
||||||
|
a = Predef.dp 1 rakeena ;
|
||||||
|
rakee = Predef.tk 2 rakeena ;
|
||||||
|
rakei = Predef.tk 1 rakee + "i" ;
|
||||||
|
raet = rae + (ifTok Str (Predef.dp 1 rae) "e" "t" [])
|
||||||
|
}
|
||||||
|
in
|
||||||
|
mkSubst a
|
||||||
|
rae
|
||||||
|
rakee
|
||||||
|
rakee
|
||||||
|
(raet + ("t" + a))
|
||||||
|
(rakee + "seen")
|
||||||
|
rakei
|
||||||
|
rakei
|
||||||
|
(rakei + "den")
|
||||||
|
(rakei + ("t" + a))
|
||||||
|
(rakei + "siin") ;
|
||||||
|
|
||||||
|
sSusi : (_,_,_ : Str) -> CommonNoun = \susi,suden,sutena ->
|
||||||
|
let {
|
||||||
|
a = Predef.dp 1 sutena ;
|
||||||
|
sude = Predef.tk 1 suden ;
|
||||||
|
sute = Predef.tk 2 sutena
|
||||||
|
}
|
||||||
|
in
|
||||||
|
mkSubst a
|
||||||
|
susi
|
||||||
|
sude
|
||||||
|
sute
|
||||||
|
(Predef.tk 1 sute + ("t" + a))
|
||||||
|
(sute + "en")
|
||||||
|
susi
|
||||||
|
susi
|
||||||
|
(susi + "en")
|
||||||
|
(susi + a)
|
||||||
|
(susi + "in") ;
|
||||||
|
|
||||||
|
sPuu : Str -> CommonNoun = \puu ->
|
||||||
|
let {
|
||||||
|
u = Predef.dp 1 puu ;
|
||||||
|
a = getHarmony u ;
|
||||||
|
pu = Predef.tk 1 puu ;
|
||||||
|
pui = pu + "i"
|
||||||
|
}
|
||||||
|
in
|
||||||
|
mkSubst a
|
||||||
|
puu
|
||||||
|
puu
|
||||||
|
puu
|
||||||
|
(puu + ("t" + a))
|
||||||
|
(puu + ("h" + u + "n"))
|
||||||
|
pui
|
||||||
|
pui
|
||||||
|
(pui + "den")
|
||||||
|
(pui + ("t" + a))
|
||||||
|
(pui + "hin") ;
|
||||||
|
|
||||||
|
sSuo : Str -> CommonNoun = \suo ->
|
||||||
|
let {
|
||||||
|
o = Predef.dp 1 suo ;
|
||||||
|
a = getHarmony o ;
|
||||||
|
soi = Predef.tk 2 suo + (o + "i")
|
||||||
|
}
|
||||||
|
in
|
||||||
|
mkSubst a
|
||||||
|
suo
|
||||||
|
suo
|
||||||
|
suo
|
||||||
|
(suo + ("t" + a))
|
||||||
|
(suo + ("h" + o + "n"))
|
||||||
|
soi
|
||||||
|
soi
|
||||||
|
(soi + "den")
|
||||||
|
(soi + ("t" + a))
|
||||||
|
(soi + "hin") ;
|
||||||
|
|
||||||
|
-- Here in fact it is handy to use the partitive form as the only stem.
|
||||||
|
|
||||||
|
sNainen : Str -> CommonNoun = \naista ->
|
||||||
|
let {
|
||||||
|
nainen = Predef.tk 3 naista + "nen" ;
|
||||||
|
nais = Predef.tk 2 naista ;
|
||||||
|
naise = nais + "e" ;
|
||||||
|
naisi = nais + "i" ;
|
||||||
|
a = Predef.dp 1 naista
|
||||||
|
}
|
||||||
|
in
|
||||||
|
mkSubst a
|
||||||
|
nainen
|
||||||
|
naise
|
||||||
|
naise
|
||||||
|
(nais + ("t" + a))
|
||||||
|
(nais + "een")
|
||||||
|
naisi
|
||||||
|
naisi
|
||||||
|
(nais + "ten")
|
||||||
|
(nais + ("i" + a))
|
||||||
|
(nais + "iin") ;
|
||||||
|
|
||||||
|
-- The following covers: "tilaus", "kaulin", "paimen", "laidun", "sammal",
|
||||||
|
-- "kyynel" (excep $Sg Iness$ for the last two?).
|
||||||
|
|
||||||
|
sTilaus : (_,_ : Str) -> CommonNoun = \tilaus, tilauksena ->
|
||||||
|
let {
|
||||||
|
tilauks = Predef.tk 3 tilauksena ;
|
||||||
|
tilaukse = tilauks + "e" ;
|
||||||
|
tilauksi = tilauks + "i" ;
|
||||||
|
a = Predef.dp 1 tilauksena
|
||||||
|
}
|
||||||
|
in
|
||||||
|
mkSubst a
|
||||||
|
tilaus
|
||||||
|
tilaukse
|
||||||
|
tilaukse
|
||||||
|
(tilaus + ("t" + a))
|
||||||
|
(tilauks + "een")
|
||||||
|
tilauksi
|
||||||
|
tilauksi
|
||||||
|
(tilaus + "ten")
|
||||||
|
(tilauks + ("i" + a))
|
||||||
|
(tilauks + "iin") ;
|
||||||
|
|
||||||
|
-- Some words have the three grades ("rakkaus","rakkauden","rakkautena"), which
|
||||||
|
-- are however derivable from the stem.
|
||||||
|
|
||||||
|
sRakkaus : Str -> CommonNoun = \rakkaus ->
|
||||||
|
let {
|
||||||
|
rakkau = Predef.tk 1 rakkaus ;
|
||||||
|
rakkaut = rakkau + "t" ;
|
||||||
|
rakkaute = rakkau + "te" ;
|
||||||
|
rakkaude = rakkau + "de" ;
|
||||||
|
rakkauksi = rakkau + "ksi" ;
|
||||||
|
u = Predef.dp 1 rakkau ;
|
||||||
|
a = ifTok Str u "u" "a" "ä"
|
||||||
|
}
|
||||||
|
in
|
||||||
|
mkSubst a
|
||||||
|
rakkaus
|
||||||
|
rakkaude
|
||||||
|
rakkaute
|
||||||
|
(rakkaut + ("t" + a))
|
||||||
|
(rakkaut + "een")
|
||||||
|
rakkauksi
|
||||||
|
rakkauksi
|
||||||
|
(rakkauksi + "en")
|
||||||
|
(rakkauksi + a)
|
||||||
|
(rakkauksi + "in") ;
|
||||||
|
|
||||||
|
-- The following covers nouns like "nauris" and adjectives like "kallis", "tyyris".
|
||||||
|
|
||||||
|
sNauris : (_ : Str) -> CommonNoun = \naurista ->
|
||||||
|
let {
|
||||||
|
a = Predef.dp 1 naurista ;
|
||||||
|
nauris = Predef.tk 2 naurista ;
|
||||||
|
nauri = Predef.tk 3 naurista ;
|
||||||
|
naurii = nauri + "i"
|
||||||
|
}
|
||||||
|
in
|
||||||
|
mkSubst a
|
||||||
|
nauris
|
||||||
|
naurii
|
||||||
|
naurii
|
||||||
|
(nauris + ("t" + a))
|
||||||
|
(naurii + "seen")
|
||||||
|
naurii
|
||||||
|
naurii
|
||||||
|
(naurii + "den")
|
||||||
|
(naurii + ("t" + a))
|
||||||
|
(naurii + "siin") ;
|
||||||
|
|
||||||
|
-- The following two are used for adjective comparison.
|
||||||
|
|
||||||
|
sSuurempi : Str -> CommonNoun = \suurempaa ->
|
||||||
|
let {
|
||||||
|
a = Predef.dp 1 suurempaa ;
|
||||||
|
suure = Predef.tk 4 suurempaa ;
|
||||||
|
suurempi = suure + "mpi" ;
|
||||||
|
suurempa = suure + ("mp" + a) ;
|
||||||
|
suuremm = suure + "mm"
|
||||||
|
}
|
||||||
|
in
|
||||||
|
mkSubst a
|
||||||
|
suurempi
|
||||||
|
(suuremm + a)
|
||||||
|
suurempa
|
||||||
|
(suurempa + a)
|
||||||
|
(suurempa + (a + "n"))
|
||||||
|
suurempi
|
||||||
|
(suuremm + "i")
|
||||||
|
(suurempi + "en")
|
||||||
|
(suurempi + a)
|
||||||
|
(suurempi + "in") ;
|
||||||
|
|
||||||
|
sSuurin : Str -> CommonNoun = \suurinta ->
|
||||||
|
let {
|
||||||
|
a = Predef.dp 1 suurinta ;
|
||||||
|
suuri = Predef.tk 3 suurinta ;
|
||||||
|
suurin = suuri + "n" ;
|
||||||
|
suurimma = suuri + ("mm" + a) ;
|
||||||
|
suurimpa = suuri + ("mp" + a) ;
|
||||||
|
suurimpi = suuri + "mpi" ;
|
||||||
|
suurimmi = suuri + "mmi"
|
||||||
|
}
|
||||||
|
in
|
||||||
|
mkSubst a
|
||||||
|
suurin
|
||||||
|
suurimma
|
||||||
|
suurimpa
|
||||||
|
(suurin + ("t" + a))
|
||||||
|
(suurimpa + (a + "n"))
|
||||||
|
suurimpi
|
||||||
|
suurimmi
|
||||||
|
(suurimpi + "en")
|
||||||
|
(suurimpi + a)
|
||||||
|
(suurimpi + "in") ;
|
||||||
|
|
||||||
|
-- This auxiliary resolves vowel harmony from a given letter.
|
||||||
|
|
||||||
|
getHarmony : Str -> Str = \u ->
|
||||||
|
ifTok Str u "a" "a" (
|
||||||
|
ifTok Str u "o" "a" (
|
||||||
|
ifTok Str u "u" "a" "ä")) ;
|
||||||
|
|
||||||
|
|
||||||
|
-- We could use an extension of the following for grade alternation, but we don't;
|
||||||
|
-- in general, *whether there is* grade alternation must be given in the lexicon
|
||||||
|
-- anyway (cf. "auto" - "auton", not "audon").
|
||||||
|
|
||||||
|
weakGrade : Str -> Str = \kukko ->
|
||||||
|
let {
|
||||||
|
ku = Predef.tk 3 kukko ;
|
||||||
|
kk = Predef.tk 1 (Predef.dp 3 kukko) ;
|
||||||
|
o = Predef.dp 1 kukko ;
|
||||||
|
ifkk = ifTok Str kk ;
|
||||||
|
k =
|
||||||
|
ifkk "kk" "k" (
|
||||||
|
ifkk "pp" "p" (
|
||||||
|
ifkk "tt" "t" (
|
||||||
|
ifkk "nt" "nn" (
|
||||||
|
ifkk "mp" "mm" (
|
||||||
|
ifkk "rt" "rr" (
|
||||||
|
ifkk "lt" "ll" (
|
||||||
|
kk)))))))
|
||||||
|
}
|
||||||
|
in ku + k + o ;
|
||||||
|
|
||||||
|
|
||||||
|
--3 Proper names
|
||||||
|
--
|
||||||
|
-- Proper names are similar to common nouns in the singular.
|
||||||
|
|
||||||
|
mkProperName : CommonNoun -> ProperName = \jussi ->
|
||||||
|
{s = \\c => jussi.s ! NCase Sg c} ;
|
||||||
|
|
||||||
|
--2 Pronouns
|
||||||
|
--
|
||||||
|
-- Here we define personal and relative pronouns.
|
||||||
|
|
||||||
|
mkPronoun : (_,_,_,_,_ : Str) -> Number -> Person -> Pronoun =
|
||||||
|
\mina, minun, minua, minuna, minuun, n, p ->
|
||||||
|
let {
|
||||||
|
minu = Predef.tk 2 minuna ;
|
||||||
|
a = Predef.dp 1 minuna
|
||||||
|
} in
|
||||||
|
{s = table {
|
||||||
|
PCase Nom => mina ;
|
||||||
|
PCase Gen => minun ;
|
||||||
|
PCase Part => minua ;
|
||||||
|
PCase Transl => minu + "ksi" ;
|
||||||
|
PCase Ess => minuna ;
|
||||||
|
PCase Iness => minu + ("ss" + a) ;
|
||||||
|
PCase Elat => minu + ("st" + a) ;
|
||||||
|
PCase Illat => minuun ;
|
||||||
|
PCase Adess => minu + ("ll" + a) ;
|
||||||
|
PCase Ablat => minu + ("lt" + a) ;
|
||||||
|
PCase Allat => minu + "lle" ;
|
||||||
|
PAcc => Predef.tk 1 minun + "t"
|
||||||
|
} ;
|
||||||
|
n = n ; p = p} ;
|
||||||
|
|
||||||
|
pronMina = mkPronoun "minä" "minun" "minua" "minuna" "minuun" Sg P1 ;
|
||||||
|
pronSina = mkPronoun "sinä" "sinun" "sinua" "sinuna" "sinuun" Sg P2 ;
|
||||||
|
pronHan = mkPronoun "hän" "hänen" "häntä" "hänenä" "häneen" Sg P3 ;
|
||||||
|
pronMe = mkPronoun "me" "meidän" "meitä" "meinä" "meihin" Pl P1 ;
|
||||||
|
pronTe = mkPronoun "te" "teidän" "teitä" "teinä" "teihin" Pl P2 ;
|
||||||
|
pronHe = mkPronoun "he" "heidän" "heitä" "heinä" "heihin" Pl P3 ;
|
||||||
|
pronNe = mkPronoun "ne" "niiden" "niitä" "niinä" "niihin" Pl P3 ;
|
||||||
|
|
||||||
|
-- The non-human pronoun "se" ('it') is even more irregular,
|
||||||
|
-- Its accusative cases do not
|
||||||
|
-- have a special form with "t", but have the normal genitive/nominative variation.
|
||||||
|
-- We use the type $ProperName$ for "se", because of the accusative but also
|
||||||
|
-- because the person and number are as for proper names.
|
||||||
|
|
||||||
|
pronSe : ProperName = {
|
||||||
|
s = table {
|
||||||
|
Nom => "se" ;
|
||||||
|
Gen => "sen" ;
|
||||||
|
Part => "sitä" ;
|
||||||
|
Transl => "siksi" ;
|
||||||
|
Ess => "sinä" ;
|
||||||
|
Iness => "siinä" ;
|
||||||
|
Elat => "siitä" ;
|
||||||
|
Illat => "siihen" ;
|
||||||
|
Adess => "sillä" ;
|
||||||
|
Ablat => "siltä" ;
|
||||||
|
Allat => "sille"
|
||||||
|
} ;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- The possessive suffixes will be needed in syntax. It will show up
|
||||||
|
-- as a separate word ("auto &+ ni"), which needs unlexing. Unlexing also
|
||||||
|
-- has to fix the vowel harmony in cases like "äiti &+ nsä".
|
||||||
|
|
||||||
|
suff : Str -> Str = \ni -> BIND ++ ni ;
|
||||||
|
|
||||||
|
possSuffix : Number => Person => Str = \\n,p =>
|
||||||
|
suff (case <n,p> of {
|
||||||
|
<Sg,P1> => "ni" ;
|
||||||
|
<Sg,P2> => "si" ;
|
||||||
|
<Sg,P3> => "nsa" ;
|
||||||
|
<Pl,P1> => "mme" ;
|
||||||
|
<Pl,P2> => "nne" ;
|
||||||
|
<Pl,P3> => "nsa"
|
||||||
|
} ) ;
|
||||||
|
|
||||||
|
-- The relative pronoun, "joka", is inflected in case and number,
|
||||||
|
-- like common nouns, but it does not take possessive suffixes.
|
||||||
|
-- The inflextion shows a surprising similarity with "suo".
|
||||||
|
|
||||||
|
relPron : RelPron =
|
||||||
|
let {jo = sSuo "jo"} in {s =
|
||||||
|
table {
|
||||||
|
Sg => table {
|
||||||
|
Nom => "joka" ;
|
||||||
|
Gen => "jonka" ;
|
||||||
|
c => jo.s ! NCase Sg c
|
||||||
|
} ;
|
||||||
|
Pl => table {
|
||||||
|
Nom => "jotka" ;
|
||||||
|
c => "j" + (jo.s ! NCase Pl c)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
mikaInt : Number => Case => Str =
|
||||||
|
let {
|
||||||
|
mi = sSuo "mi"
|
||||||
|
} in
|
||||||
|
table {
|
||||||
|
Sg => table {
|
||||||
|
Nom => "mikä" ;
|
||||||
|
Gen => "minkä" ;
|
||||||
|
c => mi.s ! NCase Sg c
|
||||||
|
} ;
|
||||||
|
Pl => table {
|
||||||
|
Nom => "mitkä" ;
|
||||||
|
Gen => "mittenkä" ;
|
||||||
|
c => mi.s ! NCase Sg c
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
kukaInt : Number => Case => Str =
|
||||||
|
let {
|
||||||
|
ku = sRae "kuka" "kenenä" ;
|
||||||
|
ket = sRae "kuka" "keinä"} in
|
||||||
|
table {
|
||||||
|
Sg => table {
|
||||||
|
Nom => "kuka" ;
|
||||||
|
Part => "ketä" ;
|
||||||
|
Illat => "keneen" ;
|
||||||
|
c => ku.s ! NCase Sg c
|
||||||
|
} ;
|
||||||
|
Pl => table {
|
||||||
|
Nom => "ketkä" ;
|
||||||
|
Illat => "keihin" ;
|
||||||
|
c => ket.s ! NCase Pl c
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
caseTable : Number -> CommonNoun -> Case => Str = \n,cn ->
|
||||||
|
\\c => cn.s ! NCase n c ;
|
||||||
|
|
||||||
|
|
||||||
|
--2 Adjectives
|
||||||
|
--
|
||||||
|
-- For the comparison of adjectives, three noun declensions
|
||||||
|
-- are needed in the worst case.
|
||||||
|
|
||||||
|
mkAdjDegr : (_,_,_ : CommonNoun) -> AdjDegr = \hyva,parempi,paras ->
|
||||||
|
{s = table {
|
||||||
|
Pos => hyva.s ;
|
||||||
|
Comp => parempi.s ;
|
||||||
|
Sup => paras.s
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- However, it is usually enough to give the positive declension and
|
||||||
|
-- the characteristic forms of comparative and superlative.
|
||||||
|
|
||||||
|
regAdjDegr : CommonNoun -> Str -> Str -> AdjDegr = \kiva, kivempaa, kivinta ->
|
||||||
|
mkAdjDegr kiva (sSuurempi kivempaa) (sSuurin kivinta) ;
|
||||||
|
|
||||||
|
|
||||||
|
--3 Verbs
|
||||||
|
--
|
||||||
|
|
||||||
|
mkVerb : (_,_,_,_,_,_ : Str) -> Verb =
|
||||||
|
\tulla,tulen,tulee,tulevat,tulkaa,tullaan ->
|
||||||
|
let {
|
||||||
|
tule = Predef.tk 1 tulen ;
|
||||||
|
a = Predef.dp 1 tulkaa
|
||||||
|
} in
|
||||||
|
{s = table {
|
||||||
|
Inf => tulla ;
|
||||||
|
Ind Sg P1 => tulen ;
|
||||||
|
Ind Sg P2 => tule + "t" ;
|
||||||
|
Ind Sg P3 => tulee ;
|
||||||
|
Ind Pl P1 => tule + "mme" ;
|
||||||
|
Ind Pl P2 => tule + "tte" ;
|
||||||
|
Ind Pl P3 => tulevat ;
|
||||||
|
Imper Sg => tule ;
|
||||||
|
Imper Pl => tulkaa ;
|
||||||
|
ImpNegPl => Predef.tk 2 tulkaa + (ifTok Str a "a" "o" "ö") ;
|
||||||
|
Pass True => tullaan ;
|
||||||
|
Pass False => Predef.tk 2 tullaan
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
-- For "sanoa", "valua", "kysyä".
|
||||||
|
|
||||||
|
vSanoa : Str -> Verb = \sanoa ->
|
||||||
|
let {
|
||||||
|
a = Predef.dp 1 sanoa ;
|
||||||
|
sano = Predef.tk 1 sanoa ;
|
||||||
|
o = Predef.dp 1 sano
|
||||||
|
} in
|
||||||
|
mkVerb
|
||||||
|
sanoa
|
||||||
|
(sano + "n")
|
||||||
|
(sano + o)
|
||||||
|
(sano + (("v" + a) + "t"))
|
||||||
|
(sano + (("k" + a) + a))
|
||||||
|
(sano + ((("t" + a) + a) + "n")) ;
|
||||||
|
|
||||||
|
-- For "ottaa", "käyttää", "löytää", "huoltaa", "hiihtää", "siirtää".
|
||||||
|
|
||||||
|
vOttaa : (_,_ : Str) -> Verb = \ottaa,otan ->
|
||||||
|
let {
|
||||||
|
a = Predef.dp 1 ottaa ;
|
||||||
|
ota = Predef.tk 1 otan ;
|
||||||
|
otta = Predef.tk 1 ottaa ;
|
||||||
|
ote = Predef.tk 1 ota + "e"
|
||||||
|
} in
|
||||||
|
mkVerb
|
||||||
|
ottaa
|
||||||
|
(ota + "n")
|
||||||
|
ottaa
|
||||||
|
(otta + (("v" + a) + "t"))
|
||||||
|
(otta + (("k" + a) + a))
|
||||||
|
(ote + ((("t" + a) + a) + "n")) ;
|
||||||
|
|
||||||
|
-- For "poistaa", "ryystää".
|
||||||
|
|
||||||
|
vPoistaa : Str -> Verb = \poistaa ->
|
||||||
|
vOttaa poistaa (Predef.tk 1 poistaa + "n") ;
|
||||||
|
|
||||||
|
-- For "juosta", "piestä", "nousta", "rangaista", "kävellä", "surra", "panna".
|
||||||
|
|
||||||
|
vJuosta : (_,_ : Str) -> Verb = \juosta,juoksen ->
|
||||||
|
let {
|
||||||
|
a = Predef.dp 1 juosta ;
|
||||||
|
juokse = Predef.tk 1 juoksen ;
|
||||||
|
juos = Predef.tk 2 juosta
|
||||||
|
} in
|
||||||
|
mkVerb
|
||||||
|
juosta
|
||||||
|
juoksen
|
||||||
|
(juokse + "e")
|
||||||
|
(juokse + (("v" + a) + "t"))
|
||||||
|
(juos + (("k" + a) + a))
|
||||||
|
(juosta + (a + "n")) ;
|
||||||
|
|
||||||
|
-- For "juoda", "syödä".
|
||||||
|
|
||||||
|
vJuoda : Str -> Verb = \juoda ->
|
||||||
|
let {
|
||||||
|
a = Predef.dp 1 juoda ;
|
||||||
|
juo = Predef.tk 2 juoda
|
||||||
|
} in
|
||||||
|
mkVerb
|
||||||
|
juoda
|
||||||
|
(juo + "n")
|
||||||
|
juo
|
||||||
|
(juo + (("v" + a) + "t"))
|
||||||
|
(juo + (("k" + a) + a))
|
||||||
|
(juoda + (a + "n")) ;
|
||||||
|
|
||||||
|
|
||||||
|
verbOlla : Verb = mkVerb "olla" "olen" "on" "ovat" "olkaa" "ollaan" ;
|
||||||
|
|
||||||
|
-- The negating operator "ei" is actually a verb, which has present
|
||||||
|
-- active indicative and imperative forms, but no infinitive.
|
||||||
|
|
||||||
|
verbEi : Verb =
|
||||||
|
let {ei = mkVerb nonExist "en" "ei" "eivät" "älkää" "ei"} in
|
||||||
|
{s = table {
|
||||||
|
Ind Pl P3 => "eivät" ;
|
||||||
|
v => ei.s ! v
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
--2 Some structural words
|
||||||
|
|
||||||
|
kuinConj = "kuin" ;
|
||||||
|
|
||||||
|
conjEtta = "että" ;
|
||||||
|
advSiten = "siten" ;
|
||||||
|
|
||||||
|
mikakukaInt : Gender => Number => Case => Str =
|
||||||
|
table {
|
||||||
|
NonHuman => mikaInt ;
|
||||||
|
Human => kukaInt
|
||||||
|
} ;
|
||||||
|
|
||||||
|
kaikkiPron : Case => Str =
|
||||||
|
let {kaiket = caseTable Pl (sKukko "kaikki" "kaiken" "kaikkia")} in
|
||||||
|
table {
|
||||||
|
Nom => "kaikki" ;
|
||||||
|
c => kaiket ! c
|
||||||
|
} ;
|
||||||
|
|
||||||
|
stopPunct = "." ;
|
||||||
|
commaPunct = "," ;
|
||||||
|
questPunct = "?" ;
|
||||||
|
exclPunct = "!" ;
|
||||||
|
|
||||||
|
koPart = suff "ko" ;
|
||||||
|
|
||||||
|
} ;
|
||||||
260
lib/resource-0.6/finnish/ParadigmsFin.gf
Normal file
260
lib/resource-0.6/finnish/ParadigmsFin.gf
Normal file
@@ -0,0 +1,260 @@
|
|||||||
|
--1 Finnish Lexical Paradigms
|
||||||
|
--
|
||||||
|
-- Aarne Ranta 2003
|
||||||
|
--
|
||||||
|
-- This is an API to the user of the resource grammar
|
||||||
|
-- for adding lexical items. It give shortcuts for forming
|
||||||
|
-- expressions of basic categories: nouns, adjectives, verbs.
|
||||||
|
--
|
||||||
|
-- Closed categories (determiners, pronouns, conjunctions) are
|
||||||
|
-- accessed through the resource syntax API, $resource.Abs.gf$.
|
||||||
|
--
|
||||||
|
-- The main difference with $morpho.Fin.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.
|
||||||
|
--
|
||||||
|
-- This is the path to read the grammar from the same directory.
|
||||||
|
--# -path=.:../abstract:../../prelude
|
||||||
|
--
|
||||||
|
-- The following modules are presupposed:
|
||||||
|
|
||||||
|
resource ParadigmsFin = open (Predef=Predef), Prelude, SyntaxFin, Finnish in {
|
||||||
|
|
||||||
|
--2 Parameters
|
||||||
|
--
|
||||||
|
-- To abstract over gender, number, and (some) case names,
|
||||||
|
-- we define the following identifiers.
|
||||||
|
|
||||||
|
oper
|
||||||
|
human : Gender ;
|
||||||
|
nonhuman : Gender ;
|
||||||
|
|
||||||
|
-- singular : Number ;
|
||||||
|
-- singular : Number ;
|
||||||
|
|
||||||
|
nominative : Case ;
|
||||||
|
genitive : Case ;
|
||||||
|
partitive : Case ;
|
||||||
|
inessive : Case ;
|
||||||
|
elative : Case ;
|
||||||
|
illative : Case ;
|
||||||
|
adessive : Case ;
|
||||||
|
ablative : Case ;
|
||||||
|
allative : Case ;
|
||||||
|
|
||||||
|
--2 Nouns
|
||||||
|
|
||||||
|
-- Worst case: give ten forms and the semantic gender.
|
||||||
|
-- In practice just a couple of forms are needed, to define the different
|
||||||
|
-- stems, vowel alternation, and vowel harmony.
|
||||||
|
|
||||||
|
oper
|
||||||
|
mkN : (talo,talon,talona,taloa,taloon,taloina,taloissa,talojen,taloja,taloihin
|
||||||
|
: Str) -> Gender -> N ;
|
||||||
|
|
||||||
|
-- Nouns with partitive "a"/"ä" are a large group.
|
||||||
|
-- To determine for grade and vowel alternation, three forms are usually needed:
|
||||||
|
-- singular nominative and genitive, and plural partitive.
|
||||||
|
-- Examples: "talo", "kukko", "huippu", "koira", "kukka", "syylä", "särki"...
|
||||||
|
|
||||||
|
nKukko : (kukko,kukon,kukkoja : Str) -> Gender -> N ;
|
||||||
|
|
||||||
|
-- A special case are nouns with no alternations:
|
||||||
|
-- the vowel harmony is inferred from the last letter,
|
||||||
|
-- which must be one of "o", "u", "ö", "y".
|
||||||
|
|
||||||
|
nTalo : (talo : Str) -> Gender -> N ;
|
||||||
|
|
||||||
|
-- Foreign words ending in consonants are actually similar to words like
|
||||||
|
-- "malli"/"mallin"/"malleja", with the exception that the "i" is not attached
|
||||||
|
-- to the singular nominative. Examples: "linux", "savett", "screen".
|
||||||
|
-- The singular partitive form is used to get the vowel harmony. (N.B. more than
|
||||||
|
-- 1-syllabic words ending in "n" would have variant plural genitive and
|
||||||
|
-- partitive forms, like "sultanien"/"sultaneiden", which are not covered.)
|
||||||
|
|
||||||
|
nLinux : (linuxia : Str) -> Gender -> N ;
|
||||||
|
|
||||||
|
-- Nouns of at least 3 syllables ending with "a" or "ä", like "peruna", "tavara",
|
||||||
|
-- "rytinä".
|
||||||
|
|
||||||
|
nPeruna : (peruna : Str) -> Gender -> N ;
|
||||||
|
|
||||||
|
-- The following paradigm covers both nouns ending in an aspirated "e", such as
|
||||||
|
-- "rae", "perhe", "savuke", and also many ones ending in a consonant
|
||||||
|
-- ("rengas", "kätkyt"). The singular nominative and essive are given.
|
||||||
|
|
||||||
|
nRae : (rae, rakeena : Str) -> Gender -> N ;
|
||||||
|
|
||||||
|
-- The following covers nouns with partitive "ta"/"tä", such as
|
||||||
|
-- "susi", "vesi", "pieni". To get all stems and the vowel harmony, it takes
|
||||||
|
-- the singular nominative, genitive, and essive.
|
||||||
|
|
||||||
|
nSusi : (susi,suden,sutta : Str) -> Gender -> N ;
|
||||||
|
|
||||||
|
-- Nouns ending with a long vowel, such as "puu", "pää", "pii", "leikkuu",
|
||||||
|
-- are inflected according to the following.
|
||||||
|
|
||||||
|
nPuu : (puu : Str) -> Gender -> N ;
|
||||||
|
|
||||||
|
-- One-syllable diphthong nouns, such as "suo", "tie", "työ", are inflected by
|
||||||
|
-- the following.
|
||||||
|
|
||||||
|
nSuo : (suo : Str) -> Gender -> N ;
|
||||||
|
|
||||||
|
-- Many adjectives but also nouns have the nominative ending "nen" which in other
|
||||||
|
-- cases becomes "s": "nainen", "ihminen", "keltainen".
|
||||||
|
-- To capture the vowel harmony, we use the partitive form as the argument.
|
||||||
|
|
||||||
|
nNainen : (naista : Str) -> Gender -> N ;
|
||||||
|
|
||||||
|
-- The following covers some nouns ending with a consonant, e.g.
|
||||||
|
-- "tilaus", "kaulin", "paimen", "laidun".
|
||||||
|
|
||||||
|
nTilaus : (tilaus,tilauksena : Str) -> Gender -> N ;
|
||||||
|
|
||||||
|
-- The following covers nouns like "nauris" and adjectives like "kallis", "tyyris".
|
||||||
|
-- The partitive form is taken to get the vowel harmony.
|
||||||
|
|
||||||
|
nNauris : (naurista : Str) -> Gender -> N ;
|
||||||
|
|
||||||
|
-- Separately-written compound nouns, like "sambal oelek", "Urho Kekkonen",
|
||||||
|
-- have only their last part inflected.
|
||||||
|
|
||||||
|
nComp : Str -> N -> N ;
|
||||||
|
|
||||||
|
-- Nouns used as functions need a case, of which by far the commonest is
|
||||||
|
-- the genitive.
|
||||||
|
|
||||||
|
mkFun : N -> Case -> Fun ;
|
||||||
|
fGen : N -> Fun ;
|
||||||
|
|
||||||
|
-- Proper names can be formed by using declensions for nouns.
|
||||||
|
|
||||||
|
mkPN : N -> PN ;
|
||||||
|
|
||||||
|
|
||||||
|
--2 Adjectives
|
||||||
|
|
||||||
|
-- Non-comparison one-place adjectives are just like nouns.
|
||||||
|
|
||||||
|
mkAdj1 : N -> Adj1 ;
|
||||||
|
|
||||||
|
-- Two-place adjectives need a case for the second argument.
|
||||||
|
|
||||||
|
mkAdj2 : N -> Case -> Adj2 ;
|
||||||
|
|
||||||
|
-- Comparison adjectives have three forms. The comparative and the superlative
|
||||||
|
-- are always inflected in the same way, so the nominative of them is actually
|
||||||
|
-- enough (except for the superlative "paras" of "hyvä").
|
||||||
|
|
||||||
|
mkAdjDeg : (kiva : N) -> (kivempaa,kivinta : Str) -> AdjDeg ;
|
||||||
|
|
||||||
|
|
||||||
|
--2 Verbs
|
||||||
|
--
|
||||||
|
-- The fragment only has present tense so far, but in all persons.
|
||||||
|
-- The worst case needs five forms, as shown in the following.
|
||||||
|
|
||||||
|
mkV : (tulla,tulen,tulee,tulevat,tulkaa,tullaan : Str) -> V ;
|
||||||
|
|
||||||
|
-- A simple special case is the one with just one stem and no grade alternation.
|
||||||
|
-- It covers e.g. "sanoa", "valua", "kysyä".
|
||||||
|
|
||||||
|
vValua : (valua : Str) -> V ;
|
||||||
|
|
||||||
|
-- With two forms, the following function covers a variety of verbs, such as
|
||||||
|
-- "ottaa", "käyttää", "löytää", "huoltaa", "hiihtää", "siirtää".
|
||||||
|
|
||||||
|
vKattaa : (kattaa, katan : Str) -> V ;
|
||||||
|
|
||||||
|
-- When grade alternation is not present, just a one-form special case is needed
|
||||||
|
-- ("poistaa", "ryystää").
|
||||||
|
|
||||||
|
vOstaa : (ostaa : Str) -> V ;
|
||||||
|
|
||||||
|
-- The following covers
|
||||||
|
-- "juosta", "piestä", "nousta", "rangaista", "kävellä", "surra", "panna".
|
||||||
|
|
||||||
|
vNousta : (nousta, nousen : Str) -> V ;
|
||||||
|
|
||||||
|
-- This is for one-syllable diphthong verbs like "juoda", "syödä".
|
||||||
|
|
||||||
|
vTuoda : (tuoda : Str) -> V ;
|
||||||
|
|
||||||
|
-- The verbs "be" and the negative auxiliary are special.
|
||||||
|
|
||||||
|
vOlla : V ;
|
||||||
|
vEi : V ;
|
||||||
|
|
||||||
|
-- Two-place verbs need a case, and can have a pre- or postposition.
|
||||||
|
-- At least one of the latter is empty, $[]$.
|
||||||
|
|
||||||
|
mkTV : V -> Case -> (prep,postp : Str) -> TV ;
|
||||||
|
|
||||||
|
-- If both are empty, the following special function can be used.
|
||||||
|
|
||||||
|
tvCase : V -> Case -> TV ;
|
||||||
|
|
||||||
|
-- Verbs with a direct (accusative) object
|
||||||
|
-- are special, since their complement case is finally decided in syntax.
|
||||||
|
|
||||||
|
tvDir : V -> TV ;
|
||||||
|
|
||||||
|
-- The definitions should not bother the user of the API. So they are
|
||||||
|
-- hidden from the document.
|
||||||
|
--.
|
||||||
|
-- singular defined in types.Fin
|
||||||
|
-- plural defined in types.Fin
|
||||||
|
|
||||||
|
human = Human ;
|
||||||
|
nonhuman = NonHuman ;
|
||||||
|
|
||||||
|
nominative = Nom ;
|
||||||
|
genitive = Gen ;
|
||||||
|
partitive = Part ;
|
||||||
|
inessive = Iness ;
|
||||||
|
elative = Elat ;
|
||||||
|
illative = Illat ;
|
||||||
|
adessive = Adess ;
|
||||||
|
ablative = Ablat ;
|
||||||
|
allative = Allat ;
|
||||||
|
|
||||||
|
mkN = \a,b,c,d,e,f,g,h,i,j,k ->
|
||||||
|
mkNoun a b c d e f g h i j ** {g = k ; lock_N = <>} ;
|
||||||
|
|
||||||
|
nKukko = \a,b,c,g -> sKukko a b c ** {g = g ; lock_N = <>} ;
|
||||||
|
nTalo = \a,g -> sTalo a ** {g = g ; lock_N = <>} ;
|
||||||
|
nLinux = \a,g -> sLinux a ** {g = g ; lock_N = <>} ;
|
||||||
|
nPeruna = \a,g -> sPeruna a ** {g = g ; lock_N = <>} ;
|
||||||
|
nRae = \a,b,g -> sRae a b ** {g = g ; lock_N = <>} ;
|
||||||
|
nSusi = \a,b,c,g -> sSusi a b c ** {g = g ; lock_N = <>} ;
|
||||||
|
nPuu = \a,g -> sPuu a ** {g = g ; lock_N = <>} ;
|
||||||
|
nSuo = \a,g -> sSuo a ** {g = g ; lock_N = <>} ;
|
||||||
|
nNainen = \a,g -> sNainen a ** {g = g ; lock_N = <>} ;
|
||||||
|
nTilaus = \a,b,g -> sTilaus a b ** {g = g ; lock_N = <>} ;
|
||||||
|
nNauris = \a,g -> sNauris a ** {g = g ; lock_N = <>} ;
|
||||||
|
|
||||||
|
|
||||||
|
nComp = \s,n -> {s = \\c => s ++ n.s ! c ; g = n.g ; lock_N = <>} ;
|
||||||
|
mkFun = \n,c -> n2n n ** {c = NPCase c ; lock_Fun = <>} ;
|
||||||
|
fGen = \n -> mkFun n genitive ;
|
||||||
|
mkPN n = mkProperName n ** {lock_PN = <>} ;
|
||||||
|
|
||||||
|
mkAdj1 = \x -> {s = x.s ; lock_Adj1 = <>} ;
|
||||||
|
mkAdj2 = \x,c -> mkAdj1 x ** {c = NPCase c ; lock_Adj2 = <>} ;
|
||||||
|
mkAdjDeg x y z = regAdjDegr x y z ** {lock_AdjDeg = <>} ;
|
||||||
|
|
||||||
|
mkV a b c d e f = mkVerb a b c d e f ** {lock_V = <>} ;
|
||||||
|
vValua v = vSanoa v ** {lock_V = <>} ;
|
||||||
|
vKattaa v u = vOttaa v u ** {lock_V = <>} ;
|
||||||
|
vOstaa v = vPoistaa v ** {lock_V = <>} ;
|
||||||
|
vNousta v u = vJuosta v u ** {lock_V = <>} ;
|
||||||
|
vTuoda v = vJuoda v ** {lock_V = <>} ;
|
||||||
|
vOlla = verbOlla ** {lock_V = <>} ;
|
||||||
|
vEi = verbEi ** {lock_V = <>} ;
|
||||||
|
|
||||||
|
mkTV = \v,c,p,o -> v ** {s3 = p ; s4 = o ; c = c ; lock_TV = <>} ;
|
||||||
|
tvCase = \v,c -> mkTV v c [] [] ;
|
||||||
|
tvDir v = mkTransVerbDir v ** {lock_TV = <>} ;
|
||||||
|
} ;
|
||||||
48
lib/resource-0.6/finnish/StructuralFin.gf
Normal file
48
lib/resource-0.6/finnish/StructuralFin.gf
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
--# -path=.:../abstract:../../prelude
|
||||||
|
|
||||||
|
--1 The Top-Level Finnish Resource Grammar: Structural Words
|
||||||
|
--
|
||||||
|
-- Aarne Ranta 2002 -- 2003
|
||||||
|
--
|
||||||
|
concrete StructuralFin of Structural =
|
||||||
|
CombinationsFin ** open Prelude, SyntaxFin in {
|
||||||
|
lin
|
||||||
|
|
||||||
|
INP = pronNounPhrase pronMina ;
|
||||||
|
ThouNP = pronNounPhrase pronSina ;
|
||||||
|
HeNP = pronNounPhrase pronHan ;
|
||||||
|
SheNP = pronNounPhrase pronHan ;
|
||||||
|
ItNP = nameNounPhrase pronSe ;
|
||||||
|
WeNP = pronNounPhrase pronMe ;
|
||||||
|
YeNP = pronNounPhrase pronTe ;
|
||||||
|
YouNP = pronNounPhrase pronTe ;
|
||||||
|
TheyNP = pronNounPhrase pronHe ; --- ne
|
||||||
|
|
||||||
|
EveryDet = jokainenDet ;
|
||||||
|
AllDet = kaikkiDet ;
|
||||||
|
WhichDet = mikaDet ;
|
||||||
|
MostDet = useimmatDet ;
|
||||||
|
|
||||||
|
HowIAdv = ss "kuinka" ;
|
||||||
|
WhenIAdv = ss "koska" ;
|
||||||
|
WhereIAdv = ss "missä" ;
|
||||||
|
WhyIAdv = ss "miksi" ;
|
||||||
|
|
||||||
|
AndConj = ss "ja" ** {n = Pl} ;
|
||||||
|
OrConj = ss "tai" ** {n = Sg} ;
|
||||||
|
BothAnd = sd2 "sekä" "että" ** {n = Pl} ;
|
||||||
|
EitherOr = sd2 "joko" "tai" ** {n = Sg} ;
|
||||||
|
NeitherNor = sd2 "ei" "eikä" ** {n = Sg} ;
|
||||||
|
IfSubj = ss "jos" ;
|
||||||
|
WhenSubj = ss "kun" ;
|
||||||
|
AlthoughSubj = ss "vaikka" ;
|
||||||
|
|
||||||
|
PhrYes = ss ("Kyllä" ++ stopPunct) ;
|
||||||
|
PhrNo = ss ("Ei" ++ stopPunct) ;
|
||||||
|
|
||||||
|
VeryAdv = ss "hyvin" ;
|
||||||
|
TooAdv = ss "liian" ;
|
||||||
|
OtherwiseAdv = ss "muuten" ;
|
||||||
|
ThereforeAdv = ss "siksi" ;
|
||||||
|
|
||||||
|
}
|
||||||
1121
lib/resource-0.6/finnish/SyntaxFin.gf
Normal file
1121
lib/resource-0.6/finnish/SyntaxFin.gf
Normal file
File diff suppressed because it is too large
Load Diff
54
lib/resource-0.6/finnish/TestResourceFin.gf
Normal file
54
lib/resource-0.6/finnish/TestResourceFin.gf
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
-- use this path to read the grammar from the same directory
|
||||||
|
--# -path=.:../abstract:../../prelude
|
||||||
|
|
||||||
|
concrete TestFin of TestAbs = ResFin ** open Prelude, SyntaxFin in {
|
||||||
|
|
||||||
|
flags startcat=Phr ; lexer=unglue ; unlexer=glue ;
|
||||||
|
|
||||||
|
-- a random sample from the lexicon
|
||||||
|
|
||||||
|
lin
|
||||||
|
Big = regAdjDegr (sTalo "iso") "isompaa" "isointa" ;
|
||||||
|
Small = regAdjDegr (sSusi "pieni" "pienen" "pienenä") "pienempää" "pienintä" ;
|
||||||
|
Old = regAdjDegr (sKukko "vanha" "vanhan" "vanhoja") "vanhempaa" "vanhinta" ;
|
||||||
|
Young = regAdjDegr (sSusi "nuori" "nuoren" "nuorena") "nuorempaa" "nuorinta" ;
|
||||||
|
American = sNainen "amerikkalaista" ;
|
||||||
|
Finnish = sNainen "suomalaista" ;
|
||||||
|
|
||||||
|
Married = sKukko "vihitty" "vihityn" "vihittyjä" ** {c = NPCase Illat} ;
|
||||||
|
--- naimisissa !
|
||||||
|
|
||||||
|
Man = cnHum (mkNoun "mies" "miehen" "miehenä" "miestä" "mieheen" "miehinä"
|
||||||
|
"miehissä" "miesten" "miehiä" "miehiin") ;
|
||||||
|
Woman = cnHum (sNainen "naista") ;
|
||||||
|
Car = cnNoHum (sTalo "auto") ;
|
||||||
|
House = cnNoHum (sTalo "talo") ;
|
||||||
|
Light = cnNoHum (sTalo "valo") ;
|
||||||
|
|
||||||
|
Walk = vJuosta "kävellä" "kävelen" ;
|
||||||
|
Run = vJuosta "juosta" "juoksen" ;
|
||||||
|
Say = vSanoa "sanoa" ;
|
||||||
|
Prove = vPoistaa "todistaa" ;
|
||||||
|
Send = mkTransVerbDir (vOttaa "lähettää" "lähetän") ;
|
||||||
|
Love = mkTransVerbCase (vPoistaa "rakastaa") Part ;
|
||||||
|
Wait = mkTransVerbCase (vOttaa "odottaa" "odotan") Part ;
|
||||||
|
Give = mkTransVerbDir (vOttaa "antaa" "annan") **
|
||||||
|
{s5 = [] ; s6 = [] ; c2 = CCase Allat} ;
|
||||||
|
Prefer = mkTransVerbDir (vOttaa "asettaa" "asetan") **
|
||||||
|
{s5 = [] ; s6 = "edelle" ; c2 = CCase Gen} ; --- pitää paremp(a/i)na
|
||||||
|
|
||||||
|
Mother = funGen (n2n (cnHum (sKukko "äiti" "äidin" "äitejä"))) ;
|
||||||
|
Uncle = funGen (n2n (cnHum (sKukko "setä" "sedän" "setiä"))) ; --- eno!
|
||||||
|
Connection = n2n (cnNoHum (sRakkaus "yhteys")) **
|
||||||
|
{c = NPCase Elat ; c2 = NPCase Illat} ; --- Tampereelle !
|
||||||
|
|
||||||
|
Always = ss "aina" ;
|
||||||
|
Well = ss "hyvin" ;
|
||||||
|
|
||||||
|
SwitchOn = mkTransVerbDir (vOttaa "sytyttää" "sytytän") ;
|
||||||
|
SwitchOff = mkTransVerbDir (vOttaa "sammuttaa" "sammutan") ;
|
||||||
|
|
||||||
|
John = mkProperName (sKukko "Jussi" "Jussin" "Jusseja") ;
|
||||||
|
Mary = mkProperName (sKukko "Mari" "Marin" "Mareja") ;
|
||||||
|
|
||||||
|
} ;
|
||||||
126
lib/resource-0.6/finnish/TypesFin.gf
Normal file
126
lib/resource-0.6/finnish/TypesFin.gf
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
--1 Finnish Word Classes and Morphological Parameters
|
||||||
|
--
|
||||||
|
-- This is a resource module for Finnish morphology, defining the
|
||||||
|
-- morphological parameters and word classes of Finnish. It is aimed
|
||||||
|
-- to be complete w.r.t. the description of word forms.
|
||||||
|
-- However, it only includes those parameters that are needed for
|
||||||
|
-- analysing individual words: such parameters are defined in syntax modules.
|
||||||
|
--
|
||||||
|
-- We use the language-independent prelude.
|
||||||
|
|
||||||
|
resource TypesFin = open Prelude in {
|
||||||
|
|
||||||
|
--
|
||||||
|
--2 Enumerated parameter types
|
||||||
|
--
|
||||||
|
-- These types are the ones found in school grammars.
|
||||||
|
-- Their parameter values are atomic. We omit three of the cases, not
|
||||||
|
-- occurring in the resource syntax. The accusative cases are only
|
||||||
|
-- defined in syntax; in morphology, there is a special accusative for
|
||||||
|
-- pronouns.
|
||||||
|
|
||||||
|
param
|
||||||
|
Number = Sg | Pl ;
|
||||||
|
Case = Nom | Gen | Part | Transl | Ess
|
||||||
|
| Iness | Elat | Illat | Adess | Ablat | Allat ;
|
||||||
|
Person = P1 | P2 | P3 ;
|
||||||
|
Degree = Pos | Comp | Sup ;
|
||||||
|
Gender = NonHuman | Human ;
|
||||||
|
|
||||||
|
-- For data abstraction, we define
|
||||||
|
|
||||||
|
oper
|
||||||
|
singular = Sg ;
|
||||||
|
plural = Pl ;
|
||||||
|
|
||||||
|
--2 Word classes and hierarchical parameter types
|
||||||
|
--
|
||||||
|
-- Real parameter types (i.e. ones on which words and phrases depend)
|
||||||
|
-- are often hierarchical. The alternative would be cross-products of
|
||||||
|
-- simple parameters, but this would usually overgenerate.
|
||||||
|
--
|
||||||
|
|
||||||
|
--3 Common nouns
|
||||||
|
--
|
||||||
|
-- Common nouns are inflected in number and noun case. In noun case, we include
|
||||||
|
-- forms used in connection with possessive suffixes.
|
||||||
|
|
||||||
|
param
|
||||||
|
NForm = NCase Number Case
|
||||||
|
| NPossNom | NPossGenPl | NPossTransl Number | NPossIllat Number ;
|
||||||
|
|
||||||
|
oper
|
||||||
|
CommonNoun : Type = {s : NForm => Str} ;
|
||||||
|
|
||||||
|
useNForm : NForm -> (Number => Case => Str) -> Str = \nf,f -> case nf of {
|
||||||
|
NCase n c => f ! n ! c ;
|
||||||
|
NPossNom => f ! Sg ! Nom ; ---- "iso autoni"; also "isot autoni" etc
|
||||||
|
NPossGenPl => f ! Pl ! Gen ;
|
||||||
|
NPossTransl n => f ! n ! Transl ;
|
||||||
|
NPossIllat n => f ! n ! Illat
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
--3 Adjectives
|
||||||
|
--
|
||||||
|
-- The major division is between the comparison degrees, but it
|
||||||
|
-- is also good to leave room for adjectives that cannon be compared.
|
||||||
|
-- Such adjectives are like common nouns.
|
||||||
|
|
||||||
|
Adjective : Type = CommonNoun ;
|
||||||
|
AdjDegr : Type = {s : Degree => NForm => Str} ;
|
||||||
|
|
||||||
|
--3 Verbs
|
||||||
|
--
|
||||||
|
-- We limit the grammar so far to verbs in the infinitive, second-person
|
||||||
|
-- imperative, and present tense indicative active and passive.
|
||||||
|
-- A special form is needed for
|
||||||
|
-- the negated plural imperative.
|
||||||
|
|
||||||
|
param
|
||||||
|
VForm =
|
||||||
|
Inf
|
||||||
|
| Ind Number Person
|
||||||
|
| Imper Number
|
||||||
|
| ImpNegPl
|
||||||
|
| Pass Bool
|
||||||
|
;
|
||||||
|
|
||||||
|
oper
|
||||||
|
Verb : Type = SS1 VForm ;
|
||||||
|
|
||||||
|
vFormNeg = Imper Sg ;
|
||||||
|
|
||||||
|
vform2number : VForm -> Number = \v -> case v of {
|
||||||
|
Ind n _ => n ;
|
||||||
|
Imper n => n ;
|
||||||
|
ImpNegPl => Pl ;
|
||||||
|
_ => Sg ---
|
||||||
|
} ;
|
||||||
|
|
||||||
|
--
|
||||||
|
--3 Pronouns
|
||||||
|
--
|
||||||
|
-- For pronouns, we need the noun case forms, plus an accusative.
|
||||||
|
|
||||||
|
param
|
||||||
|
PForm = PCase Case | PAcc ;
|
||||||
|
|
||||||
|
oper
|
||||||
|
Pronoun : Type = {s : PForm => Str ; n : Number ; p : Person} ;
|
||||||
|
|
||||||
|
--3 Proper names
|
||||||
|
--
|
||||||
|
-- Proper names only need case forms.
|
||||||
|
|
||||||
|
ProperName : Type = SS1 Case ;
|
||||||
|
|
||||||
|
|
||||||
|
--3 Relative pronouns
|
||||||
|
--
|
||||||
|
-- Relative pronouns are inflected like nouns, except for possessive suffixes.
|
||||||
|
|
||||||
|
RelPron : Type = {s : Number => Case => Str} ;
|
||||||
|
|
||||||
|
} ;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--# -path=.:../abstract:../../prelude
|
--# -path=.:../abstract:../../prelude
|
||||||
|
|
||||||
--1 The Top-Level English Resource Grammar: Structural Words
|
--1 The Top-Level Swedish Resource Grammar: Structural Words
|
||||||
--
|
--
|
||||||
-- Aarne Ranta 2002 -- 2003
|
-- Aarne Ranta 2002 -- 2003
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -168,8 +168,8 @@ execCommand env c s = case c of
|
|||||||
return (env', state1)
|
return (env', state1)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
---- CCEnvOn name -> return (languageOn (language name) env,s)
|
CCEnvOn name -> return (env,s) ---- return (languageOn (language name) env,s)
|
||||||
---- CCEnvOff name -> return (languageOff (language name) env,s)
|
CCEnvOff name -> return (env,s) ---- return (languageOff (language name) env,s)
|
||||||
|
|
||||||
-- this command is improved by the use of IO
|
-- this command is improved by the use of IO
|
||||||
CRefineRandom -> do
|
CRefineRandom -> do
|
||||||
|
|||||||
@@ -1,5 +1,26 @@
|
|||||||
module ExtendedArabic where
|
module ExtendedArabic where
|
||||||
|
|
||||||
|
mkArabic0600 :: String -> String
|
||||||
|
mkArabic0600 = digraphWordToUnicode . aarnesToDigraphWord
|
||||||
|
|
||||||
|
aarnesToDigraphWord :: String -> [(Char, Char)]
|
||||||
|
aarnesToDigraphWord str = case str of
|
||||||
|
[] -> []
|
||||||
|
'<' : cs -> ('\\', '<') : spoolMarkup2 cs
|
||||||
|
|
||||||
|
'v' : cs -> ('T', 'H') : aarnesToDigraphWord cs
|
||||||
|
'a' : cs -> (' ', 'A') : aarnesToDigraphWord cs
|
||||||
|
'o' : cs -> (' ', '3') : aarnesToDigraphWord cs
|
||||||
|
'O' : cs -> ('\'', 'i') : aarnesToDigraphWord cs
|
||||||
|
|
||||||
|
'u' : cs -> ('\'', 'A') : aarnesToDigraphWord cs
|
||||||
|
'C' : cs -> (' ', 'X') : aarnesToDigraphWord cs
|
||||||
|
|
||||||
|
'U' : cs -> ('~', 'A') : aarnesToDigraphWord cs
|
||||||
|
'A' : cs -> ('"', 't') : aarnesToDigraphWord cs
|
||||||
|
'c' : cs -> ('s', 'h') : aarnesToDigraphWord cs
|
||||||
|
c : cs -> (' ', c) : aarnesToDigraphWord cs
|
||||||
|
|
||||||
mkExtendedArabic :: String -> String
|
mkExtendedArabic :: String -> String
|
||||||
mkExtendedArabic = digraphWordToUnicode . adHocToDigraphWord
|
mkExtendedArabic = digraphWordToUnicode . adHocToDigraphWord
|
||||||
|
|
||||||
@@ -56,3 +77,9 @@ spoolMarkup s = case s of
|
|||||||
[] -> [] -- Shouldn't happen
|
[] -> [] -- Shouldn't happen
|
||||||
'>' : cs -> ('\\', '>') : adHocToDigraphWord cs
|
'>' : cs -> ('\\', '>') : adHocToDigraphWord cs
|
||||||
c1 : cs -> ('\\', c1) : spoolMarkup cs
|
c1 : cs -> ('\\', c1) : spoolMarkup cs
|
||||||
|
|
||||||
|
spoolMarkup2 :: String -> [(Char, Char)]
|
||||||
|
spoolMarkup2 s = case s of
|
||||||
|
[] -> [] -- Shouldn't happen
|
||||||
|
'>' : cs -> ('\\', '>') : aarnesToDigraphWord cs
|
||||||
|
c1 : cs -> ('\\', c1) : spoolMarkup2 cs
|
||||||
23
src/GF/Text/ExtraDiacritics.hs
Normal file
23
src/GF/Text/ExtraDiacritics.hs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
module ExtraDiacritics where
|
||||||
|
|
||||||
|
mkExtraDiacritics :: String -> String
|
||||||
|
mkExtraDiacritics = mkExtraDiacriticsWord
|
||||||
|
|
||||||
|
mkExtraDiacriticsWord :: String -> String
|
||||||
|
mkExtraDiacriticsWord str = case str of
|
||||||
|
[] -> []
|
||||||
|
'<' : cs -> '<' : spoolMarkup cs
|
||||||
|
--
|
||||||
|
'/' : cs -> toEnum 0x0301 : mkExtraDiacriticsWord cs
|
||||||
|
'~' : cs -> toEnum 0x0306 : mkExtraDiacriticsWord cs
|
||||||
|
':' : cs -> toEnum 0x0304 : mkExtraDiacriticsWord cs -- some of these could be put in LatinA
|
||||||
|
'.' : cs -> toEnum 0x0323 : mkExtraDiacriticsWord cs
|
||||||
|
'i' : '-' : cs -> toEnum 0x0268 : mkExtraDiacriticsWord cs -- in IPA extensions
|
||||||
|
-- Default
|
||||||
|
c : cs -> c : mkExtraDiacriticsWord cs
|
||||||
|
|
||||||
|
spoolMarkup :: String -> String
|
||||||
|
spoolMarkup s = case s of
|
||||||
|
[] -> [] -- Shouldn't happen
|
||||||
|
'>' : cs -> '>' : mkExtraDiacriticsWord cs
|
||||||
|
c1 : cs -> c1 : spoolMarkup cs
|
||||||
@@ -10,11 +10,13 @@ import OCSCyrillic (mkOCSCyrillic)
|
|||||||
import LatinASupplement (mkLatinASupplement)
|
import LatinASupplement (mkLatinASupplement)
|
||||||
import Devanagari (mkDevanagari)
|
import Devanagari (mkDevanagari)
|
||||||
import Hiragana (mkJapanese)
|
import Hiragana (mkJapanese)
|
||||||
|
import ExtendedArabic (mkArabic0600)
|
||||||
import ExtendedArabic (mkExtendedArabic)
|
import ExtendedArabic (mkExtendedArabic)
|
||||||
|
import ExtraDiacritics (mkExtraDiacritics)
|
||||||
|
|
||||||
-- ad hoc Unicode conversions from different alphabets
|
-- ad hoc Unicode conversions from different alphabets
|
||||||
|
|
||||||
-- AR 12/4/2000, 18/9/2001, 30/5/2002, HH 14/11/2003
|
-- AR 12/4/2000, 18/9/2001, 30/5/2002
|
||||||
|
|
||||||
mkUnicode s = case s of
|
mkUnicode s = case s of
|
||||||
'/':'/':cs -> mkGreek (remClosing cs)
|
'/':'/':cs -> mkGreek (remClosing cs)
|
||||||
@@ -22,13 +24,15 @@ mkUnicode s = case s of
|
|||||||
'/':'-':cs -> mkArabic (remClosing cs)
|
'/':'-':cs -> mkArabic (remClosing cs)
|
||||||
'/':'_':cs -> mkRussian (remClosing cs)
|
'/':'_':cs -> mkRussian (remClosing cs)
|
||||||
'/':'*':cs -> mkRusKOI8 (remClosing cs)
|
'/':'*':cs -> mkRusKOI8 (remClosing cs)
|
||||||
'/':'E':cs -> mkEthiopic (remClosing cs) -- HH
|
'/':'E':cs -> mkEthiopic (remClosing cs)
|
||||||
'/':'T':cs -> mkTamil (remClosing cs) -- HH
|
'/':'T':cs -> mkTamil (remClosing cs)
|
||||||
'/':'C':cs -> mkOCSCyrillic (remClosing cs) -- HH
|
'/':'C':cs -> mkOCSCyrillic (remClosing cs)
|
||||||
'/':'&':cs -> mkDevanagari (remClosing cs) -- HH
|
'/':'&':cs -> mkDevanagari (remClosing cs)
|
||||||
'/':'L':cs -> mkLatinASupplement (remClosing cs) -- HH
|
'/':'L':cs -> mkLatinASupplement (remClosing cs)
|
||||||
'/':'J':cs -> mkJapanese (remClosing cs) -- HH
|
'/':'J':cs -> mkJapanese (remClosing cs)
|
||||||
'/':'A':cs -> mkExtendedArabic (remClosing cs) -- HH
|
'/':'6':cs -> mkArabic0600 (remClosing cs)
|
||||||
|
'/':'A':cs -> mkExtendedArabic (remClosing cs)
|
||||||
|
'/':'X':cs -> mkExtraDiacritics (remClosing cs)
|
||||||
_ -> s
|
_ -> s
|
||||||
|
|
||||||
remClosing cs
|
remClosing cs
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
module Today where today = "Tue Dec 9 18:22:33 CET 2003"
|
module Today where today = "Fri Dec 19 18:43:03 CET 2003"
|
||||||
|
|||||||
Reference in New Issue
Block a user