diff --git a/grammars/resource/swedish/MorphoSwe.gf b/grammars/resource/swedish/MorphoSwe.gf index af2095227..12d15ac27 100644 --- a/grammars/resource/swedish/MorphoSwe.gf +++ b/grammars/resource/swedish/MorphoSwe.gf @@ -25,8 +25,21 @@ oper -- A simplified verb category: present tense only. oper - verbVara = {s = table {Infinit => "vara" ; Indicat => "är" ; Imperat => "var"}} ; - verbHava = {s = table {Infinit => "ha" ; Indicat => "har" ; Imperat => "ha"}} ; + verbVara = extVerb Act vara_1200 ; + verbHava = extVerb Act hava_1198 ; + +-- A simplified conjugation takes three forms in the worst case. + + mkVerb : (supa,super,sup : Str) -> Verb = \supa,super,sup -> + {s = table { + VPres Infinit Act => supa ; + VPres Infinit Pass => supa + "s" ; + VPres Indicat Act => super ; + VPres Indicat Pass => sup + "s" ; + VPres Imperat Act => sup ; + VPres Imparat Pass => sup + "s" + } + } ; -- Prepositions are just strings. Preposition = Str ; @@ -1019,6 +1032,38 @@ oper liten_1146 : Adj = } } ; +oper giva_1147 : Verbum = + {s = table { + VF (Pres Ind Act) => variants {"giver" ; "ger"} ; + VF (Pres Ind Pass) => variants {"gives" ; "givs" ; "ges"} ; + VF (Pres Conj Act) => "give" ; + VF (Pres Conj Pass) => "gives" ; + VF (Pret Ind Act) => "gav" ; + VF (Pret Ind Pass) => "gavs" ; + VF (Pret Conj Act) => "give" ; + VF (Pret Conj Pass) => "gives" ; + VF Imper => variants {"giv" ; "ge"} ; + VI (Inf Act) => variants {"giva" ; "ge"} ; + VI (Inf Pass) => variants {"givas" ; "ges"} ; + VI (Supin Act) => "givit" ; + VI (Supin Pass) => "givits" ; + VI (PtPres Nom) => "givande" ; + VI (PtPres Gen) => "givandes" ; + VI (PtPret (Strong (ASg Utr)) Nom) => "given" ; + VI (PtPret (Strong (ASg Utr)) Gen) => "givens" ; + VI (PtPret (Strong (ASg Neutr)) Nom) => "givet" ; + VI (PtPret (Strong (ASg Neutr)) Gen) => "givets" ; + VI (PtPret (Strong APl) Nom) => "givna" ; + VI (PtPret (Strong APl) Gen) => "givnas" ; + VI (PtPret (Weak (AxSg NoMasc)) Nom) => "givna" ; + VI (PtPret (Weak (AxSg NoMasc)) Gen) => "givnas" ; + VI (PtPret (Weak (AxSg Masc)) Nom) => "givne" ; + VI (PtPret (Weak (AxSg Masc)) Gen) => "givnes" ; + VI (PtPret (Weak AxPl) Nom) => "givna" ; + VI (PtPret (Weak AxPl) Gen) => "givnas" + } + } ; + oper gå_1174 : Verbum = {s = table { VF (Pres Ind Act) => "går" ; @@ -1050,4 +1095,67 @@ oper g VI (PtPret (Weak AxPl) Gen) => "gångnas" } } ; +oper hava_1198 : Verbum = + {s = table { + VF (Pres Ind Act) => variants {"haver" ; "har"} ; + VF (Pres Ind Pass) => variants {"havs" ; "has"} ; + VF (Pres Conj Act) => "have" ; + VF (Pres Conj Pass) => "haves" ; + VF (Pret Ind Act) => "hade" ; + VF (Pret Ind Pass) => "hades" ; + VF (Pret Conj Act) => "hade" ; + VF (Pret Conj Pass) => "hades" ; + VF Imper => variants {"hav" ; "ha"} ; + VI (Inf Act) => variants {"hava" ; "ha"} ; + VI (Inf Pass) => variants {"havas" ; "has"} ; + VI (Supin Act) => "haft" ; + VI (Supin Pass) => "hafts" ; + VI (PtPres Nom) => "havande" ; + VI (PtPres Gen) => "havandes" ; + VI (PtPret (Strong (ASg Utr)) Nom) => variants {} ; + VI (PtPret (Strong (ASg Utr)) Gen) => variants {} ; + VI (PtPret (Strong (ASg Neutr)) Nom) => variants {} ; + VI (PtPret (Strong (ASg Neutr)) Gen) => variants {} ; + VI (PtPret (Strong APl) Nom) => variants {} ; + VI (PtPret (Strong APl) Gen) => variants {} ; + VI (PtPret (Weak (AxSg NoMasc)) Nom) => variants {} ; + VI (PtPret (Weak (AxSg NoMasc)) Gen) => variants {} ; + VI (PtPret (Weak (AxSg Masc)) Nom) => variants {} ; + VI (PtPret (Weak (AxSg Masc)) Gen) => variants {} ; + VI (PtPret (Weak AxPl) Nom) => variants {} ; + VI (PtPret (Weak AxPl) Gen) => variants {} + } + } ; + +oper vara_1200 : Verbum = + {s = table { + VF (Pres Ind Act) => "är" ; + VF (Pres Ind Pass) => variants {} ; + VF (Pres Conj Act) => "vare" ; + VF (Pres Conj Pass) => variants {} ; + VF (Pret Ind Act) => "var" ; + VF (Pret Ind Pass) => variants {} ; + VF (Pret Conj Act) => "vore" ; + VF (Pret Conj Pass) => variants {} ; + VF Imper => "var" ; + VI (Inf Act) => "vara" ; + VI (Inf Pass) => variants {} ; + VI (Supin Act) => "varit" ; + VI (Supin Pass) => variants {} ; + VI (PtPres Nom) => "varande" ; + VI (PtPres Gen) => "varandes" ; + VI (PtPret (Strong (ASg Utr)) Nom) => variants {} ; + VI (PtPret (Strong (ASg Utr)) Gen) => variants {} ; + VI (PtPret (Strong (ASg Neutr)) Nom) => variants {} ; + VI (PtPret (Strong (ASg Neutr)) Gen) => variants {} ; + VI (PtPret (Strong APl) Nom) => variants {} ; + VI (PtPret (Strong APl) Gen) => variants {} ; + VI (PtPret (Weak (AxSg NoMasc)) Nom) => variants {} ; + VI (PtPret (Weak (AxSg NoMasc)) Gen) => variants {} ; + VI (PtPret (Weak (AxSg Masc)) Nom) => variants {} ; + VI (PtPret (Weak (AxSg Masc)) Gen) => variants {} ; + VI (PtPret (Weak AxPl) Nom) => variants {} ; + VI (PtPret (Weak AxPl) Gen) => variants {} + } + } ; } diff --git a/grammars/resource/swedish/ParadigmsSwe.gf b/grammars/resource/swedish/ParadigmsSwe.gf new file mode 100644 index 000000000..45eb2c16e --- /dev/null +++ b/grammars/resource/swedish/ParadigmsSwe.gf @@ -0,0 +1,284 @@ +--# -path=.:../abstract:../../prelude + +--1 Swedish 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.Swe.gf$ is that the types +-- referred to are compiled resource grammar types. We have moreover +-- had the design principle of always having existing forms as string +-- arguments of the paradigms, not stems. +-- +-- The following modules are presupposed: + +resource ParadigmsSwe = open (Predef=Predef), Prelude, SyntaxSwe, Swedish in { + +--2 Parameters +-- +-- To abstract over gender names, we define the following identifiers. + +oper + utrum : Gender ; + neutrum : Gender ; + + masculine : Sex ; + nonmasculine : Sex ; + +-- To abstract over case names, we define the following. + + nominative : Case ; + genitive : Case ; + +-- To abstract over number names, we define the following. + + singular : Number ; + plural : Number ; + + +--2 Nouns + +-- Worst case: give all nominative forms and the gender. +-- The genitive is formed automatically, even when the nominative +-- ends with an "s". + + mkN : (_,_,_,_ : Str) -> Gender -> Sex -> N ; + -- man, mannen, män, männen + +-- Here are some common patterns, corresponding to school-gramamr declensions. +-- Except $nPojke$, $nKarl$, and $nMurare$, +-- they are defined to be $nonmasculine$, which means that they don't create +-- the definite adjective form with "e" but with "a". + + nApa : Str -> N ; -- apa (apan, apor, aporna) ; utrum + nBil : Str -> N ; -- bil (bilen, bilar, bilarna) ; utrum + nKarl : Str -> N ; -- karl (karlen, karlar, karlarna) ; utrum ; masculine + nPojke : Str -> N ; -- pojke (pojken, pojkar, pojkarna) ; utrum ; masculine + nNyckel : Str -> N ; -- nyckel (nyckeln, nycklar, nycklarna) ; utrum + nRisk : Str -> N ; -- risk (risken, risker, riskerna) ; utrum + nDike : Str -> N ; -- dike (diket, diken, dikena) ; neutrum + nRep : Str -> N ; -- rep (repet, rep, repen) ; neutrum + nPapper : Str -> N ; -- papper (pappret, papper, pappren) ; neutrum + nMurare : Str -> N ; -- murare (muraren, murare, murarna) ; utrum ; masculine + nKikare : Str -> N ; -- kikare (kikaren, kikare, kikarna) ; utrum + +-- Nouns used as functions need a preposition. The most common ones are "av", +-- "på", and "till". + + mkFun : N -> Preposition -> Fun ; + funAv : N -> Fun ; + funPå : N -> Fun ; + funTill : N -> Fun ; + +-- Proper names, with their possibly +-- irregular genitive. The regular genitive is "s", omitted after "s". + + mkPN : (_,_ : Str) -> Gender -> Sex -> PN ; -- Karolus, Karoli + pnReg : Str -> Gender -> Sex -> PN ; -- Johan,Johans ; Johannes, Johannes + +-- On the top level, it is maybe $CN$ that is used rather than $N$, and +-- $NP$ rather than $PN$. + + mkCN : N -> CN ; + mkNP : (Karolus, Karoli : Str) -> Gender -> NP ; + + npReg : Str -> Gender -> NP ; -- Johann, Johanns + + +--2 Adjectives + +-- Non-comparison one-place adjectives need four forms in the worst case: +-- strong singular, weak singular, plural. + + mkAdj1 : (_,_,_,_ : Str) -> Adj1 ; -- liten, litet, lilla, små + +-- Special cases needing one form each are: regular adjectives, +-- adjectives with unstressed "e" in the last syllable, those +-- ending with "n" as a further special case, and invariable +-- adjectives. + + adjReg : Str -> Adj1 ; -- billig (billigt, billiga, billiga) + adjNykter : Str -> Adj1 ; -- nykter (nyktert, nyktra, nyktra) + adjGalen : Str -> Adj1 ; -- galen (galet, galna, galna) + adjInvar : Str -> Adj1 ; -- bra + +-- Two-place adjectives need a preposition and a case as extra arguments. + + mkAdj2 : Adj1 -> Str -> Adj2 ; -- delbar, med + mkAdj2Reg : Str -> Str -> Adj2 ; -- + +-- Comparison adjectives may need the three four forms for the positive case, plus +-- three more forms for the comparison cases. + + mkAdjDeg : (liten, litet, lilla, sma, mindre, minst, minsta : Str) -> AdjDeg ; + +-- Some comparison adjectives are completely regular. + + aReg : Str -> AdjDeg ; + +-- On top level, there are adjectival phrases. The most common case is +-- just to use a one-place adjective. The variation in $adjGen$ is taken +-- into account. + + apReg : Str -> AP ; + +--2 Verbs +-- +-- The fragment only has present tense so far. +-- The worst case needs three forms: the infinitive, the indicative, and the +-- imperative. + + mkV : (_,_,_ : Str) -> V ; -- vara, är, var; trivas, trivs, trivs + +-- The main conjugations need one string each. + + vKoka : Str -> V ; -- tala (talar, tala) + vSteka : Str -> V ; -- leka (leker, lek) + vBo : Str -> V ; -- bo (bor, bo) + + vAndas : Str -> V ; -- andas [all forms the same: also "slåss"] + vTrivas : Str -> V ; -- trivas (trivs, trivs) + +-- The verbs 'be' and 'have' are special. + + vVara : V ; + vHa : V ; + +-- Two-place verbs, and the special case with direct object. + + mkTV : V -> Preposition -> TV ; -- tycka, om + tvDir : V -> TV ; -- gilla + +-- The definitions should not bother the user of the API. So they are +-- hidden from the document. +--. + + utrum = Utr ; + neutrum = Neutr ; + masculine = Masc ; + nonmasculine = NoMasc ; + nominative = Nom ; + genitive = Gen ; + -- singular defined in Types + -- plural defined in Types + + mkN = \apa, apan, apor, aporna, g, x -> let + {nom = table { + SF Sg Indef _ => apa ; + SF Sg Def _ => apan ; + SF Pl Indef _ => apor ; + SF Pl Def _ => aporna + } + } in + {s = \\n,d,c => mkCase c (nom ! SF n d Nom) ; + g = g ; x = x + } ; + + -- auxiliaries + mkGenit : Tok -> Tok = \s -> ifTok Tok (Predef.dp 1 s) "s" s (s + "s") ; + mkCase : Case -> Tok -> Tok = \c,t -> case c of { + Nom => t ; + Gen => mkGenit t + } ; + + nApa = \apa -> + let {apor = Predef.tk 1 apa + "or"} in + mkN apa (apa + "n") apor (apor + "na") utrum nonmasculine ; + + nBil = \bil -> + mkN bil (bil + "en") (bil + "ar") (bil + "arna") utrum nonmasculine ; + nKarl = \bil -> + mkN bil (bil + "en") (bil + "ar") (bil + "arna") utrum masculine ; + nPojke = \pojke -> + let {bil = Predef.tk 1 pojke} in + mkN pojke (bil + "en") (bil + "ar") (bil + "arna") utrum masculine ; + nNyckel = \cykel -> + let {cykl = Predef.tk 2 cykel + Predef.dp 1 cykel} in + mkN cykel (cykel + "n") (cykl + "ar") (cykl + "arna") utrum nonmasculine ; + nRisk = \bil -> + mkN bil (bil + "en") (bil + "er") (bil + "erna") utrum nonmasculine ; + nDike = \dike -> + mkN dike (dike + "t") (dike + "n") (dike + "na") neutrum nonmasculine ; + nRep = \rep -> + mkN rep (rep + "et") rep (rep + "en") neutrum nonmasculine ; + nPapper = \cykel -> + let {cykl = Predef.tk 2 cykel + Predef.dp 1 cykel} in + mkN cykel (cykl + "et") cykel (cykl + "en") neutrum nonmasculine ; + nMurare = \murare -> + let {murar = Predef.tk 1 murare} in + mkN murare (murar + "en") murare (murar + "na") utrum masculine ; + nKikare = \murare -> + let {murar = Predef.tk 1 murare} in + mkN murare (murar + "en") murare (murar + "na") utrum nonmasculine ; + + +-- mkFun defined in syntax.Swe + funAv = \f -> mkFun f "av" ; + funPå = \f -> mkFun f "på" ; + funTill = \f -> mkFun f "till" ; + + mkPN = \karolus, karoli, g, x -> + {s = table {Gen => karoli ; _ => karolus} ; g = g ; x = x} ; + pnReg = \horst -> + mkPN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) ; + + mkCN = UseN ; + mkNP = \a,b,g -> UsePN (mkPN a b g nonmasculine) ; -- gender irrelevant in NP + npReg = \s,g -> UsePN (pnReg s g nonmasculine) ; + + mkAdj1 = \liten, litet, lilla, små -> + {s = table { + Strong (ASg Utr) => \\c => mkCase c liten ; + Strong (ASg Neutr) => \\c => mkCase c litet ; + Strong APl => \\c => mkCase c små ; + Weak (AxSg Masc) => \\c => mkCase c (Predef.tk 1 lilla + "e") ; + Weak _ => \\c => mkCase c lilla + } + } ; + + adjReg = \billig -> mkAdj1 billig (billig + "t") (billig + "a") (billig + "a") ; + adjNykter = \nykter -> + let {nyktr = Predef.tk 2 nykter + Predef.dp 1 nykter} in + mkAdj1 nykter (nykter + "t") (nyktr + "a") (nyktr + "a") ; + adjGalen = \galen -> + let {gal = Predef.tk 2 galen} in + mkAdj1 galen (gal + "et") (gal + "na") (gal + "na") ; + adjInvar = \bra -> {s = \\_,_ => bra} ; + + mkAdj2 = \a,p -> a ** {s2 = p} ; + mkAdj2Reg = \a -> mkAdj2 (adjReg a) ; + + mkAdjDeg = \liten, litet, lilla, sma, mindre, minst, minsta -> + let {lit = (mkAdj1 liten litet lilla sma).s} in + {s = table { + AF (Posit f) c => lit ! f ! c ; + AF Compar c => mkCase c mindre ; + AF (Super SupStrong) c => mkCase c minst ; + AF (Super SupWeak) c => mkCase c minsta --- masculine! + } + } ; + + aReg = \fin -> mkAdjDeg fin + (fin + "t") (fin + "a") (fin + "a") (fin + "are") (fin + "ast") (fin + "aste") ; + + apReg = \s -> AdjP1 (adjReg s) ; + + mkV = mkVerb ; + vKoka = \tala -> mkV tala (tala+"r") tala ; + vSteka = \leka -> let {lek = Predef.tk 1 leka} in mkV leka (lek + "er") lek ; + vBo = \bo -> mkV bo (bo+"r") bo ; + vAndas = \andas -> mkV andas andas andas ; + vTrivas = \trivas -> + let {trivs = Predef.tk 1 trivas + "s"} in mkV trivas trivs trivs ; + vVara = verbVara ; + vHa = verbHava ; + mkTV = mkTransVerb ; + tvDir = \v -> mkTV v [] ; + +} ; diff --git a/grammars/resource/swedish/ResSwe.gf b/grammars/resource/swedish/ResSwe.gf index ba6be8c7f..4767db0f6 100644 --- a/grammars/resource/swedish/ResSwe.gf +++ b/grammars/resource/swedish/ResSwe.gf @@ -186,6 +186,7 @@ lin ThouNP = pronNounPhrase du_33 ; HeNP = pronNounPhrase han_34 ; SheNP = pronNounPhrase hon_35 ; + ItNP = pronNounPhrase det_40 ; ---- WeNP = pronNounPhrase vi_36 ; YeNP = pronNounPhrase ni_37 ; TheyNP = pronNounPhrase de_38 ; diff --git a/grammars/resource/swedish/SyntaxSwe.gf b/grammars/resource/swedish/SyntaxSwe.gf index 25dcd3e18..c26a07bc8 100644 --- a/grammars/resource/swedish/SyntaxSwe.gf +++ b/grammars/resource/swedish/SyntaxSwe.gf @@ -488,7 +488,7 @@ oper -- "s" passive form. passVerb : Bool -> Verb -> VerbPhrase = \b,se -> ---- passive not yet - se ** { + {s = table {VPres m _ => se.s ! VPres m Pass} ; s2 = negation b ; s3 = \\_,_ => [] } ; @@ -582,7 +582,7 @@ oper \Jag, serdiginte -> let { jag = Jag.s ! PNom ; - ser = serdiginte.s ! Indicat ; + ser = serdiginte.s ! VPres Indicat Act ; dig = serdiginte.s3 ! Jag.g ! Jag.n ; inte = serdiginte.s2 } in @@ -625,7 +625,7 @@ oper \b, Jag, se -> let { jag = Jag.s ! PNom ; - ser = se.s ! Indicat ; + ser = se.s ! VPres Indicat Act ; inte = negation b } in {s = table { @@ -699,7 +699,7 @@ oper relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \som,sover -> {s = \\gn => - som.s ! RNom ! gn ++ sover.s2 ++ sover.s ! Indicat ++ + som.s ! RNom ! gn ++ sover.s2 ++ sover.s ! VPres Indicat Act ++ sover.s3 ! mkGenderRel som.g (genGN gn) ! numGN gn } ; @@ -893,7 +893,7 @@ oper Imperative = SS1 Number ; imperVerbPhrase : VerbPhrase -> Imperative = \titta -> - {s = \\n => titta.s ! Imperat ++ titta.s2 ++ titta.s3 ! Utr ! n} ; + {s = \\n => titta.s ! VPres Imperat Act ++ titta.s2 ++ titta.s3 ! Utr ! n} ; imperUtterance : Number -> Imperative -> Utterance = \n,I -> ss (I.s ! n ++ "!") ; diff --git a/grammars/resource/swedish/TypesSwe.gf b/grammars/resource/swedish/TypesSwe.gf index e328cd803..3f50ace66 100644 --- a/grammars/resource/swedish/TypesSwe.gf +++ b/grammars/resource/swedish/TypesSwe.gf @@ -99,17 +99,20 @@ param -- However, the syntax only needs a simplified verb category, with -- present tense only. Such a verb can be extracted from the full verb, -- and a choice can be made between an active and a passive (deponent) verb. +-- Active verbs continue to have passive forms. param - VForm = Infinit | Indicat | Imperat ; + VMode = Infinit | Indicat | Imperat ; + VForm = VPres VMode Voice ; oper Verb : Type = SS1 VForm ; extVerb : Voice -> Verbum -> Verb = \v,verb -> {s = table { - Infinit => verb.s ! VI (Inf v) ; - Indicat => verb.s ! VF (Pres Ind v) ; - Imperat => verb.s ! VF Imper --- no passive in Verbum + VPres Infinit v => verb.s ! VI (Inf v) ; + VPres Indicat v => verb.s ! VF (Pres Ind v) ; + VPres Imperat Act => verb.s ! VF Imper ; + VPres Imperat Pass => verb.s ! VF (Pres Ind Pass) --- no passive in Verbum }} ; --3 Other open classes