diff --git a/src/api/CombinatorsHrv.gf b/src/api/CombinatorsHrv.gf new file mode 100644 index 00000000..08ab3037 --- /dev/null +++ b/src/api/CombinatorsHrv.gf @@ -0,0 +1,9 @@ +--# -path=.:alltenses:prelude + +resource CombinatorsHrv = Combinators with + (Cat = CatHrv), + (Structural = StructuralHrv), + (Constructors = ConstructorsHrv) + ** open MissingHrv in {} + + diff --git a/src/api/ConstructorsHrv.gf b/src/api/ConstructorsHrv.gf new file mode 100644 index 00000000..b98440e3 --- /dev/null +++ b/src/api/ConstructorsHrv.gf @@ -0,0 +1,5 @@ +--# -path=.:alltenses:prelude + +resource ConstructorsHrv = Constructors with (Grammar = GrammarHrv) + ** open MissingHrv in {} + diff --git a/src/api/SymbolicHrv.gf b/src/api/SymbolicHrv.gf new file mode 100644 index 00000000..159e5a35 --- /dev/null +++ b/src/api/SymbolicHrv.gf @@ -0,0 +1,6 @@ +--# -path=.:../slovak:../common:../abstract:../prelude + +resource SymbolicHrv = Symbolic with + (Symbol = SymbolHrv), + (Grammar = GrammarHrv) + ** open MissingHrv in {} diff --git a/src/api/SyntaxHrv.gf b/src/api/SyntaxHrv.gf new file mode 100644 index 00000000..164a51c1 --- /dev/null +++ b/src/api/SyntaxHrv.gf @@ -0,0 +1,4 @@ +--# -path=.:./alltenses:../prelude + +instance SyntaxHrv of Syntax = + ConstructorsHrv, CatHrv, StructuralHrv, CombinatorsHrv ; diff --git a/src/api/TryHrv.gf b/src/api/TryHrv.gf new file mode 100644 index 00000000..91eb6948 --- /dev/null +++ b/src/api/TryHrv.gf @@ -0,0 +1,13 @@ +--# -path=.:../slovak:../common:../abstract:../prelude + +resource TryHrv = SyntaxHrv, LexiconHrv, ParadigmsHrv -[mkAdv, mkDet,mkQuant]** + open (P = ParadigmsHrv) in { + +-- oper + +-- mkAdv = overload SyntaxHrv { +-- mkAdv : Str -> Adv = P.mkAdv ; +-- } ; + +} + diff --git a/src/croatian/AdjectiveHrv.gf b/src/croatian/AdjectiveHrv.gf new file mode 100644 index 00000000..04f6112e --- /dev/null +++ b/src/croatian/AdjectiveHrv.gf @@ -0,0 +1,23 @@ +concrete AdjectiveHrv of Adjective = CatHrv ** open ResHrv, 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 ; isPost = True} ; + +} diff --git a/src/croatian/AdverbHrv.gf b/src/croatian/AdverbHrv.gf new file mode 100644 index 00000000..c2c6d3cd --- /dev/null +++ b/src/croatian/AdverbHrv.gf @@ -0,0 +1,9 @@ +concrete AdverbHrv of Adverb = CatHrv ** + open ResHrv, Prelude in { + +lin + PrepNP prep np = { + s = prep.s ++ np.prep ! prep.c + } ; + +} diff --git a/src/croatian/AllHrv.gf b/src/croatian/AllHrv.gf new file mode 100644 index 00000000..ebd7e114 --- /dev/null +++ b/src/croatian/AllHrv.gf @@ -0,0 +1,7 @@ +--# -path=.:../abstract:../common:../api + +concrete AllHrv of AllHrvAbs = + LangHrv, + ExtendHrv + ; + diff --git a/src/croatian/AllHrvAbs.gf b/src/croatian/AllHrvAbs.gf new file mode 100644 index 00000000..6d9779a3 --- /dev/null +++ b/src/croatian/AllHrvAbs.gf @@ -0,0 +1,7 @@ +--# -path=.:../abstract:../common:prelude + +abstract AllHrvAbs = + Lang, + Extend + ; + diff --git a/src/croatian/CatHrv.gf b/src/croatian/CatHrv.gf new file mode 100644 index 00000000..6425c336 --- /dev/null +++ b/src/croatian/CatHrv.gf @@ -0,0 +1,71 @@ +concrete CatHrv of Cat = +--- CommonX ** + + open ResHrv, 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 = ResHrv.VerbForms ; + V2 = ResHrv.VerbForms ** {c : ComplementCase} ; + VS,VQ = ResHrv.VerbForms ; + + A = ResHrv.AdjForms ; + AP = ResHrv.Adjective ** {isPost : Bool} ; -- {s : Gender => Number => Case => Str} + A2 = ResHrv.AdjForms ** {c : ComplementCase} ; + + AdA = {s : Str} ; + + N = ResHrv.NounForms ; + CN = ResHrv.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 ** {poss : DemPronForms} ; + + Adv = {s : Str} ; + Prep = ResHrv.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/croatian/ConjunctionHrv.gf b/src/croatian/ConjunctionHrv.gf new file mode 100644 index 00000000..7d555154 --- /dev/null +++ b/src/croatian/ConjunctionHrv.gf @@ -0,0 +1,56 @@ +concrete ConjunctionHrv of Conjunction = CatHrv ** + open ResHrv, 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/croatian/ExtendHrv.gf b/src/croatian/ExtendHrv.gf new file mode 100644 index 00000000..cc34f418 --- /dev/null +++ b/src/croatian/ExtendHrv.gf @@ -0,0 +1,38 @@ +concrete ExtendHrv of Extend = CatHrv ** + ExtendFunctor - [ + ReflPossPron + ---- constant not found (yet) + ,youPolFem_Pron + ,UttVPShort + ,UttAccIP + ,UttDatIP + ,SubjRelNP + ,StrandRelSlash + ,StrandQuestSlash + ,SlashBareV2S + ,PredIAdvVP + ,PredAPVP + ,ExistsNP + ,ExistS + ,ExistPluralCN + ,ExistNPQS + ,ExistMassCN + ,ExistIPQS + ,ExistCN + ,EmptyRelSlash + ,DetNPMasc + ,DetNPFem + ,ComplBareVS + ,CompIQuant + ,CompBareCN + ] + with (Grammar = GrammarHrv) + ** +open + ResHrv +in { + +lin ReflPossPron = justDemPronFormsAdjective reflPossessivePron ; + + +} diff --git a/src/croatian/GrammarHrv.gf b/src/croatian/GrammarHrv.gf new file mode 100644 index 00000000..f336b871 --- /dev/null +++ b/src/croatian/GrammarHrv.gf @@ -0,0 +1,19 @@ +--# -path=.:../abstract:../common:prelude + +concrete GrammarHrv of Grammar = + NounHrv, + VerbHrv, + AdjectiveHrv, + AdverbHrv, + NumeralHrv, + SentenceHrv, + QuestionHrv, + RelativeHrv, + ConjunctionHrv, + PhraseHrv, + TextHrv, + StructuralHrv, + IdiomHrv, + TenseHrv + ** { +} diff --git a/src/croatian/IdiomHrv.gf b/src/croatian/IdiomHrv.gf new file mode 100644 index 00000000..130e1b40 --- /dev/null +++ b/src/croatian/IdiomHrv.gf @@ -0,0 +1,5 @@ +concrete IdiomHrv of Idiom = CatHrv ** open Prelude, ResHrv in { + + + +} diff --git a/src/croatian/LangHrv.gf b/src/croatian/LangHrv.gf new file mode 100644 index 00000000..01574fc1 --- /dev/null +++ b/src/croatian/LangHrv.gf @@ -0,0 +1,10 @@ +--# -path=.:../abstract:../common:../api + +concrete LangHrv of Lang = + GrammarHrv, + LexiconHrv +-- ,ConstructionHrv +-- ,DocumentationHrv --# notpresent + ** { + +} diff --git a/src/croatian/LexiconHrv.gf b/src/croatian/LexiconHrv.gf new file mode 100644 index 00000000..593b3e94 --- /dev/null +++ b/src/croatian/LexiconHrv.gf @@ -0,0 +1,64 @@ +concrete LexiconHrv of Lexicon = + CatHrv + ** + open + ResHrv, ParadigmsHrv + in { + + + lin + boy_N = mkN "chlapec" ; + man_N = mkN "muž" ; + teacher_N = mkN "učiteľ" ; + horse_N = mkN "kôň" ; + father_N = mkN "otec" ; + husband_N = mkN "manžel" ; + + castle_N = mkN "hrad" ; + forest_N = mkN "les" ; + machine_N = mkN "stroj" ; + + woman_N = mkN "žena" ; + school_N = mkN "učilište" ; + skirt_N = mkN "sukňa"; + street_N = mkN "ulica" ; + rose_N = mkN "ruže" ; + song_N = mkN "pieseň" ; + bed_N = mkN "posteľ" ; +{- + door_N = mkN "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ý" ; +-} + +--- from Google translate dictionary + + white_A = mkA "biely" ; + black_A = mkA "čierny" ; + red_A = mkA "červený" ; + brown_A = mkA "hnedý" ; + blue_A = mkA "modrý" ; --- belasý + green_A = mkA "zelený" ; + yellow_A = mkA "žltý" ; + + buy_V2 = mkV2 (iii_kupovatVerbForms "kupovať") ; + love_V2 = mkV2 (iii_kupovatVerbForms "milovať") ; + +} + diff --git a/src/croatian/MissingHrv.gf b/src/croatian/MissingHrv.gf new file mode 100644 index 00000000..5b8300f7 --- /dev/null +++ b/src/croatian/MissingHrv.gf @@ -0,0 +1,102 @@ +resource MissingHrv = open GrammarHrv, 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/croatian/NounHrv.gf b/src/croatian/NounHrv.gf new file mode 100644 index 00000000..4481416f --- /dev/null +++ b/src/croatian/NounHrv.gf @@ -0,0 +1,101 @@ +concrete NounHrv of Noun = + CatHrv +** + + open ResHrv, 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 => pron.nom ; + Gen => pron.gen ; + Dat => pron.dat ; + Acc => pron.acc ; + Loc => pron.loc ; + Ins => pron.ins + } ; + clit = table { + Nom => pron.cnom ; + Gen => pron.cgen ; + Dat => pron.cdat ; + Acc => pron.cacc ; + Loc => pron.loc ; + Ins => pron.ins + } ; + prep = table { + Nom => pron.nom ; + Gen => pron.pgen ; + Dat => pron.pdat ; + Acc => pron.pacc ; + Loc => pron.loc ; + Ins => pron.pins + } ; + a = pron.a ; + hasClit = True ; + } ; + + PossPron pron = justDemPronFormsAdjective pron.poss ; + + UsePN pn = { + s,clit,prep = \\c => pn.s ! c ; + a = Ag pn.g Sg P3 ; + hasClit = False ; + } ; + + AdjCN ap cn = { + s = \\n,c => preOrPost (notB ap.isPost) (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/croatian/NumeralHrv.gf b/src/croatian/NumeralHrv.gf new file mode 100644 index 00000000..6d8074a9 --- /dev/null +++ b/src/croatian/NumeralHrv.gf @@ -0,0 +1,120 @@ +concrete NumeralHrv of Numeral = + + CatHrv [Numeral,Digits] ** + + open + ResHrv, + 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 -> Str -> Str -> LinDigit = + \unit,unitich,unitim,unitimi, teenbase, tenbase -> + mkNum (regNumeral unit unitich unitim unitimi) teenbase (tenbase + "desiat") (unit ++ "sto") ; + +oper bigNumeral : Str -> LinNumeral = \s -> invarNumeral s ; + +lin num x = x ; + +lin n2 = mk2Num twoNumeral "dva" "dva" ("dve" ++ "sto") ; +lin n3 = mk2Num threeNumeral "tri" "tri" ("tri" ++ "sto") ; +lin n4 = mk2Num fourNumeral "štr" "štyři" ("styri" ++ "sto") ; +lin n5 = mk5Num "päť" "piatich" "piatim" "piatimi" "pät" "pät" ; ---- +lin n6 = mk5Num "šest" "šestich" "šestim" "šestimi" "šest" "šest" ; ---- +lin n7 = mk5Num "sedem" "sedemich" "sedemim" "sedemimi" "sedem" "sedem"; ---- +lin n8 = mk5Num "osem" "osemich" "osemim" "osemimi" "osem" "osem"; +lin n9 = mk5Num "deväť" "deviatich" "deviatim" "deviatimi" "deväť" "deväť" ; + +lin pot01 = { + unit = oneNumeral.s ; hundred = "sto" ; ten = "desať" ; teen = "jedenásť" ; + size = Num1 + } ; +lin pot0 d = d ; + +lin pot110 = bigNumeral "desať" ; +lin pot111 = bigNumeral "jedenásť" ; +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íc" ; + Num5 => attr ++ "tisí" + } ; + +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/croatian/ParadigmsHrv.gf b/src/croatian/ParadigmsHrv.gf new file mode 100644 index 00000000..0300cf46 --- /dev/null +++ b/src/croatian/ParadigmsHrv.gf @@ -0,0 +1,149 @@ +resource ParadigmsHrv = open CatHrv, ResHrv, (R=ResHrv), 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 ; + 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. +-- Notice that some paradigms take two arguments, some take one. + + chlapN : Str -> N + = \s -> lin N (R.chlapN s) ; + hrdinaN : Str -> N + = \s -> lin N (R.hrdinaN s) ; + dubN : Str -> N + = \s -> lin N (R.dubN s) ; + strojN : Str -> N + = \s -> lin N (R.strojN s) ; + ponyN : Str -> N + = \s -> lin N (R.ponyN s) ; + zenaN : (snom, pgen : Str) -> N + = \s,p -> lin N (R.zenaN s) ** {pgen = p} ; + ulicaN : (snom, pgen : Str) -> N + = \s,p -> lin N (R.ulicaN s) ** {pgen = p} ; + dlanN : (snom, pgen : Str) -> N + = \s,p -> lin N (R.dlanN s p) ; + kostN : (snom, pgen : Str) -> N + = \s,p -> lin N (R.kostN s p) ; + mestoN : (snom, pgen : Str) -> N + = \s,p -> lin N (R.mestoN s) ** {pgen = p} ; + srdceN : (snom, pgen : Str) -> N + = \s,p -> lin N (R.srdceN s) ** {pgen = p} ; + vysvedcenieN : Str -> N + = \s -> lin N (R.vysvedcenieN s) ; + dievcaN : Str -> N + = \s -> lin N (R.dievcaN s) ; + dievceniecN : Str -> N + = \s -> lin N (R.dievceniecN 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 (guessAdjForms s) + } ; + + peknyA : Str -> A + = \s -> lin A (R.peknyA s) ; + krasnyA : Str -> A + = \s -> lin A (R.krasnyA s) ; + cudziA : Str -> A + = \s -> lin A (R.cudziA s) ; + rydziA : Str -> A + = \s -> lin A (R.rydziA s) ; + otcovA : Str -> A + = \s -> lin A (R.otcovA s) ; + paviA : Str -> A + = \s -> lin A (R.paviA s) ; + + invarA : Str -> A + = \s -> lin A (invarAdjForms s) ; + + mkA2 : A -> Prep -> A2 + = \a,p -> lin A2 (a ** {c = p}) ; + +-- the full definition of the adjective record is +-- { +-- msnom, fsnom, nsnom, msgen, fsgen, msdat, fsacc, msloc, msins, fsins, +-- ampnom, pgen, pins : Str +-- } +-- + +------------------------- +-- 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/croatian/PhraseHrv.gf b/src/croatian/PhraseHrv.gf new file mode 100644 index 00000000..aaa4d48d --- /dev/null +++ b/src/croatian/PhraseHrv.gf @@ -0,0 +1,19 @@ +concrete PhraseHrv of Phrase = CatHrv ** open Prelude, ResHrv 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 ! Nom} ; + +} diff --git a/src/croatian/QuestionHrv.gf b/src/croatian/QuestionHrv.gf new file mode 100644 index 00000000..33937e16 --- /dev/null +++ b/src/croatian/QuestionHrv.gf @@ -0,0 +1,7 @@ +concrete QuestionHrv of Question = CatHrv ** + open ResHrv, Prelude in { + +lin + QuestCl cl = cl ; ---- + +} diff --git a/src/croatian/RelativeHrv.gf b/src/croatian/RelativeHrv.gf new file mode 100644 index 00000000..5b146cbf --- /dev/null +++ b/src/croatian/RelativeHrv.gf @@ -0,0 +1,18 @@ +concrete RelativeHrv of Relative = CatHrv ** open + ParadigmsHrv, + ResHrv, + 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/croatian/ResHrv.gf b/src/croatian/ResHrv.gf new file mode 100644 index 00000000..8aaab1c6 --- /dev/null +++ b/src/croatian/ResHrv.gf @@ -0,0 +1,856 @@ +resource ResHrv = open Prelude in { + +-- AR September 2022 +-- sources: +-- Wiki = https://en.wikipedia.org/wiki/Serbo-Croatian_grammar +-- BCMS = Bosnian, Croatian, Montenegrin and Serbian: An Essential Grammar (Routledge Essential Grammars) 1st Edition, by Željko Vrabec + +-- 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 BCS verb morphology + +-- phonology + +oper + hardConsonant : pattern Str = #("d"|"t"|"g"|"h"|"k"|"n"|"r") ; ---- + softConsonant : pattern Str = #("c"|"č"|"ć"|"đ"|"j"|"lj"|"nj"|"š"|"ž"|"št") ; + --- wiki "and sometimes r"; BCMS slightly different + + ifSoft : Str -> (soft,hard : Str) -> Str = \word, ssoft, shard -> + case word of { + _ + #softConsonant => ssoft ; + _ => shard + } ; + + +palatalize : Str -> Str = \s -> case s of { + x + "ki" => x + "ci" ; + x + "ke" => x + "če" ; + x + "gi" => x + "zi" ; + x + "ge" => x + "že" ; + x + "hi" => x + "si" ; + x + "he" => x + "še" ; + x + "ce" => x + "če" ; ---- TODO stric but check sins: stricem, klincem, pacc klince + _ => 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 => forms.pnom ; + Gen => forms.pgen ; + Dat => forms.pdat ; + Acc => forms.pacc ; + Voc => forms.pnom ; + Loc => forms.ploc ; + Ins => forms.pins + } + } ; + g = forms.g + } ; + + +-- terminology of CEG + DeclensionType : Type = Str -> NounForms ; +{- + declensionNounForms : (snom,pgen : Str) -> Gender -> NounForms + = \snom,pgen,g -> case of { + => hrdinaN snom ; + => ponyN snom ; ---- + => chlapN snom ; + + => strojN snom ; + => dubN snom ; + => dubN snom ; + + => zenaN snom ; + => zenaN snom ; + => ulicaN snom ; + => ulicaN snom ; + => kostN snom pgen ; + => dlanN snom pgen ; + + => mestoN snom ; + => vysvedcenieN snom ; + => srdceN snom ; + => dievceniecN snom ; + => dievcaN snom ; + + _ => dubN (""+snom) ** {pgen = pgen} ---- Predef.error ("cannot infer declension type for" ++ snom ++ pgen) + } ** {pgen = pgen ; g = g} ; + +-- the "smartest" one-argument mkN + + guessNounForms : Str -> NounForms + = \snom -> case snom of { + _ + ("i"|"y"|"e") => ponyN snom ; + _ + #softConsonant => strojN snom ; + _ + #hardConsonant => dubN snom ; + _ + #neutralConsonant => dubN snom ; + _ + #hardConsonant + "a" => zenaN snom ; + _ + #neutralConsonant + "a" => zenaN snom ; + _ + #softConsonant + "a" => ulicaN snom ; + _ + ("ia"|"ya") => ulicaN snom ; + _ + "o" => mestoN snom ; + _ + "ie" => vysvedcenieN snom ; + _ + "e" => srdceN snom ; + _ + "ä" => dievcaN snom ; + + _ => dubN (""+snom) ---- Predef.error ("cannot guess declension type for" ++ snom) + } ; + +-} + + ifAnim : Animacy -> (anim, inanim : Str) -> Str = \anim, sanim, sinanim -> + case anim of { + Anim => sanim ; + Inanim => sinanim + } ; + +-- the traditional declensions, following Wiki +-- they are also exported in ParadigmsHrv with names izvorN etc + + izvorN : Animacy -> DeclensionType = \anim, izvor -> + { + snom = izvor ; + sgen = izvor + "a" ; + sdat,sloc = izvor + "u" ; + sacc = ifAnim anim (izvor + "a") izvor ; + svoc = palatalize (izvor + "e") ; + sins = ifSoft izvor + (palatalize (izvor + "e") + "m") + (izvor + "om") ; + + pnom,pvoc = palatalize (izvor + "i") ; + pgen = izvor + "a" ; + pdat,ploc,pins = + ifSoft izvor + (palatalize (izvor + "e") + "vima") + (palatalize (izvor + "i") + "ma") ; + pacc = palatalize (izvor + "e") ; + g = Masc anim + } ; + + nokatN : Animacy -> DeclensionType = \anim, nokat -> + let + nokt = Predef.tk 2 nokat + last nokat + in izvorN anim nokt ** { + snom = nokat ; + sacc = ifAnim anim (nokt + "a") nokat ; + pgen = nokat + "a" ; + } ; + + gradaninN : Animacy -> DeclensionType = \anim, gradanin -> + let + gradan = Predef.tk 2 gradanin ; + gradanN = izvorN anim gradan + in izvorN anim gradanin ** { + pnom,pvoc = gradanN.pnom ; + pgen = gradanN.pgen ; + pdat,ploc,pins = gradanN.pdat ; + pacc = gradanN.pacc ; + } ; + + -- vojnik, bubreg, trbuh, stric by izvorN, čvórak, klinac by nokatN + ---- TODO + + + + + + + + +{- + + +--------------------------- +-- 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 ; + msgen, fsgen : Str ; -- nsgen = msgen + msdat : Str ; -- nsdat = msdat + fsacc : Str ; -- amsacc = msgen, imsacc = msnom, nsacc = nsnom + msloc : Str ; -- fsloc = fsdat, nsloc = msloc + msins, fsins : Str ; -- nsins = msins, pdat = msins + + ampnom : Str ; -- *pnom = nsnom + pgen : Str ; -- + -- pdat = msins, ampacc = pgen, *pacc = nsnom, ploc = pgen + pins : Str ; + } ; + +invarAdjForms : Str -> AdjForms = \s -> { + msnom, fsnom, nsnom, msgen, fsgen, msdat, fsacc, + msloc, msins, fsins, ampnom, pgen, pins = s ; + } ; + +-- 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.fsacc ; + => afs.msloc ; + + | => afs.msins ; + => afs.fsins ; + + => afs.ampnom ; + + | => afs.pgen ; + => afs.pins + } + + } ; + + guessAdjForms : Str -> AdjForms + = \s -> case s of { + _ + "ý" => peknyA s ; + _ + "y" => krasnyA s ; + _ + "í" => cudziA s ; + _ + "i" => rydziA s ; + _ + ("ov"|"in") => otcovA s ; + _ => otcovA (""+s) ---- Predef.error ("no mkA for" ++ s) + } ; + + +-- hard consonant + y + + peknyA : Str -> AdjForms = \pekny -> + let pekn = init pekny + in { + msnom = pekn + "ý" ; + fsnom = pekn + "á" ; + nsnom = pekn + "é" ; + msgen = pekn + "ého" ; + fsgen = pekn + "ej" ; + msdat = pekn + "ému" ; + fsacc = pekn + "ú" ; + msloc = pekn + "om" ; + msins = pekn + "ým" ; + fsins = pekn + "ou" ; + ampnom = pekn + "í" ; + pgen = pekn + "ých" ; + pins = pekn + "ými" ; + } ; + +-- if the penultimate has accent, e.g. krásny, the last accent disappears + krasnyA : Str -> AdjForms = \krasny -> + let + krasn = init krasny ; + in peknyA krasny ** { + msnom = krasn + "y" ; + fsnom = krasn + "a" ; + nsnom = krasn + "e" ; + msgen = krasn + "eho" ; + msdat = krasn + "emu" ; + fsacc = krasn + "u" ; + msins = krasn + "ym" ; + ampnom = krasn + "i" ; + pgen = krasn + "ych" ; + pins = krasn + "ymi" ; + } ; + +-- soft consonant + i + + cudziA : Str -> AdjForms = \cudzi -> + let + cudz = init cudzi ; + pcudz = palatal cudz ; + in { + msnom = pcudz + "í" ; + fsnom = pcudz + "ia" ; + nsnom = pcudz + "ie" ; + msgen = pcudz + "ieho" ; + fsgen = pcudz + "ej" ; + msdat = pcudz + "iemu" ; + fsacc = pcudz + "iu" ; + msloc = cudz + "om" ; + msins = pcudz + "ím" ; + fsins = cudz + "ou" ; + ampnom = pcudz + "í" ; + pgen = pcudz + "ích" ; + pins = pcudz + "ími" ; + } ; + +-- accented vowel + soft consonant + i + rydziA : Str -> AdjForms = \rydzi -> + let + rydz = init rydzi ; + prydz = palatal rydz ; + in peknyA rydzi ** { + msnom = prydz + "i" ; + fsnom = rydz + "a" ; + nsnom = prydz + "e" ; + msgen = prydz + "eho" ; + msdat = prydz + "emu" ; + fsacc = rydz + "u" ; + msins = prydz + "im" ; + ampnom = prydz + "i" ; + pgen = prydz + "ich" ; + pins = prydz + "imi" ; + } ; + +-- masculine possession: the same endings as in feminine + + otcovA : Str -> AdjForms = \otcov -> + { + msnom = otcov ; + fsnom = otcov + "a" ; + nsnom = otcov + "o" ; + msgen = otcov + "ho" ; + fsgen = otcov + "ej" ; + msdat = otcov + "mu" ; + fsacc = otcov + "u" ; + msloc = otcov + "om" ; + msins = otcov + "ým" ; + fsins = otcov + "ou" ; + ampnom = otcov + "i" ; + pgen = otcov + "ých" ; + pins = otcov + "ými" ; + } ; + + paviA : Str -> AdjForms = \pavi -> + let + pav = init pavi ; + in { + msnom = pav + "í" ; + fsnom = pav + "ia" ; + nsnom = pav + "ie" ; + msgen = pav + "ieho" ; + fsgen = pav + "ej" ; + msdat = pav + "iemu" ; + fsacc = pav + "iu" ; + msloc = pav + "om" ; + msins = pav + "ím" ; + fsins = pav + "ou" ; + ampnom = pav + "í" ; ---- + pgen = pav + "ich" ; ---- + pins = pav + "imi" ; ---- + } ; + +--------------------- +-- Verbs +-- https://en.wikipedia.org/wiki/Slovak_language#Verbs + + VerbForms : Type = { ---- TODO more forms to add ? + inf, + pressg1, pressg2, pressg3, + prespl1, prespl2, prespl3, + pastpmasc, pastpfem, pastpneutr : Str + } ; + + 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 => vf.pressg3 ; + Ag _ Pl P1 => vf.prespl1 ; + Ag _ Pl P2 => vf.prespl2 ; + Ag _ Pl P3 => vf.prespl3 + } ; + + copulaVerbForms : VerbForms = { + inf = "byť" ; + pressg1 = "som" ; + pressg2 = "si" ; + pressg3 = "je" ; + prespl1 = "sme" ; + prespl2 = "ste" ; + prespl3 = "sú" ; + pastpmasc = "bol" ; + pastpfem = "bola" ; + pastpneutr = "bolo" ; + } ; + + haveVerbForms : VerbForms = { + inf = "mať" ; + pressg1 = "mám" ; + pressg2 = "máš" ; + pressg3 = "má" ; + prespl1 = "máme" ; + prespl2 = "máte" ; + prespl3 = "majú" ; + pastpmasc = "mal" ; + pastpfem = "mala" ; + pastpneutr = "malo" ; + } ; + +-- 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 + "jem" ; + pressg2 = kupu + "ješ" ; + pressg3 = kupu + "je" ; + prespl1 = kupu + "jeme" ; + prespl2 = kupu + "jete" ; + prespl3 = kupu + "jú" ; + pastpmasc = "kupoval" ; + pastpfem = "kupovala" ; + pastpneutr = "kupovalo" ; + } ; + + +--------------------------- +-- 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 = "ja" ; + gen,acc,pgen,pacc = "mňa" ; + cgen,cacc = "ma" ; + dat,pdat,loc = "mne" ; + cdat = "mi" ; + ins,pins = "mnou" + } ; + Ag _ Sg P2 => { + nom = "ty" ; + gen,acc,pgen,pacc = "teba" ; + cgen,cacc = "ťa" ; + dat,pdat,loc = "tebe" ; + cdat = "ti" ; + ins,pins = "tebou" + } ; + Ag (Masc _) Sg P3 => { + nom = "on" ; + gen,acc = "jeho" ; + cgen,cacc = "ho" ; + pgen,pacc = "neho" ; + ---- pgen = "ňho"; ---- bind, only with prepositions "do", "u" + ---- pgen = "ň"; ---- bind, only with preposition "do", "u" + dat = "jemu" ; + ---- pacc = "eň" ; ---- bind, only with preposition "cez" + ---- pacc = "ňho" ; ---- bind, only with prepositions "na", "pre", "za" + ---- pacc = "ň" ; ---- bind, only with preposition "na", "pre", "za" + cdat = "mu" ; + pdat = "nemu" ; + loc = "ňom" ; + ins,pins = "ním" ; + } ; + Ag Fem Sg P3 => { + nom = "ona" ; + gen,cgen,pgen,acc,cacc,pacc = "ju" ; + cdat = "jej" ; + dat,pdat,loc = "nej" ; + ins,pins = "ní" ; + } ; + Ag Neutr Sg P3 => { + nom = "ono" ; + gen, acc = "jeho" ; + cgen,cacc = "ho" ; + pgen = "neho" ; + ---- pgen = "ňho"; ---- bind, only with prepositions "do", "u" + ---- pgen = "ň"; ---- bind, only with preposition "do", "u" + dat = "jemu" ; + ---- pacc = "eň" ; ---- bind, only with preposition "cez" + ---- pacc = "ňho" ; ---- bind, only with prepositions "na", "pre", "za" + ---- pacc = "ň" ; ---- bind, only with preposition "na", "pre", "za" + pacc = "jeho"; ---- doublecheck + cdat = "mu" ; + pdat = "nemu" ; + loc = "ňom" ; + ins,pins = "ním" ; + } ; + Ag _ Pl P1 => { + nom = "my" ; + gen,acc, + cgen,cacc, + pgen,pacc, + loc = "nás" ; + dat,cdat,pdat = "nám" ; + ins,pins = "nami" ; + } ; + Ag _ Pl P2 => { + nom = "vy" ; + gen,acc, + cgen,cacc, + pgen,pacc, + loc = "vás" ; + dat,cdat,pdat = "vám" ; + ins,pins = "vami" ; + } ; + Ag (Masc Anim) Pl P3 => { + nom = "oni" ; + gen,cgen,acc,cacc = "ich" ; + pgen,pacc = "nich" ; + dat,cdat = "im" ; + pdat = "nim" ; + loc = "nich" ; + ins,pins = "nimi" ; + } ; + Ag _ Pl P3 => { + nom = "ony" ; + gen,cgen,acc,cacc = "ich" ; + pgen,pacc = "ne" ; + dat,cdat = "im" ; + pdat = "nim" ; + loc = "nich" ; + ins,pins = "nimi" ; + } + + } ; + + possessivePron : Agr -> DemPronForms = \a -> case a of { + + Ag _ Sg P1 => otcovA "moj" ** { + msnom = "môj" ; msgen = "môjho" ; msdat = "môjmu" ; + msins = "mojím" ; + ampnom = "moji" ; + nsnom, fpnom = "moje" ; + pgen = "mojich" ; + pdat = "mojim" ; + pins = "mojimi" ; + } ; + + Ag _ Sg P2 => otcovA "tvoj" ** { + msnom = "tvoj" ; msgen = "tvojho" ; msdat = "tvojmu" ; + msins = "tvojím" ; + ampnom = "tvoji" ; + nsnom, fpnom = "tvoje" ; + pgen = "tvojich" ; + pdat = "tvojim" ; + pins = "tvojimi" ; + } ; + + Ag _ Pl P1 => otcovA "naš" ** { + msnom = "náš" ; msgen = "nášho" ; msdat = "nášmu" ; + msins = "naším" ; + ampnom = "naši" ; + nsnom, fpnom = "naše" ; + pgen = "našich" ; + pdat = "našim" ; + pins = "našimi" ; + } ; + + Ag _ Pl P2 => otcovA "vaš" ** { + msnom = "váš" ; msgen = "vášho" ; msdat = "vášmu" ; + msins = "vaším" ; + ampnom = "vaši" ; + nsnom, fpnom = "vaše" ; + pgen = "vašich" ; + pdat = "vašim" ; + pins = "vašimi" ; + } ; + + Ag (Masc _ | Neutr) Sg P3 => invarDemPronForms "jeho" ** {pdat = "jeho"} ; + Ag Fem Sg P3 => invarDemPronForms "jej" ** {pdat = "jej"} ; + Ag _ Pl P3 => invarDemPronForms "ich" ** {pdat = "ich"} + + } ; + + reflPossessivePron : DemPronForms = otcovA "svoj" ** { + msnom = "svoj" ; msgen = "svojho" ; msdat = "svojmu" ; + msins = "svojím" ; + ampnom = "svoji" ; + nsnom, fpnom = "svoje" ; + pgen = "svojich" ; + pdat = "svojim" ; + pins = "svojimi" ; + } ; + + mkPron : Agr -> PronForms ** {poss : DemPronForms} = \a -> + personalPron a ** {poss = possessivePron a} ; + +-------------------------------- +-- demonstrative pronouns, used for Quant and Det + +oper + DemPronForms : Type = { + msnom, fsnom, nsnom, + msgen, fsgen, pgen, + msdat, -- fsdat = fsgen unlike AdjForms + fsacc, + msloc, + msins, fsins, + ampnom, 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.pgen ; + => dem.fpnom ; + _ => adjAdj.s ! g ! n ! c + } + s + } ; + + justDemPronFormsAdjective : DemPronForms -> Adjective = + \dem -> + let + demAdj = dem ** {fsdat = dem.fsgen} ; + adjAdj = adjFormsAdjective demAdj + in { + s = \\g,n,c => case of { + <_,Pl,Dat> => dem.pdat ; + => dem.pgen ; + => dem.fpnom ; + _ => adjAdj.s ! g ! n ! c + } + } ; + + Determiner : Type = { + s : Gender => Case => Str ; + size : NumSize + } ; + + mkDemPronForms : Str -> DemPronForms = \jedn -> { + msnom = jedn + "y" ; -- should be "jeden" + fsnom = jedn + "a" ; + nsnom = jedn + "o" ; + msgen = jedn + "ého" ; + fsgen = jedn + "ej" ; + msdat = jedn + "ému" ; + fsacc = jedn + "u" ; + msloc = jedn + "om" ; + msins = jedn + "ým" ; + fsins = jedn + "ou" ; + ampnom = jedn + "i" ; + fpnom = jedn + "y" ; + pgen = jedn + "ých" ; + pdat = jedn + "ým" ; + pins = jedn + "ými" ; + } ; + + tenDemPronForms : Str -> DemPronForms = \tam -> { + msnom = tam + "ten" ; + fsnom = tam + "tá" ; + nsnom = tam + "to" ; + msgen = tam + "toho" ; + fsgen = tam + "tej" ; + msdat = tam + "tomu" ; + fsacc = tam + "tú" ; + msloc = tam + "tom" ; + msins = tam + "tým" ; + fsins = tam + "tou" ; + ampnom = tam + "tí" ; + fpnom = tam + "tie" ; + pgen = tam + "tých" ; + pdat = tam + "tým" ; + pins = tam + "tými" ; + } ; + + invarDemPronForms : Str -> DemPronForms = \s -> { + msnom, fsnom, nsnom, msgen, fsgen, + msdat, fsacc, msloc, msins, fsins, + ampnom, fpnom, pgen, pdat, pins = s ; + } ; + +-- interrogatives + + ktoForms : Case => Str = table { + Nom => "kto" ; + Gen | Acc => "koho" ; + Dat => "komu" ; + Loc => "kom" ; + Ins => "kým" + } ; + + coForms : Case => Str = table { + Nom|Acc => "čo" ; + Gen => "čoho" ; + Dat => "čomu" ; + Loc => "čom" ; + Ins => "čím" + } ; + +-- Numerals + + -- singular forms of demonstratives + NumeralForms : Type = { + ---- amsnom, + msnom, fsnom, nsnom, + msgen, fsgen, + msdat, + fsacc, + msloc, + msins, fsins : Str + } ; + + numeralFormsDeterminer : NumeralForms -> NumSize -> Determiner = + \nume,size -> + let + dem = nume ** + {ampnom, fpnom, pgen, pdat, pins = nume.msnom} ; --- plural forms not used + demAdj = dem ** {fsdat = dem.fsgen} ; + adjAdj = adjFormsAdjective demAdj + in { + s = \\g,c => case of { +---- => nume.amsnom ; + _ => 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 = { +---- amsnom = "dvaja" ; + msnom = "dva" ; fsnom, nsnom, fsacc = "dve" ; + msgen, fsgen, msloc = "dvoch" ; + msdat = "dvom" ; + msins, fsins = "dvoma" + } + in numeralFormsDeterminer forms Num2_4 ; + + threeNumeral : Determiner = + let forms = { + ---- amsnom = "traja" ; + msnom, fsnom, nsnom, fsacc = "tri" ; ---- amsacc = "troch" + msgen, fsgen = "troch" ; + msdat = "trom" ; + msloc = "troch" ; + msins,fsins = "tromi" ; + } + in numeralFormsDeterminer forms Num2_4 ; + + fourNumeral : Determiner = + let forms = { + ---- amsnom = "štyria" ; + msnom, fsnom, nsnom, fsacc = "štyri" ; ---- amsacc = "štyroch" + msgen, fsgen = "štyroch" ; + msdat = "štyrom" ; + msloc = "štyroch" ; + msins,fsins = "štyrmi" ; + } + in numeralFormsDeterminer forms Num2_4 ; + + -- for the numbers 5 upwards + regNumeral : Str -> Str -> Str -> Str -> Determiner = \pät,piatich,piatim,piatimi -> + let forms = { + msnom,fsnom,nsnom, fsacc = pät ; + msgen, fsgen, msloc = piatich ; + msdat = piatim ; + msins, fsins = piatimi ; + } + in numeralFormsDeterminer forms Num5 ; + + invarDeterminer : Str -> NumSize -> Determiner = \sto,size -> + regNumeral sto sto 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/croatian/SentenceHrv.gf b/src/croatian/SentenceHrv.gf new file mode 100644 index 00000000..17334d58 --- /dev/null +++ b/src/croatian/SentenceHrv.gf @@ -0,0 +1,32 @@ +concrete SentenceHrv of Sentence = CatHrv ** + open Prelude, ResHrv 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/croatian/StructuralHrv.gf b/src/croatian/StructuralHrv.gf new file mode 100644 index 00000000..b40ea4b9 --- /dev/null +++ b/src/croatian/StructuralHrv.gf @@ -0,0 +1,31 @@ +concrete StructuralHrv of Structural = CatHrv ** + open ParadigmsHrv, ResHrv, Prelude in { + +lin + and_Conj = mkConj "a" ; + by8agent_Prep = mkPrep "" Ins ; + few_Det = invarNumeral "málo" ; -- see notes + for_Prep = mkPrep "pre" accusative ; + from_Prep = mkPrep (pre {"z" => "zo" ; _ => "z"}) Gen ; ---- consonant clusters and syllable with the onset with the same place of articulation + have_V2 = mkV2 haveVerbForms ; + in_Prep = mkPrep (pre {"v" => "vo" ; _ => "v"}) Loc ; ---- + many_Det = regNumeral "mnoho" "mnohých" "mnohým" "mnohými" ; ---- alternative: invarNumeral "veľa" ; + or_Conj = mkConj "alebo" ; + somePl_Det = invarDeterminer "niekoľko" Num5 ; +--- somePl_Det = {s = \\g,c => (demPronFormsAdjective (mkDemPronForms "niekoľko") "").s ! g ! Pl ! c ; size = Num5} ; + something_NP = {s,clit,prep = \\c => "nie" + coForms ! c ; a = Ag Neutr Sg P3 ; hasClit = False} ; -- CEG 5.6.3 + possess_Prep = mkPrep "" Gen ; + that_Quant = demPronFormsAdjective (tenDemPronForms "") "" ; + this_Quant = demPronFormsAdjective (tenDemPronForms "" ** {msgen = "toh"}) "to" ; + to_Prep = mkPrep "do" Gen ; + with_Prep = mkPrep (pre {"s" => "so" ; _ => "s"}) Ins ; + + i_Pron = mkPron (Ag (Masc Anim) Sg P1) ; --- to add Fem pronouns in Extend + youSg_Pron = mkPron (Ag (Masc Anim) Sg P2) ; + he_Pron = mkPron (Ag (Masc Anim) Sg P3) ; + she_Pron = mkPron (Ag Fem Sg P3) ; + it_Pron = mkPron (Ag Neutr Sg P3) ; + we_Pron = mkPron (Ag (Masc Anim) Pl P1) ; + youPl_Pron = mkPron (Ag (Masc Anim) Pl P2) ; + they_Pron = mkPron (Ag (Masc Anim) Pl P3) ; +} diff --git a/src/croatian/SymbolHrv.gf b/src/croatian/SymbolHrv.gf new file mode 100644 index 00000000..1d3a6f79 --- /dev/null +++ b/src/croatian/SymbolHrv.gf @@ -0,0 +1,11 @@ +--# -path=.:../abstract:../common:../prelude + +concrete SymbolHrv of Symbol = CatHrv ** open Prelude, ResHrv in { + +lincat + Symb = {s : Str} ; +lin + MkSymb s = s ; + SymbPN s = lin PN {s = \\_ => s.s ; g = Neutr} ; + +} diff --git a/src/croatian/TenseHrv.gf b/src/croatian/TenseHrv.gf new file mode 100644 index 00000000..5d0c163c --- /dev/null +++ b/src/croatian/TenseHrv.gf @@ -0,0 +1,20 @@ +concrete TenseHrv of Tense = + CatHrv ** + open + ResHrv, + 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/croatian/TextHrv.gf b/src/croatian/TextHrv.gf new file mode 100644 index 00000000..a501abfe --- /dev/null +++ b/src/croatian/TextHrv.gf @@ -0,0 +1,8 @@ +concrete TextHrv of Text = CatHrv ** open ResHrv 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/croatian/VerbHrv.gf b/src/croatian/VerbHrv.gf new file mode 100644 index 00000000..fe73d1c1 --- /dev/null +++ b/src/croatian/VerbHrv.gf @@ -0,0 +1,48 @@ +concrete VerbHrv of Verb = CatHrv ** open ResHrv, 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 + } ; + +}