mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
started Swedish
This commit is contained in:
43
lib/resource-1.0/scandinavian/AdjectiveScand.gf
Normal file
43
lib/resource-1.0/scandinavian/AdjectiveScand.gf
Normal file
@@ -0,0 +1,43 @@
|
||||
incomplete concrete AdjectiveScand of Adjective =
|
||||
CatScand ** open DiffScand, ResScand, Prelude in {
|
||||
|
||||
lin
|
||||
|
||||
PositA a = {
|
||||
s = \\ap => a.s ! AF (APosit ap) Nom ;
|
||||
isPre = True
|
||||
} ;
|
||||
ComparA a np = {
|
||||
s = \\_ => a.s ! AF ACompar Nom ++ conjThan ++ np.s ! NPNom ;
|
||||
isPre = False
|
||||
} ;
|
||||
|
||||
---- $SuperlA$ belongs to determiner syntax in $Noun$.
|
||||
--
|
||||
-- ComplA2 a np = {
|
||||
-- s = \\_ => a.s ! AAdj Posit ++ a.c2 ++ np.s ! Acc ;
|
||||
-- isPre = False
|
||||
-- } ;
|
||||
--
|
||||
-- ReflA2 a = {
|
||||
-- s = \\ag => a.s ! AAdj Posit ++ a.c2 ++ reflPron ! ag ;
|
||||
-- isPre = False
|
||||
-- } ;
|
||||
--
|
||||
SentAP ap s = {
|
||||
s = \\a => ap.s ! a ++ conjThat ++ s.s ! Inv ;
|
||||
isPre = False
|
||||
} ;
|
||||
QuestAP ap qs = {
|
||||
s = \\a => ap.s ! a ++ qs.s ! QIndir ;
|
||||
isPre = False
|
||||
} ;
|
||||
|
||||
AdAP ada ap = {
|
||||
s = \\a => ada.s ++ ap.s ! a ;
|
||||
isPre = ap.isPre
|
||||
} ;
|
||||
|
||||
UseA2 a = a ;
|
||||
|
||||
}
|
||||
28
lib/resource-1.0/scandinavian/AdverbScand.gf
Normal file
28
lib/resource-1.0/scandinavian/AdverbScand.gf
Normal file
@@ -0,0 +1,28 @@
|
||||
incomplete concrete AdverbScand of Adverb = CatScand ** open DiffScand, ResScand, Prelude in {
|
||||
|
||||
lin
|
||||
PositAdvAdj a = {
|
||||
s = a.s ! adverbForm
|
||||
} ;
|
||||
ComparAdvAdj cadv a np = {
|
||||
s = cadv.s ++ a.s ! adverbForm ++ conjThan ++ np.s ! NPNom
|
||||
} ;
|
||||
ComparAdvAdjS cadv a s = {
|
||||
s = cadv.s ++ a.s ! adverbForm ++ conjThan ++ s.s ! Sub
|
||||
} ;
|
||||
|
||||
PrepNP prep np = {s = prep.s ++ np.s ! NPAcc} ;
|
||||
|
||||
AdAdv = cc2 ;
|
||||
|
||||
SubjS subj s = {
|
||||
s = subj.s ++ s.s ! Sub
|
||||
} ;
|
||||
AdvSC s = s ;
|
||||
|
||||
AdnCAdv cadv = {s = cadv.s ++ "than"} ;
|
||||
|
||||
oper
|
||||
adverbForm : AForm = AF (APosit (Strong SgNeutr)) Nom ;
|
||||
|
||||
}
|
||||
71
lib/resource-1.0/scandinavian/CatScand.gf
Normal file
71
lib/resource-1.0/scandinavian/CatScand.gf
Normal file
@@ -0,0 +1,71 @@
|
||||
incomplete concrete CatScand of Cat =
|
||||
open ParamScand, Prelude, DiffScand, (R = ParamX) in {
|
||||
|
||||
lincat
|
||||
Text, Phr, Utt = {s : Str} ;
|
||||
|
||||
Imp = {s : Polarity => Number => Str} ;
|
||||
|
||||
S = {s : Order => Str} ;
|
||||
QS = {s : QForm => Str} ;
|
||||
RS = {s : Agr => Str} ;
|
||||
|
||||
Cl = {s : Tense => Anteriority => Polarity => Order => Str} ;
|
||||
Slash = {s : Tense => Anteriority => Polarity => Order => Str} ** {c2 : Str} ;
|
||||
|
||||
QCl = {s : Tense => Anteriority => Polarity => QForm => Str} ;
|
||||
RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ;
|
||||
|
||||
VP = {
|
||||
v : SForm => {
|
||||
v1 : Str ; -- V1 har ---s1
|
||||
v2 : Str -- V2 sagt ---s4
|
||||
} ;
|
||||
a1 : Bool => Str ; -- A1 inte ---s3
|
||||
n2 : Agr => Str ; -- N2 dig ---s5
|
||||
a2 : Str ; -- A2 idag ---s6
|
||||
ext : Str ; -- S extraposition ---s7
|
||||
ea1,ev2,en2,ea2,eext : Bool -- indicate if the field exists
|
||||
} ;
|
||||
|
||||
V, VS, VQ, VA = {s : VForm => Str} ;
|
||||
V2, VV, V2A = {s : VForm => Str} ** {c2 : Str} ;
|
||||
V3 = {s : VForm => Str} ** {c2,c3 : Str} ;
|
||||
|
||||
AP = {s : AFormPos => Str ; isPre : Bool} ;
|
||||
Comp = {s : AFormPos => Str} ;
|
||||
|
||||
SC = {s : Str} ; -- always Sub
|
||||
|
||||
A = {s : AForm => Str} ;
|
||||
A2 = {s : AForm => Str} ** {c2 : Str} ;
|
||||
|
||||
Adv, AdV, AdA, AdS, AdN = {s : Str} ;
|
||||
Prep = {s : Str} ;
|
||||
|
||||
Det, Quant = {s : Gender => Str ; n : Number ; det : DetSpecies } ;
|
||||
Predet, Num, Ord = {s : Str} ;
|
||||
|
||||
CN,N = Noun ;
|
||||
-- {s : Number => Species => Case => Str ; g : Gender} ;
|
||||
PN = {s : Case => Str ; g : Gender} ;
|
||||
Pron, NP = {s : NPForm => Str ; a : Agr} ;
|
||||
N2 = Noun ** {c2 : Str} ;
|
||||
N3 = Noun ** {c2,c3 : Str} ;
|
||||
|
||||
IP = NP ;
|
||||
IDet = Det ;
|
||||
IAdv = {s : Str} ;
|
||||
|
||||
RP = {s : RCase => Str ; a : RAgr} ;
|
||||
|
||||
Numeral = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
CAdv = {s : Str} ;
|
||||
|
||||
Conj = {s : Str ; n : Number} ;
|
||||
DConj = {s1,s2 : Str ; n : Number} ;
|
||||
|
||||
oper
|
||||
Noun = {s : Number => Species => Case => Str ; g : Gender} ;
|
||||
}
|
||||
43
lib/resource-1.0/scandinavian/ConjunctionScand.gf
Normal file
43
lib/resource-1.0/scandinavian/ConjunctionScand.gf
Normal file
@@ -0,0 +1,43 @@
|
||||
--concrete ConjunctionScand of Conjunction =
|
||||
-- CatScand ** open ResScand, Coordination, Prelude in {
|
||||
--
|
||||
-- lin
|
||||
--
|
||||
-- ConjS conj ss = {s = conjunctX conj ss} ;
|
||||
-- DConjS conj ss = {s = conjunctDistrX conj ss} ;
|
||||
--
|
||||
-- ConjAdv conj ss = {s = conjunctX conj ss} ;
|
||||
-- DConjAdv conj ss = {s = conjunctDistrX conj ss} ;
|
||||
--
|
||||
-- ConjNP conj ss = conjunctTable Case conj ss ** {
|
||||
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
|
||||
-- } ;
|
||||
-- DConjNP conj ss = conjunctDistrTable Case conj ss ** {
|
||||
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
|
||||
-- } ;
|
||||
--
|
||||
-- ConjAP conj ss = conjunctTable Agr conj ss ** {
|
||||
-- isPre = ss.isPre
|
||||
-- } ;
|
||||
-- DConjAP conj ss = conjunctDistrTable Agr conj ss ** {
|
||||
-- isPre = ss.isPre
|
||||
-- } ;
|
||||
--
|
||||
---- These fun's are generated from the list cat's.
|
||||
--
|
||||
-- BaseS = twoSS ;
|
||||
-- ConsS = consrSS comma ;
|
||||
-- BaseAdv = twoSS ;
|
||||
-- ConsAdv = consrSS comma ;
|
||||
-- BaseNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ;
|
||||
-- ConsNP xs x = consrTable Case comma xs x ** {a = conjAgr xs.a x.a} ;
|
||||
-- BaseAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ;
|
||||
-- ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
|
||||
--
|
||||
-- lincat
|
||||
-- [S] = {s1,s2 : Str} ;
|
||||
-- [Adv] = {s1,s2 : Str} ;
|
||||
-- [NP] = {s1,s2 : Case => Str ; a : Agr} ;
|
||||
-- [AP] = {s1,s2 : Agr => Str ; isPre : Bool} ;
|
||||
--
|
||||
--}
|
||||
12
lib/resource-1.0/scandinavian/DiffScand.gf
Normal file
12
lib/resource-1.0/scandinavian/DiffScand.gf
Normal file
@@ -0,0 +1,12 @@
|
||||
interface DiffScand = {
|
||||
|
||||
param
|
||||
Gender ;
|
||||
|
||||
oper
|
||||
neutrum, utrum : Gender ;
|
||||
|
||||
conjThat : Str ;
|
||||
conjThan : Str ;
|
||||
infMark : Str ;
|
||||
}
|
||||
15
lib/resource-1.0/scandinavian/ExtEngAbs.gf
Normal file
15
lib/resource-1.0/scandinavian/ExtEngAbs.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
abstract ExtEngAbs = Cat ** {
|
||||
|
||||
cat
|
||||
Aux ; -- auxiliary verbs: "can", "must", etc
|
||||
|
||||
-- Notice that $Aux$ cannot form $VP$ with infinitive, imperative, etc.
|
||||
|
||||
fun
|
||||
PredAux : NP -> Aux -> VP -> Cl ;
|
||||
QuestAux : IP -> Aux -> VP -> QCl ;
|
||||
|
||||
can_Aux : Aux ;
|
||||
must_Aux : Aux ;
|
||||
|
||||
}
|
||||
26
lib/resource-1.0/scandinavian/ExtScand.gf
Normal file
26
lib/resource-1.0/scandinavian/ExtScand.gf
Normal file
@@ -0,0 +1,26 @@
|
||||
--concrete ExtScand of ExtScandAbs = CatScand ** open ResScand in {
|
||||
--
|
||||
-- lincat
|
||||
--
|
||||
-- Aux = {s : Polarity => Str} ;
|
||||
--
|
||||
-- lin
|
||||
--
|
||||
-- PredAux np aux vp = mkS (np.s ! Nom) np.a
|
||||
-- (\\t,ant,b,ord,agr =>
|
||||
-- let
|
||||
-- fin = aux.s ! b ;
|
||||
-- vf : Str -> Str -> {fin, inf : Str} = \x,y ->
|
||||
-- {fin = x ; inf = y} ;
|
||||
-- in
|
||||
-- case ant of {
|
||||
-- Simul => vf fin [] ;
|
||||
-- Anter => vf fin "have"
|
||||
-- }
|
||||
-- )
|
||||
-- (\\agr => infVP vp agr) ;
|
||||
--
|
||||
-- can_Aux = {s = \\p => posneg p "can"} ; ---- cannt
|
||||
-- must_Aux = {s = \\p => posneg p "must"} ;
|
||||
--
|
||||
--}
|
||||
50
lib/resource-1.0/scandinavian/NounScand.gf
Normal file
50
lib/resource-1.0/scandinavian/NounScand.gf
Normal file
@@ -0,0 +1,50 @@
|
||||
--concrete NounScand of Noun = CatScand ** open ResScand, Prelude in {
|
||||
--
|
||||
-- flags optimize=all_subs ;
|
||||
--
|
||||
-- lin
|
||||
-- DetCN det cn = {
|
||||
-- s = \\c => det.s ++ cn.s ! det.n ! c ;
|
||||
-- a = agrP3 det.n
|
||||
-- } ;
|
||||
-- UsePN pn = pn ** {a = agrP3 Sg} ;
|
||||
-- UsePron p = p ;
|
||||
--
|
||||
-- MkDet pred quant num ord = {
|
||||
-- s = pred.s ++ quant.s ++ num.s ++ ord.s ;
|
||||
-- n = quant.n
|
||||
-- } ;
|
||||
--
|
||||
-- PossPronSg p = {s = p.s ! Gen ; n = Sg} ;
|
||||
-- PossPronPl p = {s = p.s ! Gen ; n = Pl} ;
|
||||
--
|
||||
-- NoPredet, NoNum, NoOrd = {s = []} ;
|
||||
-- NumInt n = n ;
|
||||
--
|
||||
-- NumNumeral numeral = {s = numeral.s ! NCard} ;
|
||||
-- OrdNumeral numeral = {s = numeral.s ! NOrd} ;
|
||||
--
|
||||
-- AdNum adn num = {s = adn.s ++ num.s} ;
|
||||
--
|
||||
-- OrdSuperl a = {s = a.s ! AAdj Superl} ;
|
||||
--
|
||||
-- DefSg = {s = artDef ; n = Sg} ;
|
||||
-- DefPl = {s = artDef ; n = Pl} ;
|
||||
--
|
||||
-- IndefSg = {s = artIndef ; n = Sg} ;
|
||||
-- IndefPl = {s = [] ; n = Pl} ;
|
||||
--
|
||||
-- ComplN2 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c} ;
|
||||
-- ComplN3 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; c2 = f.c3} ;
|
||||
--
|
||||
-- AdjCN ap cn = {
|
||||
-- s = \\n,c => preOrPost ap.isPre (ap.s ! agrP3 n) (cn.s ! n ! c)
|
||||
-- } ;
|
||||
-- RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ;
|
||||
--
|
||||
-- SentCN cn s = {s = \\n,c => cn.s ! n ! c ++ conjThat ++ s.s} ;
|
||||
-- QuestCN cn qs = {s = \\n,c => cn.s ! n ! c ++ qs.s ! QIndir} ;
|
||||
--
|
||||
-- UseN n = n ;
|
||||
--
|
||||
--}
|
||||
56
lib/resource-1.0/scandinavian/ParamScand.gf
Normal file
56
lib/resource-1.0/scandinavian/ParamScand.gf
Normal file
@@ -0,0 +1,56 @@
|
||||
resource ParamScand = ParamX ** {
|
||||
|
||||
param
|
||||
Species = Indef | Def ;
|
||||
Case = Nom | Gen ;
|
||||
Voice = Act | Pass ;
|
||||
|
||||
Order = Main | Inv | Sub ;
|
||||
|
||||
DetSpecies = DIndef | DDef Species ;
|
||||
|
||||
GenNum = SgUtr | SgNeutr | Plg ;
|
||||
|
||||
AForm = AF AFormGrad Case ;
|
||||
|
||||
AFormGrad =
|
||||
APosit AFormPos
|
||||
| ACompar
|
||||
| ASuperl AFormSup ;
|
||||
|
||||
AFormPos = Strong GenNum | Weak Number ;
|
||||
AFormSup = SupStrong | SupWeak ;
|
||||
|
||||
VForm =
|
||||
VF VFin
|
||||
| VI VInf ;
|
||||
|
||||
VFin =
|
||||
VPres Voice
|
||||
| VPret Voice
|
||||
| VImper Voice ;
|
||||
|
||||
VInf =
|
||||
VInfin Voice
|
||||
| VSupin Voice
|
||||
| VPtPret AFormPos Case ;
|
||||
|
||||
SForm =
|
||||
VFinite Tense Anteriority
|
||||
| VImperat
|
||||
| VInfinit Anteriority ;
|
||||
|
||||
NPForm = NPNom | NPAcc | NPGen GenNum ;
|
||||
--- AdjPronForm = APron GenNum Case ;
|
||||
--- AuxVerbForm = AuxInf | AuxPres | AuxPret | AuxSup ;
|
||||
|
||||
CardOrd = NCard | NOrd ;
|
||||
|
||||
RCase = RNom | RAcc | RGen | RPrep ;
|
||||
|
||||
RAgr = RNoAg | RAg {gn : GenNum ; p : Person} ;
|
||||
|
||||
oper
|
||||
Agr : PType = {gn : GenNum ; p : Person} ;
|
||||
|
||||
}
|
||||
24
lib/resource-1.0/scandinavian/PhraseScand.gf
Normal file
24
lib/resource-1.0/scandinavian/PhraseScand.gf
Normal file
@@ -0,0 +1,24 @@
|
||||
incomplete concrete PhraseScand of Phrase =
|
||||
CatScand, TenseX ** open DiffScand, ResScand, Prelude in {
|
||||
|
||||
lin
|
||||
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
|
||||
|
||||
UttS s = {s = s.s ! Main} ;
|
||||
UttQS qs = {s = qs.s ! QDir} ;
|
||||
UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p ! Sg} ;
|
||||
UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Pl} ;
|
||||
|
||||
UttIP ip = {s = ip.s ! NPNom} ; --- Acc also
|
||||
UttIAdv iadv = iadv ;
|
||||
UttNP np = {s = np.s ! NPAcc} ;
|
||||
---- UttVP vp = {s = infMark ++ infVP vp (agrP3 Sg)} ;
|
||||
UttAdv adv = adv ;
|
||||
|
||||
NoPConj = {s = []} ;
|
||||
PConjConj conj = conj ;
|
||||
|
||||
NoVoc = {s = []} ;
|
||||
VocNP np = {s = "," ++ np.s ! NPNom} ;
|
||||
|
||||
}
|
||||
54
lib/resource-1.0/scandinavian/QuestionScand.gf
Normal file
54
lib/resource-1.0/scandinavian/QuestionScand.gf
Normal file
@@ -0,0 +1,54 @@
|
||||
--concrete QuestionScand of Question = CatScand ** open ResScand in {
|
||||
--
|
||||
-- flags optimize=all_subs ;
|
||||
--
|
||||
-- lin
|
||||
--
|
||||
-- QuestCl cl = {
|
||||
-- s = \\t,a,p =>
|
||||
-- let cls = cl.s ! t ! a ! p
|
||||
-- in table {
|
||||
-- QDir => cls ! OQuest ;
|
||||
-- QIndir => "if" ++ cls ! ODir
|
||||
-- } ---- "whether" in ExtScand
|
||||
-- } ;
|
||||
--
|
||||
-- QuestVP qp vp =
|
||||
-- let cl = mkS (qp.s ! Nom) {n = qp.n ; p = P3} vp.s vp.s2
|
||||
-- in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ;
|
||||
--
|
||||
-- QuestSlash ip slash = {
|
||||
-- s = \\t,a,p =>
|
||||
-- let
|
||||
-- cls = slash.s ! t ! a ! p ;
|
||||
-- who = slash.c2 ++ ip.s ! Acc --- stranding in ExtScand
|
||||
-- in table {
|
||||
-- QDir => who ++ cls ! OQuest ;
|
||||
-- QIndir => who ++ cls ! ODir
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
-- QuestIAdv iadv cl = {
|
||||
-- s = \\t,a,p =>
|
||||
-- let
|
||||
-- cls = cl.s ! t ! a ! p ;
|
||||
-- why = iadv.s
|
||||
-- in table {
|
||||
-- QDir => why ++ cls ! OQuest ;
|
||||
-- QIndir => why ++ cls ! ODir
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
-- PrepIP p ip = {s = p.s ++ ip.s ! Nom} ;
|
||||
--
|
||||
-- AdvIP ip adv = {
|
||||
-- s = \\c => ip.s ! c ++ adv.s ;
|
||||
-- n = ip.n
|
||||
-- } ;
|
||||
--
|
||||
-- IDetCN idet num ord cn = {
|
||||
-- s = \\c => idet.s ++ num.s ++ ord.s ++ cn.s ! idet.n ! c ;
|
||||
-- n = idet.n
|
||||
-- } ;
|
||||
--
|
||||
--}
|
||||
34
lib/resource-1.0/scandinavian/RelativeScand.gf
Normal file
34
lib/resource-1.0/scandinavian/RelativeScand.gf
Normal file
@@ -0,0 +1,34 @@
|
||||
--concrete RelativeScand of Relative = CatScand ** open ResScand in {
|
||||
--
|
||||
-- flags optimize=all_subs ;
|
||||
--
|
||||
-- lin
|
||||
--
|
||||
-- RelCl cl = {
|
||||
-- s = \\t,a,p,_ => "such" ++ "that" ++ cl.s ! t ! a ! p ! ODir
|
||||
-- } ;
|
||||
--
|
||||
-- RelVP rp vp = {
|
||||
-- s = \\t,ant,b,ag =>
|
||||
-- let
|
||||
-- agr = case rp.a of {
|
||||
-- RNoAg => ag ;
|
||||
-- RAg a => a
|
||||
-- } ;
|
||||
-- cl = mkS (rp.s ! Nom) agr vp.s vp.s2
|
||||
-- in
|
||||
-- cl.s ! t ! ant ! b ! ODir
|
||||
-- } ;
|
||||
--
|
||||
-- RelSlash rp slash = {
|
||||
-- s = \\t,a,p,_ => slash.c2 ++ rp.s ! Acc ++ slash.s ! t ! a ! p ! ODir
|
||||
-- } ;
|
||||
--
|
||||
-- FunRP p np rp = {
|
||||
-- s = \\c => np.s ! c ++ p.s ++ rp.s ! Acc ;
|
||||
-- a = RAg np.a
|
||||
-- } ;
|
||||
--
|
||||
-- IdRP = mkIP "which" "which" "whose" Sg ** {a = RNoAg} ;
|
||||
--
|
||||
--}
|
||||
325
lib/resource-1.0/scandinavian/ResScand.gf
Normal file
325
lib/resource-1.0/scandinavian/ResScand.gf
Normal file
@@ -0,0 +1,325 @@
|
||||
----1 Scandinavian auxiliary operations.
|
||||
--
|
||||
---- This module contains operations that are needed to make the
|
||||
---- resource syntax work. To define everything that is needed to
|
||||
---- implement $Test$, it moreover contains regular lexical
|
||||
---- patterns needed for $Lex$.
|
||||
--
|
||||
resource ResScand = ParamScand ** open Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
oper
|
||||
|
||||
-- For $Lex$.
|
||||
|
||||
-- For each lexical category, here are the worst-case constructors.
|
||||
--
|
||||
-- But $mkNoun$ is fully defined only for each language, since
|
||||
-- $Gender$ varies.
|
||||
|
||||
nounForms : (_,_,_,_ : Str) -> (Number => Species => Case => Str) =
|
||||
\man,mannen,men,mennen -> \\n,d,c => case <n,d> of {
|
||||
<Sg,Indef> => mkCase c man ;
|
||||
<Sg,Def> => mkCase c mannen ;
|
||||
<Pl,Indef> => mkCase c men ;
|
||||
<Pl,Def> => mkCase c mennen
|
||||
} ;
|
||||
|
||||
mkAdjective : (s1,_,_,_,_,_,s7 : Str) -> {s : AForm => Str} =
|
||||
\liten, litet, lilla, sma, mindre, minst, minsta -> {
|
||||
s = table {
|
||||
AF (APosit a) c => mkCase c (mkAdjPos a liten litet lilla sma) ;
|
||||
AF ACompar c => mkCase c mindre ;
|
||||
AF (ASuperl SupStrong) c => mkCase c minst ;
|
||||
AF (ASuperl SupWeak) c => mkCase c minsta
|
||||
}
|
||||
} ;
|
||||
|
||||
mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> {s : VForm => Str} =
|
||||
\finna,finner,finn,fann,funnit,funnen,funnet,funna -> {
|
||||
s = table {
|
||||
VF (VPres Act) => finner ;
|
||||
VF (VPres Pass) => mkVoice Pass finn ;
|
||||
VF (VPret v) => mkVoice v fann ;
|
||||
VF (VImper v) => mkVoice v finn ;
|
||||
VI (VInfin v) => mkVoice v finna ;
|
||||
VI (VSupin v) => mkVoice v funnit ;
|
||||
VI (VPtPret a c) => mkCase c (mkAdjPos a funnen funnet funna funna)
|
||||
}
|
||||
} ;
|
||||
|
||||
-- These are useful auxiliaries.
|
||||
|
||||
mkCase : Case -> Str -> Str = \c,f -> case c of {
|
||||
Nom => f ;
|
||||
Gen => f + case last f of {
|
||||
"s" | "x" => [] ;
|
||||
_ => "s"
|
||||
}
|
||||
} ;
|
||||
|
||||
mkAdjPos : AFormPos -> (s1,_,_,s4 : Str) -> Str =
|
||||
\a, liten, litet, lilla, sma ->
|
||||
case a of {
|
||||
Strong gn => case gn of {
|
||||
SgUtr => liten ;
|
||||
SgNeutr => litet ;
|
||||
Plg => sma
|
||||
} ;
|
||||
Weak Sg => lilla ;
|
||||
Weak Pl => sma
|
||||
} ;
|
||||
|
||||
mkVoice : Voice -> Str -> Str = \v,s -> case v of {
|
||||
Act => s ;
|
||||
Pass => s + case last s of {
|
||||
"s" => "es" ;
|
||||
_ => "s"
|
||||
}
|
||||
} ;
|
||||
|
||||
-- mkAdjective : (_,_,_,_ : Str) -> {s : AForm => Str} =
|
||||
-- \good,better,best,well -> {
|
||||
-- s = table {
|
||||
-- AAdj Posit => good ;
|
||||
-- AAdj Compar => better ;
|
||||
-- AAdj Superl => best ;
|
||||
-- AAdv => well
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
-- mkVerb : (_,_,_,_,_ : Str) -> {s : VForm => Str} =
|
||||
-- \go,goes,went,gone,going -> {
|
||||
-- s = table {
|
||||
-- VInf => go ;
|
||||
-- VPres => goes ;
|
||||
-- VPast => went ;
|
||||
-- VPPart => gone ;
|
||||
-- VPresPart => going
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
-- mkIP : (i,me,my : Str) -> Number -> {s : Case => Str ; n : Number} =
|
||||
-- \i,me,my,n -> let who = mkNP i me my n P3 in {s = who.s ; n = n} ;
|
||||
--
|
||||
-- mkNP : (i,me,my : Str) -> Number -> Person -> {s : Case => Str ; a : Agr} =
|
||||
-- \i,me,my,n,p -> {
|
||||
-- s = table {
|
||||
-- Nom => i ;
|
||||
-- Acc => me ;
|
||||
-- Gen => my
|
||||
-- } ;
|
||||
-- a = {
|
||||
-- n = n ;
|
||||
-- p = p
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
---- These functions cover many cases; full coverage inflectional patterns are
|
||||
---- in $MorphoScand$.
|
||||
--
|
||||
-- regN : Str -> {s : Number => Case => Str} = \car ->
|
||||
-- mkNoun car (car + "'s") (car + "s") (car + "s'") ;
|
||||
--
|
||||
-- regA : Str -> {s : AForm => Str} = \warm ->
|
||||
-- mkAdjective warm (warm + "er") (warm + "est") (warm + "ly") ;
|
||||
--
|
||||
-- regV : Str -> {s : VForm => Str} = \walk ->
|
||||
-- mkVerb walk (walk + "s") (walk + "ed") (walk + "ed") (walk + "ing") ;
|
||||
--
|
||||
-- regNP : Str -> Number -> {s : Case => Str ; a : Agr} = \that,n ->
|
||||
-- mkNP that that (that + "'s") n P3 ;
|
||||
--
|
||||
---- We have just a heuristic definition of the indefinite article.
|
||||
---- There are lots of exceptions: consonantic "e" ("euphemism"), consonantic
|
||||
---- "o" ("one-sided"), vocalic "u" ("umbrella").
|
||||
--
|
||||
-- artIndef = pre {
|
||||
-- "a" ;
|
||||
-- "an" / strs {"a" ; "e" ; "i" ; "o" ; "A" ; "E" ; "I" ; "O" }
|
||||
-- } ;
|
||||
--
|
||||
-- artDef = "the" ;
|
||||
--
|
||||
---- For $Verb$.
|
||||
--
|
||||
-- Verb : Type = {
|
||||
-- s : VForm => Str
|
||||
-- } ;
|
||||
--
|
||||
-- VerbForms : Type =
|
||||
-- Tense => Anteriority => Polarity => Ord => Agr => {fin, inf : Str} ;
|
||||
--
|
||||
-- VP : Type = {
|
||||
-- s : VerbForms ;
|
||||
-- s2 : Agr => Str
|
||||
-- } ;
|
||||
--
|
||||
-- predV : Verb -> VP = \verb -> {
|
||||
-- s = \\t,ant,b,ord,agr =>
|
||||
-- let
|
||||
-- inf = verb.s ! VInf ;
|
||||
-- fin = presVerb verb agr ;
|
||||
-- past = verb.s ! VPast ;
|
||||
-- part = verb.s ! VPPart ;
|
||||
-- vf : Str -> Str -> {fin, inf : Str} = \x,y ->
|
||||
-- {fin = x ; inf = y} ;
|
||||
-- in
|
||||
-- case <t,ant,b,ord> of {
|
||||
-- <Pres,Simul,Pos,ODir> => vf fin [] ;
|
||||
-- <Pres,Simul,Pos,OQuest> => vf (does agr) inf ;
|
||||
-- <Pres,Simul,Neg,_> => vf (doesnt agr) inf ;
|
||||
-- <Pres,Anter,Pos,_> => vf (have agr) part ;
|
||||
-- <Pres,Anter,Neg,_> => vf (havent agr) part ;
|
||||
-- <Past,Simul,Pos,ODir> => vf past [] ;
|
||||
-- <Past,Simul,Pos,OQuest> => vf "did" inf ;
|
||||
-- <Past,Simul,Neg,_> => vf "didn't" inf ;
|
||||
-- <Past,Anter,Pos,_> => vf "had" part ;
|
||||
-- <Past,Anter,Neg,_> => vf "hadn't" part ;
|
||||
-- <Fut, Simul,Pos,_> => vf "will" inf ;
|
||||
-- <Fut, Simul,Neg,_> => vf "won't" inf ;
|
||||
-- <Fut, Anter,Pos,_> => vf "will" ("have" ++ part) ;
|
||||
-- <Fut, Anter,Neg,_> => vf "won't" ("have" ++ part) ;
|
||||
-- <Cond,Simul,Pos,_> => vf "would" inf ;
|
||||
-- <Cond,Simul,Neg,_> => vf "wouldn't" inf ;
|
||||
-- <Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
-- <Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
-- } ;
|
||||
-- s2 = \\_ => []
|
||||
-- } ;
|
||||
--
|
||||
-- predAux : Aux -> VP = \verb -> {
|
||||
-- s = \\t,ant,b,ord,agr =>
|
||||
-- let
|
||||
-- inf = verb.inf ;
|
||||
-- fin = verb.pres ! b ! agr ;
|
||||
-- past = verb.past ! b ! agr ;
|
||||
-- part = verb.ppart ;
|
||||
-- vf : Str -> Str -> {fin, inf : Str} = \x,y ->
|
||||
-- {fin = x ; inf = y} ;
|
||||
-- in
|
||||
-- case <t,ant,b,ord> of {
|
||||
-- <Pres,Simul,_, _> => vf fin [] ;
|
||||
-- <Pres,Anter,Pos,_> => vf (have agr) part ;
|
||||
-- <Pres,Anter,Neg,_> => vf (havent agr) part ;
|
||||
-- <Past,Simul,_, _> => vf past [] ;
|
||||
-- <Past,Anter,Pos,_> => vf "had" part ;
|
||||
-- <Past,Anter,Neg,_> => vf "hadn't" part ;
|
||||
-- <Fut, Simul,Pos,_> => vf "will" inf ;
|
||||
-- <Fut, Simul,Neg,_> => vf "won't" inf ;
|
||||
-- <Fut, Anter,Pos,_> => vf "will" ("have" ++ part) ;
|
||||
-- <Fut, Anter,Neg,_> => vf "won't" ("have" ++ part) ;
|
||||
-- <Cond,Simul,Pos,_> => vf "would" inf ;
|
||||
-- <Cond,Simul,Neg,_> => vf "wouldn't" inf ;
|
||||
-- <Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
-- <Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
-- } ;
|
||||
-- s2 = \\_ => []
|
||||
-- } ;
|
||||
--
|
||||
-- insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||
-- s = vp.s ;
|
||||
-- s2 = \\a => vp.s2 ! a ++ obj ! a
|
||||
-- } ;
|
||||
--
|
||||
----- This is not functional.
|
||||
--
|
||||
-- insertAdV : Str -> VP -> VP = \adv,vp -> {
|
||||
-- s = vp.s ;
|
||||
-- s2 = vp.s2
|
||||
-- } ;
|
||||
--
|
||||
-- presVerb : {s : VForm => Str} -> Agr -> Str = \verb ->
|
||||
-- agrVerb (verb.s ! VPres) (verb.s ! VInf) ;
|
||||
--
|
||||
-- infVP : VP -> Agr -> Str = \vp,a ->
|
||||
-- (vp.s ! Fut ! Simul ! Neg ! ODir ! a).inf ++ vp.s2 ! a ;
|
||||
--
|
||||
-- agrVerb : Str -> Str -> Agr -> Str = \has,have,agr ->
|
||||
-- case agr of {
|
||||
-- {n = Sg ; p = P3} => has ;
|
||||
-- _ => have
|
||||
-- } ;
|
||||
--
|
||||
-- have = agrVerb "has" "have" ;
|
||||
-- havent = agrVerb "hasn't" "haven't" ;
|
||||
-- does = agrVerb "does" "do" ;
|
||||
-- doesnt = agrVerb "doesn't" "don't" ;
|
||||
--
|
||||
-- Aux = {pres,past : Polarity => Agr => Str ; inf,ppart : Str} ;
|
||||
--
|
||||
-- auxBe : Aux = {
|
||||
-- pres = \\b,a => case <b,a> of {
|
||||
-- <Pos,{n = Sg ; p = P1}> => "am" ;
|
||||
-- <Neg,{n = Sg ; p = P1}> => ["am not"] ; --- am not I
|
||||
-- _ => agrVerb (posneg b "is") (posneg b "are") a
|
||||
-- } ;
|
||||
-- past = \\b,a => agrVerb (posneg b "was") (posneg b "were") a ;
|
||||
-- inf = "be" ;
|
||||
-- ppart = "been"
|
||||
-- } ;
|
||||
--
|
||||
-- posneg : Polarity -> Str -> Str = \p,s -> case p of {
|
||||
-- Pos => s ;
|
||||
-- Neg => s + "n't"
|
||||
-- } ;
|
||||
--
|
||||
-- conjThat : Str = "that" ;
|
||||
--
|
||||
-- reflPron : Agr => Str = table {
|
||||
-- {n = Sg ; p = P1} => "myself" ;
|
||||
-- {n = Sg ; p = P2} => "yourself" ;
|
||||
-- {n = Sg ; p = P3} => "itself" ; ----
|
||||
-- {n = Pl ; p = P1} => "ourselves" ;
|
||||
-- {n = Pl ; p = P2} => "yourselves" ;
|
||||
-- {n = Pl ; p = P3} => "themselves"
|
||||
-- } ;
|
||||
--
|
||||
---- For $Sentence$.
|
||||
--
|
||||
-- Clause : Type = {
|
||||
-- s : Tense => Anteriority => Polarity => Ord => Str
|
||||
-- } ;
|
||||
--
|
||||
-- mkS : Str -> Agr -> VerbForms -> (Agr => Str) -> Clause =
|
||||
-- \subj,agr,verb,compl0 -> {
|
||||
-- s = \\t,a,b,o =>
|
||||
-- let
|
||||
-- verb = verb ! t ! a ! b ! o ! agr ;
|
||||
-- compl = compl0 ! agr
|
||||
-- in
|
||||
-- case o of {
|
||||
-- ODir => subj ++ verb.fin ++ verb.inf ++ compl ;
|
||||
-- OQuest => verb.fin ++ subj ++ verb.inf ++ compl
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
--
|
||||
---- For $Numeral$.
|
||||
--
|
||||
-- mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} =
|
||||
-- \two, twelve, twenty, second ->
|
||||
-- {s = table {
|
||||
-- unit => table {NCard => two ; NOrd => second} ;
|
||||
-- teen => \\c => mkCard c twelve ;
|
||||
-- ten => \\c => mkCard c twenty
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
-- regNum : Str -> {s : DForm => CardOrd => Str} =
|
||||
-- \six -> mkNum six (six + "teen") (six + "ty") (regOrd six) ;
|
||||
--
|
||||
-- regCardOrd : Str -> {s : CardOrd => Str} = \ten ->
|
||||
-- {s = table {NCard => ten ; NOrd => regOrd ten}} ;
|
||||
--
|
||||
-- mkCard : CardOrd -> Str -> Str = \c,ten ->
|
||||
-- (regCardOrd ten).s ! c ;
|
||||
--
|
||||
-- regOrd : Str -> Str = \ten ->
|
||||
-- case last ten of {
|
||||
-- "y" => init ten + "ieth" ;
|
||||
-- _ => ten + "th"
|
||||
-- } ;
|
||||
--
|
||||
}
|
||||
37
lib/resource-1.0/scandinavian/SentenceScand.gf
Normal file
37
lib/resource-1.0/scandinavian/SentenceScand.gf
Normal file
@@ -0,0 +1,37 @@
|
||||
--concrete SentenceScand of Sentence = CatScand ** open ResScand in {
|
||||
--
|
||||
-- flags optimize=all_subs ;
|
||||
--
|
||||
-- lin
|
||||
-- PredVP np vp = mkS (np.s ! Nom) np.a vp.s vp.s2 ;
|
||||
--
|
||||
-- PredSCVP sc vp = mkS sc.s (agrP3 Sg) vp.s vp.s2 ;
|
||||
--
|
||||
-- ImpVP vp = {
|
||||
-- s = \\pol,n =>
|
||||
-- let
|
||||
-- agr = {n = n ; p = P2} ;
|
||||
-- verb = infVP vp agr ;
|
||||
-- dont = case pol of {
|
||||
-- Neg => "don't" ;
|
||||
-- _ => []
|
||||
-- }
|
||||
-- in
|
||||
-- dont ++ verb
|
||||
-- } ;
|
||||
--
|
||||
-- SlashV2 np v2 = mkS (np.s ! Nom) np.a (predV v2).s (\\_ => []) **
|
||||
-- {c2 = v2.c2} ;
|
||||
--
|
||||
-- SlashVVV2 np vv v2 =
|
||||
-- mkS (np.s ! Nom) np.a (predV vv).s (\\_ => "to" ++ v2.s ! VInf) **
|
||||
-- {c2 = v2.c2} ;
|
||||
--
|
||||
-- AdvSlash slash adv = {
|
||||
-- s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ;
|
||||
-- c2 = slash.c2
|
||||
-- } ;
|
||||
--
|
||||
-- SlashPrep cl prep = cl ** {c2 = prep.s} ;
|
||||
--
|
||||
--}
|
||||
41
lib/resource-1.0/scandinavian/SeqConjunctionScand.gf
Normal file
41
lib/resource-1.0/scandinavian/SeqConjunctionScand.gf
Normal file
@@ -0,0 +1,41 @@
|
||||
--concrete SeqConjunctionScand of Conjunction =
|
||||
-- CatScand ** open ResScand, Coordination, Prelude in {
|
||||
--
|
||||
-- lin
|
||||
--
|
||||
-- ConjS conj ss = {s = conjunctX conj ss} ;
|
||||
-- DConjS conj ss = {s = conjunctDistrX conj ss} ;
|
||||
--
|
||||
-- ConjAdv conj ss = {s = conjunctX conj ss} ;
|
||||
-- DConjAdv conj ss = {s = conjunctDistrX conj ss} ;
|
||||
--
|
||||
-- ConjNP conj ss = conjunctTable Case conj ss ** {
|
||||
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
|
||||
-- } ;
|
||||
-- DConjNP conj ss = conjunctDistrTable Case conj ss ** {
|
||||
-- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p}
|
||||
-- } ;
|
||||
--
|
||||
-- ConjAP conj ss = conjunctTable Agr conj ss ** {
|
||||
-- isPre = ss.isPre
|
||||
-- } ;
|
||||
-- DConjAP conj ss = conjunctDistrTable Agr conj ss ** {
|
||||
-- isPre = ss.isPre
|
||||
-- } ;
|
||||
--
|
||||
-- TwoS = twoSS ;
|
||||
-- AddS = consSS comma ;
|
||||
-- TwoAdv = twoSS ;
|
||||
-- AddAdv = consSS comma ;
|
||||
-- TwoNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ;
|
||||
-- AddNP xs x = consTable Case comma xs x ** {a = conjAgr xs.a x.a} ;
|
||||
-- TwoAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ;
|
||||
-- AddAP xs x = consTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ;
|
||||
--
|
||||
-- lincat
|
||||
-- SeqS = {s1,s2 : Str} ;
|
||||
-- SeqAdv = {s1,s2 : Str} ;
|
||||
-- SeqNP = {s1,s2 : Case => Str ; a : Agr} ;
|
||||
-- SeqAP = {s1,s2 : Agr => Str ; isPre : Bool} ;
|
||||
--
|
||||
--}
|
||||
10
lib/resource-1.0/scandinavian/TensedScand.gf
Normal file
10
lib/resource-1.0/scandinavian/TensedScand.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
--concrete TensedScand of Tensed = CatScand, TenseX ** open ResScand in {
|
||||
--
|
||||
-- flags optimize=all_subs ;
|
||||
--
|
||||
-- lin
|
||||
-- UseCl t a p cl = {s = t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! ODir} ;
|
||||
-- UseQCl t a p cl = {s = \\q => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! q} ;
|
||||
-- UseRCl t a p cl = {s = \\r => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r} ;
|
||||
--
|
||||
--}
|
||||
15
lib/resource-1.0/scandinavian/UntensedScand.gf
Normal file
15
lib/resource-1.0/scandinavian/UntensedScand.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
--concrete UntensedScand of Untensed = CatScand ** open ResScand in {
|
||||
--
|
||||
-- flags optimize=all_subs ;
|
||||
--
|
||||
-- lin
|
||||
-- PosCl cl = {s = cl.s ! Pres ! Simul ! Pos ! ODir} ;
|
||||
-- NegCl cl = {s = cl.s ! Pres ! Simul ! Neg ! ODir} ;
|
||||
--
|
||||
-- PosQCl cl = {s = cl.s ! Pres ! Simul ! Pos} ;
|
||||
-- NegQCl cl = {s = cl.s ! Pres ! Simul ! Neg} ;
|
||||
--
|
||||
-- PosRCl cl = {s = cl.s ! Pres ! Simul ! Pos} ;
|
||||
-- NegRCl cl = {s = cl.s ! Pres ! Simul ! Neg} ;
|
||||
--
|
||||
--}
|
||||
38
lib/resource-1.0/scandinavian/VerbScand.gf
Normal file
38
lib/resource-1.0/scandinavian/VerbScand.gf
Normal file
@@ -0,0 +1,38 @@
|
||||
--concrete VerbScand of Verb = CatScand ** open ResScand in {
|
||||
--
|
||||
-- flags optimize=all_subs ;
|
||||
--
|
||||
-- lin
|
||||
-- UseV = predV ;
|
||||
-- ComplV2 v np = insertObj (\\_ => v.c2 ++ np.s ! Acc) (predV v) ;
|
||||
-- ComplV3 v np np2 =
|
||||
-- insertObj (\\_ => v.c2 ++ np.s ! Acc ++ v.c3 ++ np2.s ! Acc) (predV v) ;
|
||||
--
|
||||
-- ComplVV v vp = insertObj (\\a => v.c2 ++ infVP vp a) (predV v) ;
|
||||
-- ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ;
|
||||
-- ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ;
|
||||
--
|
||||
-- ComplVA v ap = insertObj (ap.s) (predV v) ;
|
||||
-- ComplV2A v np ap =
|
||||
-- insertObj (\\_ => v.c2 ++ np.s ! Acc ++ ap.s ! np.a) (predV v) ;
|
||||
--
|
||||
-- UseComp comp = insertObj comp.s (predAux auxBe) ;
|
||||
--
|
||||
-- AdvVP vp adv = insertObj (\\_ => adv.s) vp ;
|
||||
------ AdVVP adv vp = insertAdV adv.s vp ;
|
||||
--
|
||||
-- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ;
|
||||
--
|
||||
-- PassV2 v = {s = \\_ => v.s ! VPPart} ;
|
||||
--
|
||||
-- UseVV, UseVS, UseVQ = \vv -> {s = vv.s ; c2 = []} ; -- no "to"
|
||||
--
|
||||
-- CompAP ap = ap ;
|
||||
-- CompNP np = {s = \\_ => np.s ! Acc} ;
|
||||
-- CompAdv a = {s = \\_ => a.s} ;
|
||||
--
|
||||
-- EmbedS s = {s = conjThat ++ s.s} ;
|
||||
-- EmbedQS qs = {s = qs.s ! QIndir} ;
|
||||
-- EmbedVP vp = {s = infVP vp (agrP3 Sg)} ; --- agr
|
||||
--
|
||||
--}
|
||||
2
lib/resource-1.0/swedish/AdjectiveSwe.gf
Normal file
2
lib/resource-1.0/swedish/AdjectiveSwe.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete AdjectiveSwe of Adjective = CatSwe ** AdjectiveScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
2
lib/resource-1.0/swedish/AdverbSwe.gf
Normal file
2
lib/resource-1.0/swedish/AdverbSwe.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete AdverbSwe of Adverb = CatSwe ** AdverbScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
2
lib/resource-1.0/swedish/CatSwe.gf
Normal file
2
lib/resource-1.0/swedish/CatSwe.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete CatSwe of Cat = CatScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
17
lib/resource-1.0/swedish/DiffSwe.gf
Normal file
17
lib/resource-1.0/swedish/DiffSwe.gf
Normal file
@@ -0,0 +1,17 @@
|
||||
instance DiffSwe of DiffScand = {
|
||||
|
||||
-- Parameters.
|
||||
|
||||
param
|
||||
Gender = Utr | Neutr ;
|
||||
|
||||
oper
|
||||
utrum = Utr ; neutrum = Neutr ;
|
||||
|
||||
-- Strings.
|
||||
|
||||
conjThat = "att" ;
|
||||
conjThan = "än" ;
|
||||
infMark = "att" ;
|
||||
|
||||
}
|
||||
72
lib/resource-1.0/swedish/LexSwe.gf
Normal file
72
lib/resource-1.0/swedish/LexSwe.gf
Normal file
@@ -0,0 +1,72 @@
|
||||
concrete LexSwe of Lex = CatSwe ** open ResSwe, Prelude in {
|
||||
|
||||
lin
|
||||
walk_V =
|
||||
mkVerb "gå" "går" "gå" "gick" "gått" "gången" "gånget" "gångna" ;
|
||||
help_V2 =
|
||||
mkVerb "hjälpa" "hjälper" "hjälp" "hjälpte" "hjälpt" "hjälpt" "hjälpt" "hjälpta"
|
||||
** {c2 = []} ;
|
||||
show_V3 =
|
||||
mkVerb "visa" "visar" "visa" "visade" "visat" "visad" "visat" "visade"
|
||||
** {c2 = [] ; c3 = "to"} ;
|
||||
want_VV =
|
||||
mkVerb "vilja" "vill" "vilj" "ville" "velat" "velad" "velat" "velade" ---
|
||||
** {c2 = []} ;
|
||||
claim_VS =
|
||||
mkVerb "hävda" "hävdar" "hävda" "hävdade" "hävdat" "hävdad" "hävdat" "hävdade" ;
|
||||
ask_VQ =
|
||||
mkVerb "fråga" "frågar" "fråga" "frågade" "frågat" "frågad" "frågat" "frågade" ;
|
||||
|
||||
dog_N = mkNoun "hund" "hunden" "hundar" "hundarna" utrum ;
|
||||
son_N2 = mkNoun "son" "sonen" "söner" "sönerna" utrum ** {c2 = "till"} ;
|
||||
way_N3 = mkNoun "väg" "vägen" "vägar" "vägarna" utrum ** {c2 = "från" ; c3 = "till"} ;
|
||||
|
||||
warm_A =
|
||||
mkAdjective "varm" "varmt" "varma" "varma" "varmare" "varmast" "varmaste" ;
|
||||
close_A2 =
|
||||
mkAdjective "nära" "nära" "nära" "nära" "närmare" "närmast" "närmaste"
|
||||
** {c2 = "to"} ;
|
||||
|
||||
here_Adv = {s = "här"} ;
|
||||
very_AdA = {s = "mycket"} ;
|
||||
always_AdV = {s = "alltid"} ;
|
||||
--
|
||||
-- only_Predet = {s = "bara"} ;
|
||||
-- all_Predet = {s = "alla"} ;
|
||||
-- this_Quant = {s = "this" ; n = Sg} ;
|
||||
-- these_Quant = {s = "these" ; n = Pl} ;
|
||||
--
|
||||
-- i_Pron = mkNP "I" "me" "my" Sg P1 ;
|
||||
-- he_Pron = mkNP "he" "him" "his" Sg P3 ;
|
||||
-- we_Pron = mkNP "we" "us" "our" Pl P1 ;
|
||||
--
|
||||
-- whoSg_IP = mkIP "who" "whom" "whose" Sg ;
|
||||
-- whoPl_IP = mkIP "who" "whom" "whose" Pl ;
|
||||
--
|
||||
when_IAdv = {s = "när"} ;
|
||||
where_IAdv = {s = "var"} ;
|
||||
why_IAdv = {s = "varför"} ;
|
||||
--
|
||||
-- whichSg_IDet = {s = "which" ; n = Sg} ;
|
||||
-- whichPl_IDet = {s = "which" ; n = Pl} ;
|
||||
--
|
||||
-- one_Numeral = {s = table {NCard => "one" ; NOrd => "first"} ; n = Sg} ;
|
||||
-- forty_Numeral = {s = table {NCard => "forty" ; NOrd => "fortieth"} ; n = Pl} ;
|
||||
|
||||
in_Prep = {s = "i"} ;
|
||||
of_Prep = {s = "av"} ;
|
||||
|
||||
and_Conj = {s = "och" ; n = Pl} ;
|
||||
either7or_DConj = {s1 = "antingen" ; s2 = "eller" ; n = Sg} ;
|
||||
|
||||
if_Subj = ss "om" ;
|
||||
because_Subj = ss "eftersom" ;
|
||||
|
||||
but_PConj = {s = "men"} ;
|
||||
|
||||
please_Voc = {s = "," ++ "tack"} ;
|
||||
|
||||
more_CAdv = ss "mera" ;
|
||||
less_CAdv = ss "mindre" ;
|
||||
|
||||
}
|
||||
2
lib/resource-1.0/swedish/PhraseSwe.gf
Normal file
2
lib/resource-1.0/swedish/PhraseSwe.gf
Normal file
@@ -0,0 +1,2 @@
|
||||
concrete PhraseSwe of Phrase = CatSwe, TenseX ** PhraseScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
268
lib/resource-1.0/swedish/ResSwe.gf
Normal file
268
lib/resource-1.0/swedish/ResSwe.gf
Normal file
@@ -0,0 +1,268 @@
|
||||
----1 Swedish auxiliary operations.
|
||||
--
|
||||
---- This module contains operations that are needed to make the
|
||||
---- resource syntax work. To define everything that is needed to
|
||||
---- implement $Test$, it moreover contains regular lexical
|
||||
---- patterns needed for $Lex$.
|
||||
--
|
||||
resource ResSwe = ParamScand, ResScand, DiffSwe ** open Prelude in {
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
oper
|
||||
|
||||
-- For $Lex$.
|
||||
|
||||
-- For each lexical category, here are the worst-case constructors.
|
||||
|
||||
mkNoun : (_,_,_,_ : Str) -> Gender ->
|
||||
{s : Number => Species => Case => Str ; g : Gender} =
|
||||
\man,mannen,men,mennen,g -> {
|
||||
s = nounForms man mannen men mennen ;
|
||||
g = g
|
||||
} ;
|
||||
|
||||
-- mkAdjective : (_,_,_,_ : Str) -> {s : AForm => Str} =
|
||||
-- \good,better,best,well -> {
|
||||
-- s = table {
|
||||
-- AAdj Posit => good ;
|
||||
-- AAdj Compar => better ;
|
||||
-- AAdj Superl => best ;
|
||||
-- AAdv => well
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
-- mkVerb : (_,_,_,_,_ : Str) -> {s : VForm => Str} =
|
||||
-- \go,goes,went,gone,going -> {
|
||||
-- s = table {
|
||||
-- VInf => go ;
|
||||
-- VPres => goes ;
|
||||
-- VPast => went ;
|
||||
-- VPPart => gone ;
|
||||
-- VPresPart => going
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
-- mkIP : (i,me,my : Str) -> Number -> {s : Case => Str ; n : Number} =
|
||||
-- \i,me,my,n -> let who = mkNP i me my n P3 in {s = who.s ; n = n} ;
|
||||
--
|
||||
-- mkNP : (i,me,my : Str) -> Number -> Person -> {s : Case => Str ; a : Agr} =
|
||||
-- \i,me,my,n,p -> {
|
||||
-- s = table {
|
||||
-- Nom => i ;
|
||||
-- Acc => me ;
|
||||
-- Gen => my
|
||||
-- } ;
|
||||
-- a = {
|
||||
-- n = n ;
|
||||
-- p = p
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
---- These functions cover many cases; full coverage inflectional patterns are
|
||||
---- in $MorphoScand$.
|
||||
--
|
||||
-- regN : Str -> {s : Number => Case => Str} = \car ->
|
||||
-- mkNoun car (car + "'s") (car + "s") (car + "s'") ;
|
||||
--
|
||||
-- regA : Str -> {s : AForm => Str} = \warm ->
|
||||
-- mkAdjective warm (warm + "er") (warm + "est") (warm + "ly") ;
|
||||
--
|
||||
-- regV : Str -> {s : VForm => Str} = \walk ->
|
||||
-- mkVerb walk (walk + "s") (walk + "ed") (walk + "ed") (walk + "ing") ;
|
||||
--
|
||||
-- regNP : Str -> Number -> {s : Case => Str ; a : Agr} = \that,n ->
|
||||
-- mkNP that that (that + "'s") n P3 ;
|
||||
--
|
||||
---- We have just a heuristic definition of the indefinite article.
|
||||
---- There are lots of exceptions: consonantic "e" ("euphemism"), consonantic
|
||||
---- "o" ("one-sided"), vocalic "u" ("umbrella").
|
||||
--
|
||||
-- artIndef = pre {
|
||||
-- "a" ;
|
||||
-- "an" / strs {"a" ; "e" ; "i" ; "o" ; "A" ; "E" ; "I" ; "O" }
|
||||
-- } ;
|
||||
--
|
||||
-- artDef = "the" ;
|
||||
--
|
||||
---- For $Verb$.
|
||||
--
|
||||
-- Verb : Type = {
|
||||
-- s : VForm => Str
|
||||
-- } ;
|
||||
--
|
||||
-- VerbForms : Type =
|
||||
-- Tense => Anteriority => Polarity => Ord => Agr => {fin, inf : Str} ;
|
||||
--
|
||||
-- VP : Type = {
|
||||
-- s : VerbForms ;
|
||||
-- s2 : Agr => Str
|
||||
-- } ;
|
||||
--
|
||||
-- predV : Verb -> VP = \verb -> {
|
||||
-- s = \\t,ant,b,ord,agr =>
|
||||
-- let
|
||||
-- inf = verb.s ! VInf ;
|
||||
-- fin = presVerb verb agr ;
|
||||
-- past = verb.s ! VPast ;
|
||||
-- part = verb.s ! VPPart ;
|
||||
-- vf : Str -> Str -> {fin, inf : Str} = \x,y ->
|
||||
-- {fin = x ; inf = y} ;
|
||||
-- in
|
||||
-- case <t,ant,b,ord> of {
|
||||
-- <Pres,Simul,Pos,ODir> => vf fin [] ;
|
||||
-- <Pres,Simul,Pos,OQuest> => vf (does agr) inf ;
|
||||
-- <Pres,Simul,Neg,_> => vf (doesnt agr) inf ;
|
||||
-- <Pres,Anter,Pos,_> => vf (have agr) part ;
|
||||
-- <Pres,Anter,Neg,_> => vf (havent agr) part ;
|
||||
-- <Past,Simul,Pos,ODir> => vf past [] ;
|
||||
-- <Past,Simul,Pos,OQuest> => vf "did" inf ;
|
||||
-- <Past,Simul,Neg,_> => vf "didn't" inf ;
|
||||
-- <Past,Anter,Pos,_> => vf "had" part ;
|
||||
-- <Past,Anter,Neg,_> => vf "hadn't" part ;
|
||||
-- <Fut, Simul,Pos,_> => vf "will" inf ;
|
||||
-- <Fut, Simul,Neg,_> => vf "won't" inf ;
|
||||
-- <Fut, Anter,Pos,_> => vf "will" ("have" ++ part) ;
|
||||
-- <Fut, Anter,Neg,_> => vf "won't" ("have" ++ part) ;
|
||||
-- <Cond,Simul,Pos,_> => vf "would" inf ;
|
||||
-- <Cond,Simul,Neg,_> => vf "wouldn't" inf ;
|
||||
-- <Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
-- <Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
-- } ;
|
||||
-- s2 = \\_ => []
|
||||
-- } ;
|
||||
--
|
||||
-- predAux : Aux -> VP = \verb -> {
|
||||
-- s = \\t,ant,b,ord,agr =>
|
||||
-- let
|
||||
-- inf = verb.inf ;
|
||||
-- fin = verb.pres ! b ! agr ;
|
||||
-- past = verb.past ! b ! agr ;
|
||||
-- part = verb.ppart ;
|
||||
-- vf : Str -> Str -> {fin, inf : Str} = \x,y ->
|
||||
-- {fin = x ; inf = y} ;
|
||||
-- in
|
||||
-- case <t,ant,b,ord> of {
|
||||
-- <Pres,Simul,_, _> => vf fin [] ;
|
||||
-- <Pres,Anter,Pos,_> => vf (have agr) part ;
|
||||
-- <Pres,Anter,Neg,_> => vf (havent agr) part ;
|
||||
-- <Past,Simul,_, _> => vf past [] ;
|
||||
-- <Past,Anter,Pos,_> => vf "had" part ;
|
||||
-- <Past,Anter,Neg,_> => vf "hadn't" part ;
|
||||
-- <Fut, Simul,Pos,_> => vf "will" inf ;
|
||||
-- <Fut, Simul,Neg,_> => vf "won't" inf ;
|
||||
-- <Fut, Anter,Pos,_> => vf "will" ("have" ++ part) ;
|
||||
-- <Fut, Anter,Neg,_> => vf "won't" ("have" ++ part) ;
|
||||
-- <Cond,Simul,Pos,_> => vf "would" inf ;
|
||||
-- <Cond,Simul,Neg,_> => vf "wouldn't" inf ;
|
||||
-- <Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
-- <Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
-- } ;
|
||||
-- s2 = \\_ => []
|
||||
-- } ;
|
||||
--
|
||||
-- insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||
-- s = vp.s ;
|
||||
-- s2 = \\a => vp.s2 ! a ++ obj ! a
|
||||
-- } ;
|
||||
--
|
||||
----- This is not functional.
|
||||
--
|
||||
-- insertAdV : Str -> VP -> VP = \adv,vp -> {
|
||||
-- s = vp.s ;
|
||||
-- s2 = vp.s2
|
||||
-- } ;
|
||||
--
|
||||
-- presVerb : {s : VForm => Str} -> Agr -> Str = \verb ->
|
||||
-- agrVerb (verb.s ! VPres) (verb.s ! VInf) ;
|
||||
--
|
||||
-- infVP : VP -> Agr -> Str = \vp,a ->
|
||||
-- (vp.s ! Fut ! Simul ! Neg ! ODir ! a).inf ++ vp.s2 ! a ;
|
||||
--
|
||||
-- agrVerb : Str -> Str -> Agr -> Str = \has,have,agr ->
|
||||
-- case agr of {
|
||||
-- {n = Sg ; p = P3} => has ;
|
||||
-- _ => have
|
||||
-- } ;
|
||||
--
|
||||
-- have = agrVerb "has" "have" ;
|
||||
-- havent = agrVerb "hasn't" "haven't" ;
|
||||
-- does = agrVerb "does" "do" ;
|
||||
-- doesnt = agrVerb "doesn't" "don't" ;
|
||||
--
|
||||
-- Aux = {pres,past : Polarity => Agr => Str ; inf,ppart : Str} ;
|
||||
--
|
||||
-- auxBe : Aux = {
|
||||
-- pres = \\b,a => case <b,a> of {
|
||||
-- <Pos,{n = Sg ; p = P1}> => "am" ;
|
||||
-- <Neg,{n = Sg ; p = P1}> => ["am not"] ; --- am not I
|
||||
-- _ => agrVerb (posneg b "is") (posneg b "are") a
|
||||
-- } ;
|
||||
-- past = \\b,a => agrVerb (posneg b "was") (posneg b "were") a ;
|
||||
-- inf = "be" ;
|
||||
-- ppart = "been"
|
||||
-- } ;
|
||||
--
|
||||
-- posneg : Polarity -> Str -> Str = \p,s -> case p of {
|
||||
-- Pos => s ;
|
||||
-- Neg => s + "n't"
|
||||
-- } ;
|
||||
--
|
||||
-- conjThat : Str = "that" ;
|
||||
--
|
||||
-- reflPron : Agr => Str = table {
|
||||
-- {n = Sg ; p = P1} => "myself" ;
|
||||
-- {n = Sg ; p = P2} => "yourself" ;
|
||||
-- {n = Sg ; p = P3} => "itself" ; ----
|
||||
-- {n = Pl ; p = P1} => "ourselves" ;
|
||||
-- {n = Pl ; p = P2} => "yourselves" ;
|
||||
-- {n = Pl ; p = P3} => "themselves"
|
||||
-- } ;
|
||||
--
|
||||
---- For $Sentence$.
|
||||
--
|
||||
-- Clause : Type = {
|
||||
-- s : Tense => Anteriority => Polarity => Ord => Str
|
||||
-- } ;
|
||||
--
|
||||
-- mkS : Str -> Agr -> VerbForms -> (Agr => Str) -> Clause =
|
||||
-- \subj,agr,verb,compl0 -> {
|
||||
-- s = \\t,a,b,o =>
|
||||
-- let
|
||||
-- verb = verb ! t ! a ! b ! o ! agr ;
|
||||
-- compl = compl0 ! agr
|
||||
-- in
|
||||
-- case o of {
|
||||
-- ODir => subj ++ verb.fin ++ verb.inf ++ compl ;
|
||||
-- OQuest => verb.fin ++ subj ++ verb.inf ++ compl
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
--
|
||||
---- For $Numeral$.
|
||||
--
|
||||
-- mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} =
|
||||
-- \two, twelve, twenty, second ->
|
||||
-- {s = table {
|
||||
-- unit => table {NCard => two ; NOrd => second} ;
|
||||
-- teen => \\c => mkCard c twelve ;
|
||||
-- ten => \\c => mkCard c twenty
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
-- regNum : Str -> {s : DForm => CardOrd => Str} =
|
||||
-- \six -> mkNum six (six + "teen") (six + "ty") (regOrd six) ;
|
||||
--
|
||||
-- regCardOrd : Str -> {s : CardOrd => Str} = \ten ->
|
||||
-- {s = table {NCard => ten ; NOrd => regOrd ten}} ;
|
||||
--
|
||||
-- mkCard : CardOrd -> Str -> Str = \c,ten ->
|
||||
-- (regCardOrd ten).s ! c ;
|
||||
--
|
||||
-- regOrd : Str -> Str = \ten ->
|
||||
-- case last ten of {
|
||||
-- "y" => init ten + "ieth" ;
|
||||
-- _ => ten + "th"
|
||||
-- } ;
|
||||
--
|
||||
}
|
||||
21
lib/resource-1.0/swedish/TestSwe.gf
Normal file
21
lib/resource-1.0/swedish/TestSwe.gf
Normal file
@@ -0,0 +1,21 @@
|
||||
--# -path=.:../scandinavian:../abstract:../common:prelude
|
||||
|
||||
concrete TestSwe of Test =
|
||||
-- NounSwe,
|
||||
-- VerbSwe,
|
||||
AdjectiveSwe,
|
||||
AdverbSwe,
|
||||
-- -- NumeralSwe,
|
||||
-- SentenceSwe,
|
||||
-- QuestionSwe,
|
||||
-- RelativeSwe,
|
||||
-- ConjunctionSwe,
|
||||
PhraseSwe,
|
||||
-- UntensedSwe,
|
||||
-- -- TensedSwe,
|
||||
LexSwe
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
|
||||
} ;
|
||||
Reference in New Issue
Block a user