diff --git a/lib/resource/norwegian/CountryNor.gf b/lib/resource/norwegian/CountryNor.gf new file mode 100644 index 000000000..d3dbe8456 --- /dev/null +++ b/lib/resource/norwegian/CountryNor.gf @@ -0,0 +1,27 @@ +concrete CountryNor of Country = open CategoriesNor, ParadigmsNor in { + + lincat + Country = PN ; + Nationality = A ; + Language = N ; + + lin + Denmark = regPN "Danmark" neutrum ; + England = regPN "England" neutrum ; + Finland = regPN "Finland" neutrum ; + France = regPN "Frankrike" neutrum ; + Germany = regPN "Tyskland" neutrum ; + Italy = regPN "Italien" neutrum ; + Norway = regPN "Norge" neutrum ; + Russia = regPN "Ryssland" neutrum ; + Spain = regPN "Spanien" neutrum ; + Sweden = regPN "Sverige" neutrum ; + + Danish = regA "dansk" ; + English = regA "engelsk" ; + + DanishLang = regN "dansk" masculine ; + EnglishLang = regN "engelsk" masculine ; + + +} ; diff --git a/lib/resource/norwegian/LangNor.gf b/lib/resource/norwegian/LangNor.gf new file mode 100644 index 000000000..83e3a52e8 --- /dev/null +++ b/lib/resource/norwegian/LangNor.gf @@ -0,0 +1,22 @@ +--# -path=.:../scandinavian:../abstract:../../prelude + +concrete LangNor of Lang = + RulesNor, + ClauseNor, + StructuralNor, + BasicNor, + TimeNor, + CountryNor + + ** open Prelude, ParadigmsNor in { + +lin + AdvDate d = prefixSS "på" d ; + AdvTime t = prefixSS "klokken" t ; + NWeekday w = w ; + PNWeekday w = nounPN w ; + + PNCountry x = x ; + ANationality x = x ; + NLanguage x = x ; +} diff --git a/lib/resource/norwegian/MorphoNor.gf b/lib/resource/norwegian/MorphoNor.gf index 03f674860..3042781af 100644 --- a/lib/resource/norwegian/MorphoNor.gf +++ b/lib/resource/norwegian/MorphoNor.gf @@ -8,7 +8,7 @@ -- -- We use the parameter types and word classes defined for morphology. -resource MorphoNor = open Prelude, TypesNor in { +resource MorphoNor = open Predef, Prelude, TypesNor in { -- Danish grammar source: http://users.cybercity.dk/~nmb3879/danish.html @@ -36,6 +36,12 @@ oper Gen => bil + "s" --- but: hus --> hus } ; + extNGen : Str -> NounGender = \s -> case last s of { + "n" => NUtr Masc ; + "a" => NUtr NoMasc ; + _ => NNeutr + } ; + nBil : Str -> Subst = \bil -> mkSubstantive bil (bil + "en") (bil + "er") (bil + "erne") ** {h1 = masc} ; @@ -74,6 +80,12 @@ oper aRask : Str -> Adj = \rask -> mkAdjective rask rask (rask + "e") (rask + "ere") (rask + "est") ; + aBillig : Str -> Adj = \billig -> + mkAdjective billig billig (billig + "e") (billig + "ere") (billig + "st") ; + +extractPositive : Adj -> {s : AdjFormPos => Case => Str} = \adj -> + {s = \\a,c => adj.s ! (AF (Posit a) c)} ; + -- verbs mkVerb : (_,_,_,_,_,_ : Str) -> Verbum = @@ -83,7 +95,11 @@ oper VF (Pres Pass) => spises ; VF (Pret v) => mkVoice v spiste ; VI (Supin v) => mkVoice v spist ; - VI (PtPret _ c) => mkCase spist ! c ; ---- GenNum + VI (PtPret (Strong (ASg _)) c) => mkCase spist ! c ; + VI (PtPret _ c) => case last spist of { + "a" => mkCase spist ! c ; + _ => mkCase (spist + "e") ! c + } ; VF (Imper v) => mkVoice v spis } } ; @@ -97,14 +113,37 @@ oper } ; vHusk : Str -> Verbum = \husk -> - mkVerb (husk + "e") (husk + "er") (husk + "es") (husk + "et") (husk + "et") husk ; + let huska : Str = husk + "a" ---- variants {husk + "a" ; husk + "et"} + in + mkVerb (husk + "e") (husk + "er") (husk + "es") huska huska husk ; vSpis : Str -> Verbum = \spis -> mkVerb (spis + "e") (spis + "er") (spis + "es") (spis + "te") (spis + "t") spis ; + vLev : Str -> Verbum = \lev -> + mkVerb (lev + "e") (lev + "er") (lev + "es") (lev + "de") (lev + "d") lev ; + vBo : Str -> Verbum = \bo -> mkVerb bo (bo + "r") (bo + "es") (bo + "dde") (bo + "dd") bo ; + regVerb : Str -> Str -> Verbum = \spise, spiste -> + let + spis = init spise ; + te = dp 2 spiste + in + case te of { + "te" => vSpis spis ; + "de" => case last spise of { + "e" => vLev spis ; + _ => vBo spise + } ; + _ => vHusk spis + } ; + + irregVerb : (drikke,drakk,drukket : Str) -> Verbum = + \drikke,drakk,drukket -> + mkVerb drikke (drikke + "r") (drikke + "s") drakk drukket (init drikke) ; + -- pronouns oper jag_32 : ProPN = @@ -208,7 +247,7 @@ oper De_38 : ProPN = oper den_39 : ProPN = {s = table { - PNom => "de " ; + PNom => "de" ; PAcc => "den" ; PGen _ => "dens" } ; diff --git a/lib/resource/norwegian/ParadigmsNor.gf b/lib/resource/norwegian/ParadigmsNor.gf index f8d56e886..d040a569c 100644 --- a/lib/resource/norwegian/ParadigmsNor.gf +++ b/lib/resource/norwegian/ParadigmsNor.gf @@ -71,9 +71,11 @@ oper regN : Str -> Gender -> N ; --- In practice the worst case is often just: give singular and plural indefinite. +-- This function takes the singular indefinite and definite forms; the +-- gender is computed from the definite form. + + mk2N : (bil,bilen : Str) -> N ; - mk2N : (dreng,drenger : Str) -> N ; --3 Compound nouns -- @@ -199,14 +201,14 @@ oper regV : (snakke : Str) -> V ; --- The almost regular verb function needs the infinitive and the present. +-- The almost regular verb function needs the infinitive and the preteritum. mk2V : (leve,levde : Str) -> V ; -- There is an extensive list of irregular verbs in the module $IrregularSwe$. -- In practice, it is enough to give three forms, as in school books. - irregV : (drikke, drakk, drukket : Str) -> V ; + irregV : (drikke, drakk, drukket : Str) -> V ; --3 Verbs with a particle. @@ -266,42 +268,64 @@ oper -- hidden from the document. --. - Gender = SyntaxSwe.NounGender ; - Number = TypesSwe.Number ; - Case = TypesSwe.Case ; - utrum = NUtr NoMasc ; + Gender = SyntaxNor.NounGender ; + Number = TypesNor.Number ; + Case = TypesNor.Case ; + masculine = NUtr NoMasc ; + feminine = NUtr NoMasc ; neutrum = NNeutr ; singular = Sg ; plural = Pl ; nominative = Nom ; genitive = Gen ; - mkN x y z u = extCommNoun (mkNoun x y z u) ** {lock_N = <>} ; - regN x g = extCommNoun (regNoun x (genNoun g)) ** {lock_N = <>} ; - mk2N x g = extCommNoun (reg2Noun x g) ** {lock_N = <>} ; - mascN n = {s = n.s ; g = NUtr Masc ; lock_N = <>} ; + mkN x y z u = let sb = mkSubstantive x y z u + in {s = \\n,b,c => sb.s ! SF n b c ; g = extNGen y ; lock_N = <>} ; + regN x g = case last x of { + "e" => case g of { + NUtr Masc => mkN x (x + "n") (x + "r") (x + "ne") ; + NUtr NoMasc => mkN x (init x + "a") (x + "r") (x + "ne") ; + NNeutr => mkN x (x + "t") (x + "r") (init x + "a") + } ; + _ => case g of { + NUtr Masc => mkN x (x + "en") (x + "er") (x + "ene") ; + NUtr NoMasc => mkN x (x + "a") (x + "er") (x + "ene") ; + NNeutr => mkN x (x + "et") (x + "") (x + "a") + } + } ; + + mk2N x y = case last y of { + "n" => regN x masculine ; + "a" => regN x feminine ; + _ => regN x neutrum + } ; + mkN2 = \n,p -> n ** {lock_N2 = <> ; s2 = p} ; regN2 n g = mkN2 (regN n g) (mkPreposition "av") ; mkN3 = \n,p,q -> n ** {lock_N3 = <> ; s2 = p ; s3 = q} ; - regPN n g = {s = \\c => mkCase c n ; g = g} ** {lock_PN = <>} ; + regPN n g = {s = \\c => mkCase n ! c ; g = g} ** {lock_PN = <>} ; nounPN n = {s = n.s ! singular ! Indef ; g = n.g ; lock_PN = <>} ; mkNP x y n g = {s = table {PGen _ => x ; _ => y} ; g = genNoun g ; n = n ; p = P3 ; lock_NP = <>} ; - mkA a b c = extractPositive (adjAlmostReg a b c) ** {lock_A = <>} ; - mk2A a b = extractPositive (adj2Reg a b) ** {lock_A = <>} ; - regA a = extractPositive (adjReg a) ** {lock_A = <>} ; + mkA a b c = extractPositive (mkAdjective a b c [] []) ** {lock_A = <>} ; + mk2A a b = mkA a b (a + "e") ; + regA a = extractPositive (regADeg a) ** {lock_A = <>} ; mkA2 a p = a ** {s2 = p ; lock_A2 = <>} ; - mkADeg a b c d e f g = mkAdjective a b c d e f g ** {lock_ADeg = <>} ; - regADeg a = adjReg a ** {lock_ADeg = <>} ; - irregADeg a b c = adjIrreg3 a b c ** {lock_ADeg = <>} ; - mk3ADeg a b c = adjAlmostReg a b c ** {lock_ADeg = <>} ; - mk2ADeg a b = adj2Reg a b ** {lock_ADeg = <>} ; + mkADeg a b c d e = mkAdjective a b c d e ** {lock_ADeg = <>} ; + regADeg a = case Predef.dp 2 a of { + "ig" => aBillig a ; + "sk" => aRask a ; + _ => aRod a + } ** {lock_ADeg = <>} ; + irregADeg a b c = mkAdjective a (a + "t") (a + "e") b c ** {lock_ADeg = <>} ; + mk3ADeg a b c = mkAdjective a b c (a + "ere") (a + "est") ** {lock_ADeg = <>} ; + mk2ADeg a b = mkAdjective a b (a + "e") (a + "ere") (a + "est") ** {lock_ADeg = <>} ; mkAdv x = ss x ** {lock_Adv = <>} ; mkAdV x = ss x ** {lock_AdV = <>} ; @@ -311,10 +335,14 @@ oper mkV a b c d e f = mkVerb a b c d e f ** {s1 = [] ; lock_V = <>} ; - regV a = mk2V a (a + "r") ; + regV a = case last a of { + "e" => vHusk (init a) ; + _ => vBo a + } ** {s1 = [] ; lock_V = <>} ; + mk2V a b = regVerb a b ** {s1 = [] ; lock_V = <>} ; - irregV x y z = vSälja x y z + irregV x y z = irregVerb x y z ** {s1 = [] ; lock_V = <>} ; partV v p = {s = v.s ; s1 = p ; lock_V = <>} ; diff --git a/lib/resource/norwegian/ResourceNor.gf b/lib/resource/norwegian/ResourceNor.gf new file mode 100644 index 000000000..eb0391bd3 --- /dev/null +++ b/lib/resource/norwegian/ResourceNor.gf @@ -0,0 +1,5 @@ +--# -path=.:../scandinavian:../abstract:../../prelude + +---- concrete ResourceSwe of Resource = RulesSwe, VerbphraseSwe ** {} ; +concrete ResourceNor of Resource = RulesNor, StructuralNor, ClauseNor ** {} ; + diff --git a/lib/resource/norwegian/TimeNor.gf b/lib/resource/norwegian/TimeNor.gf new file mode 100644 index 000000000..c7c2f5dc8 --- /dev/null +++ b/lib/resource/norwegian/TimeNor.gf @@ -0,0 +1,33 @@ +concrete TimeNor of Time = NumeralsNor ** + open Prelude, TypesNor, CategoriesNor, ParadigmsNor in { + +lincat +Date = SS ; +Weekday = N ; +Hour = SS ; +Minute = SS ; +Time = SS ; + +lin +DayDate day = ss (day.s ! singular ! Indef ! nominative) ; +DayTimeDate day time = ss (day.s ! singular ! Indef ! nominative ++ "klokken" ++ time.s) ; + +FormalTime = infixSS "og" ; +PastTime h m = ss (m.s ++ "over" ++ h.s) ; +ToTime h m = ss (m.s ++ "på" ++ h.s) ; +ExactTime h = ss (h.s ++ "akkurat") ; + +NumHour n = n ; +NumMinute n = n ; + +monday = regN "mandag" masculine ; +tuesday = regN "tirsdag" masculine ; +wednesday = regN "onsdag" masculine ; +thursday = regN "torsdag" masculine ; +friday = regN "fredag" masculine ; +saturday = regN "lørdag" masculine ; +sunday = regN "søndag" masculine ; + + + +} ;