diff --git a/languages.csv b/languages.csv index e80c1c02..1259a866 100644 --- a/languages.csv +++ b/languages.csv @@ -5,6 +5,7 @@ Ara,Arabic,arabic,,,,,,y,,y Bul,Bulgarian,bulgarian,,,y,,,,,y Cat,Catalan,catalan,Romance,,y,,,,y,y Chi,Chinese (simplified),chinese,,,,,,,,y +Cze,Czech,czech,,,n,n,n,n,n,n Dan,Danish,danish,Scand,,y,,,,,y Dut,Dutch,dutch,,,y,,,,,y Eng,English,english,,,y,,,,y,y @@ -22,7 +23,7 @@ Ice,Icelandic,icelandic,,,,,,n,,y Ina,Interlingua,interlingua,,,y,,n,n,,n Ita,Italian,italian,Romance,,y,,,,y,y Jpn,Japanese,japanese,,,,,,,,y -Kor,Korean,korean,,,n,n,n,n,n,n +Kor,Korean,korean,,,n,y,y,y,n,n Lat,Latin,latin,,,,,y,y,n,y Lav,Latvian,latvian,,,,,,,y,y Mlt,Maltese,maltese,,,,,,,,y diff --git a/src/api/CombinatorsCze.gf b/src/api/CombinatorsCze.gf new file mode 100644 index 00000000..2ce82550 --- /dev/null +++ b/src/api/CombinatorsCze.gf @@ -0,0 +1,9 @@ +--# -path=.:alltenses:prelude + +resource CombinatorsCze = Combinators with + (Cat = CatCze), + (Structural = StructuralCze), + (Constructors = ConstructorsCze) + ** open MissingCze in {} + + diff --git a/src/api/CombinatorsKor.gf b/src/api/CombinatorsKor.gf index 5881a4da..3c2bd13a 100644 --- a/src/api/CombinatorsKor.gf +++ b/src/api/CombinatorsKor.gf @@ -1,4 +1,4 @@ ---# -path=.:alltenses:prelude:src/korean +--# -path=.:alltenses:prelude:../korean resource CombinatorsKor = Combinators with (Cat = CatKor), diff --git a/src/api/ConstructorsCze.gf b/src/api/ConstructorsCze.gf new file mode 100644 index 00000000..86c17c33 --- /dev/null +++ b/src/api/ConstructorsCze.gf @@ -0,0 +1,5 @@ +--# -path=.:alltenses:prelude + +resource ConstructorsCze = Constructors with (Grammar = GrammarCze) + ** open MissingCze in {} + diff --git a/src/api/SymbolicCze.gf b/src/api/SymbolicCze.gf new file mode 100644 index 00000000..73126acf --- /dev/null +++ b/src/api/SymbolicCze.gf @@ -0,0 +1,6 @@ +--# -path=.:../czech:../common:../abstract:../prelude + +resource SymbolicCze = Symbolic with + (Symbol = SymbolCze), + (Grammar = GrammarCze) + ** open MissingCze in {} diff --git a/src/api/SyntaxCze.gf b/src/api/SyntaxCze.gf new file mode 100644 index 00000000..986a10c0 --- /dev/null +++ b/src/api/SyntaxCze.gf @@ -0,0 +1,4 @@ +--# -path=.:./alltenses:../prelude + +instance SyntaxCze of Syntax = + ConstructorsCze, CatCze, StructuralCze, CombinatorsCze ; diff --git a/src/api/SyntaxKor.gf b/src/api/SyntaxKor.gf index 589ef9de..3be15d31 100644 --- a/src/api/SyntaxKor.gf +++ b/src/api/SyntaxKor.gf @@ -1,5 +1,5 @@ ---# -path=.:alltenses:prelude - -instance SyntaxKor of Syntax = - ConstructorsKor, CatKor, StructuralKor, CombinatorsKor ; +--# -path=.:alltenses:prelude:../korean +instance SyntaxKor of Syntax = + ConstructorsKor, CatKor, StructuralKor, CombinatorsKor ** + open MissingKor in {} ; diff --git a/src/api/TryCze.gf b/src/api/TryCze.gf new file mode 100644 index 00000000..30a52365 --- /dev/null +++ b/src/api/TryCze.gf @@ -0,0 +1,13 @@ +--# -path=.:../czech:../common:../abstract:../prelude + +resource TryCze = SyntaxCze, LexiconCze, ParadigmsCze -[mkAdv, mkDet,mkQuant]** + open (P = ParadigmsCze) in { + +-- oper + +-- mkAdv = overload SyntaxCze { +-- mkAdv : Str -> Adv = P.mkAdv ; +-- } ; + +} + diff --git a/src/bulgarian/DocumentationBul.gf b/src/bulgarian/DocumentationBul.gf index 6e617eb9..59e77d7d 100644 --- a/src/bulgarian/DocumentationBul.gf +++ b/src/bulgarian/DocumentationBul.gf @@ -142,6 +142,7 @@ lin } ++ v.s ! Imperf ! VPres Sg P3 ++ v.c2.s ++ + linCase v.c2.c Pos ++ pp "допълнение"; s2= inflVerb v ; s3= "" diff --git a/src/czech/AdjectiveCze.gf b/src/czech/AdjectiveCze.gf new file mode 100644 index 00000000..66891f01 --- /dev/null +++ b/src/czech/AdjectiveCze.gf @@ -0,0 +1,23 @@ +concrete AdjectiveCze of Adjective = CatCze ** open ResCze, Prelude in { + + lin + + PositA a = adjFormsAdjective a ** {isPost = False} ; + + AdAP ada ap = ap ** {s = \\g,n,c => ada.s ++ ap.s ! g ! n ! c} ; + + ComplA2 a np = + let ap = adjFormsAdjective a + in + ap ** { + s = \\g,n,c => ap.s ! g ! n ! c ++ a.c.s ++ np.s ! a.c.c ; + isPost = True ; + } ; + + UseA2 a = adjFormsAdjective a ** {isPost = False} ; + + UseComparA a = adjFormsAdjective a ** {isPost = False} ; ---- TODO: this gives positive forms + + AdvAP ap adv = ap ** {s = \\g,n,c => ap.s ! g ! n ! c ++ adv.s} ; + +} diff --git a/src/czech/AdverbCze.gf b/src/czech/AdverbCze.gf new file mode 100644 index 00000000..a441d2cf --- /dev/null +++ b/src/czech/AdverbCze.gf @@ -0,0 +1,9 @@ +concrete AdverbCze of Adverb = CatCze ** + open ResCze, Prelude in { + +lin + PrepNP prep np = { + s = prep.s ++ np.prep ! prep.c + } ; + +} diff --git a/src/czech/AllCze.gf b/src/czech/AllCze.gf new file mode 100644 index 00000000..a27d206b --- /dev/null +++ b/src/czech/AllCze.gf @@ -0,0 +1,6 @@ +--# -path=.:../abstract:../common:../api + +concrete AllCze of AllCzeAbs = + LangCze + ; + diff --git a/src/czech/AllCzeAbs.gf b/src/czech/AllCzeAbs.gf new file mode 100644 index 00000000..193edeb0 --- /dev/null +++ b/src/czech/AllCzeAbs.gf @@ -0,0 +1,6 @@ +--# -path=.:../abstract:../common:prelude + +abstract AllCzeAbs = + Lang + ; + diff --git a/src/czech/CatCze.gf b/src/czech/CatCze.gf new file mode 100644 index 00000000..25ac6cef --- /dev/null +++ b/src/czech/CatCze.gf @@ -0,0 +1,70 @@ +concrete CatCze of Cat = +--- CommonX ** + + open ResCze, 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 = ResCze.VerbForms ; + V2 = ResCze.VerbForms ** {c : ComplementCase} ; + + A = ResCze.AdjForms ; + AP = ResCze.Adjective ** {isPost : Bool} ; -- {s : Gender => Number => Case => Str} + A2 = ResCze.AdjForms ** {c : ComplementCase} ; + + AdA = {s : Str} ; + + N = ResCze.NounForms ; + CN = ResCze.Noun ; -- {s : Number => Case => Str ; g : Gender} + NP = {s,clit,prep : Case => Str ; a : Agr ; hasClit : Bool} ; -- clit,prep differ for pronouns + PN = {s : Case => Str ; g : Gender} ; + Det = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ; -- can contain a numeral, therefore NumSize + Quant = {s : Gender => Number => Case => Str} ; -- same as AP + Num = Determiner ; + Card = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ; + Pron = PronForms ; + + Adv = {s : Str} ; + Prep = ResCze.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/czech/ConjunctionCze.gf b/src/czech/ConjunctionCze.gf new file mode 100644 index 00000000..11a45f37 --- /dev/null +++ b/src/czech/ConjunctionCze.gf @@ -0,0 +1,56 @@ +concrete ConjunctionCze of Conjunction = CatCze ** + open ResCze, 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/czech/GrammarCze.gf b/src/czech/GrammarCze.gf new file mode 100644 index 00000000..5e3ad930 --- /dev/null +++ b/src/czech/GrammarCze.gf @@ -0,0 +1,19 @@ +--# -path=.:../abstract:../common:prelude + +concrete GrammarCze of Grammar = + NounCze, + VerbCze, + AdjectiveCze, + AdverbCze, + NumeralCze, + SentenceCze, + QuestionCze, + RelativeCze, + ConjunctionCze, + PhraseCze, + TextCze, + StructuralCze, + IdiomCze, + TenseCze + ** { +} diff --git a/src/czech/IdiomCze.gf b/src/czech/IdiomCze.gf new file mode 100644 index 00000000..d4314dcc --- /dev/null +++ b/src/czech/IdiomCze.gf @@ -0,0 +1,5 @@ +concrete IdiomCze of Idiom = CatCze ** open Prelude, ResCze in { + + + +} diff --git a/src/czech/LangCze.gf b/src/czech/LangCze.gf new file mode 100644 index 00000000..513fa955 --- /dev/null +++ b/src/czech/LangCze.gf @@ -0,0 +1,10 @@ +--# -path=.:../abstract:../common:../api + +concrete LangCze of Lang = + GrammarCze, + LexiconCze +-- ,ConstructionCze +-- ,DocumentationCze --# notpresent + ** { + +} diff --git a/src/czech/LexiconCze.gf b/src/czech/LexiconCze.gf new file mode 100644 index 00000000..cec51cbd --- /dev/null +++ b/src/czech/LexiconCze.gf @@ -0,0 +1,59 @@ +concrete LexiconCze of Lexicon = + CatCze + ** + open + ResCze, ParadigmsCze + in { + + lin + boy_N = declPAN "kluk" ; + man_N = declMUZ "muž" ; + teacher_N = declMUZ "učitel" ; + horse_N = declMUZ "kůň" ; + father_N = declMUZ "otec" ; + husband_N = declPAN "manžel" ; + + castle_N = declHRAD "hrad" ; + forest_N = declHRAD "les" ; + machine_N = declSTROJ "stroj" ; + + woman_N = declZENA "žena" ; + school_N = declZENA "škola" ; ---- + skirt_N = declRUZE "sukně"; + street_N = declRUZE "ulice" ; + rose_N = declRUZE "růže" ; + song_N = declPISEN "píseň" ; + bed_N = declPISEN "postel" ; + door_N = declRUZE "dveře" ; + bone_N = declKOST "kost" ; + village_N = declKOST "ves" ; ---- + + city_N = declMESTO "město" ; + apple_N = declMESTO "jablko" ; ---- + sea_N = declMORE "moře" ; + airport_N = declMORE "letiště" ; + chicken_N = declKURE "kuře" ; + house_N = declSTAVENI "stavení" ; --- building, house + station_N = declSTAVENI "nádraží" ; + + young_A = mkA "mladý" ; + old_A = mkA "starý" ; + good_A = mkA "dobrý" ; + bad_A = mkA "špatný" ; + beautiful_A = mkA "krásný" ; + clean_A = mkA "čistý" ; + dirty_A = mkA "špinavý" ; + + white_A = mkA "bílý" ; + black_A = mkA "černý" ; + red_A = mkA "červený" ; + brown_A = mkA "hnědý" ; + blue_A = mkA "modrý" ; + green_A = mkA "zelený" ; + yellow_A = mkA "žlutý" ; + + buy_V2 = mkV2 (iii_kupovatVerbForms "kupovat") ; + love_V2 = mkV2 (iii_kupovatVerbForms "milovat") ; + +} + diff --git a/src/czech/MissingCze.gf b/src/czech/MissingCze.gf new file mode 100644 index 00000000..d1ae7d3b --- /dev/null +++ b/src/czech/MissingCze.gf @@ -0,0 +1,102 @@ +resource MissingCze = open GrammarCze, 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" ; + +} \ No newline at end of file diff --git a/src/czech/NounCze.gf b/src/czech/NounCze.gf new file mode 100644 index 00000000..ef990e0c --- /dev/null +++ b/src/czech/NounCze.gf @@ -0,0 +1,100 @@ +concrete NounCze of Noun = + CatCze +** + + open ResCze, Prelude in { + +lin + DetCN det cn = { + s,prep,clit = \\c => det.s ! cn.g ! c ++ numSizeForm cn.s det.size c ; + a = numSizeAgr cn.g det.size P3 ; + hasClit = False ; + } ; + + MassNP cn = { + s,prep,clit = \\c => cn.s ! Sg ! c ; + a = Ag cn.g Sg P3 ; + hasClit = False ; + } ; + + DetQuant quant num = { + s = \\g,c => num.s ! g ! c ++ quant.s ! g ! numSizeNumber num.size ! c ; + size = num.size + } ; + + DefArt = {s = \\_,_,_ => []} ; + IndefArt = {s = \\_,_,_ => []} ; + NumPl = {s = \\_,_ => [] ; size = Num2_4} ; ---- size + NumSg = {s = \\_,_ => [] ; size = Num1} ; + + UsePron pron = { + s = table { + Nom | Voc => pron.nom ; + Gen => pron.gen ; + Dat => pron.dat ; + Acc => pron.acc ; + Loc => pron.loc ; + Ins => pron.ins + } ; + clit = table { + Nom => pron.cnom ; + Voc => pron.nom ; + Gen => pron.cgen ; + Dat => pron.cdat ; + Acc => pron.cacc ; + Loc => pron.loc ; + Ins => pron.ins + } ; + prep = table { + Nom | Voc => pron.nom ; + Gen => pron.pgen ; + Dat => pron.pdat ; + Acc => pron.pacc ; + Loc => pron.loc ; + Ins => pron.pins + } ; + a = pron.a ; + hasClit = True ; + } ; + + UsePN pn = { + s,clit,prep = \\c => pn.s ! c ; + a = Ag pn.g Sg P3 ; + hasClit = False ; + } ; + + AdjCN ap cn = { + s = \\n,c => ap.s ! cn.g ! n ! c ++ cn.s ! n ! c ; + g = cn.g + } ; + + RelCN cn rs = { + s = \\n,c => cn.s ! n ! c ++ rs.s ! Ag cn.g n P3 ; + g = cn.g + } ; + + AdvCN cn adv = { + s = \\n,c => cn.s ! n ! c ++ adv.s ; + g = cn.g + } ; + + AdvNP np adv = { + s,clit = \\c => np.s ! c ++ adv.s ; + prep = \\c => np.prep ! c ++ adv.s ; + a = np.a ; + hasClit = False ; + } ; + + UseN n = nounFormsNoun n ; + + ApposCN cn np = { + s = \\n,c => cn.s ! n ! c ++ np.s ! c ; ---- TODO check apposition order + g = cn.g + } ; + + NumCard c = c ; + NumDigits ds = ds ** {s = \\_,_ => ds.s} ; + NumNumeral nu = nu ; + + +} diff --git a/src/czech/NumeralCze.gf b/src/czech/NumeralCze.gf new file mode 100644 index 00000000..26d98fb7 --- /dev/null +++ b/src/czech/NumeralCze.gf @@ -0,0 +1,120 @@ +concrete NumeralCze of Numeral = + + CatCze ** + + open + ResCze, + Prelude + in { + +-- from gf-contrib/numerals/czech.gf, added inflections +-- AR 2020-03-20 +---- TODO ordinal forms + + +oper LinNumeral = Determiner ; -- {s : NumeralForms ; size : NumSize} ; +oper LinDigit = {unit : Gender => Case => Str ; teen, ten, hundred : Str ; size : NumSize} ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; + +lincat Sub100 = LinNumeral ; +lincat Sub1000 = LinNumeral ; +lincat Sub1000000 = LinNumeral ; + +oper mkNum : Determiner -> Str -> Str -> Str -> LinDigit = + \dva, dvanast, dvadsat, dveste -> { + unit = dva.s ; + teen = dvanast + "náct" ; + ten = dvadsat ; + hundred = dveste ; + size = dva.size ; + } ; + +oper mk2Num : Determiner -> Str -> Str -> Str -> LinDigit = + \unit, teenbase, tenbase, hundred -> + mkNum unit teenbase (tenbase + "cet") hundred ; + +oper mk5Num : Str -> Str -> Str -> Str -> LinDigit = + \unit,uniti, teenbase, tenbase -> + mkNum (regNumeral unit uniti) teenbase (tenbase + "desát") (unit ++ "set") ; + +oper bigNumeral : Str -> LinNumeral = \s -> invarNumeral s ; + +lin num x = x ; + +lin n2 = mk2Num twoNumeral "dva" "dva" ("dvě" ++ "stě") ; +lin n3 = mk2Num threeNumeral "tři" "tři" ("tři" ++ "sta") ; +lin n4 = mk2Num fourNumeral "čtr" "čtyři" ("čtyři" ++ "sta") ; +lin n5 = mk5Num "pět" "pěti" "pat" "pa" ; +lin n6 = mk5Num "šest" "šesti" "šest" "še" ; +lin n7 = mk5Num "sedm" "sedmi" "sedm" "sedm"; +lin n8 = mk5Num "osm" "osmi" "osm" "osm"; +lin n9 = mk5Num "devět" "devíti" "devate" "deva" ; + +lin pot01 = { + unit = oneNumeral.s ; hundred = "sto" ; ten = "deset" ; teen = "jedenáct" ; + size = Num1 + } ; +lin pot0 d = d ; + +lin pot110 = bigNumeral "deset" ; +lin pot111 = bigNumeral "jedenáct" ; +lin pot1to19 d = bigNumeral d.teen ; + +lin pot0as1 n = {s = n.unit ; size = n.size} ; +lin pot1 d = bigNumeral d.ten ; +lin pot1plus d e = { + s = (invarNumeral (d.ten ++ determinerStr (e ** {s = e.unit}))).s ; ---- TODO inflection? + size = tfSize e.size + } ; + ---- variants { d.s ! ten ++ e.s ! unit ; glue (glue (e.s ! unit) "a") (d.s ! ten)} ; size = tfSize e.size} ; + +lin pot1as2 n = n ; +lin pot2 d = bigNumeral d.hundred ; +lin pot2plus d e = { + s = (invarNumeral (d.hundred ++ determinerStr e)).s ; ---- TODO inflection? + size = tfSize e.size + } ; + +lin pot2as3 n = n ; +lin pot3 n = bigNumeral (mkTh (determinerStr n) n.size) ; + +lin pot3plus n m = { + s = (invarNumeral (mkTh (determinerStr n) n.size ++ determinerStr m)).s ; ---- TODO inflection? + size = tfSize m.size + } ; + +oper tfSize : NumSize -> NumSize = \sz -> + table {Num1 => Num5 ; other => other} ! sz ; + +oper mkTh : Str -> NumSize -> Str = \attr,size -> + case size of { + Num1 => "tisíc" ; + Num2_4 => attr ++ "tisíce" ; + Num5 => attr ++ "tisíc" + } ; + +oper determinerStr : Determiner -> Str = \d -> d.s ! Masc Anim ! Nom ; + + +-- -- Numerals as sequences of digits have a separate, simpler grammar + lincat Dig = {s:Str ; size : NumSize} ; + + lin + IDig d = d ; + + IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s ; size = Num5} ; ---- leading zeros ?? + + D_0 = { s = "0" ; size = Num1} ; ---- ?? + D_1 = { s = "1" ; size = Num1} ; + D_2 = { s = "2" ; size = Num2_4} ; + D_3 = { s = "3" ; size = Num2_4} ; + D_4 = { s = "4" ; size = Num2_4} ; + D_5 = { s = "5" ; size = Num5} ; + D_6 = { s = "6" ; size = Num5} ; + D_7 = { s = "7" ; size = Num5} ; + D_8 = { s = "8" ; size = Num5} ; + D_9 = { s = "9" ; size = Num5} ; + +} diff --git a/src/czech/ParadigmsCze.gf b/src/czech/ParadigmsCze.gf new file mode 100644 index 00000000..2f0a7bb0 --- /dev/null +++ b/src/czech/ParadigmsCze.gf @@ -0,0 +1,141 @@ +resource ParadigmsCze = open CatCze, ResCze, Prelude in { + +---------------- +-- Parameters + +oper + singular : Number + = Sg ; + plural : Number + = Pl ; + + mascAnimate : Gender + = Masc Anim ; + mascInanimate : Gender + = Masc Inanim ; + feminine : Gender + = Fem ; + neuter : Gender + = Neutr ; + + nominative : Case + = Nom ; + genitive : Case + = Gen ; + dative : Case + = Dat ; + accusative : Case + = Acc ; + vocative : Case + = ResCze.Voc ; + locative : Case + = Loc ; + instrumental : Case + = Ins ; + +------------------------------ +-- Nouns + +oper + mkN = overload { + mkN : (nom : Str) -> N + = \nom -> lin N (guessNounForms nom) ; + mkN : (nom,gen : Str) -> Gender -> N + = \nom,gen,g -> lin N (declensionNounForms nom gen g) ; + } ; + +-- The following standard declensions can be used with good accuracy. +-- However, they have some defaults that may have to be overwritten. +-- This can be done easily by overriding those formes with record extension (**). +-- The default extensions are shown in comments; if the default is correct, no extension is needed. + + panN : Str -> N -- default ** {pnom = +i} + = \s -> lin N (declPAN s) ; + predsedaN : Str -> N -- default ** {sgen = +i} + = \s -> lin N (declPREDSEDA s) ; + hradN : Str -> N -- default ** {sgen,sloc = +u} + = \s -> lin N (declHRAD s) ; + zenaN : Str -> N -- default ** {pgen = zen} + = \s -> lin N (declZENA s) ; + mestoN : Str -> N -- default ** {sloc = +u ; pgen = mest ; ploc = +ech} + = \s -> lin N (declMESTO s) ; + muzN : Str -> N + = \s -> lin N (declMUZ s) ; + soudceN : Str -> N -- default ** {sdat,sloc = +i ; pnom = +i} + = \s -> lin N (declSOUDCE s) ; + strojN : Str -> N + = \s -> lin N (declSTROJ s) ; + ruzeN : Str -> N + = \s -> lin N (declRUZE s) ; + pisenN : Str -> N + = \s -> lin N (declPISEN s) ; + kostN : Str -> N + = \s -> lin N (declKOST s) ; + kureN : Str -> N + = \s -> lin N (declKURE s) ; + moreN : Str -> N -- default ** {pgen = +í} + = \s -> lin N (declMORE s) ; + staveniN : Str -> N + = \s -> lin N (declSTAVENI s) ; + +-- The full definition of the noun record is +-- { +-- snom,sgen,sdat,sacc,svoc,sloc,sins, pnom,pgen,pdat,pacc,ploc,pins : Str ; +-- g : Gender +-- } + + +--------------------- +-- Adjectives + +-- Only positive forms so far ---- + + mkA = overload { + mkA : Str -> A + = \s -> lin A (case s of { + _ + "ý" => mladyAdjForms s ; + _ + "í" => jarniAdjForms s ; + _ + "ův" => otcuvAdjForms s ; + _ + "in" => matcinAdjForms s ; + _ => Predef.error ("no mkA for" ++ s) + }) ; + } ; + + mladyA : Str -> A + = \s -> lin A (mladyAdjForms s) ; + jarniA : Str -> A + = \s -> lin A (jarniAdjForms s) ; + otcuvA : Str -> A + = \s -> lin A (otcuvAdjForms s) ; + matcinA : Str -> A + = \s -> lin A (matcinAdjForms s) ; + + mkA2 : A -> Prep -> A2 + = \a,p -> lin A2 (a ** {c = p}) ; + +------------------------- +-- Verbs + + mkV2 = overload { + mkV2 : VerbForms -> VerbForms ** {c : ComplementCase} + = \vf -> vf ** {c = {s = [] ; c = Acc ; hasPrep = False}} ; + mkV2 : VerbForms -> Case -> VerbForms ** {c : ComplementCase} + = \vf,c -> vf ** {c = {s = [] ; c = c ; hasPrep = False}} ; + mkV2 : VerbForms -> ComplementCase -> VerbForms ** {c : ComplementCase} + = \vf,c -> vf ** {c = c} ; + } ; + +------------------------ +-- Adverbs, prepositions, conjunctions, ... + + mkAdv : Str -> Adv + = \s -> lin Adv {s = s} ; + + mkPrep : Str -> Case -> Prep + = \s,c -> lin Prep {s = s ; c = c ; hasPrep = True} ; ---- True if s /= "" + + mkConj : Str -> Conj + = \s -> lin Conj {s1 = [] ; s2 = s} ; + + +} diff --git a/src/czech/PhraseCze.gf b/src/czech/PhraseCze.gf new file mode 100644 index 00000000..cc82fefb --- /dev/null +++ b/src/czech/PhraseCze.gf @@ -0,0 +1,19 @@ +concrete PhraseCze of Phrase = CatCze ** open Prelude, ResCze in { + +lin + UttS s = s ; + UttAdv adv = adv ; + UttCN cn = {s = cn.s ! Sg ! Nom} ; + UttAP ap = {s = ap.s ! Masc Anim ! Sg ! Nom} ; + UttNP np = {s = np.s ! Nom} ; + + PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; + + + NoPConj = {s = []} ; + PConjConj conj = {s = conj.s2} ; + + NoVoc = {s = []} ; + VocNP np = {s = np.s ! Voc} ; + +} diff --git a/src/czech/QuestionCze.gf b/src/czech/QuestionCze.gf new file mode 100644 index 00000000..d5390caa --- /dev/null +++ b/src/czech/QuestionCze.gf @@ -0,0 +1,7 @@ +concrete QuestionCze of Question = CatCze ** + open ResCze, Prelude in { + +lin + QuestCl cl = cl ; ---- + +} diff --git a/src/czech/RelativeCze.gf b/src/czech/RelativeCze.gf new file mode 100644 index 00000000..8726b851 --- /dev/null +++ b/src/czech/RelativeCze.gf @@ -0,0 +1,18 @@ +concrete RelativeCze of Relative = CatCze ** open + ParadigmsCze, + ResCze, + 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/czech/ResCze.gf b/src/czech/ResCze.gf new file mode 100644 index 00000000..f683a2ab --- /dev/null +++ b/src/czech/ResCze.gf @@ -0,0 +1,885 @@ +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 + +param + Number = Sg | Pl ; + + Animacy = Anim | Inanim ; + Gender = Masc Animacy | Fem | Neutr ; + + Case = Nom | Gen | Dat | Acc | Voc | Loc | Ins ; -- traditional order + + Person = P1 | P2 | P3 ; + + Agr = Ag Gender Number Person ; + + CTense = CTPres | CTPast ; ----- TODO complete the tense system to match Czech verb morphology + +-- phonology + +oper + hardConsonant : pattern Str = #("d"|"t"|"g"|"h"|"k"|"n"|"r") ; + softConsonant : pattern Str = #("ť"|"ď"|"j"|"ň"|"ř"|"š"|"c"|"č"|"ž") ; + neutralConsonant : pattern Str = #("b"|"f"|"l"|"m"|"p"|"s"|"v") ; + + consonant : pattern Str = + #( + "d" | "t" | "g" | "h" | "k" | "n" | "r" | + "ť" | "ď" | "j" | "ň" | "ř" | "š" | "c" | "č" | "ž" | + "b" | "f" | "l" | "m" | "p" | "s" | "v" + ) ; + + dropFleetingE : Str -> Str = \s -> case s of { + x + "e" + c@("k"|"c"|"n") => x + c ; + x + "e" + "ň" => x + "n" ; + _ => s + } ; + + shortenVowel : Str -> Str = \s -> case s of { + x + "á" + y => x + "a" + y ; + x + "é" + y => x + "e" + y ; + x + "í" + y => x + "i" + y ; + x + "ý" + y => x + "y" + y ; + x + "ó" + y => x + "o" + y ; + x + "ú" + y => x + "u" + y ; + x + "ů" + y => x + "o" + y ; + _ => s + } ; + + addI : Str -> Str = \s -> case s of { + klu + "k" => klu + "ci" ; + vra + "h" => vra + "zi" ; + ce + "ch" => ce + "ši" ; + dokto + "r" => dokto + "ři" ; + pan => pan + "i" + } ; + + addAdjI : Str -> Str = \s -> case s of { + angli + "ck" => angli + "čtí" ; + ce + "sk" => ce + "ští" ; + _ => init (addI s) + "í" + } ; + + -- 3.4.10, in particular when also final 'a' is dropped + addE : Str -> Str = \s -> case s of { + re + "k" => re + "ce" ; + pra + ("g"|"h") => pra + "ze" ; + stre + "ch" => stre + "še" ; + sest + "r" => sest + "ře" ; + pan => pan + "ě" + } ; + + addEch : Str -> Str = \s -> case s of { + klu + "k" => klu + "cich" ; + vra + ("h"|"g") => vra + "zich" ; + ce + "ch" => ce + "šich" ; + pan => pan + "ech" + } ; + + shortFemPlGen : Str -> Str = \s -> case s of { + ul + "ice" => ul + "ic" ; + koleg + "yně" => koleg + "yň" ; + ruz + "e" => ruz + "í" ; + _ => Predef.error ("shortFemPlGen does not apply to" ++ s) + } ; + +--------------- +-- Nouns +--------------- + +-- novel idea (for RGL): lexical items stored as records rather than tables +-- advantages: +-- - easier to make exceptions to paradigms (by ** {}) +-- - easier to keep the number of forms minimal +-- - easier to see what is happening than with lots of anonymous arguments to mkN, mkA, mkV + +-- so this is the lincat of N + + NounForms : Type = {snom,sgen,sdat,sacc,svoc,sloc,sins, pnom,pgen,pdat,pacc,ploc,pins : Str ; g : Gender} ; + +-- But traditional tables make agreement easier to handle in syntax +-- so this is the lincat of CN + + Noun : Type = {s : Number => Case => Str ; g : Gender} ; + +-- this is used in UseN + + nounFormsNoun : NounForms -> Noun + = \forms -> { + s = table { + Sg => table { + Nom => forms.snom ; + Gen => forms.sgen ; + Dat => forms.sdat ; + Acc => forms.sacc ; + Voc => forms.svoc ; + Loc => forms.sloc ; + Ins => forms.sins + } ; + Pl => table { + Nom | Voc => forms.pnom ; + Gen => forms.pgen ; + Dat => forms.pdat ; + Acc => forms.pacc ; + Loc => forms.ploc ; + Ins => forms.pins + } + } ; + g = forms.g + } ; + +-- terminology of CEG + DeclensionType : Type = Str -> NounForms ; + + declensionNounForms : (nom,gen : Str) -> Gender -> NounForms + = \nom,gen,g -> + let decl : DeclensionType = case of { + => declPAN ; + => declPREDSEDA ; + => declHRAD ; + => declZENA ; + => declMESTO ; + => declMUZ ; + => declMUZ ; + => declSOUDCE ; + => declSTROJ ; + => declRUZE ; + => declPISEN ; + => declKOST ; --- also many other "st" 3.6.3 + => declKURE ; + => declMORE ; + => declSTAVENI ; + _ => Predef.error ("cannot infer declension type for" ++ nom ++ gen) + } + in decl nom ; + +-- the "smartest" one-argument mkN + + guessNounForms : Str -> NounForms + = \s -> case s of { + _ + "ost" => declKOST s ; + _ + "tel" => declMUZ s ; + _ + #hardConsonant => declHRAD s ; + _ + #softConsonant => declSTROJ s ; + _ + "a" => declZENA s ; + _ + "o" => declMESTO s ; + _ + "ce" => declSOUDCE s ; + _ + "e" => declMORE s ; + _ + "í" => declSTAVENI s ; + _ => Predef.error ("cannot guess declension type for" ++ s) + } ; + +-- the traditional declensions, in both CEG and Wiki +-- they are also exported in ParadigmsCze with names panN etc + + declPAN : DeclensionType = \pan -> --- plural nom ové|i|é can be changed with ** {pnom = ...} CEG 3.5.1 + { + snom = pan ; + sgen,sacc = pan + "a" ; + sdat,sloc = pan + "ovi" ; --- pánu + svoc = shortenVowel pan + "e" ; --- "irregular shortening" 3.5.1 + sins = pan + "em" ; + + pnom = addI pan ; -- pani, kluk-kluci --- panové, host-hosté + pgen = pan + "ů" ; + pdat = pan + "ům" ; + pacc,pins = pan + "y" ; + ploc = addEch pan ; + g = Masc Anim + } ; + + declPREDSEDA : DeclensionType = \predseda -> --- 3.5.4: sgen y/i + let predsed = init predseda + in + { + snom = predseda ; + sgen = predsed + "y" ; -- pacc,pins --- i + sdat,sloc = predsed + "ovi" ; + sacc = predsed + "u" ; + svoc = predsed + "o" ; + sins = predsed + "ou" ; + + pnom = case predseda of { + tur + "ista" => tur + "isté" ; + _ => predsed + "ové" + } ; + pgen = predsed + "ů" ; + pdat = predsed + "ům" ; + pacc,pins = predsed + "y" ; + ploc = addEch predsed ; + g = Masc Anim + } ; + + declHRAD : DeclensionType = \hrad -> --- 3.5.2: sloc u/ě/e extra arg, sport-u, hrad-ě ; sgen u/a + let hrd = dropFleetingE hrad + in + { + snom,sacc = hrad ; + sgen,sdat = hrd + "u" ; --- Berlín-a + sloc = hrd + "u" ; --- addE hrad ; -- stůl-stole + svoc = hrd + "e" ; + sins = hrd + "em" ; + + pnom,pacc,pins = hrd + "y" ; + pgen = hrd + "ů" ; + pdat = hrd + "ům" ; + ploc = addEch hrd ; + g = Masc Inanim + } ; + + declZENA : DeclensionType = \zena -> --- 3.6.1 sge y/i ; pgen sometimes shortening + let zen = init zena + in + { + snom = zena ; + sgen = zen + "y" ; --- i after soft cons sometimes + sdat,sloc = zen + "ě" ; --- i after soft cons sometimes ; skol+e + sacc = zen + "u" ; + svoc = shortenVowel zen + "o" ; ---- shorten ? + sins = zen + "ou" ; + + pnom,pacc = zen + "y" ; --- also sgen + pgen = zen ; --- sometimes with vowel shortening + pdat = zen + "ám" ; + ploc = zen + "ách" ; + pins = zen + "ami" ; + g = Fem + } ; + + declMESTO : DeclensionType = \mesto -> --- 3.7.1 sloc u/e ; pgen vowel shortening sometimes ; ploc variations + let mest = init mesto + in + { + snom,sacc,svoc = mesto ; + sgen = mest + "a" ; + sdat = mest + "u" ; + sloc = mest + "u" ; --- "ě" + sins = mest + "em" ; + + pnom,pacc = mest + "a" ; + pgen = mest ; --- léta - let + pdat = mest + "ům" ; + ploc = mest + "ech" ; --- with variations + pins = mest + "y" ; + g = Neutr + } ; + + declMUZ : DeclensionType = \muz_ -> --- 3.5.3 : sdat,sloc ; pnom + let muz = dropFleetingE muz_ + in + { + snom = muz_ ; + sgen,sacc = muz + "e" ; --- pacc + sdat,sloc = muz + "i" ; --- muzovi + svoc = case muz_ of { + chlap + "ec" => chlap + "če" ; + _ => muz + "i" + } ; + sins = muz + "em" ; + + pnom = case muz_ of { + uci + "tel" => uci + "telé" ; + _ => muz + "i" --- muzové + } ; + pgen = muz + "ů" ; + pacc = muz + "e" ; + pdat = muz + "ům" ; + ploc = muz + "ích" ; + pins = muz + "i" ; + g = Masc Anim + } ; + + declSOUDCE : DeclensionType = \soudce -> --- 3.5.3: sdat/sloc i,ovi ; pnom i/ové + let soudc = init soudce + in + { + snom,sgen,sacc,svoc = soudce ; ---- pacc + sdat,sloc = soudc + "i" ; --- soudcovi + sins = soudc + "em" ; + + pnom = soudc + "i" ; --- soudcové + pgen = soudc + "ů" ; + pdat = soudc + "ům" ; + pacc = soudce ; + ploc = soudc + "ích" ; + pins = soudc + "i" ; + g = Masc Anim + } ; + + declSTROJ : DeclensionType = \stroj -> + { + snom,sacc = stroj ; + sgen = stroj + "e" ; --- pnom,pacc + sdat,svoc,sloc = stroj + "i" ; --- pins ---- svoc shorten? + sins = stroj + "em" ; + + pnom,pacc = stroj + "e" ; + pgen = stroj + "ů" ; + pdat = stroj + "ům" ; + ploc = stroj + "ích" ; + pins = stroj + "i" ; + g = Masc Inanim + } ; + + declRUZE : DeclensionType = \ruze -> --- 3.6.2: pgen ulice-ulic, chvile-cvil + let ruz = init ruze + in + { + snom,sgen,svoc = ruze ; --- pnom,pacc + sdat,sacc,sloc = ruz + "i" ; + sins = ruz + "í" ; + + pnom,pacc = ruze ; + pgen = shortFemPlGen ruze ; + pdat = ruz + "ím" ; + ploc = ruz + "ích" ; + pins = ruz + "emi" ; + g = Fem + } ; + + declPISEN : DeclensionType = \pisen -> + let pisn = dropFleetingE pisen + in + { + snom,sacc = pisen ; + sgen = pisn + "ě" ; + sdat,svoc,sloc = pisn + "i" ; -- not shortened + sins = pisn + "í" ; + + pnom,pacc = pisn + "ě" ; + pgen = pisn + "í" ; + pdat = pisn + "ím" ; + ploc = pisn + "ích" ; + pins = pisn + "ěmi" ; + g = Fem + } ; + + declKOST : DeclensionType = \kost -> + { + snom,sacc = kost ; + sgen,sdat,svoc,sloc = kost + "i" ; --- pnom,pacc + sins = kost + "í" ; --- pgen + + pnom,pacc = kost + "i" ; + pgen = kost + "í" ; + pdat = kost + "em" ; + ploc = kost + "ech" ; + pins = kost + "mi" ; + g = Fem + } ; + + declKURE : DeclensionType = \kure -> + let kur = init kure + in + { + snom,sacc,svoc = kure ; + sgen = kur + "ete" ; + sdat,sloc = kur + "eti" ; + sins = kur + "etem" ; + + pnom,pacc = kur + "ata" ; + pgen = kur + "at" ; + pdat = kur + "atům" ; + ploc = kur + "atech" ; + pins = kur + "aty" ; + g = Neutr + } ; + + declMORE : DeclensionType = \more -> --- 3.7.2 pgen zero sometimes + let mor = init more + in + { + snom,sgen,sacc,svoc = more ; --- pnom + sdat,sloc = mor + "i" ; --- pins + sins = mor + "em" ; + + pnom,pacc = more ; + pgen = mor + "í" ; --- + pdat = mor + "ím" ; + ploc = mor + "ích" ; + pins = mor + "i" ; + g = Neutr + } ; + + declSTAVENI : DeclensionType = \staveni -> + { + snom,sgen,sdat,sacc,svoc,sloc = staveni ; + sins = staveni + "m" ; + + pnom,pgen,pacc = staveni ; + pdat = staveni + "m" ; + ploc = staveni + "ch" ; + pins = staveni + "mi" ; + g = Neutr + } ; + +--------------------------- +-- Adjectives + +-- to be used for AP: 56 forms for each degree + Adjective : Type = {s : Gender => Number => Case => Str} ; + +-- to be used for A, in three degrees: 15 forms in each +---- TODO other degrees than positive + + AdjForms : Type = { + msnom, fsnom, nsnom : Str ; -- svoc = snom + msgen, fsgen : Str ; -- nsgen = msgen, pacc = fsgen + msdat, fsdat : Str ; -- nsdat = msdat + fsacc : Str ; -- amsacc = msgen, imsacc = msnom, nsacc = nsnom + msloc : Str ; -- fsloc = fsdat, nsloc = msloc + msins, fsins : Str ; -- nsins = msins, pdat = msins + + mpnom,fpnom : Str ; -- pvoc = pnom, impnom = fpnom, npnom = fsnom + pgen : Str ; -- ploc = pgen + pins : Str ; + } ; + +-- used in PositA but will also work in Compar and Superl by calling their record fields + +adjFormsAdjective : AdjForms -> Adjective = \afs -> { + s = \\g,n,c => case of { + + + | => afs.msnom ; + + | => afs.fsnom ; + => afs.nsnom ; + + + | => afs.msgen ; + + | => afs.fsgen ; + + => afs.msdat ; + => afs.fsdat ; + + => afs.fsacc ; + + => afs.msloc ; + + + | => afs.msins ; + => afs.fsins ; + + => afs.mpnom ; + => afs.fpnom ; + + => afs.pgen ; + => afs.pins + } + + } ; + +-- hard declension + + mladyAdjForms : Str -> AdjForms = \mlady -> + let mlad = init mlady + in { + msnom = mlad + "ý" ; + fsnom = mlad + "á" ; + nsnom,fsgen,fsdat,fpnom = mlad + "é" ; + msgen = mlad + "ého" ; + msdat = mlad + "ému" ; + fsacc,fsins = mlad + "ou" ; + msloc = mlad + "ém" ; + msins,pdat = mlad + "ým" ; + mpnom = addAdjI mlad ; + pgen = mlad + "ých" ; + pins = mlad + "ými" ; + } ; + +-- soft declension + + jarniAdjForms : Str -> AdjForms = \jarni -> + { + msnom,fsnom,nsnom, + fsgen,fsdat,fsacc,fsins, + mpnom,fpnom = jarni ; + msgen = jarni + "ho" ; + msdat = jarni + "mu" ; + msloc,msins = jarni + "m" ; + pgen = jarni + "ch" ; + pins = jarni + "mi" ; + } ; + +-- masculine possession: the same endings as in feminine + + otcuvAdjForms : Str -> AdjForms = \otcuv -> + let otcov = Predef.tk 2 otcuv + "ov" + in + matcinAdjForms otcov ** {msnom = otcuv} ; + +-- feminine possession + + matcinAdjForms : Str -> AdjForms = \matcin -> + { + msnom = matcin ; + fsnom,msgen = matcin + "a" ; + nsnom = matcin + "o" ; + fsgen,fpnom = matcin + "y" ; + msdat,fsacc = matcin + "u" ; + fsdat,msloc = matcin + "ě" ; + msins = matcin + "ým" ; + fsins = matcin + "ou" ; + mpnom = matcin + "i" ; + pgen = matcin + "ých" ; + pins = matcin + "ými" ; + } ; + +--------------------- +-- Verbs + + VerbForms : Type = { ---- TODO more forms to add + inf, + pressg1, pressg2, pressg3, + prespl1, prespl2, prespl3, + pastpartsg, pastpartpl, +---- passpart, + negpressg3 : Str -- matters only for copula + } ; + + ComplementCase : Type = {s : Str ; c : Case ; hasPrep : Bool} ; + + verbAgr : VerbForms -> Agr -> Bool -> Str ---- TODO tenses + = \vf,a,b -> case a of { + Ag _ Sg P1 => vf.pressg1 ; + Ag _ Sg P2 => vf.pressg2 ; + Ag _ Sg P3 => case b of { + True => vf.pressg3 ; + False => vf.negpressg3 -- matters only for copula + } ; + Ag _ Pl P1 => vf.prespl1 ; + Ag _ Pl P2 => vf.prespl2 ; + Ag _ Pl P3 => vf.prespl3 + } ; + + copulaVerbForms : VerbForms = { + inf = "být" ; + pressg1 = "jsem" ; + pressg2 = "jsi" ; + pressg3 = "je" ; + prespl1 = "jsme" ; + prespl2 = "jste" ; + prespl3 = "jsou" ; + pastpartsg = "byl" ; + pastpartpl = "byli" ; + negpressg3 = "ní" ; -- ne is added to this + } ; + + haveVerbForms : VerbForms = { + inf = "mít" ; + pressg1 = "mám" ; + pressg2 = "máš" ; + pressg3, negpressg3 = "má" ; + prespl1 = "máme" ; + prespl2 = "máte" ; + prespl3 = "mají" ; + pastpartsg = "měl" ; + pastpartpl = "měli" ; + } ; + +-- just an example of a traditional paradigm +---- TODO other traditional paradigms + + iii_kupovatVerbForms : Str -> VerbForms = \kupovat -> + let + kupo = Predef.tk 3 kupovat ; + kupu = Predef.tk 1 kupo + "u" + in + { + inf = kupovat ; + pressg1 = kupu + "ji" ; --- kupuju + pressg2 = kupu + "ješ" ; + pressg3, negpressg3 = kupu + "je" ; + prespl1 = kupu + "jeme" ; + prespl2 = kupu + "jete" ; + prespl3 = kupu + "jí" ; --- kupujou + pastpartsg = kupo + "val" ; + pastpartpl = kupo + "vali" ; + } ; + + +--------------------------- +-- Pronouns + + PronForms : Type = { + nom, cnom, -- cnom is the pro-drop subject + gen, cgen,pgen, -- bare, clitic, prepositional + acc, cacc,pacc, + dat, cdat,pdat, + loc, + ins,pins : Str ; + a : Agr + } ; + +---- TODO: possessives + + personalPron : Agr -> PronForms = \a -> + {a = a ; cnom = []} ** + case a of { + Ag _ Sg P1 => { + nom = "já" ; + gen,acc,pgen,pacc = "mne" ; + cgen,cacc = "mě" ; + dat,pdat,loc = "mně" ; + cdat = "mi" ; + ins,pins = "mnou" + } ; + Ag _ Sg P2 => { + nom = "ty" ; + gen,acc,pgen,pacc = "tebe" ; + cgen,cacc = "tě" ; + dat,pdat,loc = "tobě" ; + cdat = "ti" ; + ins,pins = "tebou" + } ; + Ag (Masc _) Sg P3 => { + nom = "on" ; + gen,acc = "jeho" ; + cgen,cacc = "ho" ; + pgen,pacc = "něho" ; + dat = "jemu" ; + cdat = "mu" ; + pdat = "němu" ; + loc = "něm" ; + ins = "jím" ; + pins = "ním" ; + } ; + Ag Fem Sg P3 => { + nom = "ona" ; + gen = "její" ; + dat,acc,cgen,cacc,cdat,ins = "ji" ; + pgen,pdat,pacc,loc,pins = "ní" ; + } ; + Ag Neutr Sg P3 => { + nom = "ono" ; + gen = "jeho" ; + cgen,cacc = "ho" ; + pgen = "něho" ; + dat = "jemu" ; + acc = "je" ; + pacc = "ně" ; + cdat = "mu" ; + pdat = "němu" ; + loc = "něm" ; + ins = "jím" ; + pins = "ním" ; + } ; + Ag _ Pl P1 => { + nom = "my" ; + gen,acc, + cgen,cacc, + pgen,pacc, + loc = "nás" ; + dat,cdat,pdat = "nám" ; + ins,pins = "námi" ; + } ; + Ag _ Pl P2 => { + nom = "vy" ; + gen,acc, + cgen,cacc, + pgen,pacc, + loc = "vás" ; + dat,cdat,pdat = "vám" ; + ins,pins = "vámi" ; + } ; + Ag g Pl P3 => { + nom = case g of { + Masc _ => "oni" ; + Fem => "ony" ; + Neutr => "ona" + } ; + gen,cgen = "jich" ; + pgen = "nich" ; + dat,cdat = "jim" ; + pdat = "nim" ; + acc,cacc = "je" ; + pacc = "ně" ; + loc = "nich" ; + ins = "jimi" ; + pins = "nimi" ; + } + + } ; + +-------------------------------- +-- demonstrative pronouns, used for Quant and Det + +oper + DemPronForms : Type = { + msnom, fsnom, nsnom, + msgen, fsgen, + msdat, -- fsdat = fsgen unlike AdjForms + fsacc, + msloc, + msins, fsins, + mpnom, fpnom, -- mpacc = fpacc = fpnom + pgen, + pdat, -- NOT msins like AdjForms + pins : Str + } ; + + demPronFormsAdjective : DemPronForms -> Str -> Adjective = + \dem,s -> + let + demAdj = dem ** {fsdat = dem.fsgen} ; + adjAdj = adjFormsAdjective demAdj + in { + s = \\g,n,c => case of { + <_,Pl,Dat> => dem.pdat ; + => dem.fpnom ; + _ => adjAdj.s ! g ! n ! c + } + s + } ; + + Determiner : Type = { + s : Gender => Case => Str ; + size : NumSize + } ; + + mkDemPronForms : Str -> DemPronForms = \t -> { + msnom = t + "en" ; + fsnom = t + "a" ; + nsnom = t + "o" ; + msgen = t + "oho" ; + fsgen = t + "é" ; + msdat = t + "omu" ; + fsacc = t + "u" ; + msloc = t + "om" ; + msins = t + "ím" ; + fsins = t + "ou" ; + mpnom = t + "i" ; + fpnom = t + "y" ; + pgen = t + "ěch" ; + pdat = t + "ěm" ; + pins = t + "ěmi" ; + } ; + + invarDemPronForms : Str -> DemPronForms = \s -> { + msnom, fsnom, nsnom, msgen, fsgen, + msdat, fsacc, msloc, msins, fsins, + mpnom, fpnom, pgen, pdat, pins = s ; + } ; + +-- interrogatives + + kdoForms : Case => Str = table { + Nom => "kdo" ; + Gen | Acc | Voc => "koho" ; + Dat => "komu" ; + Loc => "kom" ; + Ins => "kým" + } ; + + coForms : Case => Str = table { + Nom|Acc|Voc => "co" ; + Gen => "čeho" ; + Dat => "čemu" ; + Loc => "čem" ; + Ins => "čím" + } ; + +-- Numerals + + -- singular forms of demonstratives + NumeralForms : Type = { + msnom, fsnom, nsnom, + msgen, fsgen, + msdat, + fsacc, + msloc, + msins, fsins : Str + } ; + + numeralFormsDeterminer : NumeralForms -> NumSize -> Determiner = + \nume,size -> + let + dem = nume ** + {mpnom, fpnom, pgen, pdat, pins = nume.msnom} ; --- plural forms not used + demAdj = dem ** {fsdat = dem.fsgen} ; + adjAdj = adjFormsAdjective demAdj + in { + s = \\g,c => adjAdj.s ! g ! Sg ! c ; + size = size + } ; + + -- example: number 1 + oneNumeral : Determiner = numeralFormsDeterminer ((mkDemPronForms "jedn") ** {msnom = "jeden"}) Num1 ; + + -- numbers 2,3,4 ---- to check if everything comes out right with the determiner type + twoNumeral : Determiner = + let forms = { + msnom = "dva" ; fsnom, nsnom, fsacc = "dvě" ; + msgen, fsgen, msloc = "dvou" ; + msdat, msins, fsins = "dvěma" + } + in numeralFormsDeterminer forms Num2_4 ; + + threeNumeral : Determiner = + let forms = { + msnom, fsnom, nsnom, fsacc, msgen, fsgen = "tři" ; + msdat = "třem" ; + msloc = "třech" ; + msins,fsins = "třemi" ; + } + in numeralFormsDeterminer forms Num2_4 ; + + fourNumeral : Determiner = + let forms = { + msnom, fsnom, nsnom, fsacc = "čtyři" ; + msgen, fsgen = "čtyř" ; + msdat = "čtyřem" ; + msloc = "čtyřech" ; + msins,fsins = "čtyřmi" ; + } + in numeralFormsDeterminer forms Num2_4 ; + + -- for the numbers 5 upwards + regNumeral : Str -> Str -> Determiner = \pet,peti -> + let forms = { + msnom,fsnom,nsnom = pet ; + msgen, fsgen, msdat, fsacc, msloc, msins, fsins = peti + } + in numeralFormsDeterminer forms Num5 ; + + invarDeterminer : Str -> NumSize -> Determiner = \sto,size -> + regNumeral sto sto ; + + invarNumeral : Str -> Determiner = \s -> invarDeterminer s Num5 ; + +-------------------------------- +-- combining nouns with numerals + +param + NumSize = Num1 | Num2_4 | Num5 ; -- CEG 6.1 + +oper + numSizeForm : (Number => Case => Str) -> NumSize -> Case -> Str + = \cns,n,c -> case n of { + Num1 => cns ! Sg ! c ; + Num2_4 => cns ! Pl ! c ; + Num5 => case c of { + Nom | Acc => cns ! Pl ! Gen ; + _ => cns ! Pl ! c + } + } ; + + numSizeAgr : Gender -> NumSize -> Person -> Agr + = \g,ns,p -> case ns of { + Num5 => Ag Neutr Sg p ; -- essential grammar 6.1.4 + Num2_4 => Ag g Pl p ; + Num1 => Ag g Sg p + } ; + + numSizeNumber : NumSize -> Number = \ns -> case ns of { + Num1 => Sg ; + _ => Pl ---- TO CHECK + } ; +} diff --git a/src/czech/SentenceCze.gf b/src/czech/SentenceCze.gf new file mode 100644 index 00000000..2793ec35 --- /dev/null +++ b/src/czech/SentenceCze.gf @@ -0,0 +1,32 @@ +concrete SentenceCze of Sentence = CatCze ** + open Prelude, ResCze 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/czech/StructuralCze.gf b/src/czech/StructuralCze.gf new file mode 100644 index 00000000..347e7480 --- /dev/null +++ b/src/czech/StructuralCze.gf @@ -0,0 +1,27 @@ +concrete StructuralCze of Structural = CatCze ** + open ParadigmsCze, ResCze, Prelude in { + +lin + and_Conj = mkConj "a" ; + by8agent_Prep = mkPrep "od" Gen ; ---- TODO this means "from", there might be no good translation + few_Det = invarNumeral "málo" ; -- CEG 6.8 --- TODO genitive mála + for_Prep = mkPrep "pro" accusative ; + from_Prep = mkPrep (pre {"s"|"z" => "ze" ; _ => "z"}) Gen ; ---- consonant clusters + have_V2 = mkV2 haveVerbForms ; + in_Prep = mkPrep (pre {"v"|"m" => "ve" ; _ => "v"}) Loc ; ---- + many_Det = regNumeral "mnoho" "mnoha" ; -- CEG 6.8 ---- + or_Conj = mkConj "nebo" ; + somePl_Det = regNumeral "několik" "několika" ; -- CEG 6.8 ---- + something_NP = {s,clit,prep = \\c => "ně" + coForms ! c ; a = Ag Neutr Sg P3 ; hasClit = False} ; -- CEG 5.6.3 + possess_Prep = mkPrep "" Gen ; + that_Quant = demPronFormsAdjective (mkDemPronForms "tamt") "" ; + this_Quant = demPronFormsAdjective (mkDemPronForms "t") "to" ; + to_Prep = mkPrep "do" Gen ; + with_Prep = mkPrep (pre {"s"|"z" => "se" ; _ => "s"}) Ins ; ---- + + i_Pron = personalPron (Ag (Masc Anim) Sg P1) ; + youSg_Pron = personalPron (Ag (Masc Anim) Sg P2) ; + he_Pron = personalPron (Ag (Masc Anim) Sg P3) ; + she_Pron = personalPron (Ag Fem Sg P3) ; + +} diff --git a/src/czech/SymbolCze.gf b/src/czech/SymbolCze.gf new file mode 100644 index 00000000..7cef10b4 --- /dev/null +++ b/src/czech/SymbolCze.gf @@ -0,0 +1,11 @@ +--# -path=.:../abstract:../common:../prelude + +concrete SymbolCze of Symbol = CatCze ** open Prelude, ResCze in { + +lincat + Symb = {s : Str} ; +lin + MkSymb s = s ; + SymbPN s = lin PN {s = \\_ => s.s ; g = Neutr} ; + +} diff --git a/src/czech/TenseCze.gf b/src/czech/TenseCze.gf new file mode 100644 index 00000000..667cc1f2 --- /dev/null +++ b/src/czech/TenseCze.gf @@ -0,0 +1,20 @@ +concrete TenseCze of Tense = + CatCze ** + open + ResCze, + 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} ; ---- + +} \ No newline at end of file diff --git a/src/czech/TextCze.gf b/src/czech/TextCze.gf new file mode 100644 index 00000000..477b4371 --- /dev/null +++ b/src/czech/TextCze.gf @@ -0,0 +1,8 @@ +concrete TextCze of Text = CatCze ** open ResCze 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/czech/VerbCze.gf b/src/czech/VerbCze.gf new file mode 100644 index 00000000..e80c25c7 --- /dev/null +++ b/src/czech/VerbCze.gf @@ -0,0 +1,48 @@ +concrete VerbCze of Verb = CatCze ** open ResCze, 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 + } ; + +} diff --git a/src/german/MorphoGer.gf b/src/german/MorphoGer.gf index a2eeea1c..f7b6a75f 100644 --- a/src/german/MorphoGer.gf +++ b/src/german/MorphoGer.gf @@ -32,6 +32,10 @@ oper {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> {s,sp = appAdj (regA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; + detUnlikeAdj : Bool -> Number -> Str -> + {s,sp : Gender => PCase => Str ; n : Number ; a : Adjf ; isDef : Bool} = \isDef,n,dies -> + {s,sp = appAdj (regDetA dies) ! n ; n = n ; a = Weak ; isDef = isDef} ; + mkOrd : {s : Degree => AForm => Str} -> {s : AForm => Str} = \a -> {s = a.s ! Posit} ; diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index a7fa5068..8d82510b 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -157,7 +157,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { sp = table { True => \\_,_,c => usePrepC c (\k -> []) ; False => table { - Sg => \\g,c => usePrepC c (\k -> (detLikeAdj False Sg "ein").s ! g ! NPC k) ; + Sg => \\g,c => usePrepC c (\k -> (detUnlikeAdj False Sg "ein").s ! g ! NPC k) ; Pl => \\_,c => usePrepC c (\k -> caselist "einige" "einige" "einigen" "einiger" ! k) } } ; diff --git a/src/german/ResGer.gf b/src/german/ResGer.gf index 52a20c69..9e567005 100644 --- a/src/german/ResGer.gf +++ b/src/german/ResGer.gf @@ -399,6 +399,17 @@ resource ResGer = ParamX ** open Prelude in { in mkA blau blau (blau + "er") blauest ; + regDetA : Str -> Adjective = \blau -> + let + rblau = regA blau ; + dblau = adjFormsDet blau blau + in { + s = table { + Posit => dblau ; + d => rblau.s ! d + } + } ; + regV : Str -> Verb = \legen -> let lege = init legen ; @@ -503,15 +514,24 @@ resource ResGer = ParamX ** open Prelude in { table { APred => teuer ; AMod (GSg Masc) c => - caselist (teur+"er") (teur+"en") (teur+"em") (teur+"es") ! c ; + caselist (teur+"er") (teur+"en") (teur+"em") (teur+"en") ! c ; AMod (GSg Fem) c => caselist (teur+"e") (teur+"e") (teur+"er") (teur+"er") ! c ; - AMod (GSg Neut) c => - caselist (teur+"es") (teur+"es") (teur+"em") (teur+"es") ! c ; + AMod (GSg Neutr) c => + caselist (teur+"es") (teur+"es") (teur+"em") (teur+"en") ! c ; AMod GPl c => caselist (teur+"e") (teur+"e") (teur+"en") (teur+"er") ! c } ; + -- for some determiners, Gen form -es rather than -en + adjFormsDet : (x1,x2 : Str) -> AForm => Str = \teuer,teur -> + let adj = adjForms teuer teur + in + table { + AMod (GSg Masc| GSg Neutr) Gen => teur + "es" ; + a => adj ! a + } ; + -------------------------------------------- --VP CONSTRUCTION -------------------------------------------- diff --git a/src/german/StructuralGer.gf b/src/german/StructuralGer.gf index d4f92ba8..c7c30dce 100644 --- a/src/german/StructuralGer.gf +++ b/src/german/StructuralGer.gf @@ -32,7 +32,7 @@ concrete StructuralGer of Structural = CatGer ** during_Prep = mkPrep "während" P.genitive | P.mkPrep P.accusative "über" ; either7or_DConj = sd2 "entweder" "oder" ** {n = Sg} ; everybody_NP = nameNounPhrase {s = caselist "jeder" "jeden" "jedem" "jedes"} ; - every_Det = detLikeAdj False Sg "jed" ; + every_Det = detUnlikeAdj False Sg "jed" ; everything_NP = nameNounPhrase {s = caselist "alles" "alles" "allem" "alles"} ; everywhere_Adv = ss "überall" ; few_Det = detLikeAdj False Pl "wenig" ; @@ -45,7 +45,7 @@ concrete StructuralGer of Structural = CatGer ** here_Adv = ss "hier" ; how_IAdv = ss "wie" ; how8much_IAdv = ss "wieviel" ; - how8many_IDet = {s = \\g,c => (detLikeAdj False Pl "wie viel").s ! g ! NPC c ; n = Pl} ; + how8many_IDet = {s = \\g,c => (detUnlikeAdj False Pl "wie viel").s ! g ! NPC c ; n = Pl} ; if_Subj = ss "wenn" | ss "falls" ; in8front_Prep = mkPrep "vor" P.dative ; i_Pron = mkPronPers "ich" "mich" "mir" "meiner" "mein" Masc Sg P1 ; @@ -88,7 +88,7 @@ concrete StructuralGer of Structural = CatGer ** something_NP = nameNounPhrase {s = \\_ => "etwas"} ; somewhere_Adv = ss "irgendwo" ; that_Quant = let - jener : Number => Gender => PCase => Str = \\n => (detLikeAdj True n "jen").s in + jener : Number => Gender => PCase => Str = \\n => (detUnlikeAdj True n "jen").s in {s,sp = \\_ => jener ; a,aPl = Weak} ; ---b that_NP = nameNounPhrase {s = caselist "das" "das" "denem" "dessen"} ; ---- there_Adv = ss "da" | ss "dort" ; @@ -98,7 +98,7 @@ concrete StructuralGer of Structural = CatGer ** ---b these_NP = {s = caselist "diese" "diese" "diesen" "dieser" ; a = agrP3 Pl} ; they_Pron = mkPronPers "sie" "sie" "ihnen" "ihrer" "ihr" Fem Pl P3 ; this_Quant = let - dieser : Number => Gender => PCase => Str = \\n => (detLikeAdj True n "dies").s in + dieser : Number => Gender => PCase => Str = \\n => (detUnlikeAdj True n "dies").s in {s,sp = \\_ => dieser ; a,aPl = Weak} ; ---b this_NP = nameNounPhrase {s = caselist "dies" "dies" "diesem" "dieses"} ; ---- ---b those_NP = {s = caselist "jene" "jene" "jenen" "jener" ; a = agrP3 Pl} ; @@ -121,7 +121,7 @@ concrete StructuralGer of Structural = CatGer ** when_IAdv = ss "wann" ; when_Subj = ss "wenn" ; where_IAdv = ss "wo" ; - which_IQuant = {s = \\n,g,c => (detLikeAdj True n "welch").s ! g ! NPC c} ; + which_IQuant = {s = \\n,g,c => (detUnlikeAdj True n "welch").s ! g ! NPC c} ; whoSg_IP = {s = caselist "wer" "wen" "wem" "wessen" ; n = Sg} ; whoPl_IP = {s = caselist "wer" "wen" "wem" "wessen" ; n = Sg} ; -- HL 6/2016 @@ -137,7 +137,7 @@ concrete StructuralGer of Structural = CatGer ** no_Quant = let keiner : Number => Gender => PCase => Str = table { Sg => \\g,c => usePrepC c (\k -> "kein" + pronEnding ! GSg g ! k) ; - Pl => (detLikeAdj False Pl "kein").s + Pl => (detUnlikeAdj False Pl "kein").s } in {s,sp = \\_ => keiner ; a = Strong ; aPl = Weak} ; ---- sp diff --git a/src/japanese/ResJpn.gf b/src/japanese/ResJpn.gf index aac90e1a..70044fb9 100644 --- a/src/japanese/ResJpn.gf +++ b/src/japanese/ResJpn.gf @@ -23,40 +23,40 @@ param oper - NP : Type = {s : Style => Str ; prepositive : Style => Str ; needPart : Bool ; + NP : Type = {s : Style => Str ; prepositive : Style => Str ; needPart : Bool ; changePolar : Bool ; meaning : Speaker ; anim : Animateness} ; - VP : Type = {verb : Speaker => Animateness => Style => TTense => Polarity => Str ; - a_stem, i_stem : Speaker => Animateness => Style => Str ; + VP : Type = {verb : Speaker => Animateness => Style => TTense => Polarity => Str ; + a_stem, i_stem : Speaker => Animateness => Style => Str ; te, ba : Speaker => Animateness => Style => Polarity => Str ; prep : Str ; obj : Style => Str ; prepositive : Style => Str ; needSubject : Bool} ; - - Noun : Type = {s : Number => Style => Str ; anim : Animateness ; + + Noun : Type = {s : Number => Style => Str ; anim : Animateness ; counter : Str ; counterReplace : Bool ; counterTsu : Bool} ; PropNoun : Type = {s : Style => Str ; anim : Animateness} ; Adj : Type = {pred : Style => TTense => Polarity => Str ; attr, dropNaEnging : Str ; - te, ba, adv : Polarity => Str} ; - Adj2 : Type = {pred : Style => TTense => Polarity => Str ; attr, dropNaEnging, - prep : Str ; te, ba, adv : Polarity => Str} ; + te, ba, adv : Polarity => Str} ; + Adj2 : Type = {pred : Style => TTense => Polarity => Str ; attr, dropNaEnging, + prep : Str ; te, ba, adv : Polarity => Str} ; Adverb : Type = {s : Style => Str ; prepositive : Bool} ; Pronoun : Type = {s : Style => Str ; Pron1Sg : Bool ; anim : Animateness} ; - Determiner : Type = {quant : Style => Str ; postpositive : Str ; num : Str ; n : Number ; + Determiner : Type = {quant : Style => Str ; postpositive : Str ; num : Str ; n : Number ; inclCard : Bool ; sp : Style => Str ; no : Bool ; tenPlus : Bool} ; - Num : Type = {s : Str ; postpositive : Str ; n : Number ; inclCard : Bool ; + Num : Type = {s : Str ; postpositive : Str ; n : Number ; inclCard : Bool ; tenPlus : Bool} ; Preposition : Type = {s : Str ; null : Str} ; - Verb : Type = {s : Style => TTense => Polarity => Str ; a_stem, i_stem : Str ; + Verb : Type = {s : Style => TTense => Polarity => Str ; a_stem, i_stem : Str ; te, ba : Polarity => Str ; needSubject : Bool} ; - Verb2 : Type = {s, pass : Style => TTense => Polarity => Str ; a_stem, i_stem, pass_a_stem, + Verb2 : Type = {s, pass : Style => TTense => Polarity => Str ; a_stem, i_stem, pass_a_stem, pass_i_stem, prep : Str ; te, ba, pass_te, pass_ba : Polarity => Str} ; - Verb3 : Type = {s : Speaker => Style => TTense => Polarity => Str ; a_stem, i_stem : + Verb3 : Type = {s : Speaker => Style => TTense => Polarity => Str ; a_stem, i_stem : Speaker => Str ; te, ba : Speaker => Polarity => Str ; prep1, prep2 : Str} ; - VV : Type = {s : Speaker => Style => TTense => Polarity => Str ; a_stem, i_stem : + VV : Type = {s : Speaker => Style => TTense => Polarity => Str ; a_stem, i_stem : Speaker => Str ; te, ba : Speaker => Polarity => Str ; sense : ModSense} ; Conjunction : Type = {s : Str ; null : Str ; type : ConjType} ; Subjunction : Type = {s : Str ; type : SubjType} ; - - mkNoun : Str -> Str -> Str -> Str -> Animateness -> Str -> Bool -> Bool -> Noun = + + mkNoun : Str -> Str -> Str -> Str -> Animateness -> Str -> Bool -> Bool -> Noun = \man1,man2,man3,man4,a,c,b1,b2 -> { s = table { Sg => table { @@ -73,24 +73,24 @@ oper counterReplace = b1 ; counterTsu = b2 } ; - - regNoun : Str -> Animateness -> Str -> Bool -> Bool -> Noun = \s,a,c,b1,b2 -> + + regNoun : Str -> Animateness -> Str -> Bool -> Bool -> Noun = \s,a,c,b1,b2 -> mkNoun s s s s a c b1 b2 ; - + styleNoun : Str -> Str -> Animateness -> Str -> Bool -> Bool -> Noun = \kane,okane,a,c,b1,b2 -> mkNoun kane okane kane okane a c b1 b2 ; - - numberNoun : Str -> Animateness -> Str -> Bool -> Str -> Bool -> Noun = \n,a,c,b1,pl,b2 -> + + numberNoun : Str -> Animateness -> Str -> Bool -> Str -> Bool -> Noun = \n,a,c,b1,pl,b2 -> mkNoun n n pl pl a c b1 b2 ; - + regAdj : Str -> Adj = \a -> case a of { chiisa + "い" => i_mkAdj a ; _ => na_mkAdj a -- ooki + ("な"|"の") => na_mkAdj a } ; - i_mkAdj : Str -> Adj = \chiisai -> + i_mkAdj : Str -> Adj = \chiisai -> let - chiisa = init chiisai ; + chiisa = init chiisai ; in { pred = table { Resp => table { @@ -110,43 +110,43 @@ oper } ; TPast => table { Pos => chiisa + "かった" ; - Neg => chiisa + "くなかった" + Neg => chiisa + "くなかった" } } } ; attr = chiisai ; - te = table { + te = table { Pos => chiisa + "くて" ; - Neg => chiisa + "くなくて" + Neg => chiisa + "くなくて" } ; - ba = table { - Pos => chiisa + "ければ" ; - Neg => chiisa + "くなければ" + ba = table { + Pos => chiisa + "ければ" ; + Neg => chiisa + "くなければ" } ; - adv = table { + adv = table { Pos => chiisa + "く" ; Neg => chiisa + "くなく" } ; dropNaEnging = chiisai - } ; - - na_mkAdj : Str -> Adj = \ookina -> + } ; + + na_mkAdj : Str -> Adj = \ookina -> let - ooki = init ookina + ooki = init ookina in { pred = \\st,t,p => ooki ++ mkCopula.s ! st ! t ! p ; attr = ookina ; - te = table { + te = table { Pos => ooki + "で" ; Neg => ooki + "ではなくて" } ; ba = \\p => ooki ++ mkCopula.ba ! p ; - adv = table { + adv = table { Pos => ooki + "に" ; - Neg => ooki + "ではなく" + Neg => ooki + "ではなく" } ; dropNaEnging = ooki - } ; + } ; -- Added by IL 2017-07. Used in NounJpn and SymbolJpn. mkOrd : SS -> Adj = \symb -> { @@ -158,23 +158,23 @@ oper dropNaEnging = symb.s ++ "番目の" } ; - VerbalA : Str -> Str -> Adj = \kekkonshiteiru,kikonno -> + VerbalA : Str -> Str -> Adj = \kekkonshiteiru,kikonno -> let - kekkonshite = Predef.tk 2 kekkonshiteiru + kekkonshite = Predef.tk 2 kekkonshiteiru in { - pred = \\st,t,p => kekkonshite ++ mkExistV.verb ! SomeoneElse ! Anim ! st ! t ! p ; + pred = \\st,t,p => kekkonshite + mkExistV.verb ! SomeoneElse ! Anim ! st ! t ! p ; attr = kikonno ; te = \\p => kekkonshite ++ mkExistV.te ! SomeoneElse ! Anim ! Resp ! p ; ba = \\p => kekkonshite ++ mkExistV.ba ! SomeoneElse ! Anim ! Resp ! p ; - adv = table { + adv = table { Pos => init kikonno + "で" ; Neg => init kikonno + "ではなく" } ; dropNaEnging = init kikonno - } ; - - mkVerb : Str -> VerbGroup -> Verb = - \yomu,gr -> + } ; + + mkVerb : Str -> VerbGroup -> Verb = + \yomu,gr -> let yoma = mk_a_stem yomu gr ; yomi = mk_i_stem yomu gr ; @@ -207,7 +207,7 @@ oper yon + "だ" => yon + "で" ; yon + "た" => yon + "て" } ; - Neg => yoma + "ないで" + Neg => yoma + "ないで" } ; a_stem = yoma ; i_stem = yomi ; @@ -217,9 +217,9 @@ oper } ; needSubject = True } ; - - mkVerb2 : Str -> Str -> VerbGroup -> Verb2 = - \yomu,p,gr -> + + mkVerb2 : Str -> Str -> VerbGroup -> Verb2 = + \yomu,p,gr -> let yoma = mk_a_stem yomu gr ; in { @@ -256,7 +256,7 @@ oper Gr1 => yoma + "れませんでした" ; Gr2 => yoma + "られませんでした" ; Suru => Predef.tk 2 yomu + "されませんでした" ; - Kuru => "来られませんでした" + Kuru => "来られませんでした" } } } ; @@ -303,7 +303,7 @@ oper Gr2 => yoma + "られないで" ; Suru => Predef.tk 2 yomu + "されないで" ; Kuru => "来られないで" - } + } } ; pass_a_stem = case gr of { Gr1 => yoma + "れ" ; @@ -329,12 +329,12 @@ oper Gr2 => yoma + "られなければ" ; Suru => Predef.tk 2 yomu + "されなければ" ; Kuru => "来られなければ" - } + } } ; needSubject = True } ; - - mkVerb3 : Str -> Str -> Str -> VerbGroup -> Verb3 = + + mkVerb3 : Str -> Str -> Str -> VerbGroup -> Verb3 = \uru,p1,p2,gr -> { s = \\sp => (mkVerb uru gr).s ; te = \\sp => (mkVerb uru gr).te ; @@ -344,13 +344,13 @@ oper prep1 = p1 ; prep2 = p2 } ; - + mkCopula : Verb = { s = table { Resp => table { (TPres|TFut) => table { Pos => "です" ; - Neg => "ではありません" + Neg => "ではありません" } ; TPast => table { Pos => "でした" ; @@ -367,7 +367,7 @@ oper Neg => "ではなかった" } } - } ; + } ; te = table { Pos => "だって" ; Neg => "ではなくて" @@ -379,11 +379,11 @@ oper a_stem, i_stem = "で" ; -- not used needSubject = True -- not used } ; - + mkExistV : VP = { verb = \\sp => table { Anim => \\st,t,p => (mkVerb "いる" Gr2).s ! st ! t ! p ; - Inanim => table { + Inanim => table { Resp => table { (TPres|TFut) => table { Pos => "あります" ; @@ -404,7 +404,7 @@ oper Neg => "なかった" } } - } + } } ; te = \\sp => table { Anim => \\st => table { @@ -438,11 +438,11 @@ oper prepositive, obj = \\st => [] ; needSubject = True } ; - + mkWant : VV = { s = table { Me => \\st,t,p => (i_mkAdj "たい").pred ! st ! t ! p ; - SomeoneElse => \\st,t,p => "たがって" ++ (mkVerb "いる" Gr2).s ! st ! t ! p + SomeoneElse => \\st,t,p => "たがって" ++ (mkVerb "いる" Gr2).s ! st ! t ! p } ; te = table { Me => table { @@ -456,7 +456,7 @@ oper } ; a_stem = table { Me => "たいで" ; - SomeoneElse => "たがってい" + SomeoneElse => "たがってい" } ; i_stem = table { Me => "たいで" ; @@ -474,21 +474,21 @@ oper } ; sense = Wish } ; - + mkCan : VV = { s = \\sp,st,t,p => (mkVerb "できる" Gr2).s ! st ! t ! p ; te = \\sp => table { Pos => "できて" ; - Neg => "できないで" + Neg => "できないで" } ; a_stem, i_stem = \\sp => "でき" ; ba = \\sp => table { Pos => "できれば" ; - Neg => "できなければ" + Neg => "できなければ" } ; sense = Abil } ; - + mkMust : VV = { s = \\sp,st,t,p => (mkVerb "なる" Gr1).s ! st ! t ! Neg ; te = \\sp,p => "ならなくて" ; @@ -505,7 +505,7 @@ oper i_stem = \\sp => (mkVerb yomu gr).i_stem ; ba = \\sp => (mkVerb yomu gr).ba ; sense = Abil - } ; + } ; mkGive : Verb3 = { s = table { @@ -518,19 +518,19 @@ oper } ; a_stem, i_stem = table { Me => "呉れ" ; - SomeoneElse => "上げ" + SomeoneElse => "上げ" } ; ba = table { Me => (mkVerb "呉れる" Gr2).ba ; SomeoneElse => (mkVerb "上げる" Gr2).ba } ; prep1 = "に" ; - prep2 = "を" + prep2 = "を" } ; mkGo : Verb = { s = table { - Resp => (mkVerb "行く" Gr1).s ! Resp ; + Resp => (mkVerb "行く" Gr1).s ! Resp ; Plain => table { (TPres|TFut) => (mkVerb "行く" Gr1).s ! Plain ! TPres ; TPast => table { @@ -541,7 +541,7 @@ oper } ; te = table { Pos => "行って" ; - Neg => "行かないで" + Neg => "行かないで" } ; a_stem = "行か" ; i_stem = "行き" ; @@ -556,13 +556,13 @@ oper inclCard = False ; tenPlus = False } ; - + regPron : Str -> Bool -> Animateness -> Pronoun = \kare,b,a -> { s = \\st => kare ; Pron1Sg = b ; anim = a - } ; - + } ; + mkDet : Str -> Str -> Number -> Determiner = \q,sp,n -> { quant = \\st => q ; postpositive = [] ; @@ -573,7 +573,7 @@ oper no = False ; tenPlus = False } ; - + stylePron : Str -> Str -> Bool -> Animateness -> Pronoun = \boku,watashi,b,a -> { s = table { Plain => boku ; @@ -581,8 +581,8 @@ oper } ; Pron1Sg = b ; anim = a - } ; - + } ; + regPN : Str -> PropNoun = \paris -> { s = table { Plain => paris ; @@ -590,7 +590,7 @@ oper } ; anim = Inanim } ; - + personPN : Str -> Str -> PropNoun = \jon,jonsan -> { s = table { Plain => jon ; @@ -598,27 +598,27 @@ oper } ; anim = Anim } ; - + mkAdv : Str -> Adverb = \adv -> { - s = \\st => adv ; + s = \\st => adv ; prepositive = False } ; - + mkNP : Str -> Bool -> Bool -> Animateness -> NP = \np,b1,b2,a -> { - s = \\st => np ; + s = \\st => np ; prepositive = \\st => [] ; - needPart = b1 ; - changePolar = b2 ; - meaning = SomeoneElse ; + needPart = b1 ; + changePolar = b2 ; + meaning = SomeoneElse ; anim = a } ; - + mkConj : Str -> ConjType -> Conjunction = \c,t -> { s = c ; null = "" ; type = t } ; - + mkPrep : Str -> Preposition = \p -> { s = p ; null = "" ; @@ -692,10 +692,10 @@ oper "つ" => init neru + "てば" ; _ => init neru + "えば" } ; - + mkFirst : Adj = { pred = \\st,t,p => "一番目" ++ mkCopula.s ! st ! t ! p ; - attr = "一番目の" ; + attr = "一番目の" ; te = \\p => "一番目" ++ mkCopula.te ! p ; ba = \\p => "一番目" ++ mkCopula.ba ! p ; adv = table { @@ -704,12 +704,12 @@ oper } ; dropNaEnging = "一番目" } ; - + mkRain : Verb = { s = \\st,t,p => "雨が" ++ (mkVerb "降っている" Gr2).s ! st ! t ! p ; -- "ame ga furu" te = table { Pos => "雨が降っていて" ; - Neg => "雨が降っていないで" + Neg => "雨が降っていないで" } ; a_stem = "雨が降ってい" ; i_stem = "雨が降ってい" ; @@ -720,4 +720,3 @@ oper needSubject = False } ; } - diff --git a/src/korean/AdjectiveKor.gf b/src/korean/AdjectiveKor.gf index b5cd041f..d5a69c73 100644 --- a/src/korean/AdjectiveKor.gf +++ b/src/korean/AdjectiveKor.gf @@ -1,4 +1,5 @@ -concrete AdjectiveKor of Adjective = CatKor ** open ResKor, Prelude in { +concrete AdjectiveKor of Adjective = CatKor ** + open ResKor, Prelude in { flags optimize=all_subs ; @@ -11,11 +12,14 @@ concrete AdjectiveKor of Adjective = CatKor ** open ResKor, Prelude in { -- : A -> NP -> AP ; ComparA a np = a ** { - compar = np.s ! Bare + s = \\vf => "더" ++ a.s ! vf ; + compar = glue (np.s ! Bare) "보다" ; } ; -- : A2 -> NP -> AP ; -- married to her - -- ComplA2 a2 np = a2 ** { } ; + ComplA2 a2 np = a2 ** { + compar = (prepNP a2.c2 a2.p2 np).s ; + } ; -- : A2 -> AP ; -- married to itself -- ReflA2 a2 = a2 ** { } ; @@ -24,10 +28,10 @@ concrete AdjectiveKor of Adjective = CatKor ** open ResKor, Prelude in { UseA2 = PositA ; -- : A -> AP ; -- warmer - -- UseComparA a = a ** { - -- s = \\af => "???" ++ a.s ! af ; - -- compar = [] - -- } ; + UseComparA a = a ** { + s = \\af => "더" ++ a.s ! af ; + compar = [] ; + } ; -- : CAdv -> AP -> NP -> AP ; -- as cool as John @@ -37,7 +41,6 @@ concrete AdjectiveKor of Adjective = CatKor ** open ResKor, Prelude in { -- : Ord -> AP ; -- warmest AdjOrd ord = ord ** { - s = \\_ => ord.s ; compar = [] } ; diff --git a/src/korean/AdverbKor.gf b/src/korean/AdverbKor.gf index 01fb1ec6..b012f43e 100644 --- a/src/korean/AdverbKor.gf +++ b/src/korean/AdverbKor.gf @@ -11,11 +11,7 @@ lin -- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs -- : Prep -> NP -> Adv ; - PrepNP prep np = { - s = case prep.attaches of { - True => glue (np.s ! Bare) prep.s ; - False => np.s ! Bare ++ prep.s } - } ; + PrepNP = prepNP Bare ; -- Adverbs can be modified by 'adadjectives', just like adjectives. diff --git a/src/korean/CatKor.gf b/src/korean/CatKor.gf index 97939e9b..84f7df4a 100644 --- a/src/korean/CatKor.gf +++ b/src/korean/CatKor.gf @@ -8,8 +8,8 @@ concrete CatKor of Cat = CommonX ** open ResKor, Prelude in { -- Constructed in SentenceKor, and also in IdiomKor S = ResKor.Sentence ; - QS = SS ; - RS = SS ; + QS = SS ; -- Questions not implemented yet + RS = ResKor.Sentence ; -- relative sentence. Tense and polarity fixed, -- but agreement may depend on the CN/NP it modifies. @@ -66,7 +66,7 @@ concrete CatKor of Cat = CommonX ** open ResKor, Prelude in { Quant = ResKor.Quant ; Num = ResKor.Num ; Ord = { - s : Str ; -- AForm => Str ; -- Ord can come from AP and become AP again + s : VForm => Str ; -- Ord can come from AP and become AP again n : Number -- Ord can come from Num, which has inherent number } ; DAP = ResKor.Determiner ; @@ -116,7 +116,7 @@ concrete CatKor of Cat = CommonX ** open ResKor, Prelude in { N = ResKor.Noun ; N2 = ResKor.Noun2 ; N3 = ResKor.Noun3 ; - PN = ResKor.PNoun ; + PN = ResKor.NounPhrase ; linref V, V2, V3, VP = linVerb ; diff --git a/src/korean/ConjunctionKor.gf b/src/korean/ConjunctionKor.gf index ba0edcf6..01f407db 100644 --- a/src/korean/ConjunctionKor.gf +++ b/src/korean/ConjunctionKor.gf @@ -1,5 +1,5 @@ concrete ConjunctionKor of Conjunction = - CatKor ** open ResKor, Coordination, Prelude in { + CatKor ** open ResKor, Prelude in { flags optimize=all_subs ; @@ -25,54 +25,64 @@ concrete ConjunctionKor of Conjunction = ConsAdv = consrSS comma ; ConjAdv = conjunctSS ; - --} + -} --- Adverb and other simple {s : Str} types. -lincat - [Adv],[AdV],[IAdv] = {s1,s2 : Str} ; - -lin - BaseAdv, BaseAdV, BaseIAdv = twoSS ; - ConsAdv, ConsAdV, ConsIAdv = consrSS comma ; - ConjAdv, ConjAdV, ConjIAdv = conjunctDistrSS ; - - -{- --- RS depends on X, Y and Z, otherwise exactly like previous. --- RS can modify CNs, which are open for …, and have inherent … -lincat - [RS] = {s1,s2 : … => Str} ; - -lin - BaseRS = twoTable3 … ; - ConsRS = consrTable3 … comma ; - ConjRS = conjunctRSTable ; --} - lincat - [S] = ResKor.Sentence ** {firstS : ConjType => Str} ; + [Adv],[AdV],[IAdv] = ConjSS ; +lin + BaseAdv, BaseAdV, BaseIAdv = baseSS ; + ConsAdv, ConsAdV, ConsIAdv = consSS ; + ConjAdv, ConjAdV, ConjIAdv = conjSS ; + +oper + ConjSS : Type = {s : ConjType => Str} ; + + baseSS : SS -> SS -> ConjSS = \s1,s2 -> { + s = \\conj => glue s1.s (conjTable ! NStar ! conj) ++ s2.s ; + } ; + + consSS : SS -> ConjSS -> ConjSS = \s,ss -> ss ** { + s = \\conj => glue s.s (conjTable ! NStar ! conj) ++ ss.s ! conj ; + } ; + + conjSS : Conj -> ConjSS -> SS = \co,ss -> { + s = co.s1 ++ ss.s ! co.c + } ; + + -- Version with commas, no repeated conjunctions! + -- baseSS works for both: always conjunction between penultimate and last. + -- Difference from consSS: conjTable ! NStar ! conj isn't used, only comma. + consSScomma : SS -> ConjSS -> ConjSS = \s,ss -> ss ** { + s = \\conj => s.s + ++ SOFT_BIND ++ "," -- Don't add conjunction, only comma + ++ ss.s ! conj ; + } ; + + +lincat + [S], [RS] = ResKor.Sentence ** {firstS : ConjType => Str} ; lin - BaseS s1 s2 = s2 ** { + BaseS,BaseRS = \s1,s2 -> s2 ** { firstS = mkFirstS s1 } ; - ConsS s ss = ss ** { + ConsS,ConsRS = \s,ss -> ss ** { firstS = \\conj => mkFirstS s ! conj ++ ss.firstS ! conj ; } ; - ConjS co ss = ss ** { + ConjS,ConjRS = \co,ss -> ss ** { s = \\st => co.s1 ++ ss.firstS ! co.c ++ ss.s ! st } ; oper mkFirstS : ResKor.Sentence -> ConjType => Str = \s -> - \\conj => glue (s.s ! Subord) (conjTable ! NStar ! conj) ; + \\conj => glue (s.s ! WithConj) (conjTable ! VStar ! conj) ; lincat - [AP] = ResKor.AdjPhrase ** {firstAP : AForm => ConjType => Str} ; + [AP] = ResKor.AdjPhrase ** {firstAP : VForm => ConjType => Str} ; lin BaseAP a1 a2 = a2 ** { @@ -90,10 +100,8 @@ lin oper - mkFirstAP : ResKor.AdjPhrase -> AForm => ConjType => Str = \ap -> - \\af,conj => case af of { - AAttr => glue (ap.s ! AAttr) (conjTable ! NStar ! conj) ; - APred _ => glue (ap.s ! APred VStem) (conjTable ! VStar ! conj) } ; + mkFirstAP : ResKor.AdjPhrase -> VForm => ConjType => Str = \ap -> + \\af,conj => ap.compar ++ glue (ap.s ! VStem Pos) (conjTable ! VStar ! conj) ; {- lincat @@ -130,5 +138,22 @@ lin oper mkFirstNP : ResKor.NounPhrase -> ConjType => Str = \np -> \\conj => glue (np.s ! Bare) (conjTable ! NStar ! conj) ; + -- Versions with commas, no repeated conjunctions + + baseNPcomma : NP -> NP -> ListNP = \x,y -> y ** { + firstNP = \\conj => x.s ! Bare ++ BIND ++ "," ; + } ; + + consNPcomma : NP -> ListNP -> ListNP = \x,xs -> xs ** { + firstNP = \\conj => + x.s ! Bare ++ BIND ++ "," ++ xs.firstNP ! conj ; + } ; + + conjNPcomma : Conj -> ListNP -> NP = \co,xs -> xs ** { + s = \\nf => co.s1 + ++ xs.firstNP ! co.c + ++ co.s2 + ++ xs.s ! nf + } ; } diff --git a/src/korean/ExtendKor.gf b/src/korean/ExtendKor.gf index 345728b0..d0d462dd 100644 --- a/src/korean/ExtendKor.gf +++ b/src/korean/ExtendKor.gf @@ -1,8 +1,11 @@ --# -path=.:../common:../abstract concrete ExtendKor of Extend = CatKor - -- ** ExtendFunctor - [] + -- ** ExtendFunctor - [ApposNP] -- with (Grammar=GrammarKor) - ** open Prelude, ResKor, NounKor in { + ** open Prelude, ResKor, NounKor, Coordination in { + lin + -- : NP -> NP -> NP + ApposNP np1 np2 = np1 ** {s = \\nf => np1.s ! nf ++ np2.s ! nf} ; } ; diff --git a/src/korean/Hangul.gf b/src/korean/Hangul.gf index 11264927..42793d56 100644 --- a/src/korean/Hangul.gf +++ b/src/korean/Hangul.gf @@ -183,6 +183,7 @@ oper "기" | "끼" | "니" | "디" | "띠" | "리" | "미" | "비" | "삐" | "시" | "씨" | "이" | "지" | "찌" | "치" | "키" | "티" | "피" | "히" ) ; a : pattern Str = #("가" | "까" | "나" | "다" | "따" | "라" | "마" | "바" | "빠" | "사" | "싸" | "아" | "자" | "짜" | "차" | "카" | "타" | "파" | "하") ; + e : pattern Str = #("게" | "께" | "네" | "데" | "떼" | "레" | "메" | "베" | "뻬" | "세" | "쎄" | "에" | "제" | "쩨" | "체" | "케" | "테" | "페" | "헤") ; eo : pattern Str = #("거" | "꺼" | "너" | "더" | "떠" | "러" | "머" | "버" | "뻐" | "서" | "써" | "어" | "저" | "쩌" | "처" | "커" | "터" | "퍼" | "허") ; eu : pattern Str = #("그" | "끄" | "느" | "드" | "뜨" | "르" | "므" | "브" | "쁘" | "스" | "쓰" | "으" | "즈" | "쯔" | "츠" | "크" | "트" | "프" | "흐") ; i : pattern Str = #("기" | "끼" | "니" | "디" | "띠" | "리" | "미" | "비" | "삐" | "시" | "씨" | "이" | "지" | "찌" | "치" | "키" | "티" | "피" | "히") ; diff --git a/src/korean/LexiconKor.gf b/src/korean/LexiconKor.gf index 185dc31c..e2783bc5 100644 --- a/src/korean/LexiconKor.gf +++ b/src/korean/LexiconKor.gf @@ -1,5 +1,5 @@ concrete LexiconKor of Lexicon = CatKor ** - open ParadigmsKor, ResKor in { + open ParadigmsKor, ResKor, StructuralKor in { ---- -- A @@ -33,10 +33,10 @@ lin big_A = mkA "크다" ; -- lin bike_N = mkN "" ; -- lin bird_N = mkN "" ; -- lin bite_V2 = mkV2 "" ; --- lin black_A = mkA "" ; +lin black_A = mkA "검다" ; -- lin blood_N = mkN "" ; -- lin blow_V = mkV "" ; -lin blue_A = mkA "푸르다" ; +lin blue_A = mkA "파랗다" "파래요" "파랗습니다" "파란" ; -- lin boat_N = mkN "" ; -- lin bone_N = mkN "" ; -- lin boot_N = mkN "" ; @@ -59,7 +59,7 @@ lin bread_N = mkN "빵" ; -- lin camera_N = mkN "" ; -- lin cap_N = mkN "" ; --- lin car_N = mkN "" ; +lin car_N = mkN "자동차" "대" ; -- lin carpet_N = mkN "" ; lin cat_N = mkN "고양이" ; -- lin ceiling_N = mkN "" ; @@ -72,7 +72,7 @@ lin cat_N = mkN "고양이" ; -- lin clever_A = mkA "" ; -- lin close_V2 = mkV2 "" ; -- lin cloud_N = mkN "" ; --- lin coat_N = mkN "" ; +lin coat_N = mkN "코트" ; -- lin cold_A = mkA "" ; lin come_V = mkV "오다" ; -- lin computer_N = mkN "" ; @@ -95,7 +95,7 @@ lin do_V2 = mkV2 do_V ; -- lin doctor_N = mkN "" ; -- lin dog_N = mkN "" ; -- lin door_N = mkN "" ; --- lin drink_V2 = mkV2 "" ; +lin drink_V2 = mkV2 "마시다" ; -- lin dry_A = mkA "" ; -- lin dull_A = mkA "" ; -- lin dust_N = mkN "" ; @@ -209,7 +209,7 @@ lin laugh_V = mkV "웃다" ; -- lin leave_V2 = mkV2 "" ; -- lin leg_N = mkN "" ; -- lin lie_V = mkV "" ; --- lin like_V2 = mkV2 "" ; +lin like_V2 = mkV2 (mkV "좋아" do_V) topic object ; -- lin listen_V2 = mkV2 "" ; -- lin live_V = mkV ""; -- lin liver_N = mkN "" ; @@ -223,7 +223,7 @@ lin laugh_V = mkV "웃다" ; -- M lin man_N = mkN "남자" ; --- lin married_A2 = mkA "" ; +lin married_A2 = mkA2 (mkA "결혼했다" "결혼했어요" "결혼했습니다" "결혼한") with_Prep ; -- TODO check: forced past tense -- lin meat_N = mkN "" ; lin milk_N = mkN "우유" ; -- lin moon_N = mkN "" ; @@ -258,7 +258,7 @@ lin now_Adv = mkAdv "지금" ; -- lin paris_PN = mkPN "Paris" ; -- lin peace_N = mkN "" ; -- lin pen_N = mkN "" ; -lin person_N = mkN "사람" ; +lin person_N = mkN "사람" "명" ; -- lin planet_N = mkN "" ; -- lin plastic_N = mkN "" ; -- lin play_V = mkV "" ; @@ -279,7 +279,7 @@ lin person_N = mkN "사람" ; -- lin read_V2 = mkV2 "" ; -- lin ready_A = mkA "" ; -- lin reason_N = mkN "" ; --- lin red_A = mkA "" ; +lin red_A = mkA "빨갛다" "빨개요" "빨갛습니다" "빨간" ; -- lin religion_N = mkN "" ; -- lin restaurant_N = mkN "" ; -- lin river_N = mkN "" ; @@ -314,7 +314,7 @@ lin see_V2 = mkV2 "보다" ; -- lin sharp_A = mkA "" ; -- lin sheep_N = mkN "" fem ; -- lin ship_N = mkN "" ; --- lin shirt_N = mkN "" ; +lin shirt_N = mkN "셔츠" "벌" ; -- lin shoe_N = mkN "" ; -- lin shop_N = mkN "" ; lin short_A = mkA "키가" small_A ; -- "height is small" diff --git a/src/korean/MissingKor.gf b/src/korean/MissingKor.gf index 2fc1ed3f..cd6f6822 100644 --- a/src/korean/MissingKor.gf +++ b/src/korean/MissingKor.gf @@ -9,18 +9,13 @@ oper AddAdvQVP : QVP -> IAdv -> QVP = notYet "AddAdvQVP" ; oper AdjDAP : DAP -> AP -> DAP = notYet "AdjDAP" ; oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ; oper AdvAP : AP -> Adv -> AP = notYet "AdvAP" ; -oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ; oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ; oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ; -oper AdvNP : NP -> Adv -> NP = notYet "AdvNP" ; oper AdvQVP : VP -> IAdv -> QVP = notYet "AdvQVP" ; oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ; -oper ApposCN : CN -> NP -> CN = notYet "ApposCN" ; oper BaseAdV : AdV -> AdV -> ListAdV = notYet "BaseAdV" ; -oper BaseAdv : Adv -> Adv -> ListAdv = notYet "BaseAdv" ; oper BaseCN : CN -> CN -> ListCN = notYet "BaseCN" ; oper BaseIAdv : IAdv -> IAdv -> ListIAdv = notYet "BaseIAdv" ; -oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ; oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ; oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ; oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ; @@ -28,7 +23,6 @@ oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ; oper CompIP : IP -> IComp = notYet "CompIP" ; oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ; oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ; -oper ComplA2 : A2 -> NP -> AP = notYet "ComplA2" ; oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ; oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ; oper ComplSlashIP : VPSlash -> IP -> QVP = notYet "ComplSlashIP" ; @@ -37,23 +31,16 @@ oper ComplVQ : VQ -> QS -> VP = notYet "ComplVQ" ; oper ComplVS : VS -> S -> VP = notYet "ComplVS" ; oper ComplVV : VV -> VP -> VP = notYet "ComplVV" ; oper ConjAdV : Conj -> ListAdV -> AdV = notYet "ConjAdV" ; -oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ; oper ConjCN : Conj -> ListCN -> CN = notYet "ConjCN" ; oper ConjDet : Conj -> ListDAP -> Det = notYet "ConjDet" ; oper ConjIAdv : Conj -> ListIAdv -> IAdv = notYet "ConjIAdv" ; -oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ; oper ConsAdV : AdV -> ListAdV -> ListAdV = notYet "ConsAdV" ; -oper ConsAdv : Adv -> ListAdv -> ListAdv = notYet "ConsAdv" ; oper ConsCN : CN -> ListCN -> ListCN = notYet "ConsCN" ; oper ConsIAdv : IAdv -> ListIAdv -> ListIAdv = notYet "ConsIAdv" ; -oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ; oper CountNP : Det -> NP -> NP = notYet "CountNP" ; -oper D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 : Dig = notYet "D_9" ; oper DetDAP : Det -> DAP = notYet "DetDAP" ; 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 ExistIPAdv : IP -> Adv -> QCl = notYet "ExistIPAdv" ; oper ExistNP : NP -> Cl = notYet "ExistNP" ; @@ -61,9 +48,6 @@ oper ExistNPAdv : NP -> Adv -> Cl = notYet "ExistNPAdv" ; oper ExtAdvVP : VP -> Adv -> VP = notYet "ExtAdvVP" ; oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ; oper GenericCl : VP -> Cl = notYet "GenericCl" ; -oper IDig : Dig -> Digits = notYet "IDig" ; -oper IIDig : Dig -> Digits -> Digits = notYet "IIDig" ; -oper IdRP : RP = notYet "IdRP" ; oper IdetCN : IDet -> CN -> IP = notYet "IdetCN" ; oper IdetIP : IDet -> IP = notYet "IdetIP" ; oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ; @@ -71,12 +55,9 @@ oper ImpP3 : NP -> VP -> Utt = notYet "ImpP3" ; oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ; oper ImpVP : VP -> Imp = notYet "ImpVP" ; oper ImpersCl : VP -> Cl = notYet "ImpersCl" ; -oper MassNP : CN -> NP = notYet "MassNP" ; -oper NumDigits : Digits -> Card = notYet "NumDigits" ; oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ; oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ; oper OrdNumeralSuperl : Numeral -> A -> Ord = notYet "OrdNumeralSuperl" ; -oper OrdSuperl : A -> Ord = notYet "OrdSuperl" ; oper PConjConj : Conj -> PConj = notYet "PConjConj" ; oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ; oper PartNP : CN -> NP -> CN = notYet "PartNP" ; @@ -84,8 +65,6 @@ oper PassV2 : V2 -> VP = notYet "PassV2" ; oper PositAdAAdj : A -> AdA = notYet "PositAdAAdj" ; oper PositAdvAdj : A -> Adv = notYet "PositAdvAdj" ; oper PossNP : CN -> NP -> CN = notYet "PossNP" ; -oper PossPron : Pron -> Quant = notYet "PossPron" ; -oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ; oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ; oper ProgrVP : VP -> VP = notYet "ProgrVP" ; oper QuestCl : Cl -> QCl = notYet "QuestCl" ; @@ -96,18 +75,14 @@ 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 RelCN : CN -> RS -> CN = notYet "RelCN" ; -oper RelCl : Cl -> RCl = notYet "RelCl" ; oper RelNP : NP -> RS -> NP = notYet "RelNP" ; oper RelS : S -> RS -> S = notYet "RelS" ; oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ; -oper RelVP : RP -> VP -> RCl = notYet "RelVP" ; oper SSubjS : S -> Subj -> S -> S = notYet "SSubjS" ; oper SelfAdVVP : VP -> VP = notYet "SelfAdVVP" ; oper SelfAdvVP : VP -> VP = notYet "SelfAdvVP" ; oper SelfNP : NP -> NP = notYet "SelfNP" ; 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" ; @@ -122,22 +97,15 @@ oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ; oper SubjS : Subj -> S -> Adv = notYet "SubjS" ; oper Use2N3 : N3 -> N2 = notYet "Use2N3" ; oper Use3N3 : N3 -> N2 = notYet "Use3N3" ; -oper UseComparA : A -> AP = notYet "UseComparA" ; -oper UsePN : PN -> NP = notYet "UsePN" ; -oper UsePron : Pron -> NP = notYet "UsePron" ; -oper UseRCl : Temp -> Pol -> RCl -> RS = notYet "UseRCl" ; +oper UseQCl : Temp -> Pol -> QCl -> QS = notYet "UseQCl" ; oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ; -oper UttAP : AP -> Utt = notYet "UttAP" ; -oper UttAdv : Adv -> Utt = notYet "UttAdv" ; -oper UttCN : CN -> Utt = notYet "UttCN" ; -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 UttInterj : Interj -> Utt = notYet "UttInterj" ; -oper UttNP : NP -> Utt = notYet "UttNP" ; -oper UttVP : VP -> Utt = notYet "UttVP" ; +oper UttQS : QS -> Utt = notYet "UttQS" ; oper VPSlashPrep : VP -> Prep -> VPSlash = notYet "VPSlashPrep" ; oper VocNP : NP -> Voc = notYet "VocNP" ; oper above_Prep : Prep = notYet "above_Prep" ; @@ -176,7 +144,6 @@ oper between_Prep : Prep = notYet "between_Prep" ; oper bike_N : N = notYet "bike_N" ; oper bird_N : N = notYet "bird_N" ; oper bite_V2 : V2 = notYet "bite_V2" ; -oper black_A : A = notYet "black_A" ; oper blood_N : N = notYet "blood_N" ; oper blow_V : V = notYet "blow_V" ; oper boat_N : N = notYet "boat_N" ; @@ -195,8 +162,6 @@ oper burn_V : V = notYet "burn_V" ; oper but_PConj : PConj = notYet "but_PConj" ; oper butter_N : N = notYet "butter_N" ; oper buy_V2 : V2 = notYet "buy_V2" ; -oper by8agent_Prep : Prep = notYet "by8agent_Prep" ; -oper by8means_Prep : Prep = notYet "by8means_Prep" ; oper camera_N : N = notYet "camera_N" ; oper can8know_VV : VV = notYet "can8know_VV" ; oper can_VV : VV = notYet "can_VV" ; @@ -213,7 +178,6 @@ oper clean_A : A = notYet "clean_A" ; oper clever_A : A = notYet "clever_A" ; oper close_V2 : V2 = notYet "close_V2" ; oper cloud_N : N = notYet "cloud_N" ; -oper coat_N : N = notYet "coat_N" ; oper cold_A : A = notYet "cold_A" ; oper computer_N : N = notYet "computer_N" ; oper correct_A : A = notYet "correct_A" ; @@ -241,7 +205,6 @@ oper dn1000000c : Dig -> Dig -> Dig -> Dig -> Dig -> Dig -> Sub1000000 = notYet oper doctor_N : N = notYet "doctor_N" ; oper dog_N : N = notYet "dog_N" ; oper door_N : N = notYet "door_N" ; -oper drink_V2 : V2 = notYet "drink_V2" ; oper dry_A : A = notYet "dry_A" ; oper dull_A : A = notYet "dull_A" ; oper during_Prep : Prep = notYet "during_Prep" ; @@ -267,7 +230,6 @@ oper father_N2 : N2 = notYet "father_N2" ; oper fear_V2 : V2 = notYet "fear_V2" ; oper fear_VS : VS = notYet "fear_VS" ; oper feather_N : N = notYet "feather_N" ; -oper few_Det : Det = notYet "few_Det" ; oper few_X_short_of_Y : NP -> CN -> CN -> S = notYet "few_X_short_of_Y" ; oper fight_V2 : V2 = notYet "fight_V2" ; oper find_V2 : V2 = notYet "find_V2" ; @@ -305,7 +267,6 @@ oper has_age_VP : Card -> VP = notYet "has_age_VP" ; oper hat_N : N = notYet "hat_N" ; oper hate_V2 : V2 = notYet "hate_V2" ; oper have_name_Cl : NP -> NP -> Cl = notYet "have_name_Cl" ; -oper he_Pron : Pron = notYet "he_Pron" ; oper head_N : N = notYet "head_N" ; oper hear_V2 : V2 = notYet "hear_V2" ; oper heart_N : N = notYet "heart_N" ; @@ -328,7 +289,6 @@ oper how_old_QCl : NP -> QCl = notYet "how_old_QCl" ; oper hungry_VP : VP = notYet "hungry_VP" ; oper hunt_V2 : V2 = notYet "hunt_V2" ; oper husband_N : N = notYet "husband_N" ; -oper i_Pron : Pron = notYet "i_Pron" ; oper ice_N : N = notYet "ice_N" ; oper if_Subj : Subj = notYet "if_Subj" ; oper if_then_Conj : Conj = notYet "if_then_Conj" ; @@ -359,7 +319,6 @@ oper left_Ord : Ord = notYet "left_Ord" ; oper leg_N : N = notYet "leg_N" ; oper less_CAdv : CAdv = notYet "less_CAdv" ; oper lie_V : V = notYet "lie_V" ; -oper like_V2 : V2 = notYet "like_V2" ; oper listen_V2 : V2 = notYet "listen_V2" ; oper live_V : V = notYet "live_V" ; oper liver_N : N = notYet "liver_N" ; @@ -368,7 +327,6 @@ oper lose_V2 : V2 = notYet "lose_V2" ; oper louse_N : N = notYet "louse_N" ; oper love_N : N = notYet "love_N" ; oper love_V2 : V2 = notYet "love_V2" ; -oper many_Det : Det = notYet "many_Det" ; oper married_A2 : A2 = notYet "married_A2" ; oper married_Cl : NP -> NP -> Cl = notYet "married_Cl" ; oper meat_N : N = notYet "meat_N" ; @@ -406,12 +364,10 @@ oper oil_N : N = notYet "oil_N" ; oper old_A : A = notYet "old_A" ; oper on_Prep : Prep = notYet "on_Prep" ; oper open_V2 : V2 = notYet "open_V2" ; -oper or_Conj : Conj = notYet "or_Conj" ; oper otherwise_PConj : PConj = notYet "otherwise_PConj" ; oper paint_V2A : V2A = notYet "paint_V2A" ; oper paper_N : N = notYet "paper_N" ; oper paris_PN : PN = notYet "paris_PN" ; -oper part_Prep : Prep = notYet "part_Prep" ; oper peace_N : N = notYet "peace_N" ; oper pen_N : N = notYet "pen_N" ; oper planet_N : N = notYet "planet_N" ; @@ -435,7 +391,6 @@ oper read_V2 : V2 = notYet "read_V2" ; oper ready_A : A = notYet "ready_A" ; oper ready_VP : VP = notYet "ready_VP" ; oper reason_N : N = notYet "reason_N" ; -oper red_A : A = notYet "red_A" ; oper religion_N : N = notYet "religion_N" ; oper restaurant_N : N = notYet "restaurant_N" ; oper right_Ord : Ord = notYet "right_Ord" ; @@ -465,10 +420,8 @@ oper sell_V3 : V3 = notYet "sell_V3" ; oper send_V3 : V3 = notYet "send_V3" ; oper sew_V : V = notYet "sew_V" ; oper sharp_A : A = notYet "sharp_A" ; -oper she_Pron : Pron = notYet "she_Pron" ; oper sheep_N : N = notYet "sheep_N" ; oper ship_N : N = notYet "ship_N" ; -oper shirt_N : N = notYet "shirt_N" ; oper shoe_N : N = notYet "shoe_N" ; oper shop_N : N = notYet "shop_N" ; oper silver_N : N = notYet "silver_N" ; @@ -484,10 +437,7 @@ oper snake_N : N = notYet "snake_N" ; oper snow_N : N = notYet "snow_N" ; oper so_AdA : AdA = notYet "so_AdA" ; oper sock_N : N = notYet "sock_N" ; -oper somePl_Det : Det = notYet "somePl_Det" ; -oper someSg_Det : Det = notYet "someSg_Det" ; oper somebody_NP : NP = notYet "somebody_NP" ; -oper something_NP : NP = notYet "something_NP" ; oper somewhere_Adv : Adv = notYet "somewhere_Adv" ; oper song_N : N = notYet "song_N" ; oper speak_V2 : V2 = notYet "speak_V2" ; @@ -583,8 +533,5 @@ oper worm_N : N = notYet "worm_N" ; oper write_V2 : V2 = notYet "write_V2" ; oper year_N : N = notYet "year_N" ; oper yellow_A : A = notYet "yellow_A" ; -oper youPl_Pron : Pron = notYet "youPl_Pron" ; -oper youPol_Pron : Pron = notYet "youPol_Pron" ; -oper youSg_Pron : Pron = notYet "youSg_Pron" ; oper young_A : A = notYet "young_A" ; } diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index d2a3860c..83f06e7d 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -10,24 +10,23 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { DetCN det cn = cn ** {s = \\c => let cns : Str = case det.n of { - -- Pl => cn.s ! Bare ++ BIND ++ plural ! c ; - _Sg => cn.s ! c } ; + Pl => cn.s ! Bare ++ BIND ++ plural ! c ; + Sg => cn.s ! c } ; dets : Str = det.s ! cn.c.origin ; detnum : Str = case det.numtype of { IsNum => dets ++ cn.c.s ; IsDig => glue dets cn.c.s ; NoNum => dets } ; in case isNum det of { - True => cns ++ detnum ; - False => detnum ++ cns } + True => cn.rs ++ cns ++ detnum ; + False => cn.rs ++ detnum ++ cns } } ; -- : PN -> NP ; --- UsePN pn = pn ** { --- } ; + UsePN pn = pn ; -- : Pron -> NP ; - -- UsePron pron = pron ; + UsePron pron = pron ** {empty = []}; -- : Predet -> NP -> NP ; -- only the man PredetNP predet np = np ** {s = @@ -48,8 +47,13 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { -- PPartNP np v2 = np ** { -- s = \\c => v2.s ! ??? ++ np.s ! c } ; ---- - -- : NP -> Adv -> NP ; -- Paris today ; boys, such as .. - --AdvNP,ExtAdvNP = \np,adv -> np ** {} ; + -- : NP -> Adv -> NP ; -- Paris today + AdvNP np adv = np ** { + s = \\nf => adv.s ++ np.s ! nf + } ; -- TODO test + + -- : NP -> Adv -> NP ; -- boys, such as .. + -- ExtAdvNP np adv = np ** {} ; -- : NP -> RS -> NP ; -- Paris, which is here -- RelNP np rs = np ** { @@ -64,9 +68,9 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { } ; -- MassNP : CN -> NP ; - -- MassNP cn = useN cn ** { - -- } ; - + MassNP cn = cn ** { + s = \\nf => cn.rs ++ cn.s ! nf + } ; --2 Determiners @@ -97,7 +101,11 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { NumCard card = card ; -- : Digits -> Card ; - -- NumDigits dig = + NumDigits dig = baseNum ** { + s = \\_,_ => dig.s ! NCard ; + n = dig.n ; + numtype = IsDig + } ; -- : Numeral -> Card ; NumNumeral num = num ; @@ -115,10 +123,10 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { -- } ; -- : A -> Ord ; - -- OrdSuperl a = { - -- s = \\af => "제일" ++ a.s ! af ; - -- n = Sg -- ?? is this meaningful? - -- } ; + OrdSuperl a = { + s = \\vf => "가장" ++ a.s ! vf ; + n = Sg -- ?? is this meaningful? + } ; -- One can combine a numeral and a superlative. @@ -130,10 +138,7 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { IndefArt = mkQuant [] [] ; -- : Pron -> Quant - -- PossPron pron = - -- let p = pron.poss ; - -- in DefArt ** { - -- } ; + PossPron pron = pron.poss ; --2 Common nouns @@ -155,23 +160,28 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { -- Use3N3 n3 = lin N2 n3 ; -- : AP -> CN -> CN AdjCN ap cn = cn ** { - s = \\nf => ap.s ! AAttr ++ cn.s ! nf + s = \\nf => ap.compar ++ ap.s ! VAttr Pos ++ cn.s ! nf } ; -- : CN -> RS -> CN ; - -- RelCN cn rs = cn ** { - -- } ; + RelCN cn rs = cn ** { + rs = cn.rs ++ rs.s ! Subord + } ; + -{- -- : CN -> Adv -> CN ; - AdvCN cn adv = cn ** { } ; + AdvCN cn adv = cn ** { + rs = cn.rs ++ adv.s + } ; -- Nouns can also be modified by embedded sentences and questions. -- For some nouns this makes little sense, but we leave this for applications -- to decide. Sentential complements are defined in VerbKor. -- : CN -> SC -> CN ; -- question where she sleeps - SentCN cn sc = cn ** { } ; + SentCN cn sc = cn ** { + rs = cn.rs ++ sc.s + } ; --2 Apposition @@ -179,8 +189,9 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { -- This is certainly overgenerating. -- : CN -> NP -> CN ; -- city Paris (, numbers x and y) - ApposCN cn np = cn ** { s = } ; --} + ApposCN cn np = cn ** { + s = \\nf => np.s ! Bare ++ cn.s ! nf -- TODO which form of NP? + } ; --2 Possessive and partitive constructs diff --git a/src/korean/NumeralKor.gf b/src/korean/NumeralKor.gf index 31be00cc..ac21579a 100644 --- a/src/korean/NumeralKor.gf +++ b/src/korean/NumeralKor.gf @@ -37,7 +37,7 @@ lin -- : Digit -> Sub100 ; -- 10 + d pot1to19 d = let newS = xPlus "십" "열" d.s in d ** { s = newS ; - n = Pl ; + n = numNumber ; ord = newS ! NK ! Attrib ++ "번째" ; } ; @@ -84,7 +84,6 @@ lin -- : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n pot3plus m n = TODO ; - oper LinDigit : Type = ResKor.Numeral ** {isTwo : Bool ; ten : Str} ; @@ -99,7 +98,7 @@ oper SK => \\_ => sk ; NK => table {Indep => nk ; _ => nkAttr } } ; - n = Pl ; + n = numNumber ; numtype = IsNum ; isTwo = False ; ten = ten ; @@ -118,9 +117,52 @@ oper potTimes : (sk,nk : Str) -> ResKor.Numeral -> ResKor.Numeral = \sk,nk,num -> let newS = xTimes sk nk num.s in num ** { s = newS ; - n = Pl ; + n = numNumber ; ord = newS ! NK ! Attrib ++ "번째" ; -- TODO check } ; TODO : ResKor.Numeral = mkNum2 "TODO" "TODO" ; + + +-- numerals as sequences of digits + +lincat + Dig = TDigit ; + +lin + -- : Dig -> Digits ; -- 8 + IDig d = d ; + + -- : Dig -> Digits -> Digits ; -- 876 + IIDig d i = { + s = \\o => d.s ! NCard ++ BIND ++ i.s ! o ; + n = numNumber + } ; + + D_0 = mkDig "0" ; + D_1 = mk3Dig "1" "1번째" ResKor.Sg ; + D_2 = mkDig "2" ; + D_3 = mkDig "3" ; + D_4 = mkDig "4" ; + D_5 = mkDig "5" ; + D_6 = mkDig "6" ; + D_7 = mkDig "7" ; + D_8 = mkDig "8" ; + D_9 = mkDig "9" ; + +oper + mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o numNumber ; + mkDig : Str -> TDigit = \c -> mk2Dig c (c + "번째") ; + + mk3Dig : Str -> Str -> ResKor.Number -> TDigit = \c,o,n -> { + s = table {NCard => c ; NOrd => o} ; + n = n + } ; + + TDigit = { + n : ResKor.Number ; + s : CardOrd => Str + } ; + + numNumber = Sg ; -- No need for 들 with numerals } diff --git a/src/korean/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf index a8e1d6d7..185cb147 100644 --- a/src/korean/ParadigmsKor.gf +++ b/src/korean/ParadigmsKor.gf @@ -4,16 +4,27 @@ oper --2 Parameters -- --- To abstract over number, valency and (some) case names, +-- To abstract over number, valency and (some) CaseParticle names, -- we define the following identifiers. The application programmer -- should always use these constants instead of the constructors -- defined in $ResKor$. + CaseParticle : Type ; -- Arguments to give to V2, V3 + topic : CaseParticle ; -- 은 or 는 + subject : CaseParticle ; -- 이 or 가 + object : CaseParticle ; -- 을 or 를 + noCase : CaseParticle ; -- No case particle + + NumOrigin : Type ; -- Arguments to give to N + nativeKorean : NumOrigin ; -- Native Korean variant of numerals: 하나, 둘, 셋 , … + sinoKorean : NumOrigin ; -- Sino-Korean variant of numerals: 일, 이, 삼 --2 Nouns mkN : overload { - mkN : (noun : Str) -> N ; -- Predictable nouns + mkN : (noun : Str) -> N ; -- Predictable nouns with classifier 개. When quantified by a numeral, the numeral is of native Korean origin: 하나/둘/셋 , not 일/이/삼. + mkN : (noun,counter : Str) -> N ; -- Noun and classifier given as arguments. Takes numerals of native Korean origin. + mkN : (noun,counter : Str) -> NumOrigin -> N ; -- Noun, classifier and origin of numerals. E.g. `mkN "사람" "명" nativeKorean` } ; --2 Adjectives @@ -21,23 +32,33 @@ oper mkA : overload { mkA : (adj : Str) -> A ; -- Regular adjective, given in -다 form mkA : (kiga : Str) -> (jakda : A) -> A ; -- Compound adjective, e.g. 키가 작다 'short', literally 'height (is) small'. 키가 'height' given as string, 작다 'small' given as preconstructed A. + mkA : (jaemi : Str) -> (itda : V) -> A ; -- Compound adjective from 있다/없다 (or any other preconstructed verb), e.g. 재미있다 'amusing; entertaining', literally from parts 'fun' (Str) and 'have' (V). + mkA : (plain,polite,formal,attr : Str) -> A ; -- Worst case constructor: e.g. mkA "파랗다" "파래요" "파랗습니다" "파란" } ; - -- mkA2 : Str -> Prep -> A2 ; + mkA2 : overload { + mkA2 : Str -> A2 ; -- Regular adjective, given in -다 form, no postposition for complement. + mkA2 : Str -> Str -> A2 ; -- Adjective given in -다 form, postposition given as a string. If you want to use a postposition that has different forms for after vowel/after consonant, use the next constructor that takes a preconstructed Prep. + mkA2 : A -> Prep -> A2 ; -- Preconstructed adjective and postposition for complement. + } ; + mkPN : Str -> PN + = \s -> lin PN (mkNoun s) ; --2 Verbs -- Verbs mkV : overload { mkV : (plain : Str) -> V ; -- Predictable verb. Takes plain, uninflected -다 form, e.g. 가다 mkV : (nore : Str) -> (hada : V) -> V ; -- Add a prefix to an existing verb, e.g. 노래+하다 + mkV : (plain,polite,formal,attr : Str) -> V ; -- Worst case constructor: e.g. mkV "다르다" "달라요" "다릅니다" "다른" } ; copula : V ; -- The copula verb '' mkV2 : overload { - mkV2 : (plain : Str) -> V2 ; -- Regular verb. Takes plain, uninflected -다 form, object particle is 를. - mkV2 : V -> V2 ; -- Takes preconstructed V, object particle is 를. + mkV2 : (plain : Str) -> V2 ; -- Regular verb. Takes plain, uninflected -다 form, subject particle is 가/이 and object particle is 를/을. + mkV2 : V -> V2 ; -- Takes preconstructed V, subject particle is 가/이 and object particle is 를/을. + mkV2 : V -> (subj,obj : CaseParticle) -> V2 ; -- Takes preconstructed V, and subject and object particles. E.g. `mkV2 좋다_V topic subject` for "as for 는, 가 is good". } ; -- mkV3 : overload { @@ -66,7 +87,8 @@ oper --2 Structural categories mkPrep : overload { - mkPrep : (e : Str) -> Prep ; -- Particle like 에, attaches to the NP. + mkPrep : (e : Str) -> Prep ; -- Particle/postposition like 에: same form after vowel and consonant, attaches to the NP. Despite the name Prep, these are always postpositions. + mkPrep : (ro,euro : Str) -> Prep ; -- Particle like 로/으로: first argument is the form after vowel, second argument after consonant. Attaches to the NP. mkPrep : (dwie : Str) -> (attaches : Bool) -> Prep ; -- `mkPrep "뒤에" False` for a postposition that doesn't attach to the NP. } ; @@ -91,10 +113,26 @@ oper -- The definitions should not bother the user of the API. So they are -- hidden from the document. + CaseParticle : Type = ResKor.NForm ; + topic = Topic ; + subject = Subject ; + object = Object ; + noCase = Bare ; + + NumOrigin : Type = ResKor.NumOrigin ; + nativeKorean = NK ; + sinoKorean = SK ; + mkN = overload { - mkN : Str -> N = \s -> lin N (mkNoun s) ; + mkN : Str -> N = \s -> lin N (mkNoun s) ; + mkN : (noun,counter : Str) -> N = \n,c -> mkNCounter n c nativeKorean ; + mkN : (noun,counter : Str) -> NumOrigin -> N = mkNCounter } ; + mkNCounter : (noun,counter : Str) -> NumOrigin -> N = \n,c,o -> + let noun : Noun = mkNoun n ; + counter : Counter = mkCounter c o ; + in lin N (noun ** {c = counter}) ; mkN2 = overload { mkN2 : Str -> N2 = \s -> lin N2 (mkNoun s) ; @@ -108,12 +146,27 @@ oper mkA : (adj : Str) -> A = \s -> lin A (mkAdj s) ; mkA : (kiga : Str) -> (jakda : A) -> A = \kiga,jakda -> jakda ** {s = \\af => kiga ++ jakda.s ! af} ; + mkA : (plain,polite,formal,attr : Str) -> A + = \x1,x2,x3,x4 -> lin A (mkAdjReg x1 x2 x3 x4) ; + mkA : (jaemi : Str) -> (itda : V) -> A + = \jaemi,itda -> lin A ({s = \\vf => jaemi ++ itda.s ! vf}) ; } ; + mkA2 = overload { + mkA2 : Str -> A2 = \s -> lin A2 (atoa2 (mkAdj s)) ; + mkA2 : Str -> Str -> A2 + = \s,p -> let adj : Adjective = mkAdj s ; + prep : Prep = mkPrep p + in lin A2 (atoa2 adj ** {p2 = prep}) ; + mkA2 : A -> Prep -> A2 = \a,p -> lin A2 (atoa2 a ** {p2 = p}) ; + } ; + mkV = overload { mkV : (plain : Str) -> V = \v -> lin V (mkVerb v) ; mkV : (nore : Str) -> (hada : V) -> V = \nore,hada -> hada ** { s = \\vf => nore + hada.s ! vf} ; + mkV : (plain,polite,formal,attr : Str) -> V + = \x1,x2,x3,x4 -> lin V (mkVerbReg x1 x2 x3 x4) ; } ; copula = ResKor.copula ; @@ -124,6 +177,8 @@ oper mkV2 = overload { mkV2 : (plain : Str) -> V2 = \v2 -> lin V2 (mkVerb2 v2) ; mkV2 : V -> V2 = vtov2 ; + mkV2 : V -> (subj,obj : CaseParticle) -> V2 = \v,sc,c2 -> + vtov2 v ** {sc = sc ; c2 = c2} ; } ; mkV3 = overload { @@ -136,6 +191,8 @@ oper mkPrep = overload { mkPrep : (e : Str) -> Prep -- Particle like 에, attaches to the NP. = \e -> lin Prep (ResKor.mkPrep e) ; + mkPrep : (ro,euro : Str) -> Prep + = \ro,euro -> lin Prep (ResKor.mkPrep2 ro euro) ; mkPrep : (dwie : Str) -> (attaches : Bool) -> Prep -- `mkPrep "뒤에" False` for a postposition that doesn't attach to the NP. = \dwie,f -> lin Prep (ResKor.mkPrep dwie ** {attaches = f}) ; } ; diff --git a/src/korean/ParamKor.gf b/src/korean/ParamKor.gf index d37f35f8..575db8b5 100644 Binary files a/src/korean/ParamKor.gf and b/src/korean/ParamKor.gf differ diff --git a/src/korean/PhraseKor.gf b/src/korean/PhraseKor.gf index 84498a3e..6a678f00 100644 --- a/src/korean/PhraseKor.gf +++ b/src/korean/PhraseKor.gf @@ -6,20 +6,21 @@ concrete PhraseKor of Phrase = CatKor ** open Prelude, ResKor in { UttS s = {s = s.s ! Statement} ; UttQS qs = qs ; UttIAdv iadv = iadv ; + UttAdv adv = adv ; + UttInterj i = i ; {- UttImpSg pol imp = UttImpPl pol imp = UttImpPol = UttImpSg ; + -} + UttIP ip = {s = ip.s ! Bare} ; + + UttNP np = {s = np.s ! Bare} ; + UttVP vp = {s = linVP vp} ; + UttCN cn = {s = cn.rs ++ cn.s ! Bare} ; + UttCard n = {s = n.s ! NK ! Indep} ; + UttAP ap = { s = ap.compar ++ ap.s ! VF Plain Pos} ; - UttIP ip = {s = ip.s ! } ; - UttNP np = {s = np.s ! } ; - UttVP vp = {s = } ; - UttAdv adv = {s = } ; - UttCN n = {s = } ; - UttCard n = {s = } ; - UttAP ap = { s = ap.s ! } ; - UttInterj i = i ; --} NoPConj = {s = []} ; -- PConjConj conj = {s = conj.s1 ++ conj.s2 ! …} ; diff --git a/src/korean/RelativeKor.gf b/src/korean/RelativeKor.gf index a6c9e305..7fbe1030 100644 --- a/src/korean/RelativeKor.gf +++ b/src/korean/RelativeKor.gf @@ -1,22 +1,35 @@ concrete RelativeKor of Relative = CatKor ** open ResKor, Prelude, (NS=NounKor), (SS=StructuralKor) in { -{- lin -- : Cl -> RCl ; -- such that John loves her - -- RelCl cl = ; + RelCl = relSlash (ss "") ; -- : RP -> VP -> RCl ; - RelVP rp vp = + RelVP rp vp = { -- TODO no tenses yet in the grammar + s = \\t,a,p,cltyp => + rp.s ++ vp.adv ++ vp.nObj ++ + case cltyp of { + WithConj => vp.s ! VStem p ; + _ => vp.s ! VAttr p } ; + } ; -- : RP -> ClSlash -> RCl ; -- whom John loves - RelSlash rp cls = + RelSlash = relSlash ; + -- : RP ; IdRP = {s = ""} ; -- : Prep -> NP -> RP -> RP ; -- the mother of whom --FunRP prep np rp = {} ; --} + +oper + relSlash : SS -> ClSlash -> ResKor.RClause = \rp,cls -> { + s = \\t,a,p,cltyp => rp.s ++ + case cltyp of { + WithConj => cls.s ! t ! a ! p ! WithConj ; + _ => cls.s ! t ! a ! p ! Subord } ; + } ; } diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index 9993ba13..1cc6c373 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -13,76 +13,75 @@ oper origin = NK } ; - Noun : Type = { + mkCounter : Str -> NumOrigin -> Counter = \s,o -> baseCounter ** { + s = s ; + origin = o ; + } ; + + BaseNoun : Type = { s : NForm => Str ; p : Phono ; + } ; + + Noun : Type = BaseNoun ** { c : Counter ; } ; Noun2 : Type = Noun ; -- TODO eventually more parameters? Noun3 : Type = Noun ; CNoun : Type = Noun ** { + rs : Str ; -- Relative clause comes before determiner } ; - PNoun : Type = Noun ; - mkNoun : Str -> Noun = \str -> { s = \\cas => str + allomorph cas str ; p = if_then_else Phono (vowFinal str) Vowel Consonant ; c = baseCounter } ; - useN : Noun -> CNoun = \n -> n ; + useN : Noun -> CNoun = \n -> n ** { + rs = [] + } ; --------------------------------------------- -- NP - -- BaseNP : Type = { - -- a : Agreement ; - -- isPron : Bool ; - -- empty : Str ; -- standard trick for pro-drop - -- } ; - -- - -- emptyNP : NounPhrase = { - -- s = \\_ => [] ; - -- a = Sg3 Masc ; - -- isPron = False ; - -- empty = [] ; - -- } ; - -- - -- indeclNP : Str -> NounPhrase = \s -> emptyNP ** {s = \\c => s} ; - - --NounPhrase : Type = BaseNP ** {s : NForm => Str} ; - NounPhrase = Noun ; + NounPhrase = BaseNoun ** { + -- empty : Str ; -- standard trick for pro-drop + } ; -------------------------------------------------------------------------------- -- Pronouns - Pronoun : Type = NounPhrase ** { - -- poss : { -- for PossPron : Pron -> Quant - -- } ; - sp : NForm => Str ; + Pronoun : Type = BaseNoun ** { + poss : Quant ; } ; - + mkPron = overload { + mkPron : (stem,poss : Str) -> Pronoun = \s,poss -> mkNoun s ** { + poss = mkQuant poss (poss ++ "것") ; + } ; + mkPron : (stem : Str) -> Pronoun = \s -> mkNoun s ** { + poss = mkQuant (s + "의") (s + "의" ++ "것") ; + } + } ; -------------------------------------------------------------------------------- -- Det, Quant, Card, Ord BaseQuant : Type = { + sp : NForm => Str ; isPoss : Bool ; p : Phono } ; Determiner : Type = BaseQuant ** { s : NumOrigin => Str ; -- Chosen by the counter of CN - sp : NForm => Str ; n : Number ; numtype : NumType ; -- Whether its Num component is digit, numeral or Sg/Pl } ; Quant : Type = BaseQuant ** { s : Str ; - sp : NForm => Str ; } ; Num : Type = { @@ -104,6 +103,7 @@ oper } ; baseQuant : BaseQuant = { + sp = \\_ => [] ; isPoss = False ; p = Vowel ; } ; @@ -114,6 +114,13 @@ oper p = (mkNoun sp).p ; } ; + mkDet : Str -> Number -> Determiner = \s,num -> baseQuant ** { + s = \\_ => (mkNoun s).s ! Bare ; -- NumOrigin irrelevant for non-numbers + sp = (mkNoun s).s ; + n = num ; + numtype = NoNum ; + } ; + plural : NForm => Str = table { Bare => "들" ; nf => "들" + allomorph nf "들" @@ -121,9 +128,13 @@ oper -------------------------------------------------------------------------------- -- Postpositions - Postposition : Type = {s : Str ; attaches : Bool} ; + Postposition : Type = {s : Phono => Str ; attaches : Bool} ; - mkPrep : Str -> Postposition = \str -> {s=str ; attaches=True} ; + mkPrep : Str -> Postposition = \str -> {s=\\_ => str ; attaches=True} ; + mkPrep2 : (ro,euro : Str) -> Postposition = \ro,euro -> { + s = table {Vowel => ro ; Consonant => euro} ; + attaches = True + } ; emptyPP : Postposition = mkPrep [] ** {attaches=False} ; datPP : Postposition = mkPrep "에게" ; @@ -131,16 +142,25 @@ oper -------------------------------------------------------------------------------- -- Adjectives - Adjective : Type = {s : AForm => Str} ; - Adjective2 : Type = Adjective ; + Adjective : Type = {s : VForm => Str} ; -- Adjectives are verbs + Adjective2 : Type = Adjective ** {c2 : NForm ; p2 : Postposition} ; + + v2a : (attrpos : Str) -> Verb -> Adjective = \attrpos,v -> { + s = table { + VAttr Pos => attrpos ; -- Positive Attr is different in + vf => v.s ! vf } -- adjectives, otherwise adj forms == verb forms. + } ; mkAdj : Str -> Adjective = \plain -> - let stem = init plain ; - verb = mkVerb plain ; - in { - s = table { AAttr => add_N stem ; - APred vf => verb.s ! vf } - } ; + let v : Verb = mkVerb plain ; + stem : Str = v.s ! VStem Pos ; + attrpos : Str = add_N stem ; + in v2a attrpos v ; + + mkAdjReg : (x1,_,_,x4 : Str) -> Adjective = \plain,polite,formal,attr -> + v2a attr (mkVerbReg plain polite formal attr) ; + + atoa2 : Adjective -> Adjective2 = \a -> a ** {c2=Bare ; p2=emptyPP} ; AdjPhrase : Type = Adjective ** {compar : Str} ; -------------------------------------------------------------------------------- @@ -159,16 +179,13 @@ oper mkVerb : (plain : Str) -> Verb = \plain -> let stem = init plain ; - -- plainpres = case vowFinal stem of { -- not used in grammar yet - -- True => add_N stem + "다" ; - -- False => stem + "는다" } ; informal = add_eo stem ; -- not used in grammar yet - polpres = informal + "요" ; - formalpres = case vowFinal stem of { + polite = informal + "요" ; + formal = case vowFinal stem of { True => add_B stem + "니다" ; False => stem + "습니다" } ; - neg = stem + "지" ; - in mkVerbReg plain polpres formalpres neg ; + attrpos = stem + "는" ; + in mkVerbReg plain polite formal attrpos ; mkVerb2 : (plain : Str) -> Verb2 = \plain -> vtov2 (mkVerb plain) ; mkVerb3 : (plain : Str) -> Verb3 = \plain -> v2tov3 (mkVerb2 plain) ; @@ -176,18 +193,24 @@ oper vtov2 : Verb -> Verb2 = \v -> v ** {c2 = Object ; p2 = emptyPP} ; v2tov3 : Verb2 -> Verb3 = \v -> v ** {c3 = Bare ; p3 = datPP} ; + -- ㄹ-irregulars, ㅎ-irregular mkVerbReg : (x1,_,_,x4 : Str) -> Verb = - \plain,polite,formal,neg -> + \plain,polite,formal,attrpos -> let stem = init plain ; + neg = stem + "지" ; + attrneg = neg ++ "않는" ; planeg = neg ++ negForms ! Plain ; polneg = neg ++ negForms ! Polite ; formneg = neg ++ negForms ! Formal ; - in mkVerbFull stem plain polite formal planeg polneg formneg ; + in mkVerbFull stem attrpos attrneg plain polite formal planeg polneg formneg ; - mkVerbFull : (x1,_,_,_,_,_,x7 : Str) -> Verb = - \stem,plain,polite,formal,planeg,polneg,formneg -> { + mkVerbFull : (x1,_,_,_,_,_,_,_,x9 : Str) -> Verb = + \stem,attrpos,attrneg,plain,polite,formal,planeg,polneg,formneg -> { s = table { - VStem => stem ; + VStem Pos => stem ; + VStem Neg => stem + "지" ++ "않" ; + VAttr Pos => attrpos ; + VAttr Neg => attrneg ; VF Plain Pos => plain ; VF Plain Neg => planeg ; VF Polite Pos => polite ; @@ -200,6 +223,8 @@ oper copula : Verb = mkVerbFull "이" + "이는" -- TODO does this exist? + "아니는" -- TODO does this exist? "이다" "이에요" "입니다" @@ -209,6 +234,7 @@ oper copulaAfterVowel : Verb = copula ** { s = \\vf => case vf of { + VAttr Pos => "는" ; -- TODO just guessing VF Plain Pos => "다" ; VF Polite Pos => "예요" ; _ => copula.s ! vf } @@ -216,6 +242,8 @@ oper have_V : Verb = mkVerbFull "있" + "있는" + "없는" "있다" "있어요" "있습니다" @@ -223,11 +251,19 @@ oper "없어요" "없습니다" ; + -- For building an adjective. Different attr from do_V. + do_A : Verb = mkVerbReg + "하다" + "해요" + "합니다" + "한" ; + hada_A = do_A ; -- Exposing both names (hada=transliteration, do=translation) + do_V : Verb = mkVerbReg "하다" "해요" "합니다" - "하지" ; + "하는" ; negForms : Style => Str = table { Plain => "않다" ; @@ -239,26 +275,37 @@ oper Adverb : Type = SS ; + prepNP : NForm -> Postposition -> NounPhrase -> Adverb = \nf,pp,np -> { + s = case pp.attaches of { + True => glue (np.s ! nf) (pp.s ! np.p) ; + False => np.s ! nf ++ (pp.s ! np.p)} + } ; ------------------ -- Conj Conj : Type = { - s1 : Str ; + s1, s2 : Str ; c : ConjType ; -- if it's And, Or, … -- Need to add conjunction already in ConsX funs. n : Number ; } ; + + -- Do not remove this. Used in a particular application grammar. + commaConj : Conj = { + s1, s2 = [] ; + c = Comma ; + n = Pl ; + } ; + ------------------ -- VP Complement : Type = { s : VForm => Str ; - -- compar : Str ; -- comparative is discontinuous } ; emptyComp : Complement = { s = \\_ => [] ; - -- compar : Str ; } ; BaseVP : Type = { @@ -285,7 +332,7 @@ oper useVc : Verb2 -> VPSlash = \v2 -> baseVP ** v2 ; insertComp : VPSlash -> NounPhrase -> VerbPhrase = \v2,np -> useV v2 ** { - nObj = np.s ! v2.c2 ++ v2.p2.s + nObj = np.s ! v2.c2 ++ v2.p2.s ! np.p } ; insertAdv : VerbPhrase -> SS -> VerbPhrase = \vp,adv -> vp ** {adv = adv.s} ; @@ -302,16 +349,20 @@ oper QClause : Type = Clause ; - RClause : Type = {s : NForm => Tense => Anteriority => Polarity => Str} ; + RClause : Type = Clause ; Sentence : Type = {s : ClType => Str} ; - predVP : NounPhrase -> VerbPhrase -> ClSlash = \np,vp -> vp ** { + predVP : NounPhrase -> VerbPhrase -> ClSlash = \np,vp -> + let npstr : Str = np.s ! vp.sc in predVP' npstr vp ; + + predVP' : (np : Str) -> VerbPhrase -> ClSlash = \np,vp -> vp ** { s = \\t,a,p,cltyp => let vf = case cltyp of { - Subord => VStem ; - _ => VF Polite p } -- TODO: more tenses, politeness - in np.s ! vp.sc + Subord => VAttr p ; + WithConj => VStem p ; + _ => VF Polite p } -- TODO: more tenses, politeness + in np ++ vp.nObj -- an object, not copula complement ++ vp.adv ++ vp.s ! vf @@ -321,5 +372,6 @@ oper -- linrefs linVerb : Verb -> Str = \v -> v.s ! linVF ; +linVP : VerbPhrase -> Str = \vp -> vp.nObj ++ vp.adv ++ vp.s ! linVF ; } diff --git a/src/korean/SentenceKor.gf b/src/korean/SentenceKor.gf index a87ce9e6..cc9a7f47 100644 --- a/src/korean/SentenceKor.gf +++ b/src/korean/SentenceKor.gf @@ -11,7 +11,7 @@ lin PredVP = predVP ; -- : SC -> VP -> Cl ; -- that she goes is good (Saeed p. 94) - --PredSCVP sc vp = ; + PredSCVP sc vp = predVP' sc.s vp ; --2 Clauses missing object noun phrases -- : NP -> VPSlash -> ClSlash ; @@ -35,16 +35,16 @@ lin ImpVP vp = {s = \\num,pol => linVP (VImp num pol) Statement vp} ; --2 Embedded sentences - +-} -- : S -> SC ; - EmbedS s = {s = s.s ! True} ; -- choose subordinate + EmbedS s = {s = s.s ! Subord ++ "것이"} ; -- TODO check subject case -- : QS -> SC ; -- EmbedQS qs = { } ; -- : VP -> SC ; - EmbedVP vp = {s = infVP vp} ; --} + EmbedVP vp = {s = vp.s ! VAttr Pos ++ "것이"} ; + --2 Sentences -- : Temp -> Pol -> Cl -> S ; @@ -56,7 +56,7 @@ lin UseQCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! Statement} ; -- : Temp -> Pol -> RCl -> RS ; - -- UseRCl t p cl = {s = } ; + UseRCl t p rcl = {s = \\c => t.s ++ p.s ++ rcl.s ! t.t ! t.a ! p.p ! c} ; -- AdvS : Adv -> S -> S ; -- then I will go home AdvS = advS "" ; diff --git a/src/korean/StructuralKor.gf b/src/korean/StructuralKor.gf index ec258772..fe62f835 100644 --- a/src/korean/StructuralKor.gf +++ b/src/korean/StructuralKor.gf @@ -38,16 +38,15 @@ lin there_Adv = ss "" ; ------- -- Conj - and_Conj = { +lin and_Conj = { s1 = [] ; - -- no need for strings here, actual values come from ParamKor.conjTable - -- s2 = \\phono => table { - -- VStar => "고" ; - -- NStar => "하고"} ; + -- no need for string, actual values come from ParamKor.conjTable + s2 = [] ; -- this is only used in the base/cons functions with comma. + -- another application can use commas and just one conjunction. n = Pl ; c = And } ; --- lin or_Conj = {s2 = \\_ => "" ; s1 = [] ; n = Sg} ; +lin or_Conj = {s1,s2 = [] ; n = Sg ; c = Or} ; -- lin if_then_Conj = mkConj -- lin both7and_DConj = mkConj "" "" pl ; -- lin either7or_DConj = {s2 = \\_ => "" ; s1 = "" ; n = Sg} ; @@ -68,17 +67,16 @@ lin all_Predet = {s = \\_ => "마다" ; p = Vowel} ; lin only_Predet = {s = \\_ => "만" ; p = Consonant} ; --lin most_Predet = {s = ""} ; -{- -lin every_Det = R.defDet [] pl ** - { s = mkVow } ; -lin few_Det = R.indefDet "" pl ; -lin many_Det = R.indefDet "" pl ; -lin much_Det = R.indefDet "" sg ; -lin somePl_Det = -lin someSg_Det = -lin no_Quant = --} +--lin every_Det = ; +lin few_Det = mkDet "조금의" Pl ; +lin many_Det = mkDet "많은" Pl ; +-- lin much_Det = ; + +lin somePl_Det = mkDet "어떤" Pl ; +lin someSg_Det = mkDet "어떤" Sg ; +--lin no_Quant = + lin that_Quant = mkQuant "그" "그것" ; lin this_Quant = mkQuant "이" "이것" ; {-lin which_IQuant = @@ -92,11 +90,8 @@ lin everything_NP = defNP "" N.NumSg ; lin nobody_NP = mkVerb; "" lin nothing_NP = defNP "" N.NumSg ; lin somebody_NP = defNP "" N.NumSg ; -lin something_NP = defNP "" N.NumSg ; - -oper - defNP : Str -> Num -> NP = {} ; -} +lin something_NP = mkNoun "무엇" ; ------- -- Prep @@ -106,8 +101,8 @@ oper -- lin before_Prep = mkPrep "" ; lin behind_Prep = mkPrep "뒤에" False ; -- lin between_Prep = = mkPrep "" ; --- lin by8agent_Prep = mkPrep ; --- lin by8means_Prep = mkPrep ; +lin by8agent_Prep = mkPrep "에 의해" ; -- TODO check +lin by8means_Prep = mkPrep "에 인해" ; -- TODO check -- lin during_Prep = mkPrep ; -- lin except_Prep = mkPrep ; lin for_Prep = mkPrep "에게" ; @@ -115,12 +110,12 @@ lin for_Prep = mkPrep "에게" ; -- lin in8front_Prep = mkPrep "" ; lin in_Prep = mkPrep "에서" ; -- lin on_Prep = mkPrep "에서" ; --- lin part_Prep = mkPrep ; +lin part_Prep = mkPrep "의" ; lin possess_Prep = mkPrep "의" ; -- lin through_Prep = mkPrep ; lin to_Prep = mkPrep "에"; -- lin under_Prep = mkPrep "" ; --- lin with_Prep = mkPrep "" ; +lin with_Prep = mkPrep "와" "과" ; -- lin without_Prep = mkPrep "" ; @@ -129,13 +124,15 @@ lin to_Prep = mkPrep "에"; -- Pronouns are closed class, no constructor in ParadigmsKor. -- it_Pron = - -- i_Pron = - -- youPol_Pron, - -- youSg_Pron = - -- he_Pron = - -- she_Pron = + i_Pron = let iReg : Pronoun = mkPron "저" "제" in + iReg ** {s = table {Subject => "제가"; nf => iReg.s ! nf} + } ; + youPol_Pron = mkPron "당신" ; + youSg_Pron = mkPron "너" ; -- NB. this is very informal, best not used + he_Pron = mkPron "그" ; + she_Pron = mkPron "그녀" ; -- we_Pron = - -- youPl_Pron = + youPl_Pron = mkPron "너희" ; -- they_Pron = --lin whatPl_IP = ; diff --git a/src/korean/SymbolKor.gf b/src/korean/SymbolKor.gf index 2d04509a..2ed90518 100644 --- a/src/korean/SymbolKor.gf +++ b/src/korean/SymbolKor.gf @@ -1,7 +1,7 @@ --# -path=.:../abstract:../common:../prelude concrete SymbolKor of Symbol = CatKor ** - open Prelude, ParadigmsKor, ResKor, (NS=NounKor) in { + open Prelude, ResKor, (NK=NounKor), (VK=VerbKor) in { lin @@ -15,28 +15,40 @@ lin FloatPN i = mkPN i.s ; -- : Card -> PN ; -- twelve [as proper name] - NumPN i = mkPN i.s ; + NumPN i = mkPN (i.s ! NK ! Indep) ; + +oper + + mkPN : Str -> NounPhrase = \s -> { + s = \\_ => s ; + p = Consonant ; -- ?? + } ; -{- lin --- CNIntNP cn i = {} ; + -- : CN -> Int -> NP + CNIntNP cn i = NK.MassNP (cn ** { + s = \\nf => cn.s ! nf ++ i.s}) ; -- : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and y CNSymbNP det cn xs = - let cnSymb = cn ** { comp = cn.comp ++ xs.s } - in NS.DetCN det cnSymb ; + let cnSymb : CN = cn ** {s = \\nf => cn.s ! nf ++ xs.s} + in NK.DetCN det cnSymb ; -- : CN -> Card -> NP ; -- level five ; level 5 - CNNumNP cn i = NS.MassNP (cn ** { comp = cn.comp ++ i.s }) ; + CNNumNP cn i = NK.MassNP (cn ** { + s = \\nf => cn.s ! nf ++ i.s ! cn.c.origin ! Indep}) ; -- : Symb -> S ; - SymbS sy = {s = } ; + SymbS sy = {s = \\_ => sy.s} ; + -- : Symb -> Card ; - SymbNum sy = { s = sy.s ; n = Pl } ; + SymbNum sy = baseNum ** {s = \\_,_ => sy.s} ; -- : Symb -> Ord ; - SymbOrd sy = { s =} ; --} + SymbOrd sy = + let comp : Comp = VK.CompAdv (lin Adv sy) + in {s = comp.s ; n=Pl} ; + lincat Symb, [Symb] = SS ; diff --git a/src/korean/VerbKor.gf b/src/korean/VerbKor.gf index 33dc4c18..0273b542 100644 --- a/src/korean/VerbKor.gf +++ b/src/korean/VerbKor.gf @@ -111,7 +111,7 @@ lin -- : AP -> Comp ; CompAP ap = emptyComp ** { - s = \\vf => ap.s ! APred vf + s = \\vf => ap.compar ++ ap.s ! vf } ; -- : CN -> Comp ; diff --git a/src/korean/unittest/adjective.gftest b/src/korean/unittest/adjective.gftest new file mode 100644 index 00000000..d91c6e84 --- /dev/null +++ b/src/korean/unittest/adjective.gftest @@ -0,0 +1,9 @@ +-- Comparatives + +-- LangEng: I am smaller than a cat +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseComp (CompAP (ComparA small_A (DetCN (DetQuant IndefArt NumSg) (UseN cat_N)))))))) NoVoc +LangKor: 제가 고양이 &+ 보다 더 작아요 + +-- LangEng: I am a woman smaller than a cat +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseComp (CompCN (AdjCN (ComparA small_A (DetCN (DetQuant IndefArt NumSg) (UseN cat_N))) (UseN woman_N))))))) NoVoc +LangKor: 제가 고양이 &+ 보다 더 작은 여자 &+ 예요 diff --git a/src/korean/unittest/adverb.gftest b/src/korean/unittest/adverb.gftest index af31bbb5..0f49f19d 100644 --- a/src/korean/unittest/adverb.gftest +++ b/src/korean/unittest/adverb.gftest @@ -1,6 +1,6 @@ Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseComp (CompAdv (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN house_N)))))))) NoVoc LangEng: the cat is in the house -LangKor: 고양이가 집 BIND 에서 있어요 +LangKor: 고양이가 집 &+ 에서 있어요 Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseComp (CompAdv (PrepNP behind_Prep (DetCN (DetQuant DefArt NumSg) (UseN house_N)))))))) NoVoc LangEng: the cat is behind the house diff --git a/src/korean/unittest/inflection.gftest b/src/korean/unittest/inflection.gftest index 80ba1996..6716c9eb 100644 --- a/src/korean/unittest/inflection.gftest +++ b/src/korean/unittest/inflection.gftest @@ -9,7 +9,7 @@ Lang: eat_V2 LangKor: 먹어요 Lang: UseComp (CompAP (PositA good_A)) -LangKor: 좋어요 +LangKor: 좋아요 -- Final ㅏ or ㅓ does not repeat itself Lang: go_V diff --git a/src/korean/unittest/relative.gftest b/src/korean/unittest/relative.gftest new file mode 100644 index 00000000..6f85a832 --- /dev/null +++ b/src/korean/unittest/relative.gftest @@ -0,0 +1,16 @@ +Lang: DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV laugh_V)))) +LangEng: a cat that laughs +LangKor: 웃는 고양이 + +Lang: AdvNP (DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a drink_V2) (MassNP (UseN milk_N))))))) now_Adv +LangEng: a cat that drinks milk now +LangKor: 지금 우유를 마시는 고양이 +-- 지금 우유를 마시고 있는 고양이 + +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a like_V2) (DetCN (DetQuant IndefArt NumPl) (RelCN (UseN cat_N) (ConjRS and_Conj (BaseRS (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV laugh_V))) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a drink_V2) (MassNP (UseN milk_N))))))))))))) NoVoc +LangEng: I like cats that laugh and that drink milk +LangKor: 저는 웃 &+ 고 우유를 마시는 고양이를 좋아해요 + +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a like_V2) (DetCN (DetQuant IndefArt NumPl) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a like_V2) (UsePron i_Pron)))))))))) NoVoc +LangEng: I like cats that like me +LangKor: 저는 저를 좋아하는 고양이가 좋아요 diff --git a/src/korean/unittest/subjcases.gftest b/src/korean/unittest/subjcases.gftest new file mode 100644 index 00000000..f4996cd7 --- /dev/null +++ b/src/korean/unittest/subjcases.gftest @@ -0,0 +1,22 @@ +-- Subject as subject case + +-- LangEng: I see a cat +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant IndefArt NumSg) (UseN cat_N)))))) NoVoc +LangKor: 제가 고양이를 봐요 + +-- Double subject case +-- LangEng: the cat is short +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseComp (CompAP (PositA short_A)))))) NoVoc +LangKor: 고양이가 키가 작아요 + +-- Topic as subject case + +-- LangEng: I have a cat +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a have_V2) (DetCN (DetQuant IndefArt NumSg) (UseN cat_N)))))) NoVoc +LangKor: 저는 고양이가 있어요 + +-- Topic + object + +-- LangEng: I like cats +Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a like_V2) (DetCN (DetQuant IndefArt NumPl) (UseN cat_N)))))) NoVoc +LangKor: 저는 고양이를 좋아해요 diff --git a/src/turkish/AdjectiveTur.gf b/src/turkish/AdjectiveTur.gf index a0d23104..5239ddcc 100644 --- a/src/turkish/AdjectiveTur.gf +++ b/src/turkish/AdjectiveTur.gf @@ -1,32 +1,40 @@ concrete AdjectiveTur of Adjective = - CatTur ** open ResTur, ParadigmsTur, Prelude in { + CatTur ** open ResTur, HarmonyTur, ParadigmsTur, Prelude in { lin - PositA a = {s = a.s} ; + PositA a = {s = a.s; h = a.h} ; ComparA a np = { s = \\n,c => np.s ! Ablat ++ a.s ! n ! c ; + h = a.h } ; UseComparA a = { - s = \\n,c => "daha" ++ a.s ! n ! c + s = \\n,c => "daha" ++ a.s ! n ! c ; + h = a.h } ; - AdjOrd v = v ; + AdjOrd v = v ** {h = {vow=I_Har; con=SCon Soft}} ; -- to be fixed AdvAP ap adv = { - s = \\n, c => adv.s ++ ap.s ! n ! c + s = \\n, c => adv.s ++ ap.s ! n ! c ; + h = ap.h } ; AdAP ada ap = { - s = \\n, c => ada.s ++ ap.s ! n ! c + s = \\n, c => ada.s ++ ap.s ! n ! c ; + h = ap.h } ; - UseA2 a = {s = a.s} ; + UseA2 a = { + s = a.s ; + h = a.h + } ; ComplA2 a np = { - s = \\n, c => np.s ! a.c.c ++ a.c.s ++ a.s ! n ! c + s = \\n, c => np.s ! a.c.c ++ a.c.s ++ a.s ! n ! c ; + h = a.h } ; -- TODO: Whether this is correct or not requires further examination. @@ -35,7 +43,8 @@ concrete AdjectiveTur of Adjective = let kendi : N = mkN "kendi" in - \\n, c => kendi.s ! n ! c ++ a.c.s ++ a.s ! n ! Nom + \\n, c => kendi.s ! n ! c ++ a.c.s ++ a.s ! n ! Nom ; + h = a.h } ; -- Some examples of using CAdvAP: @@ -43,14 +52,15 @@ concrete AdjectiveTur of Adjective = -- > Paris kadar kötü -- > o kadar kötü CAdvAP cadv ap np = { - s = \\n, c => np.s ! Nom ++ cadv.s ++ ap.s ! n ! c + s = \\n, c => np.s ! Nom ++ cadv.s ++ ap.s ! n ! c ; + h = ap.h } ; -- TODO: Instead of `++ BIND ++ "si"`, sc.s should be treated as a noun -- and it should be inflected to `gen Sg {n = Sg; p = P3}`. SentAP ap sc = { - s = - \\n, c => sc.s ++ (ap.s ! n ! c) + s = \\n, c => sc.s ++ (ap.s ! n ! c) ; + h = ap.h } ; } diff --git a/src/turkish/CatTur.gf b/src/turkish/CatTur.gf index ced5d62f..527da0ff 100644 --- a/src/turkish/CatTur.gf +++ b/src/turkish/CatTur.gf @@ -1,4 +1,4 @@ -concrete CatTur of Cat = CommonX - [CAdv,AdN] ** open ResTur, Prelude in { +concrete CatTur of Cat = CommonX - [CAdv,AdN] ** open ResTur, HarmonyTur, Prelude, Predef in { flags optimize=all_subs ; @@ -10,11 +10,12 @@ concrete CatTur of Cat = CommonX - [CAdv,AdN] ** open ResTur, Prelude in { -- Noun - CN = {s : Number => Case => Str; gen : Number => Agr => Str} ; - NP = {s : Case => Str ; a : Agr} ; + CN = {s : Number => Case => Str; gen : Number => Agr => Str; h : Harmony} ; + NP = {s : Case => Str ; h : Harmony; a : Agr} ; + VP = Verb ; VPSlash = VP ** {c : Prep} ; - Conj = {s : Str ; s1 : Str ; s2 : Str ; ct : ConjType} ; + Comp = VP ; Pron = ResTur.Pron ; Det = {s : Str; n : Number; useGen : UseGen} ; @@ -22,7 +23,6 @@ concrete CatTur of Cat = CommonX - [CAdv,AdN] ** open ResTur, Prelude in { Card = {s : Number => Case => Str} ; Ord = {s : Number => Case => Str} ; Quant = {s : Str; useGen : UseGen} ; - Prep = {s : Str; c : Case} ; PrepNP = {s : Str} ; DAP = {s : Number => Case => Str} ; CAdv = {s : Str; p : Str; c : Case} ; @@ -32,7 +32,11 @@ concrete CatTur of Cat = CommonX - [CAdv,AdN] ** open ResTur, Prelude in { Digits = {s : CardOrd => Number => Case => Str ; n : Number; tail : DTail} ; -- Adjective - AP = {s : Number => Case => Str} ; + AP = {s : Number => Case => Str; h : Harmony} ; + + -- Structural + Conj = {s : Str; sep : Ints 4; n : Number} ; + Prep = {s : Str; c : Case} ; -- Open lexical classes, e.g. Lexicon V, VS, VV, VQ, VA = Verb ; diff --git a/src/turkish/ConjunctionTur.gf b/src/turkish/ConjunctionTur.gf index 034b8f52..75557ab3 100644 --- a/src/turkish/ConjunctionTur.gf +++ b/src/turkish/ConjunctionTur.gf @@ -1,38 +1,101 @@ concrete ConjunctionTur of Conjunction = - CatTur ** open ResTur, Coordination, Prelude in { + CatTur ** open ResTur, HarmonyTur, Coordination, Prelude, Predef in { lin - ConjNP _ _ = variants {} ; - ConsNP _ _ = variants {} ; - BaseNP _ _ = variants {} ; + ConjS conj ss = { + s = linCoord []!conj.sep ++ ss.s!conj.sep ++ conj.s ++ ss.s!4; + subord = linCoord []!conj.sep ++ ss.subord!conj.sep ++ conj.s ++ ss.subord!4; + } ; - ConsAP _ _ = variants {} ; + ConjNP conj ss = { + s = \\c => linCoord []!conj.sep ++ ss.s!c!conj.sep ++ conj.s ++ ss.s!c!4; + h = ss.h ; + a = conjAgr {n=conj.n; p=P3} ss.a + } ; + + BaseS x y = {s = table {4 => y.s; _ => x.s}; + subord = table {4 => y.subord; _ => x.subord}; + } ; + ConsS x xs = {s = table {4 => xs.s!4; t => x.s++linCoord bindComma!t++xs.s!t}; + subord = table {4 => xs.subord!4; t => x.subord++linCoord bindComma!t++xs.subord!t} ; + } ; + + BaseNP x y = + {s = \\c=>table {4 => y.s!c; _ => x.s!c}; + a = conjAgr x.a y.a; + h = y.h} ; + ConsNP x xs = + {s = \\c=>table {4 => xs.s!c!4; t => x.s!c++linCoord bindComma!t++xs.s!c!t}; + a = conjAgr xs.a x.a; + h = xs.h} ; + + ConjAP conj ss = { + s = \\n,c => linCoord []!conj.sep ++ ss.s!n!c!conj.sep ++ conj.s ++ ss.s!n!c!4; + h = ss.h + } ; + + BaseAP x y = + {s = \\n,c=>table {4 => y.s!n!c; _ => x.s!n!c}; + h = y.h + } ; + ConsAP x xs = + {s = \\n,c=>table {4 => xs.s!n!c!4; t => x.s!n!c++linCoord bindComma!t++xs.s!n!c!t}; + h = xs.h; + } ; + + ConjCN conj ss = { + s = \\n,c => linCoord []!conj.sep ++ ss.s!n!c!conj.sep ++ conj.s ++ ss.s!n!c!4; + gen = \\n,a => linCoord []!conj.sep ++ ss.gen!n!a!conj.sep ++ conj.s ++ ss.gen!n!a!4; + h = ss.h + } ; + + BaseCN x y = + {s = \\n,c=>table {4 => y.s!n!c; _ => x.s!n!c}; + gen = \\n,a=>table {4 => y.gen!n!a; _ => x.gen!n!a}; + h = y.h} ; + ConsCN x xs = + {s = \\n,c=>table {4 => xs.s!n!c!4; t => x.s!n!c++linCoord bindComma!t++xs.s!n!c!t}; + gen = \\n,a=>table {4 => xs.gen!n!a!4; t => x.gen!n!a++linCoord bindComma!t++xs.gen!n!a!t}; + h = xs.h} ; - -- TODO: ap2.s seems to irrelevant; investigate why. - BaseAP ap1 ap2 = { - s = ap1.s ! Sg ! Nom - } ; + ConjAdV conj ss = { + s = linCoord []!conj.sep ++ ss.s!conj.sep ++ conj.s ++ ss.s!4; + h = ss.h + } ; - ConjAP _ _ = variants {} ; + BaseAdV x y = + {s = table {4 => y.s; _ => x.s}; + h = y.h} ; + ConsAdV x xs = + {s = table {4 => xs.s!4; t => x.s++linCoord bindComma!t++xs.s!t}; + h = xs.h} ; - BaseAdV adv1 adv2 = { - s = adv1.s - } ; - ConsAdv _ _ = variants {} ; + ConjAdv conj ss = { + s = linCoord []!conj.sep ++ ss.s!conj.sep ++ conj.s ++ ss.s!4; + h = ss.h + } ; - BaseAdv adv1 adv2 = { - s = adv1.s - } ; + BaseAdv x y = + {s = table {4 => y.s; _ => x.s}; + h = y.h} ; + ConsAdv x xs = + {s = table {4 => xs.s!4; t => x.s++linCoord bindComma!t++xs.s!t}; + h = xs.h} ; - ConjAdv _ _ = variants {} ; ConjRS _ _ = variants {} ; ConsRS _ _ = variants {} ; BaseRS _ _ = variants {} ; - ConjS _ _ = variants {} ; - ConsS _ _ = variants {} ; - BaseS _ _ = variants {} ; + lincat + [S] = {s,subord : Ints 4 => Str} ; + [Adv] = {s : Ints 4 => Str} ; + [AdV] = {s : Ints 4 => Str} ; + [NP] = {s : Case => Ints 4 => Str; h : Harmony; a : Agr} ; + [AP] = {s : Number => Case => Ints 4 => Str; h : Harmony} ; + [CN] = {s : Number => Case => Ints 4 => Str; + gen : Number => Agr => Ints 4 => Str; + h : Harmony} ; } diff --git a/src/turkish/DocumentationTur.gf b/src/turkish/DocumentationTur.gf index 87369bdc..d00a3a24 100644 --- a/src/turkish/DocumentationTur.gf +++ b/src/turkish/DocumentationTur.gf @@ -31,11 +31,112 @@ lin ) } ; + InflectionA, InflectionA2 = \adj -> { + t = "n" ; + s1 = heading1 "Ön Ad" ; + s2 = frameTable ( + tr (th "" ++ th "tekil" ++ th "çoğul") ++ + tr (th "yalın" ++ td (adj.s ! Sg ! Nom) ++ td (adj.s ! Pl ! Nom)) ++ + tr (th "belirtme" ++ td (adj.s ! Sg ! Acc) ++ td (adj.s ! Pl ! Acc)) ++ + tr (th "yönelme" ++ td (adj.s ! Sg ! Dat) ++ td (adj.s ! Pl ! Dat)) ++ + tr (th "bulunma" ++ td (adj.s ! Sg ! Loc) ++ td (adj.s ! Pl ! Loc)) ++ + tr (th "ayrılma" ++ td (adj.s ! Sg ! Ablat) ++ td (adj.s ! Pl ! Ablat)) ++ + tr (th "tamlayan" ++ td (adj.s ! Sg ! Gen) ++ td (adj.s ! Pl ! Gen)) ++ + intagAttr "th" "colspan=\"3\"" "iyelik" ++ + tr (th "1. tekil" ++ td (adj.gen ! Sg ! {n = Sg; p = P1}) ++ td (adj.gen ! Pl ! {n = Sg; p = P1})) ++ + tr (th "2. tekil" ++ td (adj.gen ! Sg ! {n = Sg; p = P2}) ++ td (adj.gen ! Pl ! {n = Sg; p = P2})) ++ + tr (th "3. tekil" ++ td (adj.gen ! Sg ! {n = Sg; p = P3}) ++ td (adj.gen ! Pl ! {n = Sg; p = P3})) ++ + tr (th "1. çoğul" ++ td (adj.gen ! Sg ! {n = Pl; p = P1}) ++ td (adj.gen ! Pl ! {n = Pl; p = P1})) ++ + tr (th "2. çoğul" ++ td (adj.gen ! Sg ! {n = Pl; p = P2}) ++ td (adj.gen ! Pl ! {n = Pl; p = P2})) ++ + tr (th "3. çoğul" ++ td (adj.gen ! Sg ! {n = Pl; p = P3}) ++ td (adj.gen ! Pl ! {n = Pl; p = P3})) + ) ++ + heading1 ("Belirteç") ++ + paragraph (adj.adv) ; + } ; + + InflectionAdv = \adv -> { + t = "b" ; + s1= heading1 ("Belirteç") ; + s2= paragraph (adv.s) ; + } ; + + InflectionPrep = \prep -> { + t = "il" ; + s1= heading1 ("Ilgeç") ; + s2= paragraph (prep.s++"+"++ + case prep.c of { + Nom => "yalın" ; + Acc => "belirtme" ; + Dat => "yönelme" ; + Gen => "tamlayan" ; + Loc => "bulunma" ; + Ablat => "ayrılma" ; + Abess _ => "" + }) ; + s3= "" + } ; + + InflectionV, InflectionV2, InflectionVV, InflectionVS, InflectionVQ, + InflectionVA, InflectionV3, InflectionV2V, InflectionV2S, + InflectionV2Q, InflectionV2A = \v -> { + t = "f" ; + s1= heading1 ("Fiil") ; + s2= inflVerb v + } ; + lin NoDefinition t = {s=t.s}; + MkDefinition t d = {s="

