From a4d3f7e7c7e8c342e1eb46e26bebd0bcc7263bea Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 6 Dec 2005 22:19:43 +0000 Subject: [PATCH] started Swedish --- .../scandinavian/AdjectiveScand.gf | 43 +++ lib/resource-1.0/scandinavian/AdverbScand.gf | 28 ++ lib/resource-1.0/scandinavian/CatScand.gf | 71 ++++ .../scandinavian/ConjunctionScand.gf | 43 +++ lib/resource-1.0/scandinavian/DiffScand.gf | 12 + lib/resource-1.0/scandinavian/ExtEngAbs.gf | 15 + lib/resource-1.0/scandinavian/ExtScand.gf | 26 ++ lib/resource-1.0/scandinavian/NounScand.gf | 50 +++ lib/resource-1.0/scandinavian/ParamScand.gf | 56 +++ lib/resource-1.0/scandinavian/PhraseScand.gf | 24 ++ .../scandinavian/QuestionScand.gf | 54 +++ .../scandinavian/RelativeScand.gf | 34 ++ lib/resource-1.0/scandinavian/ResScand.gf | 325 ++++++++++++++++++ .../scandinavian/SentenceScand.gf | 37 ++ .../scandinavian/SeqConjunctionScand.gf | 41 +++ lib/resource-1.0/scandinavian/TensedScand.gf | 10 + .../scandinavian/UntensedScand.gf | 15 + lib/resource-1.0/scandinavian/VerbScand.gf | 38 ++ lib/resource-1.0/swedish/AdjectiveSwe.gf | 2 + lib/resource-1.0/swedish/AdverbSwe.gf | 2 + lib/resource-1.0/swedish/CatSwe.gf | 2 + lib/resource-1.0/swedish/DiffSwe.gf | 17 + lib/resource-1.0/swedish/LexSwe.gf | 72 ++++ lib/resource-1.0/swedish/PhraseSwe.gf | 2 + lib/resource-1.0/swedish/ResSwe.gf | 268 +++++++++++++++ lib/resource-1.0/swedish/TestSwe.gf | 21 ++ 26 files changed, 1308 insertions(+) create mode 100644 lib/resource-1.0/scandinavian/AdjectiveScand.gf create mode 100644 lib/resource-1.0/scandinavian/AdverbScand.gf create mode 100644 lib/resource-1.0/scandinavian/CatScand.gf create mode 100644 lib/resource-1.0/scandinavian/ConjunctionScand.gf create mode 100644 lib/resource-1.0/scandinavian/DiffScand.gf create mode 100644 lib/resource-1.0/scandinavian/ExtEngAbs.gf create mode 100644 lib/resource-1.0/scandinavian/ExtScand.gf create mode 100644 lib/resource-1.0/scandinavian/NounScand.gf create mode 100644 lib/resource-1.0/scandinavian/ParamScand.gf create mode 100644 lib/resource-1.0/scandinavian/PhraseScand.gf create mode 100644 lib/resource-1.0/scandinavian/QuestionScand.gf create mode 100644 lib/resource-1.0/scandinavian/RelativeScand.gf create mode 100644 lib/resource-1.0/scandinavian/ResScand.gf create mode 100644 lib/resource-1.0/scandinavian/SentenceScand.gf create mode 100644 lib/resource-1.0/scandinavian/SeqConjunctionScand.gf create mode 100644 lib/resource-1.0/scandinavian/TensedScand.gf create mode 100644 lib/resource-1.0/scandinavian/UntensedScand.gf create mode 100644 lib/resource-1.0/scandinavian/VerbScand.gf create mode 100644 lib/resource-1.0/swedish/AdjectiveSwe.gf create mode 100644 lib/resource-1.0/swedish/AdverbSwe.gf create mode 100644 lib/resource-1.0/swedish/CatSwe.gf create mode 100644 lib/resource-1.0/swedish/DiffSwe.gf create mode 100644 lib/resource-1.0/swedish/LexSwe.gf create mode 100644 lib/resource-1.0/swedish/PhraseSwe.gf create mode 100644 lib/resource-1.0/swedish/ResSwe.gf create mode 100644 lib/resource-1.0/swedish/TestSwe.gf diff --git a/lib/resource-1.0/scandinavian/AdjectiveScand.gf b/lib/resource-1.0/scandinavian/AdjectiveScand.gf new file mode 100644 index 000000000..cd493b6aa --- /dev/null +++ b/lib/resource-1.0/scandinavian/AdjectiveScand.gf @@ -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 ; + +} diff --git a/lib/resource-1.0/scandinavian/AdverbScand.gf b/lib/resource-1.0/scandinavian/AdverbScand.gf new file mode 100644 index 000000000..f3b1222e1 --- /dev/null +++ b/lib/resource-1.0/scandinavian/AdverbScand.gf @@ -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 ; + +} diff --git a/lib/resource-1.0/scandinavian/CatScand.gf b/lib/resource-1.0/scandinavian/CatScand.gf new file mode 100644 index 000000000..11e519230 --- /dev/null +++ b/lib/resource-1.0/scandinavian/CatScand.gf @@ -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} ; +} diff --git a/lib/resource-1.0/scandinavian/ConjunctionScand.gf b/lib/resource-1.0/scandinavian/ConjunctionScand.gf new file mode 100644 index 000000000..003b8b785 --- /dev/null +++ b/lib/resource-1.0/scandinavian/ConjunctionScand.gf @@ -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} ; +-- +--} diff --git a/lib/resource-1.0/scandinavian/DiffScand.gf b/lib/resource-1.0/scandinavian/DiffScand.gf new file mode 100644 index 000000000..61a372f11 --- /dev/null +++ b/lib/resource-1.0/scandinavian/DiffScand.gf @@ -0,0 +1,12 @@ +interface DiffScand = { + + param + Gender ; + + oper + neutrum, utrum : Gender ; + + conjThat : Str ; + conjThan : Str ; + infMark : Str ; +} diff --git a/lib/resource-1.0/scandinavian/ExtEngAbs.gf b/lib/resource-1.0/scandinavian/ExtEngAbs.gf new file mode 100644 index 000000000..85c117e47 --- /dev/null +++ b/lib/resource-1.0/scandinavian/ExtEngAbs.gf @@ -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 ; + +} diff --git a/lib/resource-1.0/scandinavian/ExtScand.gf b/lib/resource-1.0/scandinavian/ExtScand.gf new file mode 100644 index 000000000..50aaa2193 --- /dev/null +++ b/lib/resource-1.0/scandinavian/ExtScand.gf @@ -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"} ; +-- +--} diff --git a/lib/resource-1.0/scandinavian/NounScand.gf b/lib/resource-1.0/scandinavian/NounScand.gf new file mode 100644 index 000000000..e82ea04e5 --- /dev/null +++ b/lib/resource-1.0/scandinavian/NounScand.gf @@ -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 ; +-- +--} diff --git a/lib/resource-1.0/scandinavian/ParamScand.gf b/lib/resource-1.0/scandinavian/ParamScand.gf new file mode 100644 index 000000000..98a0ab421 --- /dev/null +++ b/lib/resource-1.0/scandinavian/ParamScand.gf @@ -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} ; + +} diff --git a/lib/resource-1.0/scandinavian/PhraseScand.gf b/lib/resource-1.0/scandinavian/PhraseScand.gf new file mode 100644 index 000000000..2412ced36 --- /dev/null +++ b/lib/resource-1.0/scandinavian/PhraseScand.gf @@ -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} ; + +} diff --git a/lib/resource-1.0/scandinavian/QuestionScand.gf b/lib/resource-1.0/scandinavian/QuestionScand.gf new file mode 100644 index 000000000..4d6b5d6af --- /dev/null +++ b/lib/resource-1.0/scandinavian/QuestionScand.gf @@ -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 +-- } ; +-- +--} diff --git a/lib/resource-1.0/scandinavian/RelativeScand.gf b/lib/resource-1.0/scandinavian/RelativeScand.gf new file mode 100644 index 000000000..6c191f494 --- /dev/null +++ b/lib/resource-1.0/scandinavian/RelativeScand.gf @@ -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} ; +-- +--} diff --git a/lib/resource-1.0/scandinavian/ResScand.gf b/lib/resource-1.0/scandinavian/ResScand.gf new file mode 100644 index 000000000..1ee24c2b7 --- /dev/null +++ b/lib/resource-1.0/scandinavian/ResScand.gf @@ -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 of { + => mkCase c man ; + => mkCase c mannen ; + => mkCase c men ; + => 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 of { +-- => vf fin [] ; +-- => vf (does agr) inf ; +-- => vf (doesnt agr) inf ; +-- => vf (have agr) part ; +-- => vf (havent agr) part ; +-- => vf past [] ; +-- => vf "did" inf ; +-- => vf "didn't" inf ; +-- => vf "had" part ; +-- => vf "hadn't" part ; +-- => vf "will" inf ; +-- => vf "won't" inf ; +-- => vf "will" ("have" ++ part) ; +-- => vf "won't" ("have" ++ part) ; +-- => vf "would" inf ; +-- => vf "wouldn't" inf ; +-- => vf "would" ("have" ++ part) ; +-- => 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 of { +-- => vf fin [] ; +-- => vf (have agr) part ; +-- => vf (havent agr) part ; +-- => vf past [] ; +-- => vf "had" part ; +-- => vf "hadn't" part ; +-- => vf "will" inf ; +-- => vf "won't" inf ; +-- => vf "will" ("have" ++ part) ; +-- => vf "won't" ("have" ++ part) ; +-- => vf "would" inf ; +-- => vf "wouldn't" inf ; +-- => vf "would" ("have" ++ part) ; +-- => 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 of { +-- => "am" ; +-- => ["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" +-- } ; +-- +} diff --git a/lib/resource-1.0/scandinavian/SentenceScand.gf b/lib/resource-1.0/scandinavian/SentenceScand.gf new file mode 100644 index 000000000..761b8a624 --- /dev/null +++ b/lib/resource-1.0/scandinavian/SentenceScand.gf @@ -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} ; +-- +--} diff --git a/lib/resource-1.0/scandinavian/SeqConjunctionScand.gf b/lib/resource-1.0/scandinavian/SeqConjunctionScand.gf new file mode 100644 index 000000000..b80e91cd7 --- /dev/null +++ b/lib/resource-1.0/scandinavian/SeqConjunctionScand.gf @@ -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} ; +-- +--} diff --git a/lib/resource-1.0/scandinavian/TensedScand.gf b/lib/resource-1.0/scandinavian/TensedScand.gf new file mode 100644 index 000000000..fc3134e66 --- /dev/null +++ b/lib/resource-1.0/scandinavian/TensedScand.gf @@ -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} ; +-- +--} diff --git a/lib/resource-1.0/scandinavian/UntensedScand.gf b/lib/resource-1.0/scandinavian/UntensedScand.gf new file mode 100644 index 000000000..26098207e --- /dev/null +++ b/lib/resource-1.0/scandinavian/UntensedScand.gf @@ -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} ; +-- +--} diff --git a/lib/resource-1.0/scandinavian/VerbScand.gf b/lib/resource-1.0/scandinavian/VerbScand.gf new file mode 100644 index 000000000..53ee50fbf --- /dev/null +++ b/lib/resource-1.0/scandinavian/VerbScand.gf @@ -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 +-- +--} diff --git a/lib/resource-1.0/swedish/AdjectiveSwe.gf b/lib/resource-1.0/swedish/AdjectiveSwe.gf new file mode 100644 index 000000000..cdcde3831 --- /dev/null +++ b/lib/resource-1.0/swedish/AdjectiveSwe.gf @@ -0,0 +1,2 @@ +concrete AdjectiveSwe of Adjective = CatSwe ** AdjectiveScand with + (DiffScand = DiffSwe) ; diff --git a/lib/resource-1.0/swedish/AdverbSwe.gf b/lib/resource-1.0/swedish/AdverbSwe.gf new file mode 100644 index 000000000..731130296 --- /dev/null +++ b/lib/resource-1.0/swedish/AdverbSwe.gf @@ -0,0 +1,2 @@ +concrete AdverbSwe of Adverb = CatSwe ** AdverbScand with + (DiffScand = DiffSwe) ; diff --git a/lib/resource-1.0/swedish/CatSwe.gf b/lib/resource-1.0/swedish/CatSwe.gf new file mode 100644 index 000000000..3b975e962 --- /dev/null +++ b/lib/resource-1.0/swedish/CatSwe.gf @@ -0,0 +1,2 @@ +concrete CatSwe of Cat = CatScand with + (DiffScand = DiffSwe) ; diff --git a/lib/resource-1.0/swedish/DiffSwe.gf b/lib/resource-1.0/swedish/DiffSwe.gf new file mode 100644 index 000000000..bda4e1bc7 --- /dev/null +++ b/lib/resource-1.0/swedish/DiffSwe.gf @@ -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" ; + +} diff --git a/lib/resource-1.0/swedish/LexSwe.gf b/lib/resource-1.0/swedish/LexSwe.gf new file mode 100644 index 000000000..bb5ea03b5 --- /dev/null +++ b/lib/resource-1.0/swedish/LexSwe.gf @@ -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" ; + +} diff --git a/lib/resource-1.0/swedish/PhraseSwe.gf b/lib/resource-1.0/swedish/PhraseSwe.gf new file mode 100644 index 000000000..41183723f --- /dev/null +++ b/lib/resource-1.0/swedish/PhraseSwe.gf @@ -0,0 +1,2 @@ +concrete PhraseSwe of Phrase = CatSwe, TenseX ** PhraseScand with + (DiffScand = DiffSwe) ; diff --git a/lib/resource-1.0/swedish/ResSwe.gf b/lib/resource-1.0/swedish/ResSwe.gf new file mode 100644 index 000000000..7c55e8082 --- /dev/null +++ b/lib/resource-1.0/swedish/ResSwe.gf @@ -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 of { +-- => vf fin [] ; +-- => vf (does agr) inf ; +-- => vf (doesnt agr) inf ; +-- => vf (have agr) part ; +-- => vf (havent agr) part ; +-- => vf past [] ; +-- => vf "did" inf ; +-- => vf "didn't" inf ; +-- => vf "had" part ; +-- => vf "hadn't" part ; +-- => vf "will" inf ; +-- => vf "won't" inf ; +-- => vf "will" ("have" ++ part) ; +-- => vf "won't" ("have" ++ part) ; +-- => vf "would" inf ; +-- => vf "wouldn't" inf ; +-- => vf "would" ("have" ++ part) ; +-- => 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 of { +-- => vf fin [] ; +-- => vf (have agr) part ; +-- => vf (havent agr) part ; +-- => vf past [] ; +-- => vf "had" part ; +-- => vf "hadn't" part ; +-- => vf "will" inf ; +-- => vf "won't" inf ; +-- => vf "will" ("have" ++ part) ; +-- => vf "won't" ("have" ++ part) ; +-- => vf "would" inf ; +-- => vf "wouldn't" inf ; +-- => vf "would" ("have" ++ part) ; +-- => 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 of { +-- => "am" ; +-- => ["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" +-- } ; +-- +} diff --git a/lib/resource-1.0/swedish/TestSwe.gf b/lib/resource-1.0/swedish/TestSwe.gf new file mode 100644 index 000000000..b0e038b07 --- /dev/null +++ b/lib/resource-1.0/swedish/TestSwe.gf @@ -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 ; + +} ;