From 0d6948f59b25b9f0d67244172ba85570ffd6405d Mon Sep 17 00:00:00 2001 From: aarneranta Date: Wed, 8 Apr 2020 11:07:12 +0200 Subject: [PATCH] added more comments to Czech files --- src/czech/CatCze.gf | 26 ++++++++++---------- src/czech/NounCze.gf | 2 +- src/czech/NumeralCze.gf | 1 + src/czech/ResCze.gf | 49 +++++++++++++++++++++++++++++--------- src/czech/SentenceCze.gf | 3 ++- src/czech/StructuralCze.gf | 2 +- 6 files changed, 56 insertions(+), 27 deletions(-) diff --git a/src/czech/CatCze.gf b/src/czech/CatCze.gf index 8dceb6a58..25ac6cef0 100644 --- a/src/czech/CatCze.gf +++ b/src/czech/CatCze.gf @@ -12,15 +12,15 @@ concrete CatCze of Cat = Cl = {subj,clit,compl : Str ; verb : VerbForms ; a : Agr} ; Comp = {s : Agr => Str} ; - QS = {s : Str} ; ---- - QCl = {subj,clit,compl : Str ; verb : VerbForms ; a : Agr} ; ---- + 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 + RCl = {subj,clit,compl : Agr => Str ; verb : VerbForms} ; ---- RAgr with composite RP RP = AdjForms ; - VP = {verb : VerbForms ; clit,compl : Agr => Str} ; ---- + VP = {verb : VerbForms ; clit,compl : Agr => Str} ; ---- more fields probably needed VPSlash = {verb : VerbForms ; clit,compl : Agr => Str ; c : ComplementCase} ; ---- V = ResCze.VerbForms ; V2 = ResCze.VerbForms ** {c : ComplementCase} ; @@ -33,22 +33,22 @@ concrete CatCze of Cat = N = ResCze.NounForms ; CN = ResCze.Noun ; -- {s : Number => Case => Str ; g : Gender} - NP = {s,clit,prep : Case => Str ; a : Agr ; hasClit : Bool} ; ---- - PN = {s : Case => Str ; g : Gender} ; ---- - Det = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ; + 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 = {s : Gender => Case => Str ; size : NumSize} ; + Num = Determiner ; Card = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ; Pron = PronForms ; Adv = {s : Str} ; Prep = ResCze.ComplementCase ; -- {s : Str ; c : Case ; hasPrep : Bool} ; - Conj = {s1,s2 : Str} ; ---- + 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} ; ---- + Temp = {s : Str ; t : CTense} ; + Tense = {s : Str ; t : CTense} ; + Ant = {s : Str ; t : CTense} ; PConj = {s : Str} ; Voc = {s : Str} ; @@ -63,7 +63,7 @@ concrete CatCze of Cat = A = \s -> s.msnom ; - lincat Numeral = Determiner ; ---- should contain Ord as well + lincat Numeral = Determiner ; ---- TODO: should contain Ord as well lincat Digits = {s:Str ; size : NumSize} ; diff --git a/src/czech/NounCze.gf b/src/czech/NounCze.gf index 03d722cd4..ef990e0c4 100644 --- a/src/czech/NounCze.gf +++ b/src/czech/NounCze.gf @@ -88,7 +88,7 @@ lin UseN n = nounFormsNoun n ; ApposCN cn np = { - s = \\n,c => cn.s ! n ! c ++ np.s ! c ; ---- + s = \\n,c => cn.s ! n ! c ++ np.s ! c ; ---- TODO check apposition order g = cn.g } ; diff --git a/src/czech/NumeralCze.gf b/src/czech/NumeralCze.gf index 370c6f9fb..26d98fb78 100644 --- a/src/czech/NumeralCze.gf +++ b/src/czech/NumeralCze.gf @@ -9,6 +9,7 @@ concrete NumeralCze of Numeral = -- from gf-contrib/numerals/czech.gf, added inflections -- AR 2020-03-20 +---- TODO ordinal forms oper LinNumeral = Determiner ; -- {s : NumeralForms ; size : NumSize} ; diff --git a/src/czech/ResCze.gf b/src/czech/ResCze.gf index 29f409d0a..7f791252e 100644 --- a/src/czech/ResCze.gf +++ b/src/czech/ResCze.gf @@ -1,5 +1,9 @@ resource ResCze = open Prelude in { +-- AR March 2020 +-- sources: +-- Wiki = https://en.wikipedia.org/wiki/Czech_declension, https://en.wikipedia.org/wiki/Czech_conjugation +-- CEG = J. Naughton, Czech: an Essential Grammar, Routledge 2005. -- parameters @@ -15,7 +19,7 @@ param Agr = Ag Gender Number Person ; - CTense = CTPres | CTPast ; ----- + CTense = CTPres | CTPast ; ----- TODO complete the tense system to match Czech verb morphology -- phonology @@ -31,8 +35,6 @@ oper "b" | "f" | "l" | "m" | "p" | "s" | "v" ) ; - - dropFleetingE : Str -> Str = \s -> case s of { x + "e" + c@("k"|"c") => x + c ; x + "e" + "ň" => x + "n" ; @@ -89,10 +91,25 @@ oper --------------- -- 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 - Noun : Type = {s : Number => Case => Str ; g : Gender} ; 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 { @@ -117,7 +134,7 @@ oper g = forms.g } ; - +-- terminology of CEG DeclensionType : Type = Str -> NounForms ; declensionNounForms : (nom,gen : Str) -> Gender -> NounForms @@ -142,6 +159,8 @@ oper } in decl nom ; +-- the "smartest" one-argument mkN + guessNounForms : Str -> NounForms = \s -> case s of { _ + "ost" => declKOST s ; @@ -155,11 +174,11 @@ oper _ + "í" => declSTAVENI s ; _ => Predef.error ("cannot guess declension type for" ++ s) } ; - --- source: https://en.wikipedia.org/wiki/Czech_declension +-- the traditional declensions, in both CEG and Wiki +-- they are also exported in ParadigmsCze with names panN etc - declPAN : DeclensionType = \pan -> --- plural nom ové|i|é should be given as extra arg 3.5.1 + declPAN : DeclensionType = \pan -> --- plural nom ové|i|é can be changed with ** {pnom = ...} CEG 3.5.1 { snom = pan ; sgen,sacc = pan + "a" ; @@ -406,6 +425,7 @@ oper Adjective : Type = {s : Gender => Number => Case => Str} ; -- to be used for A, in three degrees: 15 forms in each +---- TODO other degrees than positive AdjForms : Type = { msnom, fsnom, nsnom : Str ; -- svoc = snom @@ -420,6 +440,8 @@ oper pins : Str ; } ; +-- used in PositA but will also work in Compar and Superl by calling their record fields + adjFormsAdjective : AdjForms -> Adjective = \afs -> { s = \\g,n,c => case of { @@ -562,6 +584,9 @@ adjFormsAdjective : AdjForms -> Adjective = \afs -> { pastpartpl = "měli" ; } ; +-- just an example of a traditional paradigm +---- TODO other traditional paradigms + iii_kupovatVerbForms : Str -> VerbForms = \kupovat -> let kupo = Predef.tk 3 kupovat ; @@ -593,6 +618,8 @@ adjFormsAdjective : AdjForms -> Adjective = \afs -> { a : Agr } ; +---- TODO: possessives + personalPron : Agr -> PronForms = \a -> {a = a ; cnom = []} ** case a of { @@ -682,7 +709,7 @@ adjFormsAdjective : AdjForms -> Adjective = \afs -> { } ; -------------------------------- --- demonstrative pronouns +-- demonstrative pronouns, used for Quant and Det oper DemPronForms : Type = { @@ -785,7 +812,7 @@ oper -- example: number 1 oneNumeral : Determiner = numeralFormsDeterminer (mkDemPronForms "jed") Num1 ; - -- numbers 2,3,4 ---- to check if everything comes out right with this type + -- numbers 2,3,4 ---- to check if everything comes out right with the determiner type twoNumeral : Determiner = let forms = { msnom = "dva" ; fsnom, nsnom, fsacc = "dvě" ; @@ -830,7 +857,7 @@ oper -- combining nouns with numerals param - NumSize = Num1 | Num2_4 | Num5 ; -- essential grammar 6.1 + NumSize = Num1 | Num2_4 | Num5 ; -- CEG 6.1 oper numSizeForm : (Number => Case => Str) -> NumSize -> Case -> Str diff --git a/src/czech/SentenceCze.gf b/src/czech/SentenceCze.gf index 15e80b4c9..2793ec358 100644 --- a/src/czech/SentenceCze.gf +++ b/src/czech/SentenceCze.gf @@ -17,8 +17,9 @@ lin 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 ; ---- inversion optional + s = temp.s ++ cl.clit ++ pol.s ++ verbAgr cl.verb cl.a pol.p ++ cl.subj ++ cl.compl ; } ; UseRCl temp pol rcl = { diff --git a/src/czech/StructuralCze.gf b/src/czech/StructuralCze.gf index ffe5a10b2..6cbf9280a 100644 --- a/src/czech/StructuralCze.gf +++ b/src/czech/StructuralCze.gf @@ -12,7 +12,7 @@ lin many_Det = regNumeral "mnoho" "mnoha" ; -- CEG 6.8 ---- or_Conj = mkConj "nebo" ; somePl_Det = regNumeral "několik" "několika" ; -- CEG 6.8 ---- - something_NP = {s,clit,prep = \\c => "ně" ++ coForms ! c ; a = Ag Neutr Sg P3 ; hasClit = False} ; -- CEG 5.6.3 + something_NP = {s,clit,prep = \\c => "ně" + coForms ! c ; a = Ag Neutr Sg P3 ; hasClit = False} ; -- CEG 5.6.3 possess_Prep = mkPrep "" Gen ; that_Quant = demPronFormsAdjective (mkDemPronForms "tamt") "" ; this_Quant = demPronFormsAdjective (mkDemPronForms "t") "to" ;