From 1eabf5c8637286a64c2394503de11a4197bf6c2e Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Sat, 18 Apr 2020 09:07:51 +0200 Subject: [PATCH] initialized Slovak (Slo) by cloning from Czech --- src/api/CombinatorsSlo.gf | 9 + src/api/ConstructorsSlo.gf | 5 + src/api/SymbolicSlo.gf | 6 + src/api/SyntaxSlo.gf | 4 + src/api/TrySlo.gf | 13 + src/slovak/AdjectiveSlo.gf | 23 + src/slovak/AdverbSlo.gf | 9 + src/slovak/AllSlo.gf | 6 + src/slovak/AllSloAbs.gf | 6 + src/slovak/CatSlo.gf | 70 +++ src/slovak/ConjunctionSlo.gf | 56 +++ src/slovak/GrammarSlo.gf | 19 + src/slovak/IdiomSlo.gf | 5 + src/slovak/LangSlo.gf | 10 + src/slovak/LexiconSlo.gf | 59 +++ src/slovak/MissingSlo.gf | 102 ++++ src/slovak/NounSlo.gf | 100 ++++ src/slovak/NumeralSlo.gf | 120 +++++ src/slovak/ParadigmsSlo.gf | 141 ++++++ src/slovak/PhraseSlo.gf | 19 + src/slovak/QuestionSlo.gf | 7 + src/slovak/RelativeSlo.gf | 18 + src/slovak/ResSlo.gf | 885 +++++++++++++++++++++++++++++++++++ src/slovak/SentenceSlo.gf | 32 ++ src/slovak/StructuralSlo.gf | 27 ++ src/slovak/SymbolSlo.gf | 11 + src/slovak/TenseSlo.gf | 20 + src/slovak/TextSlo.gf | 8 + src/slovak/VerbSlo.gf | 48 ++ 29 files changed, 1838 insertions(+) create mode 100644 src/api/CombinatorsSlo.gf create mode 100644 src/api/ConstructorsSlo.gf create mode 100644 src/api/SymbolicSlo.gf create mode 100644 src/api/SyntaxSlo.gf create mode 100644 src/api/TrySlo.gf create mode 100644 src/slovak/AdjectiveSlo.gf create mode 100644 src/slovak/AdverbSlo.gf create mode 100644 src/slovak/AllSlo.gf create mode 100644 src/slovak/AllSloAbs.gf create mode 100644 src/slovak/CatSlo.gf create mode 100644 src/slovak/ConjunctionSlo.gf create mode 100644 src/slovak/GrammarSlo.gf create mode 100644 src/slovak/IdiomSlo.gf create mode 100644 src/slovak/LangSlo.gf create mode 100644 src/slovak/LexiconSlo.gf create mode 100644 src/slovak/MissingSlo.gf create mode 100644 src/slovak/NounSlo.gf create mode 100644 src/slovak/NumeralSlo.gf create mode 100644 src/slovak/ParadigmsSlo.gf create mode 100644 src/slovak/PhraseSlo.gf create mode 100644 src/slovak/QuestionSlo.gf create mode 100644 src/slovak/RelativeSlo.gf create mode 100644 src/slovak/ResSlo.gf create mode 100644 src/slovak/SentenceSlo.gf create mode 100644 src/slovak/StructuralSlo.gf create mode 100644 src/slovak/SymbolSlo.gf create mode 100644 src/slovak/TenseSlo.gf create mode 100644 src/slovak/TextSlo.gf create mode 100644 src/slovak/VerbSlo.gf diff --git a/src/api/CombinatorsSlo.gf b/src/api/CombinatorsSlo.gf new file mode 100644 index 000000000..ef7fe69b4 --- /dev/null +++ b/src/api/CombinatorsSlo.gf @@ -0,0 +1,9 @@ +--# -path=.:alltenses:prelude + +resource CombinatorsSlo = Combinators with + (Cat = CatSlo), + (Structural = StructuralSlo), + (Constructors = ConstructorsSlo) + ** open MissingSlo in {} + + diff --git a/src/api/ConstructorsSlo.gf b/src/api/ConstructorsSlo.gf new file mode 100644 index 000000000..144198d76 --- /dev/null +++ b/src/api/ConstructorsSlo.gf @@ -0,0 +1,5 @@ +--# -path=.:alltenses:prelude + +resource ConstructorsSlo = Constructors with (Grammar = GrammarSlo) + ** open MissingSlo in {} + diff --git a/src/api/SymbolicSlo.gf b/src/api/SymbolicSlo.gf new file mode 100644 index 000000000..804ccf992 --- /dev/null +++ b/src/api/SymbolicSlo.gf @@ -0,0 +1,6 @@ +--# -path=.:../slovak:../common:../abstract:../prelude + +resource SymbolicSlo = Symbolic with + (Symbol = SymbolSlo), + (Grammar = GrammarSlo) + ** open MissingSlo in {} diff --git a/src/api/SyntaxSlo.gf b/src/api/SyntaxSlo.gf new file mode 100644 index 000000000..48fddc911 --- /dev/null +++ b/src/api/SyntaxSlo.gf @@ -0,0 +1,4 @@ +--# -path=.:./alltenses:../prelude + +instance SyntaxSlo of Syntax = + ConstructorsSlo, CatSlo, StructuralSlo, CombinatorsSlo ; diff --git a/src/api/TrySlo.gf b/src/api/TrySlo.gf new file mode 100644 index 000000000..c81174a13 --- /dev/null +++ b/src/api/TrySlo.gf @@ -0,0 +1,13 @@ +--# -path=.:../slovak:../common:../abstract:../prelude + +resource TrySlo = SyntaxSlo, LexiconSlo, ParadigmsSlo -[mkAdv, mkDet,mkQuant]** + open (P = ParadigmsSlo) in { + +-- oper + +-- mkAdv = overload SyntaxSlo { +-- mkAdv : Str -> Adv = P.mkAdv ; +-- } ; + +} + diff --git a/src/slovak/AdjectiveSlo.gf b/src/slovak/AdjectiveSlo.gf new file mode 100644 index 000000000..623faa7e6 --- /dev/null +++ b/src/slovak/AdjectiveSlo.gf @@ -0,0 +1,23 @@ +concrete AdjectiveSlo of Adjective = CatSlo ** open ResSlo, Prelude in { + + lin + + PositA a = adjFormsAdjective a ** {isPost = False} ; + + AdAP ada ap = ap ** {s = \\g,n,c => ada.s ++ ap.s ! g ! n ! c} ; + + ComplA2 a np = + let ap = adjFormsAdjective a + in + ap ** { + s = \\g,n,c => ap.s ! g ! n ! c ++ a.c.s ++ np.s ! a.c.c ; + isPost = True ; + } ; + + UseA2 a = adjFormsAdjective a ** {isPost = False} ; + + UseComparA a = adjFormsAdjective a ** {isPost = False} ; ---- TODO: this gives positive forms + + AdvAP ap adv = ap ** {s = \\g,n,c => ap.s ! g ! n ! c ++ adv.s} ; + +} diff --git a/src/slovak/AdverbSlo.gf b/src/slovak/AdverbSlo.gf new file mode 100644 index 000000000..6b993fb5d --- /dev/null +++ b/src/slovak/AdverbSlo.gf @@ -0,0 +1,9 @@ +concrete AdverbSlo of Adverb = CatSlo ** + open ResSlo, Prelude in { + +lin + PrepNP prep np = { + s = prep.s ++ np.prep ! prep.c + } ; + +} diff --git a/src/slovak/AllSlo.gf b/src/slovak/AllSlo.gf new file mode 100644 index 000000000..021062dad --- /dev/null +++ b/src/slovak/AllSlo.gf @@ -0,0 +1,6 @@ +--# -path=.:../abstract:../common:../api + +concrete AllSlo of AllSloAbs = + LangSlo + ; + diff --git a/src/slovak/AllSloAbs.gf b/src/slovak/AllSloAbs.gf new file mode 100644 index 000000000..f7eaf6830 --- /dev/null +++ b/src/slovak/AllSloAbs.gf @@ -0,0 +1,6 @@ +--# -path=.:../abstract:../common:prelude + +abstract AllSloAbs = + Lang + ; + diff --git a/src/slovak/CatSlo.gf b/src/slovak/CatSlo.gf new file mode 100644 index 000000000..2f737358d --- /dev/null +++ b/src/slovak/CatSlo.gf @@ -0,0 +1,70 @@ +concrete CatSlo of Cat = +--- CommonX ** + + open ResSlo, Prelude in { + + lincat + Text = {s : Str} ; + Phr = {s : Str} ; + Utt = {s : Str} ; + + S = {s : Str} ; + Cl = {subj,clit,compl : Str ; verb : VerbForms ; a : Agr} ; + Comp = {s : Agr => Str} ; + + QS = {s : Str} ; ---- TODO: indirect questions + QCl = {subj,clit,compl : Str ; verb : VerbForms ; a : Agr} ; -- = Cl ---- check if enough + IAdv = {s : Str} ; + + RS = {s : Agr => Str} ; + RCl = {subj,clit,compl : Agr => Str ; verb : VerbForms} ; ---- RAgr with composite RP + RP = AdjForms ; + + VP = {verb : VerbForms ; clit,compl : Agr => Str} ; ---- more fields probably needed + VPSlash = {verb : VerbForms ; clit,compl : Agr => Str ; c : ComplementCase} ; ---- + V = ResSlo.VerbForms ; + V2 = ResSlo.VerbForms ** {c : ComplementCase} ; + + A = ResSlo.AdjForms ; + AP = ResSlo.Adjective ** {isPost : Bool} ; -- {s : Gender => Number => Case => Str} + A2 = ResSlo.AdjForms ** {c : ComplementCase} ; + + AdA = {s : Str} ; + + N = ResSlo.NounForms ; + CN = ResSlo.Noun ; -- {s : Number => Case => Str ; g : Gender} + NP = {s,clit,prep : Case => Str ; a : Agr ; hasClit : Bool} ; -- clit,prep differ for pronouns + PN = {s : Case => Str ; g : Gender} ; + Det = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ; -- can contain a numeral, therefore NumSize + Quant = {s : Gender => Number => Case => Str} ; -- same as AP + Num = Determiner ; + Card = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ; + Pron = PronForms ; + + Adv = {s : Str} ; + Prep = ResSlo.ComplementCase ; -- {s : Str ; c : Case ; hasPrep : Bool} ; + Conj = {s1,s2 : Str} ; ---- may need a number + + Pol = {s : Str ; p : Bool} ; + Temp = {s : Str ; t : CTense} ; + Tense = {s : Str ; t : CTense} ; + Ant = {s : Str ; t : CTense} ; + + PConj = {s : Str} ; + Voc = {s : Str} ; + + AdN = {s : Str} ; + AdV = {s : Str} ; + CAdv = {s : Str} ; + SC = {s : Str} ; + + linref + N = \s -> s.snom ; + A = \s -> s.msnom ; + + + lincat Numeral = Determiner ; ---- TODO: should contain Ord as well + lincat Digits = {s:Str ; size : NumSize} ; + + +} diff --git a/src/slovak/ConjunctionSlo.gf b/src/slovak/ConjunctionSlo.gf new file mode 100644 index 000000000..085254168 --- /dev/null +++ b/src/slovak/ConjunctionSlo.gf @@ -0,0 +1,56 @@ +concrete ConjunctionSlo of Conjunction = CatSlo ** + open ResSlo, Coordination, Prelude in { + + lincat + [Adv] = {s1,s2 : Str} ; + [AP] = {s1,s2 : Gender => Number => Case => Str ; isPost : Bool} ; + [NP] = {s1,s2,prep1,prep2 : Case => Str ; a : Agr} ; + [S] = {s1,s2 : Str} ; + [RS] = {s1,s2 : Agr => Str} ; + + lin + BaseAdv = twoSS ; + ConsAdv = consrSS comma ; + + BaseAP x y = twoTable3 Gender Number Case x y + ** {isPost = orB x.isPost y.isPost} ; ---- should be so in Pol too + ConsAP x xs = consrTable3 Gender Number Case comma x xs + ** {isPost = orB x.isPost xs.isPost} ; + + BaseNP x y = { + s1 = x.s ; + s2 = y.s ; + prep1 = x.prep ; + prep2 = y.prep ; + a = y.a + } ; -- clitics disappear ---- Agr TODO + ConsNP x xs = { + s1 = \\c => x.s ! c ++ comma ++ xs.s1 ! c ; + s2 = xs.s2 ; + prep1 = \\c => x.prep ! c ++ comma ++ xs.prep1 ! c ; + prep2 = xs.prep2 ; + a = xs.a ---- + } ; + + BaseS = twoSS ; + ConsS = consrSS comma ; + + BaseRS = twoTable Agr ; + ConsRS = consrTable Agr comma ; + + ConjAdv = conjunctDistrSS ; + + ConjAP conj xs = conjunctDistrTable3 Gender Number Case conj xs + ** {isPost = xs.isPost} ; + + ConjNP conj xs = { + s,clit = \\c => conj.s1 ++ xs.s1 ! c ++ conj.s2 ++ xs.s2 ! c ; + prep = \\c => conj.s1 ++ xs.prep1 ! c ++ conj.s2 ++ xs.prep2 ! c ; + a = xs.a ; ---- dep. on conj as well + hasClit = False ; + } ; + + ConjS = conjunctDistrSS ; + ConjRS = conjunctDistrTable Agr ; + +} diff --git a/src/slovak/GrammarSlo.gf b/src/slovak/GrammarSlo.gf new file mode 100644 index 000000000..b711fba9d --- /dev/null +++ b/src/slovak/GrammarSlo.gf @@ -0,0 +1,19 @@ +--# -path=.:../abstract:../common:prelude + +concrete GrammarSlo of Grammar = + NounSlo, + VerbSlo, + AdjectiveSlo, + AdverbSlo, + NumeralSlo, + SentenceSlo, + QuestionSlo, + RelativeSlo, + ConjunctionSlo, + PhraseSlo, + TextSlo, + StructuralSlo, + IdiomSlo, + TenseSlo + ** { +} diff --git a/src/slovak/IdiomSlo.gf b/src/slovak/IdiomSlo.gf new file mode 100644 index 000000000..4f5f867d3 --- /dev/null +++ b/src/slovak/IdiomSlo.gf @@ -0,0 +1,5 @@ +concrete IdiomSlo of Idiom = CatSlo ** open Prelude, ResSlo in { + + + +} diff --git a/src/slovak/LangSlo.gf b/src/slovak/LangSlo.gf new file mode 100644 index 000000000..55fcce474 --- /dev/null +++ b/src/slovak/LangSlo.gf @@ -0,0 +1,10 @@ +--# -path=.:../abstract:../common:../api + +concrete LangSlo of Lang = + GrammarSlo, + LexiconSlo +-- ,ConstructionSlo +-- ,DocumentationSlo --# notpresent + ** { + +} diff --git a/src/slovak/LexiconSlo.gf b/src/slovak/LexiconSlo.gf new file mode 100644 index 000000000..e4e27d48d --- /dev/null +++ b/src/slovak/LexiconSlo.gf @@ -0,0 +1,59 @@ +concrete LexiconSlo of Lexicon = + CatSlo + ** + open + ResSlo, ParadigmsSlo + in { + + lin + boy_N = declPAN "kluk" ; + man_N = declMUZ "muž" ; + teacher_N = declMUZ "učitel" ; + horse_N = declMUZ "kůň" ; + father_N = declMUZ "otec" ; + husband_N = declPAN "manžel" ; + + castle_N = declHRAD "hrad" ; + forest_N = declHRAD "les" ; + machine_N = declSTROJ "stroj" ; + + woman_N = declZENA "žena" ; + school_N = declZENA "škola" ; ---- + skirt_N = declRUZE "sukně"; + street_N = declRUZE "ulice" ; + rose_N = declRUZE "růže" ; + song_N = declPISEN "píseň" ; + bed_N = declPISEN "postel" ; + door_N = declRUZE "dveře" ; + bone_N = declKOST "kost" ; + village_N = declKOST "ves" ; ---- + + city_N = declMESTO "město" ; + apple_N = declMESTO "jablko" ; ---- + sea_N = declMORE "moře" ; + airport_N = declMORE "letiště" ; + chicken_N = declKURE "kuře" ; + house_N = declSTAVENI "stavení" ; --- building, house + station_N = declSTAVENI "nádraží" ; + + young_A = mkA "mladý" ; + old_A = mkA "starý" ; + good_A = mkA "dobrý" ; + bad_A = mkA "špatný" ; + beautiful_A = mkA "krásný" ; + clean_A = mkA "čistý" ; + dirty_A = mkA "špinavý" ; + + white_A = mkA "bílý" ; + black_A = mkA "černý" ; + red_A = mkA "červený" ; + brown_A = mkA "hnědý" ; + blue_A = mkA "modrý" ; + green_A = mkA "zelený" ; + yellow_A = mkA "žlutý" ; + + buy_V2 = mkV2 (iii_kupovatVerbForms "kupovat") ; + love_V2 = mkV2 (iii_kupovatVerbForms "milovat") ; + +} + diff --git a/src/slovak/MissingSlo.gf b/src/slovak/MissingSlo.gf new file mode 100644 index 000000000..4408f8f2c --- /dev/null +++ b/src/slovak/MissingSlo.gf @@ -0,0 +1,102 @@ +resource MissingSlo = open GrammarSlo, Prelude in { + +-- temporary definitions to enable the compilation of RGL API +oper AAnter : Ant = notYet "AAnter" ; +oper AdAdv : AdA -> Adv -> Adv = notYet "AdAdv" ; +oper AdNum : AdN -> Card -> Card = notYet "AdNum" ; +oper AdVVP : AdV -> VP -> VP = notYet "AdVVP" ; +oper AdjOrd : Ord -> AP = notYet "AdjOrd" ; +oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ; +oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ; +oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ; +oper AdvS : Adv -> S -> S = notYet "AdvS" ; +oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ; +oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ; +oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ; +oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ; +oper CompCN : CN -> Comp = notYet "CompCN" ; +oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ; +oper CompIP : IP -> IComp = notYet "CompIP" ; +oper ComparA : A -> NP -> AP = notYet "ComparA" ; +oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ; +oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ; +oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ; +oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ; +oper ComplVA : VA -> AP -> VP = notYet "ComplVA" ; +oper ComplVQ : VQ -> QS -> VP = notYet "ComplVQ" ; +oper ComplVS : VS -> S -> VP = notYet "ComplVS" ; +oper ComplVV : VV -> VP -> VP = notYet "ComplVV" ; +oper DetNP : Det -> NP = notYet "DetNP" ; +oper DetQuantOrd : Quant -> Num -> Ord -> Det = notYet "DetQuantOrd" ; +oper EmbedQS : QS -> SC = notYet "EmbedQS" ; +oper EmbedS : S -> SC = notYet "EmbedS" ; +oper EmbedVP : VP -> SC = notYet "EmbedVP" ; +oper ExistIP : IP -> QCl = notYet "ExistIP" ; +oper ExistNP : NP -> Cl = notYet "ExistNP" ; +oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ; +oper GenericCl : VP -> Cl = notYet "GenericCl" ; +oper IdetCN : IDet -> CN -> IP = notYet "IdetCN" ; +oper IdetIP : IDet -> IP = notYet "IdetIP" ; +oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ; +oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ; +oper ImpVP : VP -> Imp = notYet "ImpVP" ; +oper ImpersCl : VP -> Cl = notYet "ImpersCl" ; +oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ; +oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ; +oper OrdSuperl : A -> Ord = notYet "OrdSuperl" ; +oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ; +oper PassV2 : V2 -> VP = notYet "PassV2" ; +oper PositAdvAdj : A -> Adv = notYet "PositAdvAdj" ; +oper PossPron : Pron -> Quant = notYet "PossPron" ; +oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ; +oper PredetNP : Predet -> NP -> NP = notYet "PredetNP" ; +oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ; +oper ProgrVP : VP -> VP = notYet "ProgrVP" ; +oper QuestIAdv : IAdv -> Cl -> QCl = notYet "QuestIAdv" ; +oper QuestIComp : IComp -> NP -> QCl = notYet "QuestIComp" ; +oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ; +oper QuestVP : IP -> VP -> QCl = notYet "QuestVP" ; +oper ReflA2 : A2 -> AP = notYet "ReflA2" ; +oper ReflVP : VPSlash -> VP = notYet "ReflVP" ; +oper RelCl : Cl -> RCl = notYet "RelCl" ; +oper RelNP : NP -> RS -> NP = notYet "RelNP" ; +oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ; +oper SentAP : AP -> SC -> AP = notYet "SentAP" ; +oper SentCN : CN -> SC -> CN = notYet "SentCN" ; +oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ; +oper Slash3V3 : V3 -> NP -> VPSlash = notYet "Slash3V3" ; +oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ; +oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ; +oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ; +oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ; +oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ; +oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ; +oper SlashVP : NP -> VPSlash -> ClSlash = notYet "SlashVP" ; +oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ; +oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ; +oper SubjS : Subj -> S -> Adv = notYet "SubjS" ; +oper TCond : Tense = notYet "TCond" ; +oper TFut : Tense = notYet "TFut" ; +oper TPast : Tense = notYet "TPast" ; +oper Use2N3 : N3 -> N2 = notYet "Use2N3" ; +oper UseN2 : N2 -> CN = notYet "UseN2" ; +oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ; +oper UttCard : Card -> Utt = notYet "UttCard" ; +oper UttIAdv : IAdv -> Utt = notYet "UttIAdv" ; +oper UttIP : IP -> Utt = notYet "UttIP" ; +oper UttImpPl : Pol -> Imp -> Utt = notYet "UttImpPl" ; +oper UttImpPol : Pol -> Imp -> Utt = notYet "UttImpPol" ; +oper UttImpSg : Pol -> Imp -> Utt = notYet "UttImpSg" ; +oper UttQS : QS -> Utt = notYet "UttQS" ; +oper UttVP : VP -> Utt = notYet "UttVP" ; +oper by8agent_Prep : Prep = notYet "by8agent_Prep" ; +oper it_Pron : Pron = notYet "it_Pron" ; +oper they_Pron : Pron = notYet "they_Pron" ; +oper we_Pron : Pron = notYet "we_Pron" ; +oper whatSg_IP : IP = notYet "whatSg_IP" ; +oper which_IQuant : IQuant = notYet "which_IQuant" ; +oper whoSg_IP : IP = notYet "whoSg_IP" ; +oper youPl_Pron : Pron = notYet "youPl_Pron" ; +oper youPol_Pron : Pron = notYet "youPol_Pron" ; + +} diff --git a/src/slovak/NounSlo.gf b/src/slovak/NounSlo.gf new file mode 100644 index 000000000..2e60e38a8 --- /dev/null +++ b/src/slovak/NounSlo.gf @@ -0,0 +1,100 @@ +concrete NounSlo of Noun = + CatSlo +** + + open ResSlo, Prelude in { + +lin + DetCN det cn = { + s,prep,clit = \\c => det.s ! cn.g ! c ++ numSizeForm cn.s det.size c ; + a = numSizeAgr cn.g det.size P3 ; + hasClit = False ; + } ; + + MassNP cn = { + s,prep,clit = \\c => cn.s ! Sg ! c ; + a = Ag cn.g Sg P3 ; + hasClit = False ; + } ; + + DetQuant quant num = { + s = \\g,c => num.s ! g ! c ++ quant.s ! g ! numSizeNumber num.size ! c ; + size = num.size + } ; + + DefArt = {s = \\_,_,_ => []} ; + IndefArt = {s = \\_,_,_ => []} ; + NumPl = {s = \\_,_ => [] ; size = Num2_4} ; ---- size + NumSg = {s = \\_,_ => [] ; size = Num1} ; + + UsePron pron = { + s = table { + Nom | Voc => pron.nom ; + Gen => pron.gen ; + Dat => pron.dat ; + Acc => pron.acc ; + Loc => pron.loc ; + Ins => pron.ins + } ; + clit = table { + Nom => pron.cnom ; + Voc => pron.nom ; + Gen => pron.cgen ; + Dat => pron.cdat ; + Acc => pron.cacc ; + Loc => pron.loc ; + Ins => pron.ins + } ; + prep = table { + Nom | Voc => pron.nom ; + Gen => pron.pgen ; + Dat => pron.pdat ; + Acc => pron.pacc ; + Loc => pron.loc ; + Ins => pron.pins + } ; + a = pron.a ; + hasClit = True ; + } ; + + UsePN pn = { + s,clit,prep = \\c => pn.s ! c ; + a = Ag pn.g Sg P3 ; + hasClit = False ; + } ; + + AdjCN ap cn = { + s = \\n,c => ap.s ! cn.g ! n ! c ++ cn.s ! n ! c ; + g = cn.g + } ; + + RelCN cn rs = { + s = \\n,c => cn.s ! n ! c ++ rs.s ! Ag cn.g n P3 ; + g = cn.g + } ; + + AdvCN cn adv = { + s = \\n,c => cn.s ! n ! c ++ adv.s ; + g = cn.g + } ; + + AdvNP np adv = { + s,clit = \\c => np.s ! c ++ adv.s ; + prep = \\c => np.prep ! c ++ adv.s ; + a = np.a ; + hasClit = False ; + } ; + + UseN n = nounFormsNoun n ; + + ApposCN cn np = { + s = \\n,c => cn.s ! n ! c ++ np.s ! c ; ---- TODO check apposition order + g = cn.g + } ; + + NumCard c = c ; + NumDigits ds = ds ** {s = \\_,_ => ds.s} ; + NumNumeral nu = nu ; + + +} diff --git a/src/slovak/NumeralSlo.gf b/src/slovak/NumeralSlo.gf new file mode 100644 index 000000000..19538c46e --- /dev/null +++ b/src/slovak/NumeralSlo.gf @@ -0,0 +1,120 @@ +concrete NumeralSlo of Numeral = + + CatSlo ** + + open + ResSlo, + Prelude + in { + +-- from gf-contrib/numerals/czech.gf, added inflections +-- AR 2020-03-20 +---- TODO ordinal forms + + +oper LinNumeral = Determiner ; -- {s : NumeralForms ; size : NumSize} ; +oper LinDigit = {unit : Gender => Case => Str ; teen, ten, hundred : Str ; size : NumSize} ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; + +lincat Sub100 = LinNumeral ; +lincat Sub1000 = LinNumeral ; +lincat Sub1000000 = LinNumeral ; + +oper mkNum : Determiner -> Str -> Str -> Str -> LinDigit = + \dva, dvanast, dvadsat, dveste -> { + unit = dva.s ; + teen = dvanast + "náct" ; + ten = dvadsat ; + hundred = dveste ; + size = dva.size ; + } ; + +oper mk2Num : Determiner -> Str -> Str -> Str -> LinDigit = + \unit, teenbase, tenbase, hundred -> + mkNum unit teenbase (tenbase + "cet") hundred ; + +oper mk5Num : Str -> Str -> Str -> Str -> LinDigit = + \unit,uniti, teenbase, tenbase -> + mkNum (regNumeral unit uniti) teenbase (tenbase + "desát") (unit ++ "set") ; + +oper bigNumeral : Str -> LinNumeral = \s -> invarNumeral s ; + +lin num x = x ; + +lin n2 = mk2Num twoNumeral "dva" "dva" ("dvě" ++ "stě") ; +lin n3 = mk2Num threeNumeral "tři" "tři" ("tři" ++ "sta") ; +lin n4 = mk2Num fourNumeral "čtr" "čtyři" ("čtyři" ++ "sta") ; +lin n5 = mk5Num "pět" "pěti" "pat" "pa" ; +lin n6 = mk5Num "šest" "šesti" "šest" "še" ; +lin n7 = mk5Num "sedm" "sedmi" "sedm" "sedm"; +lin n8 = mk5Num "osm" "osmi" "osm" "osm"; +lin n9 = mk5Num "devět" "devíti" "devate" "deva" ; + +lin pot01 = { + unit = oneNumeral.s ; hundred = "sto" ; ten = "deset" ; teen = "jedenáct" ; + size = Num1 + } ; +lin pot0 d = d ; + +lin pot110 = bigNumeral "deset" ; +lin pot111 = bigNumeral "jedenáct" ; +lin pot1to19 d = bigNumeral d.teen ; + +lin pot0as1 n = {s = n.unit ; size = n.size} ; +lin pot1 d = bigNumeral d.ten ; +lin pot1plus d e = { + s = (invarNumeral (d.ten ++ determinerStr (e ** {s = e.unit}))).s ; ---- TODO inflection? + size = tfSize e.size + } ; + ---- variants { d.s ! ten ++ e.s ! unit ; glue (glue (e.s ! unit) "a") (d.s ! ten)} ; size = tfSize e.size} ; + +lin pot1as2 n = n ; +lin pot2 d = bigNumeral d.hundred ; +lin pot2plus d e = { + s = (invarNumeral (d.hundred ++ determinerStr e)).s ; ---- TODO inflection? + size = tfSize e.size + } ; + +lin pot2as3 n = n ; +lin pot3 n = bigNumeral (mkTh (determinerStr n) n.size) ; + +lin pot3plus n m = { + s = (invarNumeral (mkTh (determinerStr n) n.size ++ determinerStr m)).s ; ---- TODO inflection? + size = tfSize m.size + } ; + +oper tfSize : NumSize -> NumSize = \sz -> + table {Num1 => Num5 ; other => other} ! sz ; + +oper mkTh : Str -> NumSize -> Str = \attr,size -> + case size of { + Num1 => "tisíc" ; + Num2_4 => attr ++ "tisíce" ; + Num5 => attr ++ "tisíc" + } ; + +oper determinerStr : Determiner -> Str = \d -> d.s ! Masc Anim ! Nom ; + + +-- -- Numerals as sequences of digits have a separate, simpler grammar + lincat Dig = {s:Str ; size : NumSize} ; + + lin + IDig d = d ; + + IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s ; size = Num5} ; ---- leading zeros ?? + + D_0 = { s = "0" ; size = Num1} ; ---- ?? + D_1 = { s = "1" ; size = Num1} ; + D_2 = { s = "2" ; size = Num2_4} ; + D_3 = { s = "3" ; size = Num2_4} ; + D_4 = { s = "4" ; size = Num2_4} ; + D_5 = { s = "5" ; size = Num5} ; + D_6 = { s = "6" ; size = Num5} ; + D_7 = { s = "7" ; size = Num5} ; + D_8 = { s = "8" ; size = Num5} ; + D_9 = { s = "9" ; size = Num5} ; + +} diff --git a/src/slovak/ParadigmsSlo.gf b/src/slovak/ParadigmsSlo.gf new file mode 100644 index 000000000..542d3a931 --- /dev/null +++ b/src/slovak/ParadigmsSlo.gf @@ -0,0 +1,141 @@ +resource ParadigmsSlo = open CatSlo, ResSlo, Prelude in { + +---------------- +-- Parameters + +oper + singular : Number + = Sg ; + plural : Number + = Pl ; + + mascAnimate : Gender + = Masc Anim ; + mascInanimate : Gender + = Masc Inanim ; + feminine : Gender + = Fem ; + neuter : Gender + = Neutr ; + + nominative : Case + = Nom ; + genitive : Case + = Gen ; + dative : Case + = Dat ; + accusative : Case + = Acc ; + vocative : Case + = ResSlo.Voc ; + locative : Case + = Loc ; + instrumental : Case + = Ins ; + +------------------------------ +-- Nouns + +oper + mkN = overload { + mkN : (nom : Str) -> N + = \nom -> lin N (guessNounForms nom) ; + mkN : (nom,gen : Str) -> Gender -> N + = \nom,gen,g -> lin N (declensionNounForms nom gen g) ; + } ; + +-- The following standard declensions can be used with good accuracy. +-- However, they have some defaults that may have to be overwritten. +-- This can be done easily by overriding those formes with record extension (**). +-- The default extensions are shown in comments; if the default is correct, no extension is needed. + + panN : Str -> N -- default ** {pnom = +i} + = \s -> lin N (declPAN s) ; + predsedaN : Str -> N -- default ** {sgen = +i} + = \s -> lin N (declPREDSEDA s) ; + hradN : Str -> N -- default ** {sgen,sloc = +u} + = \s -> lin N (declHRAD s) ; + zenaN : Str -> N -- default ** {pgen = zen} + = \s -> lin N (declZENA s) ; + mestoN : Str -> N -- default ** {sloc = +u ; pgen = mest ; ploc = +ech} + = \s -> lin N (declMESTO s) ; + muzN : Str -> N + = \s -> lin N (declMUZ s) ; + soudceN : Str -> N -- default ** {sdat,sloc = +i ; pnom = +i} + = \s -> lin N (declSOUDCE s) ; + strojN : Str -> N + = \s -> lin N (declSTROJ s) ; + ruzeN : Str -> N + = \s -> lin N (declRUZE s) ; + pisenN : Str -> N + = \s -> lin N (declPISEN s) ; + kostN : Str -> N + = \s -> lin N (declKOST s) ; + kureN : Str -> N + = \s -> lin N (declKURE s) ; + moreN : Str -> N -- default ** {pgen = +í} + = \s -> lin N (declMORE s) ; + staveniN : Str -> N + = \s -> lin N (declSTAVENI s) ; + +-- The full definition of the noun record is +-- { +-- snom,sgen,sdat,sacc,svoc,sloc,sins, pnom,pgen,pdat,pacc,ploc,pins : Str ; +-- g : Gender +-- } + + +--------------------- +-- Adjectives + +-- Only positive forms so far ---- + + mkA = overload { + mkA : Str -> A + = \s -> lin A (case s of { + _ + "ý" => mladyAdjForms s ; + _ + "í" => jarniAdjForms s ; + _ + "ův" => otcuvAdjForms s ; + _ + "in" => matcinAdjForms s ; + _ => Predef.error ("no mkA for" ++ s) + }) ; + } ; + + mladyA : Str -> A + = \s -> lin A (mladyAdjForms s) ; + jarniA : Str -> A + = \s -> lin A (jarniAdjForms s) ; + otcuvA : Str -> A + = \s -> lin A (otcuvAdjForms s) ; + matcinA : Str -> A + = \s -> lin A (matcinAdjForms s) ; + + mkA2 : A -> Prep -> A2 + = \a,p -> lin A2 (a ** {c = p}) ; + +------------------------- +-- Verbs + + mkV2 = overload { + mkV2 : VerbForms -> VerbForms ** {c : ComplementCase} + = \vf -> vf ** {c = {s = [] ; c = Acc ; hasPrep = False}} ; + mkV2 : VerbForms -> Case -> VerbForms ** {c : ComplementCase} + = \vf,c -> vf ** {c = {s = [] ; c = c ; hasPrep = False}} ; + mkV2 : VerbForms -> ComplementCase -> VerbForms ** {c : ComplementCase} + = \vf,c -> vf ** {c = c} ; + } ; + +------------------------ +-- Adverbs, prepositions, conjunctions, ... + + mkAdv : Str -> Adv + = \s -> lin Adv {s = s} ; + + mkPrep : Str -> Case -> Prep + = \s,c -> lin Prep {s = s ; c = c ; hasPrep = True} ; ---- True if s /= "" + + mkConj : Str -> Conj + = \s -> lin Conj {s1 = [] ; s2 = s} ; + + +} diff --git a/src/slovak/PhraseSlo.gf b/src/slovak/PhraseSlo.gf new file mode 100644 index 000000000..4510ff084 --- /dev/null +++ b/src/slovak/PhraseSlo.gf @@ -0,0 +1,19 @@ +concrete PhraseSlo of Phrase = CatSlo ** open Prelude, ResSlo in { + +lin + UttS s = s ; + UttAdv adv = adv ; + UttCN cn = {s = cn.s ! Sg ! Nom} ; + UttAP ap = {s = ap.s ! Masc Anim ! Sg ! Nom} ; + UttNP np = {s = np.s ! Nom} ; + + PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; + + + NoPConj = {s = []} ; + PConjConj conj = {s = conj.s2} ; + + NoVoc = {s = []} ; + VocNP np = {s = np.s ! Voc} ; + +} diff --git a/src/slovak/QuestionSlo.gf b/src/slovak/QuestionSlo.gf new file mode 100644 index 000000000..839b576c3 --- /dev/null +++ b/src/slovak/QuestionSlo.gf @@ -0,0 +1,7 @@ +concrete QuestionSlo of Question = CatSlo ** + open ResSlo, Prelude in { + +lin + QuestCl cl = cl ; ---- + +} diff --git a/src/slovak/RelativeSlo.gf b/src/slovak/RelativeSlo.gf new file mode 100644 index 000000000..3def5503e --- /dev/null +++ b/src/slovak/RelativeSlo.gf @@ -0,0 +1,18 @@ +concrete RelativeSlo of Relative = CatSlo ** open + ParadigmsSlo, + ResSlo, + Prelude in { + +lin + RelVP rp vp = vp ** { + subj = + let rel = (adjFormsAdjective rp).s + in \\a => case a of { + Ag g n _ => rel ! g ! n ! Nom + } + } ; + + IdRP = mkA "který" ; + + +} diff --git a/src/slovak/ResSlo.gf b/src/slovak/ResSlo.gf new file mode 100644 index 000000000..be2179529 --- /dev/null +++ b/src/slovak/ResSlo.gf @@ -0,0 +1,885 @@ +resource ResSlo = open Prelude in { + +-- AR March 2020 +-- sources: +-- Wiki = https://en.wikipedia.org/wiki/Czech_declension, https://en.wikipedia.org/wiki/Czech_conjugation +-- CEG = J. Naughton, Czech: an Essential Grammar, Routledge 2005. + +-- parameters + +param + Number = Sg | Pl ; + + Animacy = Anim | Inanim ; + Gender = Masc Animacy | Fem | Neutr ; + + Case = Nom | Gen | Dat | Acc | Voc | Loc | Ins ; -- traditional order + + Person = P1 | P2 | P3 ; + + Agr = Ag Gender Number Person ; + + CTense = CTPres | CTPast ; ----- TODO complete the tense system to match Czech verb morphology + +-- phonology + +oper + hardConsonant : pattern Str = #("d"|"t"|"g"|"h"|"k"|"n"|"r") ; + softConsonant : pattern Str = #("ť"|"ď"|"j"|"ň"|"ř"|"š"|"c"|"č"|"ž") ; + neutralConsonant : pattern Str = #("b"|"f"|"l"|"m"|"p"|"s"|"v") ; + + consonant : pattern Str = + #( + "d" | "t" | "g" | "h" | "k" | "n" | "r" | + "ť" | "ď" | "j" | "ň" | "ř" | "š" | "c" | "č" | "ž" | + "b" | "f" | "l" | "m" | "p" | "s" | "v" + ) ; + + dropFleetingE : Str -> Str = \s -> case s of { + x + "e" + c@("k"|"c"|"n") => x + c ; + x + "e" + "ň" => x + "n" ; + _ => s + } ; + + shortenVowel : Str -> Str = \s -> case s of { + x + "á" + y => x + "a" + y ; + x + "é" + y => x + "e" + y ; + x + "í" + y => x + "i" + y ; + x + "ý" + y => x + "y" + y ; + x + "ó" + y => x + "o" + y ; + x + "ú" + y => x + "u" + y ; + x + "ů" + y => x + "o" + y ; + _ => s + } ; + + addI : Str -> Str = \s -> case s of { + klu + "k" => klu + "ci" ; + vra + "h" => vra + "zi" ; + ce + "ch" => ce + "ši" ; + dokto + "r" => dokto + "ři" ; + pan => pan + "i" + } ; + + addAdjI : Str -> Str = \s -> case s of { + angli + "ck" => angli + "čtí" ; + ce + "sk" => ce + "ští" ; + _ => init (addI s) + "í" + } ; + + -- 3.4.10, in particular when also final 'a' is dropped + addE : Str -> Str = \s -> case s of { + re + "k" => re + "ce" ; + pra + ("g"|"h") => pra + "ze" ; + stre + "ch" => stre + "še" ; + sest + "r" => sest + "ře" ; + pan => pan + "ě" + } ; + + addEch : Str -> Str = \s -> case s of { + klu + "k" => klu + "cich" ; + vra + ("h"|"g") => vra + "zich" ; + ce + "ch" => ce + "šich" ; + pan => pan + "ech" + } ; + + shortFemPlGen : Str -> Str = \s -> case s of { + ul + "ice" => ul + "ic" ; + koleg + "yně" => koleg + "yň" ; + ruz + "e" => ruz + "í" ; + _ => Predef.error ("shortFemPlGen does not apply to" ++ s) + } ; + +--------------- +-- Nouns +--------------- + +-- novel idea (for RGL): lexical items stored as records rather than tables +-- advantages: +-- - easier to make exceptions to paradigms (by ** {}) +-- - easier to keep the number of forms minimal +-- - easier to see what is happening than with lots of anonymous arguments to mkN, mkA, mkV + +-- so this is the lincat of N + + NounForms : Type = {snom,sgen,sdat,sacc,svoc,sloc,sins, pnom,pgen,pdat,pacc,ploc,pins : Str ; g : Gender} ; + +-- But traditional tables make agreement easier to handle in syntax +-- so this is the lincat of CN + + Noun : Type = {s : Number => Case => Str ; g : Gender} ; + +-- this is used in UseN + + nounFormsNoun : NounForms -> Noun + = \forms -> { + s = table { + Sg => table { + Nom => forms.snom ; + Gen => forms.sgen ; + Dat => forms.sdat ; + Acc => forms.sacc ; + Voc => forms.svoc ; + Loc => forms.sloc ; + Ins => forms.sins + } ; + Pl => table { + Nom | Voc => forms.pnom ; + Gen => forms.pgen ; + Dat => forms.pdat ; + Acc => forms.pacc ; + Loc => forms.ploc ; + Ins => forms.pins + } + } ; + g = forms.g + } ; + +-- terminology of CEG + DeclensionType : Type = Str -> NounForms ; + + declensionNounForms : (nom,gen : Str) -> Gender -> NounForms + = \nom,gen,g -> + let decl : DeclensionType = case of { + => declPAN ; + => declPREDSEDA ; + => declHRAD ; + => declZENA ; + => declMESTO ; + => declMUZ ; + => declMUZ ; + => declSOUDCE ; + => declSTROJ ; + => declRUZE ; + => declPISEN ; + => declKOST ; --- also many other "st" 3.6.3 + => declKURE ; + => declMORE ; + => declSTAVENI ; + _ => Predef.error ("cannot infer declension type for" ++ nom ++ gen) + } + in decl nom ; + +-- the "smartest" one-argument mkN + + guessNounForms : Str -> NounForms + = \s -> case s of { + _ + "ost" => declKOST s ; + _ + "tel" => declMUZ s ; + _ + #hardConsonant => declHRAD s ; + _ + #softConsonant => declSTROJ s ; + _ + "a" => declZENA s ; + _ + "o" => declMESTO s ; + _ + "ce" => declSOUDCE s ; + _ + "e" => declMORE s ; + _ + "í" => declSTAVENI s ; + _ => Predef.error ("cannot guess declension type for" ++ s) + } ; + +-- the traditional declensions, in both CEG and Wiki +-- they are also exported in ParadigmsSlo with names panN etc + + declPAN : DeclensionType = \pan -> --- plural nom ové|i|é can be changed with ** {pnom = ...} CEG 3.5.1 + { + snom = pan ; + sgen,sacc = pan + "a" ; + sdat,sloc = pan + "ovi" ; --- pánu + svoc = shortenVowel pan + "e" ; --- "irregular shortening" 3.5.1 + sins = pan + "em" ; + + pnom = addI pan ; -- pani, kluk-kluci --- panové, host-hosté + pgen = pan + "ů" ; + pdat = pan + "ům" ; + pacc,pins = pan + "y" ; + ploc = addEch pan ; + g = Masc Anim + } ; + + declPREDSEDA : DeclensionType = \predseda -> --- 3.5.4: sgen y/i + let predsed = init predseda + in + { + snom = predseda ; + sgen = predsed + "y" ; -- pacc,pins --- i + sdat,sloc = predsed + "ovi" ; + sacc = predsed + "u" ; + svoc = predsed + "o" ; + sins = predsed + "ou" ; + + pnom = case predseda of { + tur + "ista" => tur + "isté" ; + _ => predsed + "ové" + } ; + pgen = predsed + "ů" ; + pdat = predsed + "ům" ; + pacc,pins = predsed + "y" ; + ploc = addEch predsed ; + g = Masc Anim + } ; + + declHRAD : DeclensionType = \hrad -> --- 3.5.2: sloc u/ě/e extra arg, sport-u, hrad-ě ; sgen u/a + let hrd = dropFleetingE hrad + in + { + snom,sacc = hrad ; + sgen,sdat = hrd + "u" ; --- Berlín-a + sloc = hrd + "u" ; --- addE hrad ; -- stůl-stole + svoc = hrd + "e" ; + sins = hrd + "em" ; + + pnom,pacc,pins = hrd + "y" ; + pgen = hrd + "ů" ; + pdat = hrd + "ům" ; + ploc = addEch hrd ; + g = Masc Inanim + } ; + + declZENA : DeclensionType = \zena -> --- 3.6.1 sge y/i ; pgen sometimes shortening + let zen = init zena + in + { + snom = zena ; + sgen = zen + "y" ; --- i after soft cons sometimes + sdat,sloc = zen + "ě" ; --- i after soft cons sometimes ; skol+e + sacc = zen + "u" ; + svoc = shortenVowel zen + "o" ; ---- shorten ? + sins = zen + "ou" ; + + pnom,pacc = zen + "y" ; --- also sgen + pgen = zen ; --- sometimes with vowel shortening + pdat = zen + "ám" ; + ploc = zen + "ách" ; + pins = zen + "ami" ; + g = Fem + } ; + + declMESTO : DeclensionType = \mesto -> --- 3.7.1 sloc u/e ; pgen vowel shortening sometimes ; ploc variations + let mest = init mesto + in + { + snom,sacc,svoc = mesto ; + sgen = mest + "a" ; + sdat = mest + "u" ; + sloc = mest + "u" ; --- "ě" + sins = mest + "em" ; + + pnom,pacc = mest + "a" ; + pgen = mest ; --- léta - let + pdat = mest + "ům" ; + ploc = mest + "ech" ; --- with variations + pins = mest + "y" ; + g = Neutr + } ; + + declMUZ : DeclensionType = \muz_ -> --- 3.5.3 : sdat,sloc ; pnom + let muz = dropFleetingE muz_ + in + { + snom = muz_ ; + sgen,sacc = muz + "e" ; --- pacc + sdat,sloc = muz + "i" ; --- muzovi + svoc = case muz_ of { + chlap + "ec" => chlap + "če" ; + _ => muz + "i" + } ; + sins = muz + "em" ; + + pnom = case muz_ of { + uci + "tel" => uci + "telé" ; + _ => muz + "i" --- muzové + } ; + pgen = muz + "ů" ; + pacc = muz + "e" ; + pdat = muz + "ům" ; + ploc = muz + "ích" ; + pins = muz + "i" ; + g = Masc Anim + } ; + + declSOUDCE : DeclensionType = \soudce -> --- 3.5.3: sdat/sloc i,ovi ; pnom i/ové + let soudc = init soudce + in + { + snom,sgen,sacc,svoc = soudce ; ---- pacc + sdat,sloc = soudc + "i" ; --- soudcovi + sins = soudc + "em" ; + + pnom = soudc + "i" ; --- soudcové + pgen = soudc + "ů" ; + pdat = soudc + "ům" ; + pacc = soudce ; + ploc = soudc + "ích" ; + pins = soudc + "i" ; + g = Masc Anim + } ; + + declSTROJ : DeclensionType = \stroj -> + { + snom,sacc = stroj ; + sgen = stroj + "e" ; --- pnom,pacc + sdat,svoc,sloc = stroj + "i" ; --- pins ---- svoc shorten? + sins = stroj + "em" ; + + pnom,pacc = stroj + "e" ; + pgen = stroj + "ů" ; + pdat = stroj + "ům" ; + ploc = stroj + "ích" ; + pins = stroj + "i" ; + g = Masc Inanim + } ; + + declRUZE : DeclensionType = \ruze -> --- 3.6.2: pgen ulice-ulic, chvile-cvil + let ruz = init ruze + in + { + snom,sgen,svoc = ruze ; --- pnom,pacc + sdat,sacc,sloc = ruz + "i" ; + sins = ruz + "í" ; + + pnom,pacc = ruze ; + pgen = shortFemPlGen ruze ; + pdat = ruz + "ím" ; + ploc = ruz + "ích" ; + pins = ruz + "emi" ; + g = Fem + } ; + + declPISEN : DeclensionType = \pisen -> + let pisn = dropFleetingE pisen + in + { + snom,sacc = pisen ; + sgen = pisn + "ě" ; + sdat,svoc,sloc = pisn + "i" ; -- not shortened + sins = pisn + "í" ; + + pnom,pacc = pisn + "ě" ; + pgen = pisn + "í" ; + pdat = pisn + "ím" ; + ploc = pisn + "ích" ; + pins = pisn + "ěmi" ; + g = Fem + } ; + + declKOST : DeclensionType = \kost -> + { + snom,sacc = kost ; + sgen,sdat,svoc,sloc = kost + "i" ; --- pnom,pacc + sins = kost + "í" ; --- pgen + + pnom,pacc = kost + "i" ; + pgen = kost + "í" ; + pdat = kost + "em" ; + ploc = kost + "ech" ; + pins = kost + "mi" ; + g = Fem + } ; + + declKURE : DeclensionType = \kure -> + let kur = init kure + in + { + snom,sacc,svoc = kure ; + sgen = kur + "ete" ; + sdat,sloc = kur + "eti" ; + sins = kur + "etem" ; + + pnom,pacc = kur + "ata" ; + pgen = kur + "at" ; + pdat = kur + "atům" ; + ploc = kur + "atech" ; + pins = kur + "aty" ; + g = Neutr + } ; + + declMORE : DeclensionType = \more -> --- 3.7.2 pgen zero sometimes + let mor = init more + in + { + snom,sgen,sacc,svoc = more ; --- pnom + sdat,sloc = mor + "i" ; --- pins + sins = mor + "em" ; + + pnom,pacc = more ; + pgen = mor + "í" ; --- + pdat = mor + "ím" ; + ploc = mor + "ích" ; + pins = mor + "i" ; + g = Neutr + } ; + + declSTAVENI : DeclensionType = \staveni -> + { + snom,sgen,sdat,sacc,svoc,sloc = staveni ; + sins = staveni + "m" ; + + pnom,pgen,pacc = staveni ; + pdat = staveni + "m" ; + ploc = staveni + "ch" ; + pins = staveni + "mi" ; + g = Neutr + } ; + +--------------------------- +-- Adjectives + +-- to be used for AP: 56 forms for each degree + Adjective : Type = {s : Gender => Number => Case => Str} ; + +-- to be used for A, in three degrees: 15 forms in each +---- TODO other degrees than positive + + AdjForms : Type = { + msnom, fsnom, nsnom : Str ; -- svoc = snom + msgen, fsgen : Str ; -- nsgen = msgen, pacc = fsgen + msdat, fsdat : Str ; -- nsdat = msdat + fsacc : Str ; -- amsacc = msgen, imsacc = msnom, nsacc = nsnom + msloc : Str ; -- fsloc = fsdat, nsloc = msloc + msins, fsins : Str ; -- nsins = msins, pdat = msins + + mpnom,fpnom : Str ; -- pvoc = pnom, impnom = fpnom, npnom = fsnom + pgen : Str ; -- ploc = pgen + pins : Str ; + } ; + +-- used in PositA but will also work in Compar and Superl by calling their record fields + +adjFormsAdjective : AdjForms -> Adjective = \afs -> { + s = \\g,n,c => case of { + + + | => afs.msnom ; + + | => afs.fsnom ; + => afs.nsnom ; + + + | => afs.msgen ; + + | => afs.fsgen ; + + => afs.msdat ; + => afs.fsdat ; + + => afs.fsacc ; + + => afs.msloc ; + + + | => afs.msins ; + => afs.fsins ; + + => afs.mpnom ; + => afs.fpnom ; + + => afs.pgen ; + => afs.pins + } + + } ; + +-- hard declension + + mladyAdjForms : Str -> AdjForms = \mlady -> + let mlad = init mlady + in { + msnom = mlad + "ý" ; + fsnom = mlad + "á" ; + nsnom,fsgen,fsdat,fpnom = mlad + "é" ; + msgen = mlad + "ého" ; + msdat = mlad + "ému" ; + fsacc,fsins = mlad + "ou" ; + msloc = mlad + "ém" ; + msins,pdat = mlad + "ým" ; + mpnom = addAdjI mlad ; + pgen = mlad + "ých" ; + pins = mlad + "ými" ; + } ; + +-- soft declension + + jarniAdjForms : Str -> AdjForms = \jarni -> + { + msnom,fsnom,nsnom, + fsgen,fsdat,fsacc,fsins, + mpnom,fpnom = jarni ; + msgen = jarni + "ho" ; + msdat = jarni + "mu" ; + msloc,msins = jarni + "m" ; + pgen = jarni + "ch" ; + pins = jarni + "mi" ; + } ; + +-- masculine possession: the same endings as in feminine + + otcuvAdjForms : Str -> AdjForms = \otcuv -> + let otcov = Predef.tk 2 otcuv + "ov" + in + matcinAdjForms otcov ** {msnom = otcuv} ; + +-- feminine possession + + matcinAdjForms : Str -> AdjForms = \matcin -> + { + msnom = matcin ; + fsnom,msgen = matcin + "a" ; + nsnom = matcin + "o" ; + fsgen,fpnom = matcin + "y" ; + msdat,fsacc = matcin + "u" ; + fsdat,msloc = matcin + "ě" ; + msins = matcin + "ým" ; + fsins = matcin + "ou" ; + mpnom = matcin + "i" ; + pgen = matcin + "ých" ; + pins = matcin + "ými" ; + } ; + +--------------------- +-- Verbs + + VerbForms : Type = { ---- TODO more forms to add + inf, + pressg1, pressg2, pressg3, + prespl1, prespl2, prespl3, + pastpartsg, pastpartpl, +---- passpart, + negpressg3 : Str -- matters only for copula + } ; + + ComplementCase : Type = {s : Str ; c : Case ; hasPrep : Bool} ; + + verbAgr : VerbForms -> Agr -> Bool -> Str ---- TODO tenses + = \vf,a,b -> case a of { + Ag _ Sg P1 => vf.pressg1 ; + Ag _ Sg P2 => vf.pressg2 ; + Ag _ Sg P3 => case b of { + True => vf.pressg3 ; + False => vf.negpressg3 -- matters only for copula + } ; + Ag _ Pl P1 => vf.prespl1 ; + Ag _ Pl P2 => vf.prespl2 ; + Ag _ Pl P3 => vf.prespl3 + } ; + + copulaVerbForms : VerbForms = { + inf = "být" ; + pressg1 = "jsem" ; + pressg2 = "jsi" ; + pressg3 = "je" ; + prespl1 = "jsme" ; + prespl2 = "jste" ; + prespl3 = "jsou" ; + pastpartsg = "byl" ; + pastpartpl = "byli" ; + negpressg3 = "ní" ; -- ne is added to this + } ; + + haveVerbForms : VerbForms = { + inf = "mít" ; + pressg1 = "mám" ; + pressg2 = "máš" ; + pressg3, negpressg3 = "má" ; + prespl1 = "máme" ; + prespl2 = "máte" ; + prespl3 = "mají" ; + pastpartsg = "měl" ; + pastpartpl = "měli" ; + } ; + +-- just an example of a traditional paradigm +---- TODO other traditional paradigms + + iii_kupovatVerbForms : Str -> VerbForms = \kupovat -> + let + kupo = Predef.tk 3 kupovat ; + kupu = Predef.tk 1 kupo + "u" + in + { + inf = kupovat ; + pressg1 = kupu + "ji" ; --- kupuju + pressg2 = kupu + "ješ" ; + pressg3, negpressg3 = kupu + "je" ; + prespl1 = kupu + "jeme" ; + prespl2 = kupu + "jete" ; + prespl3 = kupu + "jí" ; --- kupujou + pastpartsg = kupo + "val" ; + pastpartpl = kupo + "vali" ; + } ; + + +--------------------------- +-- Pronouns + + PronForms : Type = { + nom, cnom, -- cnom is the pro-drop subject + gen, cgen,pgen, -- bare, clitic, prepositional + acc, cacc,pacc, + dat, cdat,pdat, + loc, + ins,pins : Str ; + a : Agr + } ; + +---- TODO: possessives + + personalPron : Agr -> PronForms = \a -> + {a = a ; cnom = []} ** + case a of { + Ag _ Sg P1 => { + nom = "já" ; + gen,acc,pgen,pacc = "mne" ; + cgen,cacc = "mě" ; + dat,pdat,loc = "mně" ; + cdat = "mi" ; + ins,pins = "mnou" + } ; + Ag _ Sg P2 => { + nom = "ty" ; + gen,acc,pgen,pacc = "tebe" ; + cgen,cacc = "tě" ; + dat,pdat,loc = "tobě" ; + cdat = "ti" ; + ins,pins = "tebou" + } ; + Ag (Masc _) Sg P3 => { + nom = "on" ; + gen,acc = "jeho" ; + cgen,cacc = "ho" ; + pgen,pacc = "něho" ; + dat = "jemu" ; + cdat = "mu" ; + pdat = "němu" ; + loc = "něm" ; + ins = "jím" ; + pins = "ním" ; + } ; + Ag Fem Sg P3 => { + nom = "ona" ; + gen = "její" ; + dat,acc,cgen,cacc,cdat,ins = "ji" ; + pgen,pdat,pacc,loc,pins = "ní" ; + } ; + Ag Neutr Sg P3 => { + nom = "ono" ; + gen = "jeho" ; + cgen,cacc = "ho" ; + pgen = "něho" ; + dat = "jemu" ; + acc = "je" ; + pacc = "ně" ; + cdat = "mu" ; + pdat = "němu" ; + loc = "něm" ; + ins = "jím" ; + pins = "ním" ; + } ; + Ag _ Pl P1 => { + nom = "my" ; + gen,acc, + cgen,cacc, + pgen,pacc, + loc = "nás" ; + dat,cdat,pdat = "nám" ; + ins,pins = "námi" ; + } ; + Ag _ Pl P2 => { + nom = "vy" ; + gen,acc, + cgen,cacc, + pgen,pacc, + loc = "vás" ; + dat,cdat,pdat = "vám" ; + ins,pins = "vámi" ; + } ; + Ag g Pl P3 => { + nom = case g of { + Masc _ => "oni" ; + Fem => "ony" ; + Neutr => "ona" + } ; + gen,cgen = "jich" ; + pgen = "nich" ; + dat,cdat = "jim" ; + pdat = "nim" ; + acc,cacc = "je" ; + pacc = "ně" ; + loc = "nich" ; + ins = "jimi" ; + pins = "nimi" ; + } + + } ; + +-------------------------------- +-- demonstrative pronouns, used for Quant and Det + +oper + DemPronForms : Type = { + msnom, fsnom, nsnom, + msgen, fsgen, + msdat, -- fsdat = fsgen unlike AdjForms + fsacc, + msloc, + msins, fsins, + mpnom, fpnom, -- mpacc = fpacc = fpnom + pgen, + pdat, -- NOT msins like AdjForms + pins : Str + } ; + + demPronFormsAdjective : DemPronForms -> Str -> Adjective = + \dem,s -> + let + demAdj = dem ** {fsdat = dem.fsgen} ; + adjAdj = adjFormsAdjective demAdj + in { + s = \\g,n,c => case of { + <_,Pl,Dat> => dem.pdat ; + => dem.fpnom ; + _ => adjAdj.s ! g ! n ! c + } + s + } ; + + Determiner : Type = { + s : Gender => Case => Str ; + size : NumSize + } ; + + mkDemPronForms : Str -> DemPronForms = \t -> { + msnom = t + "en" ; + fsnom = t + "a" ; + nsnom = t + "o" ; + msgen = t + "oho" ; + fsgen = t + "é" ; + msdat = t + "omu" ; + fsacc = t + "u" ; + msloc = t + "om" ; + msins = t + "ím" ; + fsins = t + "ou" ; + mpnom = t + "i" ; + fpnom = t + "y" ; + pgen = t + "ěch" ; + pdat = t + "ěm" ; + pins = t + "ěmi" ; + } ; + + invarDemPronForms : Str -> DemPronForms = \s -> { + msnom, fsnom, nsnom, msgen, fsgen, + msdat, fsacc, msloc, msins, fsins, + mpnom, fpnom, pgen, pdat, pins = s ; + } ; + +-- interrogatives + + kdoForms : Case => Str = table { + Nom => "kdo" ; + Gen | Acc | Voc => "koho" ; + Dat => "komu" ; + Loc => "kom" ; + Ins => "kým" + } ; + + coForms : Case => Str = table { + Nom|Acc|Voc => "co" ; + Gen => "čeho" ; + Dat => "čemu" ; + Loc => "čem" ; + Ins => "čím" + } ; + +-- Numerals + + -- singular forms of demonstratives + NumeralForms : Type = { + msnom, fsnom, nsnom, + msgen, fsgen, + msdat, + fsacc, + msloc, + msins, fsins : Str + } ; + + numeralFormsDeterminer : NumeralForms -> NumSize -> Determiner = + \nume,size -> + let + dem = nume ** + {mpnom, fpnom, pgen, pdat, pins = nume.msnom} ; --- plural forms not used + demAdj = dem ** {fsdat = dem.fsgen} ; + adjAdj = adjFormsAdjective demAdj + in { + s = \\g,c => adjAdj.s ! g ! Sg ! c ; + size = size + } ; + + -- example: number 1 + oneNumeral : Determiner = numeralFormsDeterminer ((mkDemPronForms "jedn") ** {msnom = "jeden"}) Num1 ; + + -- numbers 2,3,4 ---- to check if everything comes out right with the determiner type + twoNumeral : Determiner = + let forms = { + msnom = "dva" ; fsnom, nsnom, fsacc = "dvě" ; + msgen, fsgen, msloc = "dvou" ; + msdat, msins, fsins = "dvěma" + } + in numeralFormsDeterminer forms Num2_4 ; + + threeNumeral : Determiner = + let forms = { + msnom, fsnom, nsnom, fsacc, msgen, fsgen = "tři" ; + msdat = "třem" ; + msloc = "třech" ; + msins,fsins = "třemi" ; + } + in numeralFormsDeterminer forms Num2_4 ; + + fourNumeral : Determiner = + let forms = { + msnom, fsnom, nsnom, fsacc = "čtyři" ; + msgen, fsgen = "čtyř" ; + msdat = "čtyřem" ; + msloc = "čtyřech" ; + msins,fsins = "čtyřmi" ; + } + in numeralFormsDeterminer forms Num2_4 ; + + -- for the numbers 5 upwards + regNumeral : Str -> Str -> Determiner = \pet,peti -> + let forms = { + msnom,fsnom,nsnom = pet ; + msgen, fsgen, msdat, fsacc, msloc, msins, fsins = peti + } + in numeralFormsDeterminer forms Num5 ; + + invarDeterminer : Str -> NumSize -> Determiner = \sto,size -> + regNumeral sto sto ; + + invarNumeral : Str -> Determiner = \s -> invarDeterminer s Num5 ; + +-------------------------------- +-- combining nouns with numerals + +param + NumSize = Num1 | Num2_4 | Num5 ; -- CEG 6.1 + +oper + numSizeForm : (Number => Case => Str) -> NumSize -> Case -> Str + = \cns,n,c -> case n of { + Num1 => cns ! Sg ! c ; + Num2_4 => cns ! Pl ! c ; + Num5 => case c of { + Nom | Acc => cns ! Pl ! Gen ; + _ => cns ! Pl ! c + } + } ; + + numSizeAgr : Gender -> NumSize -> Person -> Agr + = \g,ns,p -> case ns of { + Num5 => Ag Neutr Sg p ; -- essential grammar 6.1.4 + Num2_4 => Ag g Pl p ; + Num1 => Ag g Sg p + } ; + + numSizeNumber : NumSize -> Number = \ns -> case ns of { + Num1 => Sg ; + _ => Pl ---- TO CHECK + } ; +} diff --git a/src/slovak/SentenceSlo.gf b/src/slovak/SentenceSlo.gf new file mode 100644 index 000000000..2b8103a1b --- /dev/null +++ b/src/slovak/SentenceSlo.gf @@ -0,0 +1,32 @@ +concrete SentenceSlo of Sentence = CatSlo ** + open Prelude, ResSlo in { + +lin + PredVP np vp = { + subj = case np.hasClit of { + True => np.clit ! Nom ; -- pro-drop + False => np.s ! Nom + } ; + verb = vp.verb ; + clit = vp.clit ! np.a ; + compl = vp.compl ! np.a ; + a = np.a ; + } ; + + UseCl temp pol cl = { + s = temp.s ++ cl.subj ++ cl.clit ++ pol.s ++ verbAgr cl.verb cl.a pol.p ++ cl.compl ; + } ; + + --- TODO is inversion the standard? ; add indirect questions + UseQCl temp pol cl = { + s = temp.s ++ cl.clit ++ pol.s ++ verbAgr cl.verb cl.a pol.p ++ cl.subj ++ cl.compl ; + } ; + + UseRCl temp pol rcl = { + s = \\a => temp.s ++ + rcl.subj ! a ++ rcl.clit ! a ++ + pol.s ++ verbAgr rcl.verb a pol.p ++ + rcl.compl ! a ; + } ; + +} diff --git a/src/slovak/StructuralSlo.gf b/src/slovak/StructuralSlo.gf new file mode 100644 index 000000000..6fea21060 --- /dev/null +++ b/src/slovak/StructuralSlo.gf @@ -0,0 +1,27 @@ +concrete StructuralSlo of Structural = CatSlo ** + open ParadigmsSlo, ResSlo, Prelude in { + +lin + and_Conj = mkConj "a" ; + by8agent_Prep = mkPrep "od" Gen ; ---- TODO this means "from", there might be no good translation + few_Det = invarNumeral "málo" ; -- CEG 6.8 --- TODO genitive mála + for_Prep = mkPrep "pro" accusative ; + from_Prep = mkPrep (pre {"s"|"z" => "ze" ; _ => "z"}) Gen ; ---- consonant clusters + have_V2 = mkV2 haveVerbForms ; + in_Prep = mkPrep (pre {"v"|"m" => "ve" ; _ => "v"}) Loc ; ---- + many_Det = regNumeral "mnoho" "mnoha" ; -- CEG 6.8 ---- + or_Conj = mkConj "nebo" ; + somePl_Det = regNumeral "několik" "několika" ; -- CEG 6.8 ---- + something_NP = {s,clit,prep = \\c => "ně" + coForms ! c ; a = Ag Neutr Sg P3 ; hasClit = False} ; -- CEG 5.6.3 + possess_Prep = mkPrep "" Gen ; + that_Quant = demPronFormsAdjective (mkDemPronForms "tamt") "" ; + this_Quant = demPronFormsAdjective (mkDemPronForms "t") "to" ; + to_Prep = mkPrep "do" Gen ; + with_Prep = mkPrep (pre {"s"|"z" => "se" ; _ => "s"}) Ins ; ---- + + i_Pron = personalPron (Ag (Masc Anim) Sg P1) ; + youSg_Pron = personalPron (Ag (Masc Anim) Sg P2) ; + he_Pron = personalPron (Ag (Masc Anim) Sg P3) ; + she_Pron = personalPron (Ag Fem Sg P3) ; + +} diff --git a/src/slovak/SymbolSlo.gf b/src/slovak/SymbolSlo.gf new file mode 100644 index 000000000..b76f4e211 --- /dev/null +++ b/src/slovak/SymbolSlo.gf @@ -0,0 +1,11 @@ +--# -path=.:../abstract:../common:../prelude + +concrete SymbolSlo of Symbol = CatSlo ** open Prelude, ResSlo in { + +lincat + Symb = {s : Str} ; +lin + MkSymb s = s ; + SymbPN s = lin PN {s = \\_ => s.s ; g = Neutr} ; + +} diff --git a/src/slovak/TenseSlo.gf b/src/slovak/TenseSlo.gf new file mode 100644 index 000000000..9aeb9e4eb --- /dev/null +++ b/src/slovak/TenseSlo.gf @@ -0,0 +1,20 @@ +concrete TenseSlo of Tense = + CatSlo ** + open + ResSlo, + Prelude + in { +lin + PNeg = { + s = "ne" ++ Predef.BIND ; + p = False + } ; + PPos = { + s = [] ; + p = True + } ; + ASimul = {s = [] ; t = CTPres} ; + TPres = {s = [] ; t = CTPres} ; + TTAnt t a = {s = t.s ++ a.s ; t = t.t} ; ---- + +} diff --git a/src/slovak/TextSlo.gf b/src/slovak/TextSlo.gf new file mode 100644 index 000000000..7f862cfd9 --- /dev/null +++ b/src/slovak/TextSlo.gf @@ -0,0 +1,8 @@ +concrete TextSlo of Text = CatSlo ** open ResSlo in { + + lin + TEmpty = {s = []} ; + TFullStop x xs = {s = x.s ++ "." ++ xs.s} ; + TQuestMark x xs = {s = x.s ++ "?" ++ xs.s} ; + TExclMark x xs = {s = x.s ++ "!" ++ xs.s} ; +} diff --git a/src/slovak/VerbSlo.gf b/src/slovak/VerbSlo.gf new file mode 100644 index 000000000..f9ff0a82a --- /dev/null +++ b/src/slovak/VerbSlo.gf @@ -0,0 +1,48 @@ +concrete VerbSlo of Verb = CatSlo ** open ResSlo, Prelude in { + +lin + UseV v = { + verb = v ; + clit,compl = \\_ => [] + } ; + + ComplSlash vps np = case of { + => vps ** { + clit = \\a => vps.clit ! a ++ np.clit ! vps.c.c + } ; + _ => vps ** { + compl = \\a => vps.compl ! a ++ vps.c.s ++ np.s ! vps.c.c + } + } ; + + SlashV2a v = { + verb = v ; + clit,compl = \\_ => [] ; + c = v.c + } ; + + UseComp comp = { + verb = copulaVerbForms ; + clit = \\_ => [] ; + compl = comp.s + } ; + + CompAP ap = { + s = \\a => case a of { + Ag g n p_ => ap.s ! g ! n ! Nom + } + } ; + + CompNP np = { + s = \\a_ => np.s ! Nom ; ---- InstrC in Pol + } ; + + CompAdv adv = { + s = \\a_ => adv.s + } ; + + AdvVP vp adv = vp ** { + compl = \\a => vp.compl ! a ++ adv.s + } ; + +}