started Croatian, some noun declensions in place

This commit is contained in:
Aarne Ranta
2022-09-20 11:07:30 +02:00
parent 0c57e45540
commit 70d9c74279
30 changed files with 1868 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
--# -path=.:alltenses:prelude
resource CombinatorsHrv = Combinators with
(Cat = CatHrv),
(Structural = StructuralHrv),
(Constructors = ConstructorsHrv)
** open MissingHrv in {}

View File

@@ -0,0 +1,5 @@
--# -path=.:alltenses:prelude
resource ConstructorsHrv = Constructors with (Grammar = GrammarHrv)
** open MissingHrv in {}

6
src/api/SymbolicHrv.gf Normal file
View File

@@ -0,0 +1,6 @@
--# -path=.:../slovak:../common:../abstract:../prelude
resource SymbolicHrv = Symbolic with
(Symbol = SymbolHrv),
(Grammar = GrammarHrv)
** open MissingHrv in {}

4
src/api/SyntaxHrv.gf Normal file
View File

@@ -0,0 +1,4 @@
--# -path=.:./alltenses:../prelude
instance SyntaxHrv of Syntax =
ConstructorsHrv, CatHrv, StructuralHrv, CombinatorsHrv ;

13
src/api/TryHrv.gf Normal file
View File

@@ -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 ;
-- } ;
}

View File

@@ -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} ;
}

View File

@@ -0,0 +1,9 @@
concrete AdverbHrv of Adverb = CatHrv **
open ResHrv, Prelude in {
lin
PrepNP prep np = {
s = prep.s ++ np.prep ! prep.c
} ;
}

7
src/croatian/AllHrv.gf Normal file
View File

@@ -0,0 +1,7 @@
--# -path=.:../abstract:../common:../api
concrete AllHrv of AllHrvAbs =
LangHrv,
ExtendHrv
;

View File

@@ -0,0 +1,7 @@
--# -path=.:../abstract:../common:prelude
abstract AllHrvAbs =
Lang,
Extend
;

71
src/croatian/CatHrv.gf Normal file
View File

@@ -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} ;
}

View File

@@ -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 ;
}

38
src/croatian/ExtendHrv.gf Normal file
View File

@@ -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 ;
}

View File

@@ -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
** {
}

5
src/croatian/IdiomHrv.gf Normal file
View File

@@ -0,0 +1,5 @@
concrete IdiomHrv of Idiom = CatHrv ** open Prelude, ResHrv in {
}

10
src/croatian/LangHrv.gf Normal file
View File

@@ -0,0 +1,10 @@
--# -path=.:../abstract:../common:../api
concrete LangHrv of Lang =
GrammarHrv,
LexiconHrv
-- ,ConstructionHrv
-- ,DocumentationHrv --# notpresent
** {
}

View File

@@ -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ť") ;
}

102
src/croatian/MissingHrv.gf Normal file
View File

@@ -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" ;
}

101
src/croatian/NounHrv.gf Normal file
View File

@@ -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 ;
}

120
src/croatian/NumeralHrv.gf Normal file
View File

@@ -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} ;
}

View File

@@ -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} ;
}

19
src/croatian/PhraseHrv.gf Normal file
View File

@@ -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} ;
}

View File

@@ -0,0 +1,7 @@
concrete QuestionHrv of Question = CatHrv **
open ResHrv, Prelude in {
lin
QuestCl cl = cl ; ----
}

View File

@@ -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ý" ;
}

856
src/croatian/ResHrv.gf Normal file
View File

@@ -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 <g, snom, pgen> of {
<Masc Anim, _ + "a" , _ + "ov"> => hrdinaN snom ;
<Masc _, _ + ("i"|"y"|"e") , _ + "ov"> => ponyN snom ; ----
<Masc Anim, _ , _ + "ov"> => chlapN snom ;
<Masc Inanim, _ + #softConsonant, _ + "ov"> => strojN snom ;
<Masc Ianim, _ + #hardConsonant, _ + "ov"> => dubN snom ;
<Masc Ianim, _ + #neutralConsonant,_ + "ov"> => dubN snom ;
<Fem, _ + #hardConsonant + "a", _ + #consonant> => zenaN snom ;
<Fem, _ + #neutralConsonant + "a", _ + #consonant> => zenaN snom ;
<Fem, _ + #softConsonant + "a", _ + #consonant> => ulicaN snom ;
<Fem, _ + ("ia"|"ya"), _> => ulicaN snom ;
<Fem, _ + ("c"|"s"|"p"|"v"|"sť"), _ + "í"> => kostN snom pgen ;
<Fem, _ + #consonant , _ + "í"> => dlanN snom pgen ;
<Neutr, _ + "o" , _ > => mestoN snom ;
<Neutr, _ + "ie" , _ + "í"> => vysvedcenieN snom ;
<Neutr, _ + "e" , _ > => srdceN snom ;
<Neutr, _ + ("a"|"ä") , _ + "iec"> => dievceniecN snom ;
<Neutr, _ + ("a"|"ä") , _ > => 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 <n,c,g> of {
<Sg, Nom, Masc _>
| <Sg, Acc, Masc Inanim> => afs.msnom ;
<Sg, Nom, Fem> => afs.fsnom ;
<Sg, Nom|Acc, Neutr>
| <Pl, Nom|Acc, Masc Inanim|Fem|Neutr> => afs.nsnom ;
<Sg, Gen, Masc _ | Neutr>
| <Sg,Acc,Masc Anim> => afs.msgen ;
<Sg, Gen|Dat|Loc, Fem> => afs.fsgen ;
<Sg, Dat, Masc _|Neutr> => afs.msdat ;
<Sg, Acc, Fem> => afs.fsacc ;
<Sg, Loc, Masc _|Neutr> => afs.msloc ;
<Sg, Ins, Masc _|Neutr>
| <Pl,Dat,_> => afs.msins ;
<Sg, Ins, Fem> => afs.fsins ;
<Pl, Nom, Masc Anim> => afs.ampnom ;
<Pl, Gen|Loc,_>
| <Pl, Acc, Masc Anim> => afs.pgen ;
<Pl, Ins,_> => 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 <g,n,c> of {
<_,Pl,Dat> => dem.pdat ;
<Masc Anim, Pl, Acc> => dem.pgen ;
<Masc Inanim | Fem | Neutr, Pl, Nom|Acc> => 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 <g,n,c> of {
<_,Pl,Dat> => dem.pdat ;
<Masc Anim, Pl, Acc> => dem.pgen ;
<Masc Inanim | Fem | Neutr, Pl, Nom|Acc> => 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 <g,c> of {
---- <Masc Anim, Nom> => 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
} ;
-}
}

View File

@@ -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 ;
} ;
}

View File

@@ -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) ;
}

11
src/croatian/SymbolHrv.gf Normal file
View File

@@ -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} ;
}

20
src/croatian/TenseHrv.gf Normal file
View File

@@ -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} ; ----
}

8
src/croatian/TextHrv.gf Normal file
View File

@@ -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} ;
}

48
src/croatian/VerbHrv.gf Normal file
View File

@@ -0,0 +1,48 @@
concrete VerbHrv of Verb = CatHrv ** open ResHrv, Prelude in {
lin
UseV v = {
verb = v ;
clit,compl = \\_ => []
} ;
ComplSlash vps np = case <np.hasClit, vps.c.hasPrep> of {
<True,False> => 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
} ;
}