Tarif:"++t.s++d.s++"

"}; + MkDefinitionEx t d e = {s="

Tarif:"++t.s++d.s++"

Örnek:"++e.s++"

"}; lin MkDocument d i e = {s = i.s1 ++ d.s ++ i.s2 ++ paragraph e.s} ; MkTag i = {s = i.t} ; +oper + inflVerb : Verb -> Str = \v -> + (heading2 ("Şimdiki zaman") ++ + finite VPres ++ + tag "br" ++ + finite VProg ++ + heading2 ("Geçmiş zaman") ++ + finite VPast ++ + heading2 ("Gelecek zaman") ++ + finite VFuture ++ + heading2 ("Emir kipi") ++ + paragraph (v.s ! VImperative) ++ + heading2 ("Eylemlik") ++ + paragraph (v.s ! VInfinitive) ++ + heading2 ("Ulaç") ++ + nounForm Gerund ++ + heading2 ("Ad") ++ + nounForm VNoun) + where { + finite : (Agr -> VForm) -> Str = \f -> + frameTable ( + tr (th "" ++ + th "tekil" ++ + th "çoğul") ++ + tr (th "1." ++ + td (v.s ! f {n=Sg; p=P1}) ++ + td (v.s ! f {n=Pl; p=P1})) ++ + tr (th "2." ++ + td (v.s ! f {n=Sg; p=P2}) ++ + td (v.s ! f {n=Pl; p=P2})) ++ + tr (th "3." ++ + td (v.s ! f {n=Sg; p=P3}) ++ + td (v.s ! f {n=Pl; p=P3})) + ) ; + + nounForm : (Number -> Case -> VForm) -> Str = \f -> + frameTable ( + tr (th "" ++ th "tekil" ++ th "çoğul") ++ + tr (th "yalın" ++ td (v.s ! f Sg Nom) ++ td (v.s ! f Pl Nom)) ++ + tr (th "belirtme" ++ td (v.s ! f Sg Acc) ++ td (v.s ! f Pl Acc)) ++ + tr (th "yönelme" ++ td (v.s ! f Sg Dat) ++ td (v.s ! f Pl Dat)) ++ + tr (th "bulunma" ++ td (v.s ! f Sg Loc) ++ td (v.s ! f Pl Loc)) ++ + tr (th "ayrılma" ++ td (v.s ! f Sg Ablat) ++ td (v.s ! f Pl Ablat)) ++ + tr (th "tamlayan" ++ td (v.s ! f Sg Gen) ++ td (v.s ! f Pl Gen)) + ) ; + } ; } diff --git a/src/turkish/NounTur.gf b/src/turkish/NounTur.gf index 982d4872..839ffad5 100644 --- a/src/turkish/NounTur.gf +++ b/src/turkish/NounTur.gf @@ -12,13 +12,17 @@ concrete NounTur of Noun = CatTur ** open ResTur, SuffixTur, HarmonyTur, Prelude YesGen a => \\c => det.s ++ cn.gen ! det.n ! a ; UseIndef => \\c => det.s ++ cn.s ! det.n ! c } ; + h = cn.h ; a = agrP3 det.n } ; UsePron p = p ; - -- TODO: look further into how correct this is. - UsePN pn = { s = \\c => pn.s ! Sg ! c; a = {n = Sg; p = P1}} ; + UsePN pn = { + s = \\c => pn.s ! Sg ! c; + h = pn.h; + a = {n = Sg; p = P3} + } ; PossPron p = {s = []; useGen = YesGen p.a} ; @@ -54,50 +58,72 @@ concrete NounTur of Noun = CatTur ** open ResTur, SuffixTur, HarmonyTur, Prelude Use2N3 n = variants {} ; - MassNP cn = { s = cn.s ! Sg; a = { n = Sg; p = P1 } } ; + MassNP cn = { + s = cn.s ! Sg; + h = cn.h; + a = { n = Sg; p = P1 } + } ; ComplN2 f x = - let - h : Harmony = {vow = f.harmony.vow; con = f.harmony.con} - in case f.c.c of { Nom => { s = \\n, c => x.s ! Gen ++ f.s ! n ! Acc; - gen = \\_, _ => "TODO" + gen = \\_, _ => "TODO"; + h = f.h }; - Acc => {s = \\_,_ => "TODO"; gen = \\_, _ => "TODO"}; + Acc => { + s = \\_,_ => "TODO"; + gen = \\_, _ => "TODO"; + h = f.h}; Gen => { s = \\n, c => x.s ! Gen ++ f.gen ! n ! {n = Sg; p = P3} - ++ BIND ++ (caseSuffixes ! c).st ! h.con ! h.vow; - gen = \\_, _ => "TODO" + ++ BIND ++ (caseSuffixes ! c).st ! f.h.con ! f.h.vow; + gen = \\_, _ => "TODO"; + h = f.h }; Dat => { s = \\n, c => x.s ! Gen ++ f.gen ! n ! {n = Sg; p = P3} - ++ datSuffixN.st ! h.con ! h.vow; - gen = \\_, _ => "TODO" + ++ datSuffixN.st ! f.h.con ! f.h.vow; + gen = \\_, _ => "TODO"; + h = f.h }; - Loc => {s = \\_,_ => "TODO"; gen = \\_, _ => "TODO"}; - Ablat => {s = \\_,_ => "TODO"; gen = \\_, _ => "TODO"}; - Abess _ => {s = \\_,_ => "TODO"; gen = \\_, _ => "TODO"} + Loc => { + s = \\_,_ => "TODO"; + gen = \\_, _ => "TODO"; + h = f.h + }; + Ablat => { + s = \\_,_ => "TODO"; + gen = \\_, _ => "TODO"; + h = f.h + }; + Abess _ => { + s = \\_,_ => "TODO"; + gen = \\_, _ => "TODO"; + h = f.h + } }; AdjCN ap cn = { s = \\n,c => ap.s ! Sg ! Nom ++ cn.s ! n ! c; - gen = \\n, a => ap.s ! Sg ! Nom ++ cn.gen ! n ! a + gen = \\n, a => ap.s ! Sg ! Nom ++ cn.gen ! n ! a; + h = cn.h } ; -- lin CN = {s : Number => Case => Str; gen : Number => Agr => Str} ; AdvCN cn adv = { s = \\n, c => adv.s ++ cn.s ! n ! c; - gen = \\n, a => adv.s ++ cn.gen ! n ! a + gen = \\n, a => adv.s ++ cn.gen ! n ! a; + h = cn.h } ; AdvNP np adv = { s = \\c => adv.s ++ np.s ! c; + h = np.h ; a = np.a } ; @@ -111,21 +137,23 @@ concrete NounTur of Noun = CatTur ** open ResTur, SuffixTur, HarmonyTur, Prelude -- TODO: further test how correct this is. ApposCN cn np = { - s = \\n,c => cn.s ! n ! c ++ np.s ! c ; - gen = cn.gen + s = \\n,c => cn.s ! n ! c ++ np.s ! c ; + gen = cn.gen ; + h = cn.h } ; ComplN3 f x = { - s = \\n, c => x.s ! Ablat ++ f.s ! n ! c ; - gen = f.gen ; - c = f.c2 ; - harmony = f.harmony ; + s = \\n, c => x.s ! Ablat ++ f.s ! n ! c ; + gen = f.gen ; + c = f.c2 ; + h = f.h ; } ; -- TODO: not entirely sure `CountNP` is sensible in Turkish but it should -- look something like this. CountNP det np = { s = \\c => det.s ++ np.s ! Ablat ; + h = np.h ; a = np.a } ; @@ -134,12 +162,14 @@ concrete NounTur of Noun = CatTur ** open ResTur, SuffixTur, HarmonyTur, Prelude -- TODO: further check the correctness of this. DetNP det = { s = \\c => det.s ; + h = {vow=I_Har; con=SCon Soft} ; -- to be fixed a = {n = det.n ; p = P1} } ; ExtAdvNP np adv = { s = \\c => np.s ! c ++ "," ++ adv.s ; - a = np.a + a = np.a ; + h = np.h } ; NumDigits n = { @@ -152,6 +182,7 @@ concrete NounTur of Noun = CatTur ** open ResTur, SuffixTur, HarmonyTur, Prelude PPartNP np v2 = { s = \\c => np.s ! c ++ v2.s ! (VPast np.a); + h = np.h ; a = np.a } ; @@ -161,35 +192,41 @@ concrete NounTur of Noun = CatTur ** open ResTur, SuffixTur, HarmonyTur, Prelude -- Further check the correctness. PartNP cn np = { s = \\n,c => np.s ! Gen ++ cn.s ! n ! Gen ; - gen = cn.gen + gen = cn.gen ; + h = cn.h } ; PossNP cn np = { s = \\n,c => np.s ! Gen ++ cn.s ! n ! c ; - gen = cn.gen + gen = cn.gen ; + h = cn.h } ; -- TODO: currently I am not able to generate trees for this but should be -- quite close what is needed. PredetNP pred np = { s = \\c => pred.s ++ np.s ! c ; + h = np.h ; a = np.a } ; SentCN cn sc = { - s = \\n,c => "(TODO: SentCN)" ; - gen = cn.gen + s = \\n,c => "(TODO: SentCN)" ; + gen = cn.gen ; + h = cn.h } ; -- TODO: currently not able to generate trees. RelCN cn rs = { s = \\n,c => "(TODO: RelCN)" ; - gen = cn.gen + gen = cn.gen ; + h = cn.h } ; RelNP np rs = { s = \\c => "(TODO: RelNP)" ; gen = np.gen ; + h = np.h ; a = np.a ; c = np.c } ; diff --git a/src/turkish/ParadigmsTur.gf b/src/turkish/ParadigmsTur.gf index 580b9c5b..36f220dd 100644 --- a/src/turkish/ParadigmsTur.gf +++ b/src/turkish/ParadigmsTur.gf @@ -143,10 +143,10 @@ resource ParadigmsTur = open regN : Str -> N ; -- Paradigm for proper noun - regPN : Str -> Noun ; + regPN : Str -> PN ; -- Worst case function for proper nouns - makePN : Str -> Str -> Noun ; + makePN : Str -> Str -> PN ; -- digits can be seen as proper noun, but we need an additional harmony argument -- since harmony information can not be extracted from digit string. @@ -322,31 +322,31 @@ resource ParadigmsTur = open lin N { s = table { Sg => table { - Nom => sn ; - Acc => sa ; - Dat => sd ; - Gen => sg ; - Loc => sl ; - Ablat => sabl ; - Abess Pos => sgabPos ; + Nom => sn ; + Acc => sa ; + Dat => sd ; + Gen => sg ; + Loc => sl ; + Ablat => sabl ; + Abess Pos => sgabPos ; Abess Neg => sgabNeg - } ; + } ; Pl => table { - Abess Pos => addSuffix sgabPos plHar plSuffix; - Abess Neg => addSuffix sgabNeg plHar plSuffix; - c => addSuffix pln plHar (caseSuffixes ! c) - } - } ; + Abess Pos => addSuffix sgabPos plHar plSuffix; + Abess Neg => addSuffix sgabNeg plHar plSuffix; + c => addSuffix pln plHar (caseSuffixes ! c) + } + } ; gen = table { Sg => table { - -- Genitive suffix for P3 is always -ları, always selecting plural form of - -- base and harmony is a trick to implement this - {n=Pl; p=P3} => addSuffix pln plHar genPlP3Suffix ; - s => addSuffix sgs har (genSuffixes ! s) - } ; + -- Genitive suffix for P3 is always -ları, always selecting plural form of + -- base and harmony is a trick to implement this + {n=Pl; p=P3} => addSuffix pln plHar genPlP3Suffix ; + s => addSuffix sgs har (genSuffixes ! s) + } ; Pl => \\s => addSuffix pln plHar (genSuffixes ! s) - } ; - harmony = har + } ; + h = har } ; irregN_h sn sg har = irregN har sn sg ; @@ -429,33 +429,33 @@ resource ParadigmsTur = open plHar = getHarmony pn in lin N { s = table { - Sg => table { - Nom => sn ; --tereyağı - Acc => addSuffix sn sgHar accSuffixN ; --tereyağını - Dat => addSuffix sn sgHar datSuffixN ; --tereyağına - Gen => addSuffix sn sgHar genSuffix ; --tereyağının - Loc => addSuffix sn sgHar locSuffixN ; --tereyağında - Ablat => addSuffix sn sgHar ablatSuffixN ; --tereyağından - Abess Pos => sgAbessPos ; --tereyağlı - Abess Neg => sgAbessNeg --tereyağsız - } ; - Pl => table { - Nom => pn ;--tereyağları - Acc => addSuffix pn plHar accSuffixN ; --tereyağlarını - Dat => addSuffix pn plHar datSuffixN ; --tereyağlarına - Gen => addSuffix pn plHar genSuffix ; --tereyağlarının - Loc => addSuffix pn plHar locSuffixN ; --tereyağlarında - Ablat => addSuffix pn plHar ablatSuffixN ; --tereyağlarından - Abess Pos => addSuffix sgAbessPos plHar abessPosSuffix ; --tereyağlılar - Abess Neg => addSuffix sgAbessNeg plHar abessNegSuffix --tereyağsızlar + Sg => table { + Nom => sn ; --tereyağı + Acc => addSuffix sn sgHar accSuffixN ; --tereyağını + Dat => addSuffix sn sgHar datSuffixN ; --tereyağına + Gen => addSuffix sn sgHar genSuffix ; --tereyağının + Loc => addSuffix sn sgHar locSuffixN ; --tereyağında + Ablat => addSuffix sn sgHar ablatSuffixN ; --tereyağından + Abess Pos => sgAbessPos ; --tereyağlı + Abess Neg => sgAbessNeg --tereyağsız + } ; + Pl => table { + Nom => pn ;--tereyağları + Acc => addSuffix pn plHar accSuffixN ; --tereyağlarını + Dat => addSuffix pn plHar datSuffixN ; --tereyağlarına + Gen => addSuffix pn plHar genSuffix ; --tereyağlarının + Loc => addSuffix pn plHar locSuffixN ; --tereyağlarında + Ablat => addSuffix pn plHar ablatSuffixN ; --tereyağlarından + Abess Pos => addSuffix sgAbessPos plHar abessPosSuffix ; --tereyağlılar + Abess Neg => addSuffix sgAbessNeg plHar abessNegSuffix --tereyağsızlar } } ; gen = case ct of { Con => \\num,agr => n1sn + n2.gen ! num ! agr ; Sep => \\num,agr => n1sn ++ n2.gen ! num ! agr - } ; - harmony = sgHar - } ; + } ; + h = sgHar + } ; mkN = overload { mkN : (araba : Str) -> N = @@ -571,6 +571,9 @@ resource ParadigmsTur = open n = num } ; + mkConj : Str -> Number -> Conj = + \s,n -> {s = s; sep = 3; n = n; lock_Conj = <>} ; + -- Helper functions and parameters -- finds which aorist type will be used with a base, see aorist type parameter for more info getAoristType : Str -> AoristType = @@ -608,7 +611,7 @@ resource ParadigmsTur = open ablat_Case : Prep = mkPrep [] Ablat; dat_Case : Prep = mkPrep [] Dat; - acc_Case : Prep = mkPrep [] Dat; + acc_Case : Prep = mkPrep [] Acc; mkQuant : Str -> Quant = \s -> lin Quant {s=s; useGen = NoGen} ; diff --git a/src/turkish/ResTur.gf b/src/turkish/ResTur.gf index ecd8b4a9..8c6f7496 100644 --- a/src/turkish/ResTur.gf +++ b/src/turkish/ResTur.gf @@ -16,14 +16,20 @@ resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur in { Agr = {n : Number ; p : Person} ; Noun = { s : Number => Case => Str ; - gen : Number => Agr => Str ; - harmony : Harmony + gen : Number => Agr => Str ; + h : Harmony } ; - Pron = {s : Case => Str; a : Agr} ; + Pron = {s : Case => Str ; + h : Harmony; + a : Agr} ; agrP3 : Number -> Agr ; agrP3 n = {n = n; p = P3} ; -- For $Adjective$ + + conjAgr : Agr -> Agr -> Agr = \a,b -> + {n=conjNumber a.n b.n; p=conjPerson a.p b.p} ; + oper Adjective = Noun ** { adv : Str } ; @@ -69,6 +75,7 @@ resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur in { Abess Pos => benli ; Abess Neg => bensiz } ; + h = getHarmony ben ; a = {n=n; p=p} ; } ; @@ -78,8 +85,12 @@ resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur in { mkPrep : Str -> Case -> {s : Str; c : Case; lock_Prep : {}} = \s, c -> lin Prep {s=s; c=c}; - mkNP : Noun -> Number -> Person -> {s : Case => Str; a : Agr} = - \noun, n, p -> {s = noun.s ! n; a = {n = n; p = p}} ; + mkNP : Noun -> Number -> Person -> {s : Case => Str; h : Harmony; a : Agr} = + \noun, n, p -> { + s = noun.s ! n; + h = noun.h; + a = {n = n; p = p} + } ; mkClause : Str -> Agr -> Verb -> {s : Tense => Str; subord : Str} = \np, a, v -> { @@ -95,28 +106,6 @@ resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur in { mkDet : Str -> Number -> UseGen -> {s : Str; n : Number; useGen : UseGen} = \s, n, ug -> {s = s; n = n; useGen = ug} ; - mkConj : overload { - mkConj : Str -> {s : Str ; s1 : Str ; s2 : Str ; ct : ConjType} ; - mkConj : Str -> Str -> {s : Str ; s1 : Str ; s2 : Str ; ct : ConjType} ; - } ; - - mkConj = overload { - mkConj : Str -> {s : Str ; s1 : Str ; s2 : Str ; ct : ConjType} = - \s -> { - s = s ; - s1 = s ; - s2 = [] ; - ct = Infix - } ; - mkConj : Str -> Str -> {s : Str ; s1 : Str ; s2 : Str ; ct : ConjType} = - \s1, s2 -> { - s = s1 ++ s2 ; - s1 = s1 ; - s2 = s2 ; - ct = Mixfix - } ; - } ; - attachMe : Verb -> {s : Str} = \v -> let @@ -126,4 +115,8 @@ resource ResTur = ParamX ** open Prelude, Predef, HarmonyTur in { (_ + #vowel + _ )* + (_ + #frontVowel + _) => ss (s ++ "me") ; (_ + #vowel + _)* + (_ + #backVowel + _) => ss (s ++ "ma") } ; + + linCoord : Str -> Ints 4 => Str ; + linCoord comma = table {0 => "hem"; 1=>"ya"; 2=>"ne"; 3=>comma; 4=>[]} ; + } diff --git a/src/turkish/StructuralTur.gf b/src/turkish/StructuralTur.gf index ada43998..62db6591 100644 --- a/src/turkish/StructuralTur.gf +++ b/src/turkish/StructuralTur.gf @@ -83,9 +83,8 @@ concrete StructuralTur of Structural = CatTur ** between_Prep = mkPrep "arasındaki" Gen ; - and_Conj = mkConj "ile" ; - - or_Conj = mkConj "veya" ; + and_Conj = mkConj "ve" Pl ; + or_Conj = mkConj "veya" Sg ; yes_Utt = ss "evet" ; no_Utt = ss "hayır" ; @@ -136,8 +135,8 @@ concrete StructuralTur of Structural = CatTur ** if_Subj = {s = "eğer"} ; - both7and_DConj = mkConj "hem" "hem de" ; - either7or_DConj = mkConj "ya" "ya da" ; + both7and_DConj = mkConj "hem de" Pl ** {sep=0} ; + either7or_DConj = mkConj "ya da" Sg ** {sep=1} ; few_Det = mkDet "birkaç" Sg NoGen ; @@ -182,10 +181,6 @@ concrete StructuralTur of Structural = CatTur ** how_IAdv = {s = "nasıl"} ; - -- Conditionals in Turkish are handled through inflections. - -- I will decide what to do with this later. - if_then_Conj = mkConj "foo" "bar" ; - -- TODO: in8front_Prep in8front_Prep = mkPrep "önünde" Gen ; @@ -252,10 +247,6 @@ concrete StructuralTur of Structural = CatTur ** whatSg_IP = { s = "ne" } ; - -- Not sure what this is for given that we have separate functions for the - -- plural "what" case and the singular "what" case. - what_IP = { s = "ne" } ; - when_IAdv = { s = "ne zaman" } ; which_IQuant = { s = "hangi" } ; diff --git a/src/turkish/SuffixTur.gf b/src/turkish/SuffixTur.gf index a1ce3e6a..7bd64934 100644 --- a/src/turkish/SuffixTur.gf +++ b/src/turkish/SuffixTur.gf @@ -95,6 +95,21 @@ resource SuffixTur = open Prelude, Predef, ResTur, HarmonyTur in { p1PlVerbalSuffix : Suffix = regSuffix "iz" "k" ; p2PlVerbalSuffix : Suffix = regSuffix21 "siniz" "niz" ; p3PlVerbalSuffix : Suffix = regSuffix "ler" "ler" ; + + p1SgAlethicCopulaSuffix : Suffix = regSuffix "dim" "ydim" ; + p2SgAlethicCopulaSuffix : Suffix = regSuffix "din" "ydin" ; + p3SgAlethicCopulaSuffix : Suffix = regSuffix "di" "ydi" ; + p1PlAlethicCopulaSuffix : Suffix = regSuffix "dik" "ydik" ; + p2PlAlethicCopulaSuffix : Suffix = regSuffix "diniz" "ydiniz" ; + p3PlAlethicCopulaSuffix : Suffix = regSuffix "diler" "ydiler" ; + + p1SgCondCopulaSuffix : Suffix = regSuffix "sem" "sem" ; + p2SgCondCopulaSuffix : Suffix = regSuffix "sen" "sen" ; + p3SgCondCopulaSuffix : Suffix = regSuffix "se" "se" ; + p1PlCondCopulaSuffix : Suffix = regSuffix "sek" "sek" ; + p2PlCondCopulaSuffix : Suffix = regSuffix21 "seniz" "seniz" ; + p3PlCondCopulaSuffix : Suffix = regSuffix "lerse" "lerse" ; + subordSuffixDik : Suffix = regSuffix2 "dik" "dikler" ; softSubordSuffixDik : Suffix = regSuffix2 "diğ" "dikler" ; @@ -135,6 +150,26 @@ resource SuffixTur = open Prelude, Predef, ResTur, HarmonyTur in { {n=Pl; p=P3} => p3PlVerbalSuffix } ; + alethicCopulaSuffixes : Agr => Suffix = + table { + {n=Sg; p=P1} => p1SgAlethicCopulaSuffix ; + {n=Sg; p=P2} => p2SgAlethicCopulaSuffix ; + {n=Sg; p=P3} => p3SgAlethicCopulaSuffix ; + {n=Pl; p=P1} => p1PlAlethicCopulaSuffix ; + {n=Pl; p=P2} => p2PlAlethicCopulaSuffix ; + {n=Pl; p=P3} => p3PlAlethicCopulaSuffix + } ; + + condCopulaSuffixes : Agr => Suffix = + table { + {n=Sg; p=P1} => p1SgCondCopulaSuffix ; + {n=Sg; p=P2} => p2SgCondCopulaSuffix ; + {n=Sg; p=P3} => p3SgCondCopulaSuffix ; + {n=Pl; p=P1} => p1PlCondCopulaSuffix ; + {n=Pl; p=P2} => p2PlCondCopulaSuffix ; + {n=Pl; p=P3} => p3PlCondCopulaSuffix + } ; + -- Adds a suffix to the base given as Str using Harmony. -- If only one form of base is given then it is assumed that base does not soften addSuffix = overload { @@ -148,6 +183,8 @@ resource SuffixTur = open Prelude, Predef, ResTur, HarmonyTur in { addSuffixTable : (Softness => Str) -> Harmony -> Suffix -> Str = \baseTable,har,suf -> (baseTable ! suf.stemT) + suf.st ! har.con ! har.vow ; + suffixStr : Harmony -> Suffix -> Str = + \har,suf -> BIND ++ suf.st ! har.con ! har.vow ; regSuffix larC larV = { diff --git a/src/turkish/SymbolTur.gf b/src/turkish/SymbolTur.gf index 682a6d17..52085b2a 100644 --- a/src/turkish/SymbolTur.gf +++ b/src/turkish/SymbolTur.gf @@ -3,7 +3,7 @@ concrete SymbolTur of Symbol = CatTur ** open Prelude, ResTur, HarmonyTur in { lin - SymbPN i = {s,gen = \\_,_ => i.s ; harmony = {vow=I_Har; con=SCon Soft}} ; -- just a placeholder, probably wrong + SymbPN i = {s,gen = \\_,_ => i.s ; h = {vow=I_Har; con=SCon Soft}} ; -- just a placeholder, probably wrong {- TODO! IntPN i = {s = addGenitiveS i.s ; g = Neutr} ; diff --git a/src/turkish/VerbTur.gf b/src/turkish/VerbTur.gf index 60318ea2..9a370084 100644 --- a/src/turkish/VerbTur.gf +++ b/src/turkish/VerbTur.gf @@ -1,4 +1,4 @@ -concrete VerbTur of Verb = CatTur ** open ResTur in { +concrete VerbTur of Verb = CatTur ** open Prelude, ResTur, SuffixTur, HarmonyTur in { lin UseV v = v ; @@ -26,10 +26,42 @@ concrete VerbTur of Verb = CatTur ** open ResTur in { ComplVV _ _ = variants {} ; ComplVQ _ _ = variants {} ; - UseComp _ = variants {} ; + UseComp comp = comp ; CompCN _ = variants {} ; - CompNP _ = variants {} ; - CompAP _ = variants {} ; + + CompNP ap = lin VP { + s = table { + VPres agr => ap.s ! Nom ++ + case agr of { + {n=Sg; p=P3} => [] ; + _ => suffixStr ap.h (verbSuffixes ! agr) + } ; + VProg agr => ap.s ! Nom ; + VPast agr => ap.s ! Nom ++ + suffixStr ap.h (alethicCopulaSuffixes ! agr); + VFuture agr => ap.s ! Nom ++ + addSuffix "olacağ" (mkHar I_Har (SCon Hard)) (verbSuffixes ! agr) ; + VInfinitive => ap.s ! Nom ++ "olmak" ; + _ => "TODO" + } + } ; + + CompAP ap = lin VP { + s = table { + VPres agr => case agr.p of { + P3 => ap.s ! Sg ! Nom ; + _ => ap.s ! agr.n ! Nom ++ suffixStr ap.h (verbSuffixes ! agr) + } ; + VProg agr => ap.s ! agr.n ! Nom ; + VPast agr => ap.s ! agr.n ! Nom ++ + suffixStr ap.h (alethicCopulaSuffixes ! agr); + VFuture agr => ap.s ! agr.n ! Nom ++ + addSuffix "olacağ" (mkHar I_Har (SCon Hard)) (verbSuffixes ! agr) ; + VInfinitive => ap.s ! Sg ! Nom ++ "olmak" ; + _ => "TODO" + } + } ; + CompAdv _ = variants {} ; ReflVP = variants {} ;