From 79262fb73fab7f8918e667841a3a64a145092f88 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 31 Mar 2020 15:22:19 +0200 Subject: [PATCH 01/53] (Jpn) Automatic whitespace adjustment --- src/japanese/ResJpn.gf | 185 ++++++++++++++++++++--------------------- 1 file changed, 92 insertions(+), 93 deletions(-) diff --git a/src/japanese/ResJpn.gf b/src/japanese/ResJpn.gf index aac90e1a..b80691ab 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,7 +158,7 @@ oper dropNaEnging = symb.s ++ "番目の" } ; - VerbalA : Str -> Str -> Adj = \kekkonshiteiru,kikonno -> + VerbalA : Str -> Str -> Adj = \kekkonshiteiru,kikonno -> let kekkonshite = Predef.tk 2 kekkonshiteiru in { @@ -166,15 +166,15 @@ oper 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 } ; } - From b215395044b150db130a08f332c7c07a67430334 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 31 Mar 2020 15:23:23 +0200 Subject: [PATCH 02/53] (Jpn) Remove space between te-form and iru in verbal adj --- src/japanese/ResJpn.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/japanese/ResJpn.gf b/src/japanese/ResJpn.gf index b80691ab..70044fb9 100644 --- a/src/japanese/ResJpn.gf +++ b/src/japanese/ResJpn.gf @@ -160,9 +160,9 @@ oper 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 ; From 7c275c1c2807d748ef0e2206e26eacc22be4ddcf Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Wed, 1 Apr 2020 11:07:09 +0200 Subject: [PATCH 03/53] started Czech with a mini-like coverage --- src/czech/AdjectiveCze.gf | 19 + src/czech/AdverbCze.gf | 9 + src/czech/AllCze.gf | 6 + src/czech/AllCzeAbs.gf | 6 + src/czech/CatCze.gf | 65 +++ src/czech/ConjunctionCze.gf | 56 +++ src/czech/GrammarCze.gf | 19 + src/czech/IdiomCze.gf | 5 + src/czech/LangCze.gf | 10 + src/czech/LexiconCze.gf | 59 +++ src/czech/NounCze.gf | 100 +++++ src/czech/NumeralCze.gf | 118 ++++++ src/czech/ParadigmsCze.gf | 29 ++ src/czech/PhraseCze.gf | 19 + src/czech/QuestionCze.gf | 7 + src/czech/RelativeCze.gf | 18 + src/czech/ResCze.gf | 806 ++++++++++++++++++++++++++++++++++++ src/czech/SentenceCze.gf | 31 ++ src/czech/StructuralCze.gf | 25 ++ src/czech/SymbolCze.gf | 9 + src/czech/TenseCze.gf | 20 + src/czech/TextCze.gf | 8 + src/czech/VerbCze.gf | 48 +++ 23 files changed, 1492 insertions(+) create mode 100644 src/czech/AdjectiveCze.gf create mode 100644 src/czech/AdverbCze.gf create mode 100644 src/czech/AllCze.gf create mode 100644 src/czech/AllCzeAbs.gf create mode 100644 src/czech/CatCze.gf create mode 100644 src/czech/ConjunctionCze.gf create mode 100644 src/czech/GrammarCze.gf create mode 100644 src/czech/IdiomCze.gf create mode 100644 src/czech/LangCze.gf create mode 100644 src/czech/LexiconCze.gf create mode 100644 src/czech/NounCze.gf create mode 100644 src/czech/NumeralCze.gf create mode 100644 src/czech/ParadigmsCze.gf create mode 100644 src/czech/PhraseCze.gf create mode 100644 src/czech/QuestionCze.gf create mode 100644 src/czech/RelativeCze.gf create mode 100644 src/czech/ResCze.gf create mode 100644 src/czech/SentenceCze.gf create mode 100644 src/czech/StructuralCze.gf create mode 100644 src/czech/SymbolCze.gf create mode 100644 src/czech/TenseCze.gf create mode 100644 src/czech/TextCze.gf create mode 100644 src/czech/VerbCze.gf diff --git a/src/czech/AdjectiveCze.gf b/src/czech/AdjectiveCze.gf new file mode 100644 index 00000000..1ec27121 --- /dev/null +++ b/src/czech/AdjectiveCze.gf @@ -0,0 +1,19 @@ +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} ; + +} 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..f28f25ca --- /dev/null +++ b/src/czech/CatCze.gf @@ -0,0 +1,65 @@ +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} ; ---- + QCl = {subj,clit,compl : Str ; verb : VerbForms ; a : Agr} ; ---- + IAdv = {s : Str} ; + + RS = {s : Agr => Str} ; + RCl = {subj,clit,compl : Agr => Str ; verb : VerbForms} ; ---- RAgr + RP = AdjForms ; + + VP = {verb : VerbForms ; clit,compl : Agr => Str} ; ---- + 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} ; ---- + PN = {s : Case => Str ; g : Gender} ; ---- + Det = {s : Gender => Case => Str ; n : NumSize} ; + Quant = {s : Gender => Number => Case => Str} ; -- same as AP + Num = {s : Gender => Case => Str ; n : NumSize} ; + Card = {s : Gender => Case => Str ; n : NumSize} ; + Pron = PronForms ; + + Adv = {s : Str} ; + Prep = ResCze.ComplementCase ; -- {s : Str ; c : Case ; hasPrep : Bool} ; + Conj = {s1,s2 : Str} ; ---- + + 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} ; + + linref + N = \s -> s.snom ; + A = \s -> s.msnom ; + + + lincat Numeral = {s : NumeralForms ; size : NumSize} ; + lincat Digits = {s:Str ; n : 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/NounCze.gf b/src/czech/NounCze.gf new file mode 100644 index 00000000..7e6bbb0a --- /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.n c ; + a = numSizeAgr cn.g det.n 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.n ! c ; + n = num.n + } ; + + DefArt = {s = \\_,_,_ => []} ; + IndefArt = {s = \\_,_,_ => []} ; + NumPl = {s = \\_,_ => [] ; n = Num2_4} ; + NumSg = {s = \\_,_ => [] ; n = 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 ; ---- + g = cn.g + } ; + + NumCard c = c ; + NumDigits ds = ds ** {s = \\_,_ => ds.s} ; + NumNumeral nu = {s = numeralFormsDeterminer nu.s ; n = nu.size} ; ---- TODO: inflection of numerals + + +} diff --git a/src/czech/NumeralCze.gf b/src/czech/NumeralCze.gf new file mode 100644 index 00000000..84313789 --- /dev/null +++ b/src/czech/NumeralCze.gf @@ -0,0 +1,118 @@ +concrete NumeralCze of Numeral = + + CatCze ** + + open + ResCze, + Prelude + in { + +-- from gf-contrib/numerals/czech.gf, added inflections +-- AR 2020-03-20 + + +oper LinNumeral = {s : NumeralForms ; size : NumSize} ; +oper LinDigit = {unit : NumeralForms ; teen, ten, hundred : Str ; size : NumSize} ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; + +lincat Sub100 = LinNumeral ; +lincat Sub1000 = LinNumeral ; +lincat Sub1000000 = LinNumeral ; + +oper mkNum : NumeralForms -> Str -> Str -> Str -> NumSize -> LinDigit = + \dva, dvanast, dvadsat, dveste, sz -> { + unit = dva ; + teen = dvanast + "náct" ; + ten = dvadsat ; + hundred = dveste ; + size = sz + } ; + +oper mk2Num : NumeralForms -> Str -> Str -> Str -> LinDigit = + \unit, teenbase, tenbase, hundred -> + mkNum unit teenbase (tenbase + "cet") hundred Num2_4 ; + +oper mk5Num : Str -> Str -> Str -> Str -> LinDigit = + \unit,uniti, teenbase, tenbase -> + mkNum (regNumeralForms unit uniti) teenbase (tenbase + "desát") (unit ++ "set") Num5 ; + +oper bigNumeral : Str -> LinNumeral = \s -> {s = invarNumeralForms s ; size = Num5} ; + +lin num x = x ; + +lin n2 = mk2Num twoNumeralForms "dva" "dva" ("dvě" ++ "stě") ; +lin n3 = mk2Num threeNumeralForms "tři" "tři" ("tři" ++ "sta") ; +lin n4 = mk2Num fourNumeralForms "č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 = oneNumeralForms ; 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 = invarNumeralForms (d.ten ++ e.unit.msnom) ; ---- 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 = invarNumeralForms (d.hundred ++ e.s.msnom) ; ---- TODO inflection? + size = tfSize e.size + } ; + +lin pot2as3 n = n ; +lin pot3 n = bigNumeral (mkTh n.s.msnom n.size) ; + +lin pot3plus n m = { + s = invarNumeralForms (mkTh n.s.msnom n.size ++ m.s.msnom) ; ---- 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" + } ; + + + +-- -- Numerals as sequences of digits have a separate, simpler grammar + lincat Dig = {s:Str ; n : NumSize} ; + + lin + IDig d = d; + + IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s ; n = Num5} ; ---- leading zeros ?? + + D_0 = { s = "0" ; n = Num1} ; ---- ?? + D_1 = { s = "1" ; n = Num1} ; + D_2 = { s = "2" ; n = Num2_4} ; + D_3 = { s = "3" ; n = Num2_4} ; + D_4 = { s = "4" ; n = Num2_4} ; + D_5 = { s = "5" ; n = Num5} ; + D_6 = { s = "6" ; n = Num5} ; + D_7 = { s = "7" ; n = Num5} ; + D_8 = { s = "8" ; n = Num5} ; + D_9 = { s = "9" ; n = Num5} ; + +} diff --git a/src/czech/ParadigmsCze.gf b/src/czech/ParadigmsCze.gf new file mode 100644 index 00000000..e2372853 --- /dev/null +++ b/src/czech/ParadigmsCze.gf @@ -0,0 +1,29 @@ +resource ParadigmsCze = open CatCze, ResCze, Prelude in { + +oper + 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} ; + + 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) + }) ; + + 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} ; + } ; + + +} 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..0d4471a4 --- /dev/null +++ b/src/czech/ResCze.gf @@ -0,0 +1,806 @@ +resource ResCze = open Prelude in { + + +-- 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 ; ----- + +-- 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") => 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 + "i" ; + _ => Predef.error ("shortFemPlGen does not apply to" ++ s) + } ; + +--------------- +-- Nouns + + Noun : Type = {s : Number => Case => Str ; g : Gender} ; + NounForms : Type = {snom,sgen,sdat,sacc,svoc,sloc,sins, pnom,pgen,pdat,pacc,ploc,pins : Str ; g : Gender} ; + + 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 + } ; + + + DeclensionType : Type = Str -> NounForms ; + + declensionType : (nom,gen : Str) -> Gender -> DeclensionType + = \nom,gen,g -> 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) + } ; + +-- source: https://en.wikipedia.org/wiki/Czech_declension + + declPAN : DeclensionType = \pan -> --- plural nom ové|i|é should be given as extra arg 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 + "tele" ; + _ => 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,sins = ruz + "i" ; + + 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 + + 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 ; + } ; + +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" ; + } ; + + 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 + } ; + + 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 + +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 + } ; + + 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 ; + } ; + +-- Numerals + + -- singular forms of demonstratives + NumeralForms : Type = { + msnom, fsnom, nsnom, + msgen, fsgen, + msdat, + fsacc, + msloc, + msins, fsins : Str + } ; + + numeralFormsDeterminer : NumeralForms -> (Gender => Case => Str) = + \nume -> + let + dem = nume ** + {mpnom, fpnom, pgen, pdat, pins = nume.msnom} ; --- plural forms not used + demAdj = dem ** {fsdat = dem.fsgen} ; + adjAdj = adjFormsAdjective demAdj + in + \\g,c => adjAdj.s ! g ! Sg ! c ; + + + -- example: number 1 + oneNumeralForms : NumeralForms = mkDemPronForms "jed" ; + + -- numbers 2,3,4 ---- to check if everything comes out right with this type + twoNumeralForms : NumeralForms = { + msnom = "dva" ; fsnom, nsnom, fsacc = "dvě" ; + msgen, fsgen, msloc = "dvou" ; + msdat, msins, fsins = "dvěma" + } ; + + threeNumeralForms : NumeralForms = { + msnom, fsnom, nsnom, fsacc, msgen, fsgen = "tři" ; + msdat = "třem" ; + msloc = "třech" ; + msins,fsins = "třemi" ; + } ; + + fourNumeralForms : NumeralForms = { + msnom, fsnom, nsnom, fsacc = "čtyři" ; + msgen, fsgen = "čtyř" ; + msdat = "čtyřem" ; + msloc = "čtyřech" ; + msins,fsins = "čtyřmi" ; + } ; + + -- for the numbers 5 upwards + regNumeralForms : Str -> Str -> NumeralForms = \pet,peti -> { + msnom,fsnom,nsnom = pet ; + msgen, fsgen, msdat, fsacc, msloc, msins, fsins = peti + } ; + + invarNumeralForms : Str -> NumeralForms = \sto -> + regNumeralForms sto sto ; + +-------------------------------- +-- combining nouns with numerals + +param + NumSize = Num1 | Num2_4 | Num5 ; -- essential grammar 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 + } ; +} \ No newline at end of file diff --git a/src/czech/SentenceCze.gf b/src/czech/SentenceCze.gf new file mode 100644 index 00000000..15e80b4c --- /dev/null +++ b/src/czech/SentenceCze.gf @@ -0,0 +1,31 @@ +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 ; + } ; + + UseQCl temp pol cl = { + s = temp.s ++ cl.clit ++ pol.s ++ verbAgr cl.verb cl.a pol.p ++ cl.subj ++ cl.compl ; ---- inversion optional + } ; + + 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..23928f01 --- /dev/null +++ b/src/czech/StructuralCze.gf @@ -0,0 +1,25 @@ +concrete StructuralCze of Structural = CatCze ** + open ParadigmsCze, ResCze, Prelude in { + +lin + and_Conj = mkConj "i" ; +---- by8agent_Prep : Prep +---- few_Det : Det + 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 : Det + or_Conj = mkConj "nebo" ; +---- somePl_Det : Det +---- something_NP : NP + 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..8b7fd596 --- /dev/null +++ b/src/czech/SymbolCze.gf @@ -0,0 +1,9 @@ +--# -path=.:../abstract:../common:../prelude + +concrete SymbolCze of Symbol = CatCze ** open Prelude, ResCze in { + +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 + } ; + +} From 0f763b7960e3470477cf35ad5b42a3c947aad1dc Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Wed, 1 Apr 2020 11:42:42 +0200 Subject: [PATCH 04/53] api for Czech with backup for missing --- src/api/CombinatorsCze.gf | 9 ++++ src/api/ConstructorsCze.gf | 5 ++ src/api/SymbolicCze.gf | 6 +++ src/api/SyntaxCze.gf | 4 ++ src/api/TryCze.gf | 13 +++++ src/czech/CatCze.gf | 5 ++ src/czech/MissingCze.gf | 103 +++++++++++++++++++++++++++++++++++++ src/czech/StructuralCze.gf | 1 + 8 files changed, 146 insertions(+) create mode 100644 src/api/CombinatorsCze.gf create mode 100644 src/api/ConstructorsCze.gf create mode 100644 src/api/SymbolicCze.gf create mode 100644 src/api/SyntaxCze.gf create mode 100644 src/api/TryCze.gf create mode 100644 src/czech/MissingCze.gf 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/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/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/czech/CatCze.gf b/src/czech/CatCze.gf index f28f25ca..6808ba21 100644 --- a/src/czech/CatCze.gf +++ b/src/czech/CatCze.gf @@ -53,6 +53,11 @@ concrete CatCze of Cat = 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 ; diff --git a/src/czech/MissingCze.gf b/src/czech/MissingCze.gf new file mode 100644 index 00000000..eaf4d1e2 --- /dev/null +++ b/src/czech/MissingCze.gf @@ -0,0 +1,103 @@ +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 UseComparA : A -> AP = notYet "UseComparA" ; +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/StructuralCze.gf b/src/czech/StructuralCze.gf index 23928f01..60a5c4ce 100644 --- a/src/czech/StructuralCze.gf +++ b/src/czech/StructuralCze.gf @@ -12,6 +12,7 @@ lin or_Conj = mkConj "nebo" ; ---- somePl_Det : Det ---- something_NP : NP + possess_Prep = mkPrep "" Gen ; that_Quant = demPronFormsAdjective (mkDemPronForms "tamt") "" ; this_Quant = demPronFormsAdjective (mkDemPronForms "t") "to" ; to_Prep = mkPrep "do" Gen ; From 29a10589aec98b90ee03fad9ee2ac620347b3489 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Wed, 1 Apr 2020 11:56:01 +0200 Subject: [PATCH 05/53] added Czech to languages.csv --- languages.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/languages.csv b/languages.csv index e80c1c02..7497a742 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 From 7b09a6cf8b18e87ce838cd6289bc10b0fc5d6775 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 1 Apr 2020 17:31:15 +0200 Subject: [PATCH 06/53] (Kor) Add new VForms, replace AForm with VForm (now identical) --- src/korean/ConjunctionKor.gf | 10 +++++----- src/korean/NounKor.gf | 2 +- src/korean/ParamKor.gf | Bin 2764 -> 2779 bytes src/korean/ResKor.gf | 30 +++++++++++++++++++----------- src/korean/VerbKor.gf | 2 +- 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/korean/ConjunctionKor.gf b/src/korean/ConjunctionKor.gf index ba0edcf6..c3eaad01 100644 --- a/src/korean/ConjunctionKor.gf +++ b/src/korean/ConjunctionKor.gf @@ -69,10 +69,10 @@ lin oper mkFirstS : ResKor.Sentence -> ConjType => Str = \s -> - \\conj => glue (s.s ! Subord) (conjTable ! NStar ! conj) ; + \\conj => glue (s.s ! WithConj) (conjTable ! NStar ! conj) ; lincat - [AP] = ResKor.AdjPhrase ** {firstAP : AForm => ConjType => Str} ; + [AP] = ResKor.AdjPhrase ** {firstAP : VForm => ConjType => Str} ; lin BaseAP a1 a2 = a2 ** { @@ -90,10 +90,10 @@ lin oper - mkFirstAP : ResKor.AdjPhrase -> AForm => ConjType => Str = \ap -> + mkFirstAP : ResKor.AdjPhrase -> VForm => 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) } ; + VAttr p => glue (ap.s ! VAttr p) (conjTable ! NStar ! conj) ; + _ => glue (ap.s ! VStem) (conjTable ! VStar ! conj) } ; {- lincat diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index d2a3860c..6ff30cb4 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -155,7 +155,7 @@ 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.s ! VAttr Pos ++ cn.s ! nf } ; -- : CN -> RS -> CN ; diff --git a/src/korean/ParamKor.gf b/src/korean/ParamKor.gf index d37f35f8fa24923b7901221c07d032871ab33c4e..1b2a715db18a8cf765565e5416dd7723151b3fe0 100644 GIT binary patch delta 88 zcmX>jdRuhE64uEdnL{^gvTbHocPuF>QV7V;Ni51NsZ`L_RY=P(QYbD>$}dXE%u6gu pRY=ZBEGH5XSc7XZhxA3Fd5 delta 79 zcmcaDdPa1^5?0-U#G=GpE(HZgxBQ}91zRo!FmQA%DJcT8YZM# Str} ; + Adjective : Type = {s : VForm => Str} ; -- Adjectives are verbs Adjective2 : Type = Adjective ; mkAdj : Str -> Adjective = \plain -> let stem = init plain ; verb = mkVerb plain ; in { - s = table { AAttr => add_N stem ; - APred vf => verb.s ! vf } + s = table { + VAttr Pos => add_N stem ; -- Positive Attr form is different in + vf => verb.s ! vf } -- adjectives, otherwise adj forms == verb forms. } ; AdjPhrase : Type = Adjective ** {compar : Str} ; @@ -159,9 +160,6 @@ 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 { @@ -179,15 +177,19 @@ oper mkVerbReg : (x1,_,_,x4 : Str) -> Verb = \plain,polite,formal,neg -> let stem = init plain ; + attrpos = stem + "는" ; -- TODO: ㄹ-irregulars + 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 ; + VAttr Pos => attrpos ; + VAttr Neg => attrneg ; VF Plain Pos => plain ; VF Plain Neg => planeg ; VF Polite Pos => polite ; @@ -200,6 +202,8 @@ oper copula : Verb = mkVerbFull "이" + "이는" -- TODO does this exist? + "아니는" -- TODO does this exist? "이다" "이에요" "입니다" @@ -209,6 +213,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 +221,8 @@ oper have_V : Verb = mkVerbFull "있" + "있는" + "없는" "있다" "있어요" "있습니다" @@ -309,8 +316,9 @@ oper predVP : NounPhrase -> VerbPhrase -> ClSlash = \np,vp -> vp ** { s = \\t,a,p,cltyp => let vf = case cltyp of { - Subord => VStem ; - _ => VF Polite p } -- TODO: more tenses, politeness + Subord => VAttr p ; + WithConj => VStem ; + _ => VF Polite p } -- TODO: more tenses, politeness in np.s ! vp.sc ++ vp.nObj -- an object, not copula complement ++ vp.adv diff --git a/src/korean/VerbKor.gf b/src/korean/VerbKor.gf index 33dc4c18..fad6da70 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 = ap.s } ; -- : CN -> Comp ; From c23016aaad91b97db03ccd1a226a4881d3bd6185 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 1 Apr 2020 18:44:11 +0200 Subject: [PATCH 07/53] (Kor) Relative clauses --- src/korean/NounKor.gf | 9 +++++---- src/korean/RelativeKor.gf | 14 +++++++++----- src/korean/ResKor.gf | 7 +++++-- src/korean/SentenceKor.gf | 2 +- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index 6ff30cb4..b31105b4 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -18,8 +18,8 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { 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 ; @@ -159,8 +159,9 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { } ; -- : CN -> RS -> CN ; - -- RelCN cn rs = cn ** { - -- } ; + RelCN cn rs = cn ** { + rs = rs.s + } ; {- -- : CN -> Adv -> CN ; diff --git a/src/korean/RelativeKor.gf b/src/korean/RelativeKor.gf index a6c9e305..78b3c56e 100644 --- a/src/korean/RelativeKor.gf +++ b/src/korean/RelativeKor.gf @@ -1,22 +1,26 @@ concrete RelativeKor of Relative = CatKor ** open ResKor, Prelude, (NS=NounKor), (SS=StructuralKor) in { -{- lin -- : Cl -> RCl ; -- such that John loves her - -- RelCl cl = ; + RelCl cl = {s = \\t,a,p => cl.s ! t ! a ! p ! Subord} ; -- : RP -> VP -> RCl ; - RelVP rp vp = + RelVP rp vp = { + s = \\t,a,p => vp.s ! VAttr p -- TODO no tenses yet in the grammar + ++ rp.s ; +} ; -- : RP -> ClSlash -> RCl ; -- whom John loves - RelSlash rp cls = + RelSlash rp cls = { + s = \\t,a,p => cls.s ! t ! a ! p ! Subord + ++ rp.s ; +} ; -- : RP ; IdRP = {s = ""} ; -- : Prep -> NP -> RP -> RP ; -- the mother of whom --FunRP prep np rp = {} ; --} } diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index a86c661c..e40a64fa 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -22,6 +22,7 @@ oper Noun3 : Type = Noun ; CNoun : Type = Noun ** { + rs : Str ; -- Relative clause comes before determiner } ; PNoun : Type = Noun ; @@ -32,7 +33,9 @@ oper c = baseCounter } ; - useN : Noun -> CNoun = \n -> n ; + useN : Noun -> CNoun = \n -> n ** { + rs = [] + } ; --------------------------------------------- -- NP @@ -309,7 +312,7 @@ oper QClause : Type = Clause ; - RClause : Type = {s : NForm => Tense => Anteriority => Polarity => Str} ; + RClause : Type = {s : Tense => Anteriority => Polarity => Str} ; Sentence : Type = {s : ClType => Str} ; diff --git a/src/korean/SentenceKor.gf b/src/korean/SentenceKor.gf index a87ce9e6..d8bd7372 100644 --- a/src/korean/SentenceKor.gf +++ b/src/korean/SentenceKor.gf @@ -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 = t.s ++ p.s ++ rcl.s ! t.t ! t.a ! p.p} ; -- AdvS : Adv -> S -> S ; -- then I will go home AdvS = advS "" ; From cd9dd6bdc77710b8e134ee283b9d4a7924224c27 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 1 Apr 2020 18:44:52 +0200 Subject: [PATCH 08/53] (Kor) SC, PredSCVP --- src/korean/ResKor.gf | 7 +++++-- src/korean/SentenceKor.gf | 10 +++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index e40a64fa..925f28c2 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -316,13 +316,16 @@ oper 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 => VAttr p ; WithConj => VStem ; _ => VF Polite p } -- TODO: more tenses, politeness - in np.s ! vp.sc + in np ++ vp.nObj -- an object, not copula complement ++ vp.adv ++ vp.s ! vf diff --git a/src/korean/SentenceKor.gf b/src/korean/SentenceKor.gf index d8bd7372..38d9738e 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 ; From f75b9b1c31b3511c94b3c8c6450b0bd8e11d37a3 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 1 Apr 2020 19:53:02 +0200 Subject: [PATCH 09/53] (Kor) Add more conjunctions --- src/korean/ConjunctionKor.gf | 43 +++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/korean/ConjunctionKor.gf b/src/korean/ConjunctionKor.gf index c3eaad01..1ffb4d21 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,30 +25,36 @@ concrete ConjunctionKor of Conjunction = ConsAdv = consrSS comma ; ConjAdv = conjunctSS ; - --} + -} --- Adverb and other simple {s : Str} types. lincat - [Adv],[AdV],[IAdv] = {s1,s2 : Str} ; - + [Adv],[AdV],[IAdv],[RS] = ConjSS ; lin - BaseAdv, BaseAdV, BaseIAdv = twoSS ; - ConsAdv, ConsAdV, ConsIAdv = consrSS comma ; - ConjAdv, ConjAdV, ConjIAdv = conjunctDistrSS ; + BaseAdv, BaseAdV, BaseIAdv, BaseRS = baseSS ; + ConsAdv, ConsAdV, ConsIAdv, ConsRS = consSS ; + ConjAdv, ConjAdV, ConjIAdv, ConjRS = conjSS ; +oper + ConjSS : Type = SS ** {firstSS : ConjType => Str} ; -{- --- 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} ; + baseSS : SS -> SS -> ConjSS = \s1,s2 -> s2 ** { + firstSS = mkFirstSS s1 ; + } ; + + consSS : SS -> ConjSS -> ConjSS = \s,ss -> ss ** { + firstSS = \\conj => + mkFirstSS s ! conj ++ ss.firstSS ! conj ; + } ; + + conjSS : Conj -> ConjSS -> SS = \co,ss -> { + s = co.s1 ++ ss.firstSS ! co.c ++ ss.s + } ; + +oper + mkFirstSS : SS -> ConjType => Str = \s -> + \\conj => glue s.s (conjTable ! NStar ! conj) ; -lin - BaseRS = twoTable3 … ; - ConsRS = consrTable3 … comma ; - ConjRS = conjunctRSTable ; --} lincat [S] = ResKor.Sentence ** {firstS : ConjType => Str} ; @@ -131,4 +137,5 @@ oper mkFirstNP : ResKor.NounPhrase -> ConjType => Str = \np -> \\conj => glue (np.s ! Bare) (conjTable ! NStar ! conj) ; + } From 4e701884db7ffc01541c0121be5e2f01d22ae82f Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 11:13:26 +0200 Subject: [PATCH 10/53] (Kor) Add pronouns --- src/korean/ResKor.gf | 42 +++++++++++++++---------------------- src/korean/StructuralKor.gf | 14 +++++++------ 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index 925f28c2..dca52438 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -13,9 +13,12 @@ oper origin = NK } ; - Noun : Type = { + BaseNoun : Type = { s : NForm => Str ; p : Phono ; + } ; + + Noun : Type = BaseNoun ** { c : Counter ; } ; Noun2 : Type = Noun ; -- TODO eventually more parameters? @@ -25,8 +28,6 @@ oper 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 ; @@ -40,34 +41,25 @@ oper --------------------------------------------- -- 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 diff --git a/src/korean/StructuralKor.gf b/src/korean/StructuralKor.gf index ec258772..4123c7e2 100644 --- a/src/korean/StructuralKor.gf +++ b/src/korean/StructuralKor.gf @@ -129,13 +129,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 {Subj => "제가"; 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 = ; From a18ffbe232489f893d3862d6231ad2efcf9a60a7 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 11:55:32 +0200 Subject: [PATCH 11/53] (Kor) Add UsePron and PossPron, minor fix in i_Pron --- src/korean/CatKor.gf | 2 +- src/korean/NounKor.gf | 7 ++----- src/korean/StructuralKor.gf | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/korean/CatKor.gf b/src/korean/CatKor.gf index 97939e9b..8623b1cc 100644 --- a/src/korean/CatKor.gf +++ b/src/korean/CatKor.gf @@ -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/NounKor.gf b/src/korean/NounKor.gf index b31105b4..73ef7f62 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -27,7 +27,7 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { -- } ; -- : Pron -> NP ; - -- UsePron pron = pron ; + UsePron pron = pron ** {empty = []}; -- : Predet -> NP -> NP ; -- only the man PredetNP predet np = np ** {s = @@ -130,10 +130,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 diff --git a/src/korean/StructuralKor.gf b/src/korean/StructuralKor.gf index 4123c7e2..477b401e 100644 --- a/src/korean/StructuralKor.gf +++ b/src/korean/StructuralKor.gf @@ -130,7 +130,7 @@ lin to_Prep = mkPrep "에"; -- Pronouns are closed class, no constructor in ParadigmsKor. -- it_Pron = i_Pron = let iReg : Pronoun = mkPron "저" "제" in - iReg ** {s = table {Subj => "제가"; nf => iReg.s ! nf} + iReg ** {s = table {Subject => "제가"; nf => iReg.s ! nf} } ; youPol_Pron = mkPron "당신" ; youSg_Pron = mkPron "너" ; -- NB. this is very informal, best not used From e689b1cc5aae5fb153658773093bcfda5ffe7314 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 11:57:47 +0200 Subject: [PATCH 12/53] (Kor) Add new constructor for V2, export CaseParticle in Paradigms --- src/korean/LexiconKor.gf | 2 +- src/korean/ParadigmsKor.gf | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/korean/LexiconKor.gf b/src/korean/LexiconKor.gf index 185dc31c..d4d047f3 100644 --- a/src/korean/LexiconKor.gf +++ b/src/korean/LexiconKor.gf @@ -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 "좋다") topic subject ; -- lin listen_V2 = mkV2 "" ; -- lin live_V = mkV ""; -- lin liver_N = mkN "" ; diff --git a/src/korean/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf index a8e1d6d7..73746fb4 100644 --- a/src/korean/ParadigmsKor.gf +++ b/src/korean/ParadigmsKor.gf @@ -4,11 +4,16 @@ 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 --2 Nouns @@ -36,8 +41,9 @@ oper 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 { @@ -91,6 +97,12 @@ 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 ; + mkN = overload { mkN : Str -> N = \s -> lin N (mkNoun s) ; } ; @@ -124,6 +136,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 { From 9bdf4eedf496ce04bbf960b30103a503fb8c902e Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 11:57:57 +0200 Subject: [PATCH 13/53] (Kor) Updates in tests --- src/korean/unittest/adverb.gftest | 2 +- src/korean/unittest/cases.gftest | 20 ++++++++++++++++++++ src/korean/unittest/inflection.gftest | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 src/korean/unittest/cases.gftest 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/cases.gftest b/src/korean/unittest/cases.gftest new file mode 100644 index 00000000..ce68a6a8 --- /dev/null +++ b/src/korean/unittest/cases.gftest @@ -0,0 +1,20 @@ +-- 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: 저는 고양이가 있어요 + +-- 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/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 From 477a214cc0d4e345ffb691d27fa2e17a7e8c8b23 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 15:42:23 +0200 Subject: [PATCH 14/53] (Kor) Add PNs --- src/korean/NounKor.gf | 3 +-- src/korean/ParadigmsKor.gf | 2 ++ src/korean/SymbolKor.gf | 11 +++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index 73ef7f62..f8a25e8b 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -23,8 +23,7 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { } ; -- : PN -> NP ; --- UsePN pn = pn ** { --- } ; + UsePN pn = pn ; -- : Pron -> NP ; UsePron pron = pron ** {empty = []}; diff --git a/src/korean/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf index 73746fb4..5cd59732 100644 --- a/src/korean/ParadigmsKor.gf +++ b/src/korean/ParadigmsKor.gf @@ -30,6 +30,8 @@ oper -- mkA2 : Str -> Prep -> A2 ; + mkPN : Str -> PN + = \s -> lin PN (mkNoun s) ; --2 Verbs -- Verbs diff --git a/src/korean/SymbolKor.gf b/src/korean/SymbolKor.gf index 2d04509a..dd10943a 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 in { lin @@ -15,7 +15,14 @@ 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 From a9ec29a1e6c14bed2be83966c008ded49c369f38 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 15:43:16 +0200 Subject: [PATCH 15/53] (Kor) Add some Dets --- src/korean/ResKor.gf | 11 +++++++++-- src/korean/StructuralKor.gf | 19 +++++++++---------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index dca52438..099b3920 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -64,20 +64,19 @@ oper -- 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 = { @@ -99,6 +98,7 @@ oper } ; baseQuant : BaseQuant = { + sp = \\_ => [] ; isPoss = False ; p = Vowel ; } ; @@ -109,6 +109,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 "들" diff --git a/src/korean/StructuralKor.gf b/src/korean/StructuralKor.gf index 477b401e..2b274b68 100644 --- a/src/korean/StructuralKor.gf +++ b/src/korean/StructuralKor.gf @@ -68,17 +68,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 = From 85b905f0e08313d2722b0c439ea0bd05a8193d1a Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 16:04:52 +0200 Subject: [PATCH 16/53] (Kor) Add SymbolKor functions and MassNP --- src/korean/NounKor.gf | 6 +++--- src/korean/SymbolKor.gf | 23 +++++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index f8a25e8b..d2abb0cc 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -63,9 +63,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 diff --git a/src/korean/SymbolKor.gf b/src/korean/SymbolKor.gf index dd10943a..c5da282f 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, ResKor in { + open Prelude, ResKor, (NK=NounKor) in { lin @@ -24,26 +24,29 @@ oper 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 = sy ** {n=Pl} ; + lincat Symb, [Symb] = SS ; From a4ad8964bc71053ac864be3d300f3c106aeba554 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 18:02:38 +0200 Subject: [PATCH 17/53] Add paths --- src/api/CombinatorsKor.gf | 2 +- src/api/SyntaxKor.gf | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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/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 {} ; From 8b62ad1fa7f12e169d1384aa6669a60797d79e48 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 18:04:34 +0200 Subject: [PATCH 18/53] (Kor) Add comparatives and superlatives --- src/korean/AdjectiveKor.gf | 4 ++-- src/korean/CatKor.gf | 2 +- src/korean/NounKor.gf | 10 +++++----- src/korean/SymbolKor.gf | 6 ++++-- src/korean/VerbKor.gf | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/korean/AdjectiveKor.gf b/src/korean/AdjectiveKor.gf index b5cd041f..c603ce6a 100644 --- a/src/korean/AdjectiveKor.gf +++ b/src/korean/AdjectiveKor.gf @@ -11,7 +11,8 @@ 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 @@ -37,7 +38,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/CatKor.gf b/src/korean/CatKor.gf index 8623b1cc..07a705d1 100644 --- a/src/korean/CatKor.gf +++ b/src/korean/CatKor.gf @@ -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 ; diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index d2abb0cc..272b004c 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -114,10 +114,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. @@ -151,7 +151,7 @@ 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 ! VAttr Pos ++ cn.s ! nf + s = \\nf => ap.compar ++ ap.s ! VAttr Pos ++ cn.s ! nf } ; -- : CN -> RS -> CN ; diff --git a/src/korean/SymbolKor.gf b/src/korean/SymbolKor.gf index c5da282f..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, ResKor, (NK=NounKor) in { + open Prelude, ResKor, (NK=NounKor), (VK=VerbKor) in { lin @@ -45,7 +45,9 @@ lin SymbNum sy = baseNum ** {s = \\_,_ => sy.s} ; -- : Symb -> Ord ; - SymbOrd sy = sy ** {n=Pl} ; + 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 fad6da70..0273b542 100644 --- a/src/korean/VerbKor.gf +++ b/src/korean/VerbKor.gf @@ -111,7 +111,7 @@ lin -- : AP -> Comp ; CompAP ap = emptyComp ** { - s = ap.s + s = \\vf => ap.compar ++ ap.s ! vf } ; -- : CN -> Comp ; From e586c478a38fedbe7553a63ab3d766d69ee50c6f Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 18:04:54 +0200 Subject: [PATCH 19/53] (Kor) New words + new tests --- src/korean/StructuralKor.gf | 9 +++------ src/korean/unittest/adjective.gftest | 9 +++++++++ src/korean/unittest/{cases.gftest => subjcases.gftest} | 0 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 src/korean/unittest/adjective.gftest rename src/korean/unittest/{cases.gftest => subjcases.gftest} (100%) diff --git a/src/korean/StructuralKor.gf b/src/korean/StructuralKor.gf index 2b274b68..c0e91538 100644 --- a/src/korean/StructuralKor.gf +++ b/src/korean/StructuralKor.gf @@ -38,7 +38,7 @@ 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 { @@ -47,7 +47,7 @@ lin there_Adv = ss "" ; n = Pl ; c = And } ; --- lin or_Conj = {s2 = \\_ => "" ; s1 = [] ; n = Sg} ; +lin or_Conj = {s1 = [] ; n = Sg ; c = Or} ; -- lin if_then_Conj = mkConj -- lin both7and_DConj = mkConj "" "" pl ; -- lin either7or_DConj = {s2 = \\_ => "" ; s1 = "" ; n = Sg} ; @@ -91,11 +91,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 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/cases.gftest b/src/korean/unittest/subjcases.gftest similarity index 100% rename from src/korean/unittest/cases.gftest rename to src/korean/unittest/subjcases.gftest From 44abd1a8da2edd84b8167aba7d128cf072466b3e Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 19:35:32 +0200 Subject: [PATCH 20/53] (Kor) Add Utt* linearisations --- src/korean/PhraseKor.gf | 19 ++++++++++--------- src/korean/ResKor.gf | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/korean/PhraseKor.gf b/src/korean/PhraseKor.gf index 84498a3e..cb1b719b 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.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/ResKor.gf b/src/korean/ResKor.gf index 099b3920..c2962fe8 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -334,5 +334,6 @@ oper -- linrefs linVerb : Verb -> Str = \v -> v.s ! linVF ; +linVP : VerbPhrase -> Str = \vp -> vp.nObj ++ vp.adv ++ vp.s ! linVF ; } From 844e606429d827802c5cf5cc689e9a601b9fced4 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 19:35:59 +0200 Subject: [PATCH 21/53] (Kor) Add A2, ComplA2, mkA2 --- src/korean/AdjectiveKor.gf | 7 +++++-- src/korean/ParadigmsKor.gf | 10 +++++++++- src/korean/ResKor.gf | 4 +++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/korean/AdjectiveKor.gf b/src/korean/AdjectiveKor.gf index c603ce6a..f76289bc 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, (AK=AdverbKor), Prelude in { flags optimize=all_subs ; @@ -16,7 +17,9 @@ concrete AdjectiveKor of Adjective = CatKor ** open ResKor, Prelude in { } ; -- : A2 -> NP -> AP ; -- married to her - -- ComplA2 a2 np = a2 ** { } ; + ComplA2 a2 np = a2 ** { + compar = (AK.PrepNP a2.p2 np).s ; + } ; -- : A2 -> AP ; -- married to itself -- ReflA2 a2 = a2 ** { } ; diff --git a/src/korean/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf index 5cd59732..012970ef 100644 --- a/src/korean/ParadigmsKor.gf +++ b/src/korean/ParadigmsKor.gf @@ -28,7 +28,10 @@ oper mkA : (kiga : Str) -> (jakda : A) -> A ; -- Compound adjective, e.g. 키가 작다 'short', literally 'height (is) small'. 키가 'height' given as string, 작다 'small' given as preconstructed A. } ; - -- mkA2 : Str -> Prep -> A2 ; + mkA2 : overload { + mkA2 : Str -> A2 ; -- Regular adjective, given in -다 form, no postposition for complement. + mkA2 : A -> Prep -> A2 ; -- Preconstructed adjective and postposition for complement. + } ; mkPN : Str -> PN = \s -> lin PN (mkNoun s) ; @@ -124,6 +127,11 @@ oper jakda ** {s = \\af => kiga ++ jakda.s ! af} ; } ; + mkA2 = overload { + mkA2 : Str -> A2 = \s -> lin A2 (atoa2 (mkAdj s)) ; + mkA2 : A -> Prep -> A2 = \a,p -> lin A2 (a ** {p2 = p}) ; + } ; + mkV = overload { mkV : (plain : Str) -> V = \v -> lin V (mkVerb v) ; mkV : (nore : Str) -> (hada : V) -> V = \nore,hada -> hada ** { diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index c2962fe8..c41838e8 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -134,7 +134,7 @@ oper -- Adjectives Adjective : Type = {s : VForm => Str} ; -- Adjectives are verbs - Adjective2 : Type = Adjective ; + Adjective2 : Type = Adjective ** {p2 : Postposition} ; mkAdj : Str -> Adjective = \plain -> let stem = init plain ; @@ -145,6 +145,8 @@ oper vf => verb.s ! vf } -- adjectives, otherwise adj forms == verb forms. } ; + atoa2 : Adjective -> Adjective2 = \a -> a ** {c2=Bare ; p2=emptyPP} ; + AdjPhrase : Type = Adjective ** {compar : Str} ; -------------------------------------------------------------------------------- -- Verbs From 90af822547db26a15d37e89af4621dcb907045ee Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 19:36:22 +0200 Subject: [PATCH 22/53] (Kor) Add Digits --- src/korean/NounKor.gf | 6 +++++- src/korean/NumeralKor.gf | 42 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index 272b004c..2765fddf 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -96,7 +96,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 ; diff --git a/src/korean/NumeralKor.gf b/src/korean/NumeralKor.gf index 31be00cc..ff1a04e6 100644 --- a/src/korean/NumeralKor.gf +++ b/src/korean/NumeralKor.gf @@ -84,7 +84,6 @@ lin -- : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n pot3plus m n = TODO ; - oper LinDigit : Type = ResKor.Numeral ** {isTwo : Bool ; ten : Str} ; @@ -123,4 +122,45 @@ oper } ; 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 = Pl + } ; + + 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 ResKor.Pl ; + 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 + } ; } From 642b4b9f6b27e307c88a12cf98f5f7685541cf35 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 19:41:10 +0200 Subject: [PATCH 23/53] (Kor) Add {Appos,Rel,Adv,Sent}CN --- src/korean/NounKor.gf | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index 2765fddf..0596d99a 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -160,19 +160,23 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { -- : CN -> RS -> CN ; RelCN cn rs = cn ** { - rs = rs.s + rs = cn.rs ++ rs.s } ; -{- + -- : 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 @@ -180,8 +184,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 From 1c7bad313cc9cf0e5c2490e48e1a1343b2702924 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 20:03:23 +0200 Subject: [PATCH 24/53] (Kor) Misc. small additions --- src/korean/AdjectiveKor.gf | 8 ++++---- src/korean/LexiconKor.gf | 8 ++++---- src/korean/NounKor.gf | 9 +++++++-- src/korean/StructuralKor.gf | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/korean/AdjectiveKor.gf b/src/korean/AdjectiveKor.gf index f76289bc..d4d3fb7c 100644 --- a/src/korean/AdjectiveKor.gf +++ b/src/korean/AdjectiveKor.gf @@ -28,10 +28,10 @@ concrete AdjectiveKor of Adjective = CatKor ** 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 diff --git a/src/korean/LexiconKor.gf b/src/korean/LexiconKor.gf index d4d047f3..b9e0cac6 100644 --- a/src/korean/LexiconKor.gf +++ b/src/korean/LexiconKor.gf @@ -33,7 +33,7 @@ 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 "푸르다" ; @@ -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 "" ; @@ -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/NounKor.gf b/src/korean/NounKor.gf index 0596d99a..d74976d1 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -47,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 ** { diff --git a/src/korean/StructuralKor.gf b/src/korean/StructuralKor.gf index c0e91538..354906c9 100644 --- a/src/korean/StructuralKor.gf +++ b/src/korean/StructuralKor.gf @@ -111,7 +111,7 @@ 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 "에"; From 5a3a5597a854482877d07379cf432ccb542c885a Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 3 Apr 2020 20:03:35 +0200 Subject: [PATCH 25/53] (Kor) Update MissingKor --- src/korean/MissingKor.gf | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src/korean/MissingKor.gf b/src/korean/MissingKor.gf index 2fc1ed3f..3fed47a8 100644 --- a/src/korean/MissingKor.gf +++ b/src/korean/MissingKor.gf @@ -9,18 +9,12 @@ 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 +22,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" ; @@ -36,17 +29,11 @@ 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 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" ; @@ -85,7 +72,6 @@ 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,12 +82,8 @@ 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" ; @@ -122,22 +104,10 @@ 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 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 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 VPSlashPrep : VP -> Prep -> VPSlash = notYet "VPSlashPrep" ; oper VocNP : NP -> Voc = notYet "VocNP" ; oper above_Prep : Prep = notYet "above_Prep" ; From f0685a3233f09cc7b74e60bb8460df3307316d83 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Sat, 4 Apr 2020 09:18:57 +0200 Subject: [PATCH 26/53] harmonized the lincats of Numeral and Det --- src/czech/CatCze.gf | 10 +++--- src/czech/NounCze.gf | 14 ++++---- src/czech/NumeralCze.gf | 63 +++++++++++++++++----------------- src/czech/ResCze.gf | 76 +++++++++++++++++++++++++---------------- 4 files changed, 90 insertions(+), 73 deletions(-) diff --git a/src/czech/CatCze.gf b/src/czech/CatCze.gf index 6808ba21..8dceb6a5 100644 --- a/src/czech/CatCze.gf +++ b/src/czech/CatCze.gf @@ -35,10 +35,10 @@ concrete CatCze of Cat = CN = ResCze.Noun ; -- {s : Number => Case => Str ; g : Gender} NP = {s,clit,prep : Case => Str ; a : Agr ; hasClit : Bool} ; ---- PN = {s : Case => Str ; g : Gender} ; ---- - Det = {s : Gender => Case => Str ; n : NumSize} ; + Det = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ; Quant = {s : Gender => Number => Case => Str} ; -- same as AP - Num = {s : Gender => Case => Str ; n : NumSize} ; - Card = {s : Gender => Case => Str ; n : NumSize} ; + Num = {s : Gender => Case => Str ; size : NumSize} ; + Card = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ; Pron = PronForms ; Adv = {s : Str} ; @@ -63,8 +63,8 @@ concrete CatCze of Cat = A = \s -> s.msnom ; - lincat Numeral = {s : NumeralForms ; size : NumSize} ; - lincat Digits = {s:Str ; n : NumSize} ; + lincat Numeral = Determiner ; ---- should contain Ord as well + lincat Digits = {s:Str ; size : NumSize} ; } diff --git a/src/czech/NounCze.gf b/src/czech/NounCze.gf index 7e6bbb0a..03d722cd 100644 --- a/src/czech/NounCze.gf +++ b/src/czech/NounCze.gf @@ -6,8 +6,8 @@ concrete NounCze of Noun = lin DetCN det cn = { - s,prep,clit = \\c => det.s ! cn.g ! c ++ numSizeForm cn.s det.n c ; - a = numSizeAgr cn.g det.n P3 ; + s,prep,clit = \\c => det.s ! cn.g ! c ++ numSizeForm cn.s det.size c ; + a = numSizeAgr cn.g det.size P3 ; hasClit = False ; } ; @@ -18,14 +18,14 @@ lin } ; DetQuant quant num = { - s = \\g,c => num.s ! g ! c ++ quant.s ! g ! numSizeNumber num.n ! c ; - n = num.n + s = \\g,c => num.s ! g ! c ++ quant.s ! g ! numSizeNumber num.size ! c ; + size = num.size } ; DefArt = {s = \\_,_,_ => []} ; IndefArt = {s = \\_,_,_ => []} ; - NumPl = {s = \\_,_ => [] ; n = Num2_4} ; - NumSg = {s = \\_,_ => [] ; n = Num1} ; + NumPl = {s = \\_,_ => [] ; size = Num2_4} ; ---- size + NumSg = {s = \\_,_ => [] ; size = Num1} ; UsePron pron = { s = table { @@ -94,7 +94,7 @@ lin NumCard c = c ; NumDigits ds = ds ** {s = \\_,_ => ds.s} ; - NumNumeral nu = {s = numeralFormsDeterminer nu.s ; n = nu.size} ; ---- TODO: inflection of numerals + NumNumeral nu = nu ; } diff --git a/src/czech/NumeralCze.gf b/src/czech/NumeralCze.gf index 84313789..370c6f9f 100644 --- a/src/czech/NumeralCze.gf +++ b/src/czech/NumeralCze.gf @@ -11,8 +11,8 @@ concrete NumeralCze of Numeral = -- AR 2020-03-20 -oper LinNumeral = {s : NumeralForms ; size : NumSize} ; -oper LinDigit = {unit : NumeralForms ; teen, ten, hundred : Str ; size : NumSize} ; +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 ; @@ -21,30 +21,30 @@ lincat Sub100 = LinNumeral ; lincat Sub1000 = LinNumeral ; lincat Sub1000000 = LinNumeral ; -oper mkNum : NumeralForms -> Str -> Str -> Str -> NumSize -> LinDigit = - \dva, dvanast, dvadsat, dveste, sz -> { - unit = dva ; +oper mkNum : Determiner -> Str -> Str -> Str -> LinDigit = + \dva, dvanast, dvadsat, dveste -> { + unit = dva.s ; teen = dvanast + "náct" ; ten = dvadsat ; hundred = dveste ; - size = sz + size = dva.size ; } ; -oper mk2Num : NumeralForms -> Str -> Str -> Str -> LinDigit = +oper mk2Num : Determiner -> Str -> Str -> Str -> LinDigit = \unit, teenbase, tenbase, hundred -> - mkNum unit teenbase (tenbase + "cet") hundred Num2_4 ; + mkNum unit teenbase (tenbase + "cet") hundred ; oper mk5Num : Str -> Str -> Str -> Str -> LinDigit = \unit,uniti, teenbase, tenbase -> - mkNum (regNumeralForms unit uniti) teenbase (tenbase + "desát") (unit ++ "set") Num5 ; + mkNum (regNumeral unit uniti) teenbase (tenbase + "desát") (unit ++ "set") ; -oper bigNumeral : Str -> LinNumeral = \s -> {s = invarNumeralForms s ; size = Num5} ; +oper bigNumeral : Str -> LinNumeral = \s -> invarNumeral s ; lin num x = x ; -lin n2 = mk2Num twoNumeralForms "dva" "dva" ("dvě" ++ "stě") ; -lin n3 = mk2Num threeNumeralForms "tři" "tři" ("tři" ++ "sta") ; -lin n4 = mk2Num fourNumeralForms "čtr" "čtyři" ("čtyři" ++ "sta") ; +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"; @@ -52,7 +52,7 @@ lin n8 = mk5Num "osm" "osmi" "osm" "osm"; lin n9 = mk5Num "devět" "devíti" "devate" "deva" ; lin pot01 = { - unit = oneNumeralForms ; hundred = "sto" ; ten = "deset" ; teen = "jedenáct" ; + unit = oneNumeral.s ; hundred = "sto" ; ten = "deset" ; teen = "jedenáct" ; size = Num1 } ; lin pot0 d = d ; @@ -64,7 +64,7 @@ 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 = invarNumeralForms (d.ten ++ e.unit.msnom) ; ---- TODO inflection? + 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} ; @@ -72,15 +72,15 @@ lin pot1plus d e = { lin pot1as2 n = n ; lin pot2 d = bigNumeral d.hundred ; lin pot2plus d e = { - s = invarNumeralForms (d.hundred ++ e.s.msnom) ; ---- TODO inflection? + s = (invarNumeral (d.hundred ++ determinerStr e)).s ; ---- TODO inflection? size = tfSize e.size } ; lin pot2as3 n = n ; -lin pot3 n = bigNumeral (mkTh n.s.msnom n.size) ; +lin pot3 n = bigNumeral (mkTh (determinerStr n) n.size) ; lin pot3plus n m = { - s = invarNumeralForms (mkTh n.s.msnom n.size ++ m.s.msnom) ; ---- TODO inflection? + s = (invarNumeral (mkTh (determinerStr n) n.size ++ determinerStr m)).s ; ---- TODO inflection? size = tfSize m.size } ; @@ -94,25 +94,26 @@ oper mkTh : Str -> NumSize -> Str = \attr,size -> 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 ; n : NumSize} ; + lincat Dig = {s:Str ; size : NumSize} ; lin - IDig d = d; + IDig d = d ; - IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s ; n = Num5} ; ---- leading zeros ?? + IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s ; size = Num5} ; ---- leading zeros ?? - D_0 = { s = "0" ; n = Num1} ; ---- ?? - D_1 = { s = "1" ; n = Num1} ; - D_2 = { s = "2" ; n = Num2_4} ; - D_3 = { s = "3" ; n = Num2_4} ; - D_4 = { s = "4" ; n = Num2_4} ; - D_5 = { s = "5" ; n = Num5} ; - D_6 = { s = "6" ; n = Num5} ; - D_7 = { s = "7" ; n = Num5} ; - D_8 = { s = "8" ; n = Num5} ; - D_9 = { s = "9" ; n = Num5} ; + 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/ResCze.gf b/src/czech/ResCze.gf index 0d4471a4..c4879420 100644 --- a/src/czech/ResCze.gf +++ b/src/czech/ResCze.gf @@ -694,6 +694,11 @@ oper } + s } ; + Determiner : Type = { + s : Gender => Case => Str ; + size : NumSize + } ; + mkDemPronForms : Str -> DemPronForms = \t -> { msnom = t + "en" ; fsnom = t + "a" ; @@ -730,50 +735,61 @@ oper msins, fsins : Str } ; - numeralFormsDeterminer : NumeralForms -> (Gender => Case => Str) = - \nume -> + 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 - \\g,c => adjAdj.s ! g ! Sg ! c ; - + in { + s = \\g,c => adjAdj.s ! g ! Sg ! c ; + size = size + } ; -- example: number 1 - oneNumeralForms : NumeralForms = mkDemPronForms "jed" ; + oneNumeral : Determiner = numeralFormsDeterminer (mkDemPronForms "jed") Num1 ; -- numbers 2,3,4 ---- to check if everything comes out right with this type - twoNumeralForms : NumeralForms = { - msnom = "dva" ; fsnom, nsnom, fsacc = "dvě" ; - msgen, fsgen, msloc = "dvou" ; - msdat, msins, fsins = "dvěma" - } ; + twoNumeral : Determiner = + let forms = { + msnom = "dva" ; fsnom, nsnom, fsacc = "dvě" ; + msgen, fsgen, msloc = "dvou" ; + msdat, msins, fsins = "dvěma" + } + in numeralFormsDeterminer forms Num2_4 ; - threeNumeralForms : NumeralForms = { - msnom, fsnom, nsnom, fsacc, msgen, fsgen = "tři" ; - msdat = "třem" ; - msloc = "třech" ; - msins,fsins = "třemi" ; - } ; + 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 ; - fourNumeralForms : NumeralForms = { - msnom, fsnom, nsnom, fsacc = "čtyři" ; - msgen, fsgen = "čtyř" ; - msdat = "čtyřem" ; - msloc = "čtyřech" ; - msins,fsins = "čtyřmi" ; - } ; + 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 - regNumeralForms : Str -> Str -> NumeralForms = \pet,peti -> { - msnom,fsnom,nsnom = pet ; - msgen, fsgen, msdat, fsacc, msloc, msins, fsins = peti - } ; + regNumeral : Str -> Str -> Determiner = \pet,peti -> + let forms = { + msnom,fsnom,nsnom = pet ; + msgen, fsgen, msdat, fsacc, msloc, msins, fsins = peti + } + in numeralFormsDeterminer forms Num5 ; - invarNumeralForms : Str -> NumeralForms = \sto -> - regNumeralForms sto sto ; + invarDeterminer : Str -> NumSize -> Determiner = \sto,size -> + regNumeral sto sto ; + + invarNumeral : Str -> Determiner = \s -> invarDeterminer s Num5 ; -------------------------------- -- combining nouns with numerals From 5f436574f992b081d8e0602bbfe9bb485ab580fd Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Sat, 4 Apr 2020 10:29:57 +0200 Subject: [PATCH 27/53] more paradigms for Cze N and A --- src/czech/ParadigmsCze.gf | 137 ++++++++++++++++++++++++++++++++++---- src/czech/ResCze.gf | 23 ++++++- 2 files changed, 143 insertions(+), 17 deletions(-) diff --git a/src/czech/ParadigmsCze.gf b/src/czech/ParadigmsCze.gf index e2372853..03fabf07 100644 --- a/src/czech/ParadigmsCze.gf +++ b/src/czech/ParadigmsCze.gf @@ -1,20 +1,117 @@ resource ParadigmsCze = open CatCze, ResCze, Prelude in { -oper - 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} ; +---------------- +-- Parameters - 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) - }) ; +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) ; + +------------------------- +-- Verbs mkV2 = overload { mkV2 : VerbForms -> VerbForms ** {c : ComplementCase} @@ -24,6 +121,18 @@ oper 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/ResCze.gf b/src/czech/ResCze.gf index c4879420..632b0baa 100644 --- a/src/czech/ResCze.gf +++ b/src/czech/ResCze.gf @@ -120,8 +120,9 @@ oper DeclensionType : Type = Str -> NounForms ; - declensionType : (nom,gen : Str) -> Gender -> DeclensionType - = \nom,gen,g -> case of { + declensionNounForms : (nom,gen : Str) -> Gender -> NounForms + = \nom,gen,g -> + let decl : DeclensionType = case of { => declPAN ; => declPREDSEDA ; => declHRAD ; @@ -138,7 +139,23 @@ oper => declMORE ; => declSTAVENI ; _ => Predef.error ("cannot infer declension type for" ++ nom ++ gen) - } ; + } + in decl nom ; + + 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) + } ; + -- source: https://en.wikipedia.org/wiki/Czech_declension From e57e916349660dee1013f6e5751dc1d93e3c7a14 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Sat, 4 Apr 2020 11:23:05 +0200 Subject: [PATCH 28/53] added some words to StructuralCze, mostly very uncertain --- src/czech/ResCze.gf | 18 ++++++++++++++++++ src/czech/StructuralCze.gf | 10 +++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/czech/ResCze.gf b/src/czech/ResCze.gf index 632b0baa..29f409d0 100644 --- a/src/czech/ResCze.gf +++ b/src/czech/ResCze.gf @@ -740,6 +740,24 @@ oper 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 diff --git a/src/czech/StructuralCze.gf b/src/czech/StructuralCze.gf index 60a5c4ce..3995db26 100644 --- a/src/czech/StructuralCze.gf +++ b/src/czech/StructuralCze.gf @@ -3,15 +3,15 @@ concrete StructuralCze of Structural = CatCze ** lin and_Conj = mkConj "i" ; ----- by8agent_Prep : Prep ----- few_Det : Det + 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 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 : Det + many_Det = regNumeral "mnoho" "mnoha" ; -- CEG 6.8 ---- or_Conj = mkConj "nebo" ; ----- somePl_Det : Det ----- something_NP : NP + 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" ; From 0da96d0fcec26cf027e7cd77d1119afc399a2624 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Sat, 4 Apr 2020 12:56:49 +0200 Subject: [PATCH 29/53] more paradigms for Cze N and A --- src/czech/AdjectiveCze.gf | 4 ++++ src/czech/MissingCze.gf | 1 - src/czech/ParadigmsCze.gf | 3 +++ src/czech/StructuralCze.gf | 1 + src/czech/SymbolCze.gf | 2 ++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/czech/AdjectiveCze.gf b/src/czech/AdjectiveCze.gf index 1ec27121..66891f01 100644 --- a/src/czech/AdjectiveCze.gf +++ b/src/czech/AdjectiveCze.gf @@ -16,4 +16,8 @@ concrete AdjectiveCze of Adjective = CatCze ** open ResCze, Prelude in { 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/MissingCze.gf b/src/czech/MissingCze.gf index eaf4d1e2..d1ae7d3b 100644 --- a/src/czech/MissingCze.gf +++ b/src/czech/MissingCze.gf @@ -79,7 +79,6 @@ oper TCond : Tense = notYet "TCond" ; oper TFut : Tense = notYet "TFut" ; oper TPast : Tense = notYet "TPast" ; oper Use2N3 : N3 -> N2 = notYet "Use2N3" ; -oper UseComparA : A -> AP = notYet "UseComparA" ; oper UseN2 : N2 -> CN = notYet "UseN2" ; oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ; oper UttCard : Card -> Utt = notYet "UttCard" ; diff --git a/src/czech/ParadigmsCze.gf b/src/czech/ParadigmsCze.gf index 03fabf07..2f0a7bb0 100644 --- a/src/czech/ParadigmsCze.gf +++ b/src/czech/ParadigmsCze.gf @@ -110,6 +110,9 @@ oper matcinA : Str -> A = \s -> lin A (matcinAdjForms s) ; + mkA2 : A -> Prep -> A2 + = \a,p -> lin A2 (a ** {c = p}) ; + ------------------------- -- Verbs diff --git a/src/czech/StructuralCze.gf b/src/czech/StructuralCze.gf index 3995db26..ffe5a10b 100644 --- a/src/czech/StructuralCze.gf +++ b/src/czech/StructuralCze.gf @@ -5,6 +5,7 @@ lin and_Conj = mkConj "i" ; 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 ; ---- diff --git a/src/czech/SymbolCze.gf b/src/czech/SymbolCze.gf index 8b7fd596..7cef10b4 100644 --- a/src/czech/SymbolCze.gf +++ b/src/czech/SymbolCze.gf @@ -2,6 +2,8 @@ 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} ; From 0053d8223ca2360f64aa5473862039016bc3552c Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 6 Apr 2020 11:24:31 +0200 Subject: [PATCH 30/53] (Kor) Bugfix in RelVP --- src/korean/RelativeKor.gf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/korean/RelativeKor.gf b/src/korean/RelativeKor.gf index 78b3c56e..c55e2419 100644 --- a/src/korean/RelativeKor.gf +++ b/src/korean/RelativeKor.gf @@ -7,7 +7,9 @@ lin -- : RP -> VP -> RCl ; RelVP rp vp = { - s = \\t,a,p => vp.s ! VAttr p -- TODO no tenses yet in the grammar + s = \\t,a,p => vp.adv + ++ vp.nObj + ++ vp.s ! VAttr p -- TODO no tenses yet in the grammar ++ rp.s ; } ; From edc79e47174c301723c191300e6af19e90bd22c4 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 6 Apr 2020 17:37:00 +0200 Subject: [PATCH 31/53] (Kor) Add variants using commas instead of repeated conjunctions --- src/korean/ConjunctionKor.gf | 16 ++++++++++++++++ src/korean/ResKor.gf | 2 +- src/korean/StructuralKor.gf | 9 ++++----- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/korean/ConjunctionKor.gf b/src/korean/ConjunctionKor.gf index 1ffb4d21..ab2792e8 100644 --- a/src/korean/ConjunctionKor.gf +++ b/src/korean/ConjunctionKor.gf @@ -51,6 +51,22 @@ oper s = co.s1 ++ ss.firstSS ! co.c ++ ss.s } ; +-- Versions with commas, no repeated conjunctions + baseSScomma : SS -> SS -> ConjSS = \s1,s2 -> s2 ** { + firstSS = \\conj => s1.s ++ SOFT_BIND ++ "," ; + } ; + + consSScomma : SS -> ConjSS -> ConjSS = \s,ss -> ss ** { + firstSS = \\conj => + s.s ++ SOFT_BIND ++ "," ++ ss.firstSS ! conj ; + } ; + + conjSScomma : Conj -> ConjSS -> SS = \co,ss -> { + s = co.s1 + ++ glue (ss.firstSS ! co.c) co.s2 + ++ ss.s + } ; + oper mkFirstSS : SS -> ConjType => Str = \s -> \\conj => glue s.s (conjTable ! NStar ! conj) ; diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index c41838e8..5e48317e 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -254,7 +254,7 @@ oper -- 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 ; diff --git a/src/korean/StructuralKor.gf b/src/korean/StructuralKor.gf index 354906c9..ea4f03c1 100644 --- a/src/korean/StructuralKor.gf +++ b/src/korean/StructuralKor.gf @@ -40,14 +40,13 @@ lin there_Adv = ss "" ; 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 = {s1 = [] ; n = Sg ; c = Or} ; +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} ; From cef3e428c2fb419eb90cd31c6fbf68987910e51f Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 6 Apr 2020 17:41:48 +0200 Subject: [PATCH 32/53] (Kor) Make Prep's s field dependent on Phono parameter of NP --- src/korean/AdverbKor.gf | 4 ++-- src/korean/ParadigmsKor.gf | 5 ++++- src/korean/ResKor.gf | 10 +++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/korean/AdverbKor.gf b/src/korean/AdverbKor.gf index 01fb1ec6..126cb3d8 100644 --- a/src/korean/AdverbKor.gf +++ b/src/korean/AdverbKor.gf @@ -13,8 +13,8 @@ lin -- : Prep -> NP -> Adv ; PrepNP prep np = { s = case prep.attaches of { - True => glue (np.s ! Bare) prep.s ; - False => np.s ! Bare ++ prep.s } + True => glue (np.s ! Bare) (prep.s ! np.p) ; + False => np.s ! Bare ++ (prep.s ! np.p)} } ; -- Adverbs can be modified by 'adadjectives', just like adjectives. diff --git a/src/korean/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf index 012970ef..6eeb4de8 100644 --- a/src/korean/ParadigmsKor.gf +++ b/src/korean/ParadigmsKor.gf @@ -77,7 +77,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. } ; @@ -160,6 +161,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/ResKor.gf b/src/korean/ResKor.gf index 5e48317e..f980f989 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -123,9 +123,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 "에게" ; @@ -296,7 +300,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} ; From aa3bc1d656ac22dd4179cbdb67bc3cbfa3661e1d Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 6 Apr 2020 17:49:31 +0200 Subject: [PATCH 33/53] (Kor) New constructors for N and A2 --- src/korean/ParadigmsKor.gf | 15 +++++++++++++-- src/korean/ResKor.gf | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/korean/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf index 6eeb4de8..268a4bea 100644 --- a/src/korean/ParadigmsKor.gf +++ b/src/korean/ParadigmsKor.gf @@ -18,7 +18,8 @@ oper --2 Nouns mkN : overload { - mkN : (noun : Str) -> N ; -- Predictable nouns + mkN : (noun : Str) -> N ; -- Predictable nouns with classifier 개 + mkN : (noun,counter : Str) -> N ; -- Noun and classifier given as arguments. } ; --2 Adjectives @@ -30,6 +31,7 @@ oper 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. } ; @@ -110,7 +112,12 @@ oper noCase = Bare ; 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 -> + let noun : Noun = mkNoun n ; + counter : Counter = mkCounter c ; + in lin N (noun ** {c = counter}) ; + } ; @@ -130,6 +137,10 @@ oper 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 (adj ** {p2 = prep}) ; mkA2 : A -> Prep -> A2 = \a,p -> lin A2 (a ** {p2 = p}) ; } ; diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index f980f989..de5c081d 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -13,6 +13,10 @@ oper origin = NK } ; + mkCounter : Str -> Counter = \s -> baseCounter ** { + s = s ; + } ; + BaseNoun : Type = { s : NForm => Str ; p : Phono ; From 8b6275af1c1bdc16c25a36f4d51e334eca254173 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 6 Apr 2020 17:50:11 +0200 Subject: [PATCH 34/53] (Kor) Fixes in conjunctions for the verby cats (AP,S,RS) --- src/korean/ConjunctionKor.gf | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/korean/ConjunctionKor.gf b/src/korean/ConjunctionKor.gf index ab2792e8..cf4df960 100644 --- a/src/korean/ConjunctionKor.gf +++ b/src/korean/ConjunctionKor.gf @@ -69,8 +69,7 @@ oper oper mkFirstSS : SS -> ConjType => Str = \s -> - \\conj => glue s.s (conjTable ! NStar ! conj) ; - + \\conj => glue s.s (conjTable ! VStar ! conj) ; lincat [S] = ResKor.Sentence ** {firstS : ConjType => Str} ; @@ -91,7 +90,7 @@ lin oper mkFirstS : ResKor.Sentence -> ConjType => Str = \s -> - \\conj => glue (s.s ! WithConj) (conjTable ! NStar ! conj) ; + \\conj => glue (s.s ! WithConj) (conjTable ! VStar ! conj) ; lincat [AP] = ResKor.AdjPhrase ** {firstAP : VForm => ConjType => Str} ; @@ -113,9 +112,7 @@ lin oper mkFirstAP : ResKor.AdjPhrase -> VForm => ConjType => Str = \ap -> - \\af,conj => case af of { - VAttr p => glue (ap.s ! VAttr p) (conjTable ! NStar ! conj) ; - _ => glue (ap.s ! VStem) (conjTable ! VStar ! conj) } ; + \\af,conj => ap.compar ++ glue (ap.s ! VStem) (conjTable ! VStar ! conj) ; {- lincat From ee3adec4282ebe9f3356ac845ddcf7d0e2982619 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 6 Apr 2020 17:50:22 +0200 Subject: [PATCH 35/53] (Kor) Small fixes + new words --- src/korean/LexiconKor.gf | 4 ++-- src/korean/PhraseKor.gf | 2 +- src/korean/StructuralKor.gf | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/korean/LexiconKor.gf b/src/korean/LexiconKor.gf index b9e0cac6..8ea10252 100644 --- a/src/korean/LexiconKor.gf +++ b/src/korean/LexiconKor.gf @@ -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 (mkV "좋다") topic subject ; +lin like_V2 = mkV2 (mkV "좋아" do_V) topic object ; -- lin listen_V2 = mkV2 "" ; -- lin live_V = mkV ""; -- lin liver_N = mkN "" ; diff --git a/src/korean/PhraseKor.gf b/src/korean/PhraseKor.gf index cb1b719b..6a678f00 100644 --- a/src/korean/PhraseKor.gf +++ b/src/korean/PhraseKor.gf @@ -19,7 +19,7 @@ concrete PhraseKor of Phrase = CatKor ** open Prelude, ResKor in { UttVP vp = {s = linVP vp} ; UttCN cn = {s = cn.rs ++ cn.s ! Bare} ; UttCard n = {s = n.s ! NK ! Indep} ; - UttAP ap = { s = ap.s ! VF Plain Pos} ; + UttAP ap = { s = ap.compar ++ ap.s ! VF Plain Pos} ; NoPConj = {s = []} ; -- PConjConj conj = {s = conj.s1 ++ conj.s2 ! …} ; diff --git a/src/korean/StructuralKor.gf b/src/korean/StructuralKor.gf index ea4f03c1..60b3f719 100644 --- a/src/korean/StructuralKor.gf +++ b/src/korean/StructuralKor.gf @@ -101,8 +101,8 @@ lin something_NP = mkNoun "무엇" ; -- 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 "에게" ; From ac1501c94263a620c8bb20e9ff90ba0a331396ef Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 6 Apr 2020 18:19:20 +0200 Subject: [PATCH 36/53] (Kor) Add inflection table to RCl and RS, change other funs accordingly --- src/korean/CatKor.gf | 4 ++-- src/korean/ConjunctionKor.gf | 18 ++++++++++-------- src/korean/NounKor.gf | 2 +- src/korean/RelativeKor.gf | 29 ++++++++++++++++++----------- src/korean/ResKor.gf | 2 +- src/korean/SentenceKor.gf | 2 +- 6 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/korean/CatKor.gf b/src/korean/CatKor.gf index 07a705d1..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. diff --git a/src/korean/ConjunctionKor.gf b/src/korean/ConjunctionKor.gf index cf4df960..6d81e0d4 100644 --- a/src/korean/ConjunctionKor.gf +++ b/src/korean/ConjunctionKor.gf @@ -29,11 +29,11 @@ concrete ConjunctionKor of Conjunction = lincat - [Adv],[AdV],[IAdv],[RS] = ConjSS ; + [Adv],[AdV],[IAdv] = ConjSS ; lin - BaseAdv, BaseAdV, BaseIAdv, BaseRS = baseSS ; - ConsAdv, ConsAdV, ConsIAdv, ConsRS = consSS ; - ConjAdv, ConjAdV, ConjIAdv, ConjRS = conjSS ; + BaseAdv, BaseAdV, BaseIAdv = baseSS ; + ConsAdv, ConsAdV, ConsIAdv = consSS ; + ConjAdv, ConjAdV, ConjIAdv = conjSS ; oper ConjSS : Type = SS ** {firstSS : ConjType => Str} ; @@ -71,20 +71,22 @@ oper mkFirstSS : SS -> ConjType => Str = \s -> \\conj => glue s.s (conjTable ! VStar ! conj) ; + + lincat - [S] = ResKor.Sentence ** {firstS : ConjType => Str} ; + [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 } ; diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index d74976d1..8c569347 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -165,7 +165,7 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { -- : CN -> RS -> CN ; RelCN cn rs = cn ** { - rs = cn.rs ++ rs.s + rs = cn.rs ++ rs.s ! Subord } ; diff --git a/src/korean/RelativeKor.gf b/src/korean/RelativeKor.gf index c55e2419..4150f6e4 100644 --- a/src/korean/RelativeKor.gf +++ b/src/korean/RelativeKor.gf @@ -3,21 +3,20 @@ concrete RelativeKor of Relative = CatKor ** open lin -- : Cl -> RCl ; -- such that John loves her - RelCl cl = {s = \\t,a,p => cl.s ! t ! a ! p ! Subord} ; + RelCl = relSlash (ss "") ; -- : RP -> VP -> RCl ; - RelVP rp vp = { - s = \\t,a,p => vp.adv - ++ vp.nObj - ++ vp.s ! VAttr p -- TODO no tenses yet in the grammar - ++ rp.s ; -} ; + 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 ; + _ => vp.s ! VAttr p } ; + } ; -- : RP -> ClSlash -> RCl ; -- whom John loves - RelSlash rp cls = { - s = \\t,a,p => cls.s ! t ! a ! p ! Subord - ++ rp.s ; -} ; + RelSlash = relSlash ; + -- : RP ; IdRP = {s = ""} ; @@ -25,4 +24,12 @@ lin -- : 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 de5c081d..a51bacbf 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -321,7 +321,7 @@ oper QClause : Type = Clause ; - RClause : Type = {s : Tense => Anteriority => Polarity => Str} ; + RClause : Type = Clause ; Sentence : Type = {s : ClType => Str} ; diff --git a/src/korean/SentenceKor.gf b/src/korean/SentenceKor.gf index 38d9738e..cc9a7f47 100644 --- a/src/korean/SentenceKor.gf +++ b/src/korean/SentenceKor.gf @@ -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 rcl = {s = t.s ++ p.s ++ rcl.s ! t.t ! t.a ! p.p} ; + 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 "" ; From 3c50099303f6e3847d4663b2ed512b60aae45fab Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 6 Apr 2020 18:19:33 +0200 Subject: [PATCH 37/53] (Kor) New + updated unit tests --- src/korean/unittest/relative.gftest | 16 ++++++++++++++++ src/korean/unittest/subjcases.gftest | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/korean/unittest/relative.gftest 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 index ce68a6a8..f4996cd7 100644 --- a/src/korean/unittest/subjcases.gftest +++ b/src/korean/unittest/subjcases.gftest @@ -15,6 +15,8 @@ LangKor: 고양이가 키가 작아요 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: 저는 고양이가 좋아요 +LangKor: 저는 고양이를 좋아해요 From ef06c0d3c0a1d0d4a4bf750c4ae0a9f65dabc72d Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 7 Apr 2020 13:50:48 +0200 Subject: [PATCH 38/53] (Kor) Add worst case constructors for A and V --- src/korean/LexiconKor.gf | 2 +- src/korean/ParadigmsKor.gf | 6 ++++++ src/korean/ResKor.gf | 38 ++++++++++++++++++++++++-------------- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/korean/LexiconKor.gf b/src/korean/LexiconKor.gf index 8ea10252..5a06dbf2 100644 --- a/src/korean/LexiconKor.gf +++ b/src/korean/LexiconKor.gf @@ -36,7 +36,7 @@ lin big_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 "" ; diff --git a/src/korean/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf index 268a4bea..1e14bd9c 100644 --- a/src/korean/ParadigmsKor.gf +++ b/src/korean/ParadigmsKor.gf @@ -27,6 +27,7 @@ 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 : (plain,polite,formal,neg,attr : Str) -> A ; -- Worst case constructor: e.g. mkA "파랗다" "파래요" "파랗습니다" "파랗지" "파란" } ; mkA2 : overload { @@ -43,6 +44,7 @@ oper 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,neg,attr : Str) -> V ; -- Worst case constructor: e.g. mkV "다르다" "달라요" "다릅니다" "다르지" "다른" } ; copula : V ; -- The copula verb '' @@ -133,6 +135,8 @@ 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 : (x1,_,_,_,x5 : Str) -> A + = \x1,x2,x3,x4,x5 -> lin A (mkAdjReg x1 x2 x3 x4 x5) ; } ; mkA2 = overload { @@ -148,6 +152,8 @@ oper 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,neg,attr : Str) -> V + = \x1,x2,x3,x4,x5 -> lin V (mkVerbReg x1 x2 x3 x4 x5) ; } ; copula = ResKor.copula ; diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index a51bacbf..8a0e94ac 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -144,14 +144,22 @@ oper Adjective : Type = {s : VForm => Str} ; -- Adjectives are verbs Adjective2 : Type = Adjective ** {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 { - VAttr Pos => add_N stem ; -- Positive Attr form is different in - vf => verb.s ! vf } -- adjectives, otherwise adj forms == verb forms. - } ; + let v : Verb = mkVerb plain ; + stem : Str = v.s ! VStem ; + attrpos : Str = add_N stem ; + in v2a attrpos v ; + + mkAdjReg : (x1,_,_,_,x5 : Str) -> Adjective = \plain,polite,formal,neg,attr -> + v2a attr (mkVerbReg plain polite formal neg attr) ; atoa2 : Adjective -> Adjective2 = \a -> a ** {c2=Bare ; p2=emptyPP} ; @@ -173,12 +181,13 @@ oper mkVerb : (plain : Str) -> Verb = \plain -> let stem = init plain ; 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 neg attrpos ; mkVerb2 : (plain : Str) -> Verb2 = \plain -> vtov2 (mkVerb plain) ; mkVerb3 : (plain : Str) -> Verb3 = \plain -> v2tov3 (mkVerb2 plain) ; @@ -186,10 +195,10 @@ oper vtov2 : Verb -> Verb2 = \v -> v ** {c2 = Object ; p2 = emptyPP} ; v2tov3 : Verb2 -> Verb3 = \v -> v ** {c3 = Bare ; p3 = datPP} ; - mkVerbReg : (x1,_,_,x4 : Str) -> Verb = - \plain,polite,formal,neg -> + -- ㄹ-irregulars, ㅎ-irregular + mkVerbReg : (x1,_,_,_,x5 : Str) -> Verb = + \plain,polite,formal,neg,attrpos -> let stem = init plain ; - attrpos = stem + "는" ; -- TODO: ㄹ-irregulars attrneg = neg ++ "않는" ; planeg = neg ++ negForms ! Plain ; polneg = neg ++ negForms ! Polite ; @@ -246,7 +255,8 @@ oper "하다" "해요" "합니다" - "하지" ; + "하지" + "한" ; negForms : Style => Str = table { Plain => "않다" ; From e54743feafb74ed169590b0ed669e1e2610afa21 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 7 Apr 2020 16:54:11 +0200 Subject: [PATCH 39/53] (Kor) Remove neg form from A's and V's worst-case constructor --- src/korean/LexiconKor.gf | 2 +- src/korean/ParadigmsKor.gf | 12 ++++++------ src/korean/ResKor.gf | 15 ++++++--------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/korean/LexiconKor.gf b/src/korean/LexiconKor.gf index 5a06dbf2..977f3ce2 100644 --- a/src/korean/LexiconKor.gf +++ b/src/korean/LexiconKor.gf @@ -36,7 +36,7 @@ lin big_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 "" ; diff --git a/src/korean/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf index 1e14bd9c..31c7524a 100644 --- a/src/korean/ParadigmsKor.gf +++ b/src/korean/ParadigmsKor.gf @@ -27,7 +27,7 @@ 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 : (plain,polite,formal,neg,attr : Str) -> A ; -- Worst case constructor: e.g. mkA "파랗다" "파래요" "파랗습니다" "파랗지" "파란" + mkA : (plain,polite,formal,attr : Str) -> A ; -- Worst case constructor: e.g. mkA "파랗다" "파래요" "파랗습니다" "파란" } ; mkA2 : overload { @@ -44,7 +44,7 @@ oper 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,neg,attr : Str) -> V ; -- Worst case constructor: e.g. mkV "다르다" "달라요" "다릅니다" "다르지" "다른" + mkV : (plain,polite,formal,attr : Str) -> V ; -- Worst case constructor: e.g. mkV "다르다" "달라요" "다릅니다" "다른" } ; copula : V ; -- The copula verb '' @@ -135,8 +135,8 @@ 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 : (x1,_,_,_,x5 : Str) -> A - = \x1,x2,x3,x4,x5 -> lin A (mkAdjReg x1 x2 x3 x4 x5) ; + mkA : (plain,polite,formal,attr : Str) -> A + = \x1,x2,x3,x4 -> lin A (mkAdjReg x1 x2 x3 x4) ; } ; mkA2 = overload { @@ -152,8 +152,8 @@ oper 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,neg,attr : Str) -> V - = \x1,x2,x3,x4,x5 -> lin V (mkVerbReg x1 x2 x3 x4 x5) ; + mkV : (plain,polite,formal,attr : Str) -> V + = \x1,x2,x3,x4 -> lin V (mkVerbReg x1 x2 x3 x4) ; } ; copula = ResKor.copula ; diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index 8a0e94ac..fc2d4aee 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -144,8 +144,6 @@ oper Adjective : Type = {s : VForm => Str} ; -- Adjectives are verbs Adjective2 : Type = Adjective ** {p2 : Postposition} ; - - v2a : (attrpos : Str) -> Verb -> Adjective = \attrpos,v -> { s = table { VAttr Pos => attrpos ; -- Positive Attr is different in @@ -158,8 +156,8 @@ oper attrpos : Str = add_N stem ; in v2a attrpos v ; - mkAdjReg : (x1,_,_,_,x5 : Str) -> Adjective = \plain,polite,formal,neg,attr -> - v2a attr (mkVerbReg plain polite formal neg attr) ; + 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} ; @@ -185,9 +183,8 @@ oper formal = case vowFinal stem of { True => add_B stem + "니다" ; False => stem + "습니다" } ; - neg = stem + "지" ; attrpos = stem + "는" ; - in mkVerbReg plain polite formal neg attrpos ; + in mkVerbReg plain polite formal attrpos ; mkVerb2 : (plain : Str) -> Verb2 = \plain -> vtov2 (mkVerb plain) ; mkVerb3 : (plain : Str) -> Verb3 = \plain -> v2tov3 (mkVerb2 plain) ; @@ -196,9 +193,10 @@ oper v2tov3 : Verb2 -> Verb3 = \v -> v ** {c3 = Bare ; p3 = datPP} ; -- ㄹ-irregulars, ㅎ-irregular - mkVerbReg : (x1,_,_,_,x5 : Str) -> Verb = - \plain,polite,formal,neg,attrpos -> + mkVerbReg : (x1,_,_,x4 : Str) -> Verb = + \plain,polite,formal,attrpos -> let stem = init plain ; + neg = stem + "지" ; attrneg = neg ++ "않는" ; planeg = neg ++ negForms ! Plain ; polneg = neg ++ negForms ! Polite ; @@ -255,7 +253,6 @@ oper "하다" "해요" "합니다" - "하지" "한" ; negForms : Style => Str = From 1928fcc1c3a6aebbb2f100d834b2077fb7a7ffc9 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 7 Apr 2020 18:21:35 +0200 Subject: [PATCH 40/53] (Kor) Add comma only as a conjunction. (Used in an application grammar) --- src/korean/ParamKor.gf | Bin 2779 -> 3199 bytes src/korean/ResKor.gf | 8 ++++++++ 2 files changed, 8 insertions(+) diff --git a/src/korean/ParamKor.gf b/src/korean/ParamKor.gf index 1b2a715db18a8cf765565e5416dd7723151b3fe0..7967a265cdc161a85ba20cbff93a10b6ffe101fa 100644 GIT binary patch delta 490 zcmcaD`d?y$3LATkf^&XuZsKHRwz>5Ry1EL%1*yrIi8%^N$@zI%rFqFEnfZB2Rtj0A z#U%;_r6mfIrKUn+K|xMtaw5nEh4iAt-1^+aA{~X4{512}XX?b;DJUq|+9@dMC@ENTf$h@ORq)JHD9K1w$jdLvP0Ue9PApE zLQ!f#YGO%hib7&qNotWoYGQJRLTXNGZfaf$$eBKw^~EI-FcX~-zE{XBR>;dQQAo^F zNGwV(1*ctA> z8I=mjnOdwjc{iJr zLA)K<->+v(c-=Kc2^3W!{x1FslW6ci@QGe&N1VGm~p E0HYhBga7~l delta 64 zcmew_aa(kQ3fp8IwmFlNIBd1Uf=d#M>=bP66qM}kl@zSG6ciK`Z2XIK{16haXH0nA MHAQLj8IH}&0EcuG-v9sr diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index fc2d4aee..fa4035ff 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -274,6 +274,14 @@ oper -- 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 From 99de92594e803ad571f357d5d480f94b1ef92097 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 7 Apr 2020 19:13:28 +0200 Subject: [PATCH 41/53] (Kor) Add new constructor for making A out of Str+V --- src/korean/ParadigmsKor.gf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/korean/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf index 31c7524a..160cc6ac 100644 --- a/src/korean/ParadigmsKor.gf +++ b/src/korean/ParadigmsKor.gf @@ -27,6 +27,7 @@ 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 "파랗다" "파래요" "파랗습니다" "파란" } ; @@ -136,7 +137,9 @@ oper 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) ; + = \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 { From dc948a1f9d95e938eb738b3bf9d983968cc5a6bb Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 7 Apr 2020 19:17:55 +0200 Subject: [PATCH 42/53] (Kor) Fix Attr in do_V, add adjective variant for using in compound adjs --- src/korean/ResKor.gf | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index fa4035ff..e4d73a43 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -249,11 +249,19 @@ oper "없어요" "없습니다" ; - do_V : Verb = mkVerbReg + -- 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 => "않다" ; From 80557e34b2b91c03a3ab459f22b4f3e5891d5096 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 7 Apr 2020 19:48:05 +0200 Subject: [PATCH 43/53] (Kor) Add NForm as a parameter to A2 --- src/korean/AdjectiveKor.gf | 4 ++-- src/korean/AdverbKor.gf | 6 +----- src/korean/ParadigmsKor.gf | 4 ++-- src/korean/ResKor.gf | 7 ++++++- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/korean/AdjectiveKor.gf b/src/korean/AdjectiveKor.gf index d4d3fb7c..d5a69c73 100644 --- a/src/korean/AdjectiveKor.gf +++ b/src/korean/AdjectiveKor.gf @@ -1,5 +1,5 @@ concrete AdjectiveKor of Adjective = CatKor ** - open ResKor, (AK=AdverbKor), Prelude in { + open ResKor, Prelude in { flags optimize=all_subs ; @@ -18,7 +18,7 @@ concrete AdjectiveKor of Adjective = CatKor ** -- : A2 -> NP -> AP ; -- married to her ComplA2 a2 np = a2 ** { - compar = (AK.PrepNP a2.p2 np).s ; + compar = (prepNP a2.c2 a2.p2 np).s ; } ; -- : A2 -> AP ; -- married to itself diff --git a/src/korean/AdverbKor.gf b/src/korean/AdverbKor.gf index 126cb3d8..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 ! np.p) ; - False => np.s ! Bare ++ (prep.s ! np.p)} - } ; + PrepNP = prepNP Bare ; -- Adverbs can be modified by 'adadjectives', just like adjectives. diff --git a/src/korean/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf index 160cc6ac..cfa77008 100644 --- a/src/korean/ParadigmsKor.gf +++ b/src/korean/ParadigmsKor.gf @@ -147,8 +147,8 @@ oper mkA2 : Str -> Str -> A2 = \s,p -> let adj : Adjective = mkAdj s ; prep : Prep = mkPrep p - in lin A2 (adj ** {p2 = prep}) ; - mkA2 : A -> Prep -> A2 = \a,p -> lin A2 (a ** {p2 = p}) ; + in lin A2 (atoa2 adj ** {p2 = prep}) ; + mkA2 : A -> Prep -> A2 = \a,p -> lin A2 (atoa2 a ** {p2 = p}) ; } ; mkV = overload { diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index e4d73a43..a6b4b725 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -142,7 +142,7 @@ oper -- Adjectives Adjective : Type = {s : VForm => Str} ; -- Adjectives are verbs - Adjective2 : Type = Adjective ** {p2 : Postposition} ; + Adjective2 : Type = Adjective ** {c2 : NForm ; p2 : Postposition} ; v2a : (attrpos : Str) -> Verb -> Adjective = \attrpos,v -> { s = table { @@ -273,6 +273,11 @@ 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 From 291a3051efbdae477581db66771c62e60a6d3f5b Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 7 Apr 2020 21:02:42 +0200 Subject: [PATCH 44/53] (Kor) Add ApposNP in ExtendKor --- src/korean/ExtendKor.gf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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} ; } ; From d9d2b907d1174c4ce64dbec1456d24f561531268 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 7 Apr 2020 21:09:01 +0200 Subject: [PATCH 45/53] (Kor) Small fixes in comma versions of Conj opers --- src/korean/ConjunctionKor.gf | 19 ++++++++++++++++++- src/korean/ParamKor.gf | Bin 3199 -> 3234 bytes 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/korean/ConjunctionKor.gf b/src/korean/ConjunctionKor.gf index 6d81e0d4..42952fd8 100644 --- a/src/korean/ConjunctionKor.gf +++ b/src/korean/ConjunctionKor.gf @@ -63,7 +63,8 @@ oper conjSScomma : Conj -> ConjSS -> SS = \co,ss -> { s = co.s1 - ++ glue (ss.firstSS ! co.c) co.s2 + ++ ss.firstSS ! co.c + ++ co.s2 ++ ss.s } ; @@ -151,6 +152,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/ParamKor.gf b/src/korean/ParamKor.gf index 7967a265cdc161a85ba20cbff93a10b6ffe101fa..b1811c199686610bba567d1de4d2d2ce4b8df94d 100644 GIT binary patch delta 58 zcmew_u}E@57Q3!ra7kj3oq~dbt(}6Bj*@~kmx6+Vf{k;2Zf>GZ7_#K6%?mb{uyeBl E0PcAZvH$=8 delta 23 ecmZ1^`Cno~7CTqGoq~dbt(}6B&gSXt+^hgtHwHxj From cc3a2646f8084e6f79d7ab4770ee6b7826066338 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 7 Apr 2020 21:09:19 +0200 Subject: [PATCH 46/53] (Kor) Small cleanup + new words --- src/korean/LexiconKor.gf | 2 +- src/korean/ResKor.gf | 2 -- src/korean/StructuralKor.gf | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/korean/LexiconKor.gf b/src/korean/LexiconKor.gf index 977f3ce2..f57e9e14 100644 --- a/src/korean/LexiconKor.gf +++ b/src/korean/LexiconKor.gf @@ -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 "" ; diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index a6b4b725..e8907c24 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -300,12 +300,10 @@ oper Complement : Type = { s : VForm => Str ; - -- compar : Str ; -- comparative is discontinuous } ; emptyComp : Complement = { s = \\_ => [] ; - -- compar : Str ; } ; BaseVP : Type = { diff --git a/src/korean/StructuralKor.gf b/src/korean/StructuralKor.gf index 60b3f719..f3c5cb92 100644 --- a/src/korean/StructuralKor.gf +++ b/src/korean/StructuralKor.gf @@ -69,7 +69,7 @@ lin only_Predet = {s = \\_ => "만" ; p = Consonant} ; --lin every_Det = ; -lin few_Det = mkDet "조금" Pl ; +lin few_Det = mkDet "조금의" Pl ; lin many_Det = mkDet "많은" Pl ; -- lin much_Det = ; From fc8987e557bbe7ce3a8cbf644b9a106750b03094 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 7 Apr 2020 21:30:43 +0200 Subject: [PATCH 47/53] (Kor) Small cleanup + new words --- src/korean/Hangul.gf | 1 + src/korean/LexiconKor.gf | 6 +++--- src/korean/ResKor.gf | 2 -- src/korean/StructuralKor.gf | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) 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 977f3ce2..11e46d85 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 @@ -223,7 +223,7 @@ lin like_V2 = mkV2 (mkV "좋아" do_V) topic object ; -- 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 "" ; @@ -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 "" ; diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index a6b4b725..e8907c24 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -300,12 +300,10 @@ oper Complement : Type = { s : VForm => Str ; - -- compar : Str ; -- comparative is discontinuous } ; emptyComp : Complement = { s = \\_ => [] ; - -- compar : Str ; } ; BaseVP : Type = { diff --git a/src/korean/StructuralKor.gf b/src/korean/StructuralKor.gf index 60b3f719..fe62f835 100644 --- a/src/korean/StructuralKor.gf +++ b/src/korean/StructuralKor.gf @@ -69,7 +69,7 @@ lin only_Predet = {s = \\_ => "만" ; p = Consonant} ; --lin every_Det = ; -lin few_Det = mkDet "조금" Pl ; +lin few_Det = mkDet "조금의" Pl ; lin many_Det = mkDet "많은" Pl ; -- lin much_Det = ; @@ -115,7 +115,7 @@ 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 "" ; From 96a7f49132ab23ec11dd9df86225f6c693c9feac Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 7 Apr 2020 21:31:10 +0200 Subject: [PATCH 48/53] Update languages.csv + MissingKor --- languages.csv | 2 +- src/korean/MissingKor.gf | 43 ++++++++++------------------------------ 2 files changed, 11 insertions(+), 34 deletions(-) diff --git a/languages.csv b/languages.csv index 7497a742..1259a866 100644 --- a/languages.csv +++ b/languages.csv @@ -23,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/korean/MissingKor.gf b/src/korean/MissingKor.gf index 3fed47a8..cd6f6822 100644 --- a/src/korean/MissingKor.gf +++ b/src/korean/MissingKor.gf @@ -11,10 +11,11 @@ oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ; oper AdvAP : AP -> Adv -> AP = notYet "AdvAP" ; 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 BaseAdV : AdV -> AdV -> ListAdV = notYet "BaseAdV" ; oper BaseCN : CN -> CN -> ListCN = notYet "BaseCN" ; +oper BaseIAdv : IAdv -> IAdv -> ListIAdv = notYet "BaseIAdv" ; oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ; oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ; oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ; @@ -29,18 +30,17 @@ 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 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 ConsAdV : AdV -> ListAdV -> ListAdV = notYet "ConsAdV" ; oper ConsCN : CN -> ListCN -> ListCN = notYet "ConsCN" ; oper ConsIAdv : IAdv -> ListIAdv -> ListIAdv = notYet "ConsIAdv" ; 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" ; @@ -48,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" ; @@ -58,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" ; @@ -71,7 +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 PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ; oper ProgrVP : VP -> VP = notYet "ProgrVP" ; oper QuestCl : Cl -> QCl = notYet "QuestCl" ; @@ -84,12 +77,12 @@ oper ReflA2 : A2 -> AP = notYet "ReflA2" ; oper ReflVP : VPSlash -> VP = notYet "ReflVP" ; oper RelNP : NP -> RS -> NP = notYet "RelNP" ; oper RelS : S -> RS -> S = notYet "RelS" ; +oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ; 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" ; @@ -104,10 +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 UseQCl : Temp -> Pol -> QCl -> QS = notYet "UseQCl" ; oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ; +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 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" ; @@ -146,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" ; @@ -165,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" ; @@ -183,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" ; @@ -211,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" ; @@ -237,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" ; @@ -275,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" ; @@ -298,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" ; @@ -329,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" ; @@ -338,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" ; @@ -376,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" ; @@ -405,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" ; @@ -435,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" ; @@ -454,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" ; @@ -553,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" ; } From 0d6948f59b25b9f0d67244172ba85570ffd6405d Mon Sep 17 00:00:00 2001 From: aarneranta Date: Wed, 8 Apr 2020 11:07:12 +0200 Subject: [PATCH 49/53] added more comments to Czech files --- src/czech/CatCze.gf | 26 ++++++++++---------- src/czech/NounCze.gf | 2 +- src/czech/NumeralCze.gf | 1 + src/czech/ResCze.gf | 49 +++++++++++++++++++++++++++++--------- src/czech/SentenceCze.gf | 3 ++- src/czech/StructuralCze.gf | 2 +- 6 files changed, 56 insertions(+), 27 deletions(-) diff --git a/src/czech/CatCze.gf b/src/czech/CatCze.gf index 8dceb6a5..25ac6cef 100644 --- a/src/czech/CatCze.gf +++ b/src/czech/CatCze.gf @@ -12,15 +12,15 @@ concrete CatCze of Cat = Cl = {subj,clit,compl : Str ; verb : VerbForms ; a : Agr} ; Comp = {s : Agr => Str} ; - QS = {s : Str} ; ---- - QCl = {subj,clit,compl : Str ; verb : VerbForms ; a : Agr} ; ---- + QS = {s : Str} ; ---- TODO: indirect questions + QCl = {subj,clit,compl : Str ; verb : VerbForms ; a : Agr} ; -- = Cl ---- check if enough IAdv = {s : Str} ; RS = {s : Agr => Str} ; - RCl = {subj,clit,compl : Agr => Str ; verb : VerbForms} ; ---- RAgr + RCl = {subj,clit,compl : Agr => Str ; verb : VerbForms} ; ---- RAgr with composite RP RP = AdjForms ; - VP = {verb : VerbForms ; clit,compl : Agr => Str} ; ---- + VP = {verb : VerbForms ; clit,compl : Agr => Str} ; ---- more fields probably needed VPSlash = {verb : VerbForms ; clit,compl : Agr => Str ; c : ComplementCase} ; ---- V = ResCze.VerbForms ; V2 = ResCze.VerbForms ** {c : ComplementCase} ; @@ -33,22 +33,22 @@ concrete CatCze of Cat = N = ResCze.NounForms ; CN = ResCze.Noun ; -- {s : Number => Case => Str ; g : Gender} - NP = {s,clit,prep : Case => Str ; a : Agr ; hasClit : Bool} ; ---- - PN = {s : Case => Str ; g : Gender} ; ---- - Det = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ; + NP = {s,clit,prep : Case => Str ; a : Agr ; hasClit : Bool} ; -- clit,prep differ for pronouns + PN = {s : Case => Str ; g : Gender} ; + Det = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ; -- can contain a numeral, therefore NumSize Quant = {s : Gender => Number => Case => Str} ; -- same as AP - Num = {s : Gender => Case => Str ; size : NumSize} ; + Num = Determiner ; Card = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ; Pron = PronForms ; Adv = {s : Str} ; Prep = ResCze.ComplementCase ; -- {s : Str ; c : Case ; hasPrep : Bool} ; - Conj = {s1,s2 : Str} ; ---- + Conj = {s1,s2 : Str} ; ---- may need a number Pol = {s : Str ; p : Bool} ; - Temp = {s : Str ; t : CTense} ; ---- - Tense = {s : Str ; t : CTense} ; ---- - Ant = {s : Str ; t : CTense} ; ---- + Temp = {s : Str ; t : CTense} ; + Tense = {s : Str ; t : CTense} ; + Ant = {s : Str ; t : CTense} ; PConj = {s : Str} ; Voc = {s : Str} ; @@ -63,7 +63,7 @@ concrete CatCze of Cat = A = \s -> s.msnom ; - lincat Numeral = Determiner ; ---- should contain Ord as well + lincat Numeral = Determiner ; ---- TODO: should contain Ord as well lincat Digits = {s:Str ; size : NumSize} ; diff --git a/src/czech/NounCze.gf b/src/czech/NounCze.gf index 03d722cd..ef990e0c 100644 --- a/src/czech/NounCze.gf +++ b/src/czech/NounCze.gf @@ -88,7 +88,7 @@ lin UseN n = nounFormsNoun n ; ApposCN cn np = { - s = \\n,c => cn.s ! n ! c ++ np.s ! c ; ---- + s = \\n,c => cn.s ! n ! c ++ np.s ! c ; ---- TODO check apposition order g = cn.g } ; diff --git a/src/czech/NumeralCze.gf b/src/czech/NumeralCze.gf index 370c6f9f..26d98fb7 100644 --- a/src/czech/NumeralCze.gf +++ b/src/czech/NumeralCze.gf @@ -9,6 +9,7 @@ concrete NumeralCze of Numeral = -- from gf-contrib/numerals/czech.gf, added inflections -- AR 2020-03-20 +---- TODO ordinal forms oper LinNumeral = Determiner ; -- {s : NumeralForms ; size : NumSize} ; diff --git a/src/czech/ResCze.gf b/src/czech/ResCze.gf index 29f409d0..7f791252 100644 --- a/src/czech/ResCze.gf +++ b/src/czech/ResCze.gf @@ -1,5 +1,9 @@ resource ResCze = open Prelude in { +-- AR March 2020 +-- sources: +-- Wiki = https://en.wikipedia.org/wiki/Czech_declension, https://en.wikipedia.org/wiki/Czech_conjugation +-- CEG = J. Naughton, Czech: an Essential Grammar, Routledge 2005. -- parameters @@ -15,7 +19,7 @@ param Agr = Ag Gender Number Person ; - CTense = CTPres | CTPast ; ----- + CTense = CTPres | CTPast ; ----- TODO complete the tense system to match Czech verb morphology -- phonology @@ -31,8 +35,6 @@ oper "b" | "f" | "l" | "m" | "p" | "s" | "v" ) ; - - dropFleetingE : Str -> Str = \s -> case s of { x + "e" + c@("k"|"c") => x + c ; x + "e" + "ň" => x + "n" ; @@ -89,10 +91,25 @@ oper --------------- -- Nouns +--------------- + +-- novel idea (for RGL): lexical items stored as records rather than tables +-- advantages: +-- - easier to make exceptions to paradigms (by ** {}) +-- - easier to keep the number of forms minimal +-- - easier to see what is happening than with lots of anonymous arguments to mkN, mkA, mkV + +-- so this is the lincat of N - Noun : Type = {s : Number => Case => Str ; g : Gender} ; NounForms : Type = {snom,sgen,sdat,sacc,svoc,sloc,sins, pnom,pgen,pdat,pacc,ploc,pins : Str ; g : Gender} ; +-- But traditional tables make agreement easier to handle in syntax +-- so this is the lincat of CN + + Noun : Type = {s : Number => Case => Str ; g : Gender} ; + +-- this is used in UseN + nounFormsNoun : NounForms -> Noun = \forms -> { s = table { @@ -117,7 +134,7 @@ oper g = forms.g } ; - +-- terminology of CEG DeclensionType : Type = Str -> NounForms ; declensionNounForms : (nom,gen : Str) -> Gender -> NounForms @@ -142,6 +159,8 @@ oper } in decl nom ; +-- the "smartest" one-argument mkN + guessNounForms : Str -> NounForms = \s -> case s of { _ + "ost" => declKOST s ; @@ -155,11 +174,11 @@ oper _ + "í" => declSTAVENI s ; _ => Predef.error ("cannot guess declension type for" ++ s) } ; - --- source: https://en.wikipedia.org/wiki/Czech_declension +-- the traditional declensions, in both CEG and Wiki +-- they are also exported in ParadigmsCze with names panN etc - declPAN : DeclensionType = \pan -> --- plural nom ové|i|é should be given as extra arg 3.5.1 + declPAN : DeclensionType = \pan -> --- plural nom ové|i|é can be changed with ** {pnom = ...} CEG 3.5.1 { snom = pan ; sgen,sacc = pan + "a" ; @@ -406,6 +425,7 @@ oper Adjective : Type = {s : Gender => Number => Case => Str} ; -- to be used for A, in three degrees: 15 forms in each +---- TODO other degrees than positive AdjForms : Type = { msnom, fsnom, nsnom : Str ; -- svoc = snom @@ -420,6 +440,8 @@ oper pins : Str ; } ; +-- used in PositA but will also work in Compar and Superl by calling their record fields + adjFormsAdjective : AdjForms -> Adjective = \afs -> { s = \\g,n,c => case of { @@ -562,6 +584,9 @@ adjFormsAdjective : AdjForms -> Adjective = \afs -> { pastpartpl = "měli" ; } ; +-- just an example of a traditional paradigm +---- TODO other traditional paradigms + iii_kupovatVerbForms : Str -> VerbForms = \kupovat -> let kupo = Predef.tk 3 kupovat ; @@ -593,6 +618,8 @@ adjFormsAdjective : AdjForms -> Adjective = \afs -> { a : Agr } ; +---- TODO: possessives + personalPron : Agr -> PronForms = \a -> {a = a ; cnom = []} ** case a of { @@ -682,7 +709,7 @@ adjFormsAdjective : AdjForms -> Adjective = \afs -> { } ; -------------------------------- --- demonstrative pronouns +-- demonstrative pronouns, used for Quant and Det oper DemPronForms : Type = { @@ -785,7 +812,7 @@ oper -- example: number 1 oneNumeral : Determiner = numeralFormsDeterminer (mkDemPronForms "jed") Num1 ; - -- numbers 2,3,4 ---- to check if everything comes out right with this type + -- numbers 2,3,4 ---- to check if everything comes out right with the determiner type twoNumeral : Determiner = let forms = { msnom = "dva" ; fsnom, nsnom, fsacc = "dvě" ; @@ -830,7 +857,7 @@ oper -- combining nouns with numerals param - NumSize = Num1 | Num2_4 | Num5 ; -- essential grammar 6.1 + NumSize = Num1 | Num2_4 | Num5 ; -- CEG 6.1 oper numSizeForm : (Number => Case => Str) -> NumSize -> Case -> Str diff --git a/src/czech/SentenceCze.gf b/src/czech/SentenceCze.gf index 15e80b4c..2793ec35 100644 --- a/src/czech/SentenceCze.gf +++ b/src/czech/SentenceCze.gf @@ -17,8 +17,9 @@ lin s = temp.s ++ cl.subj ++ cl.clit ++ pol.s ++ verbAgr cl.verb cl.a pol.p ++ cl.compl ; } ; + --- TODO is inversion the standard? ; add indirect questions UseQCl temp pol cl = { - s = temp.s ++ cl.clit ++ pol.s ++ verbAgr cl.verb cl.a pol.p ++ cl.subj ++ cl.compl ; ---- inversion optional + s = temp.s ++ cl.clit ++ pol.s ++ verbAgr cl.verb cl.a pol.p ++ cl.subj ++ cl.compl ; } ; UseRCl temp pol rcl = { diff --git a/src/czech/StructuralCze.gf b/src/czech/StructuralCze.gf index ffe5a10b..6cbf9280 100644 --- a/src/czech/StructuralCze.gf +++ b/src/czech/StructuralCze.gf @@ -12,7 +12,7 @@ lin many_Det = regNumeral "mnoho" "mnoha" ; -- CEG 6.8 ---- or_Conj = mkConj "nebo" ; somePl_Det = regNumeral "několik" "několika" ; -- CEG 6.8 ---- - something_NP = {s,clit,prep = \\c => "ně" ++ coForms ! c ; a = Ag Neutr Sg P3 ; hasClit = False} ; -- CEG 5.6.3 + something_NP = {s,clit,prep = \\c => "ně" + coForms ! c ; a = Ag Neutr Sg P3 ; hasClit = False} ; -- CEG 5.6.3 possess_Prep = mkPrep "" Gen ; that_Quant = demPronFormsAdjective (mkDemPronForms "tamt") "" ; this_Quant = demPronFormsAdjective (mkDemPronForms "t") "to" ; From f39662af62f0888c8b1c72695ea33bfba1884aab Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 8 Apr 2020 20:32:03 +0200 Subject: [PATCH 50/53] =?UTF-8?q?(Kor)=20Add=20a=20conjunction=20that=20re?= =?UTF-8?q?peats=20"=EA=B3=A0,"=20after=20each=20word?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/korean/ParamKor.gf | Bin 3234 -> 3235 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/korean/ParamKor.gf b/src/korean/ParamKor.gf index b1811c199686610bba567d1de4d2d2ce4b8df94d..4b883ea5b9622265f90ccf70fffddbf8dc0e96f0 100644 GIT binary patch delta 14 VcmZ1^xma?;baqCa&C}VrSpg Date: Wed, 8 Apr 2020 21:04:57 +0200 Subject: [PATCH 51/53] (Kor) Add new constructor for N + new words --- src/korean/LexiconKor.gf | 6 +++--- src/korean/ParadigmsKor.gf | 24 +++++++++++++++++------- src/korean/ResKor.gf | 3 ++- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/korean/LexiconKor.gf b/src/korean/LexiconKor.gf index 11e46d85..e2783bc5 100644 --- a/src/korean/LexiconKor.gf +++ b/src/korean/LexiconKor.gf @@ -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 "" ; @@ -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 "" ; @@ -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/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf index cfa77008..185cb147 100644 --- a/src/korean/ParadigmsKor.gf +++ b/src/korean/ParadigmsKor.gf @@ -15,11 +15,16 @@ oper 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 with classifier 개 - mkN : (noun,counter : Str) -> N ; -- Noun and classifier given as arguments. + 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 @@ -114,15 +119,20 @@ oper object = Object ; noCase = Bare ; + NumOrigin : Type = ResKor.NumOrigin ; + nativeKorean = NK ; + sinoKorean = SK ; + mkN = overload { mkN : Str -> N = \s -> lin N (mkNoun s) ; - mkN : (noun,counter : Str) -> N = \n,c -> - let noun : Noun = mkNoun n ; - counter : Counter = mkCounter c ; - in lin N (noun ** {c = counter}) ; - + 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) ; diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf index e8907c24..59bf669a 100644 --- a/src/korean/ResKor.gf +++ b/src/korean/ResKor.gf @@ -13,8 +13,9 @@ oper origin = NK } ; - mkCounter : Str -> Counter = \s -> baseCounter ** { + mkCounter : Str -> NumOrigin -> Counter = \s,o -> baseCounter ** { s = s ; + origin = o ; } ; BaseNoun : Type = { From 3bda323675ae6a5c001d7fd9a41cacce8b160dd6 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 9 Apr 2020 10:58:46 +0200 Subject: [PATCH 52/53] (Kor) Add show function for param VForm (used in an application grammar) --- src/korean/ParamKor.gf | Bin 3235 -> 3733 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/korean/ParamKor.gf b/src/korean/ParamKor.gf index 4b883ea5b9622265f90ccf70fffddbf8dc0e96f0..24832b20a1aaee3106a3319d9fa67d5214ebc9cd 100644 GIT binary patch delta 527 zcmZ21IaPMU4eojc1zlZ*(Bjk-h0HvK#5{$>f`XjPT%#Ju!W zkmj;9qvDbx1uKOxxBQ}91zkIZ;F2N*TZNdiw0aOPIk7lZp)5@yKTV;UOF=inDBjHNXj19=o$t+1laiE(5LJ-+hh-ke6s<9AJkRXcMoW#sLu&HoQxhVv| e1Tj^D%*0R$acZrCH5ZpI98A_@^qQ>0Qw{(^JCz6k delta 15 WcmbO#yI69=4erS*j3JZd_{sq;tp!8? From 00c9782c9aa894684e968f082f5fb020bb9b4555 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 9 Apr 2020 11:08:16 +0200 Subject: [PATCH 53/53] (Kor) Add explicit plural for all nouns --- src/korean/NounKor.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index 8c569347..83f06e7d 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -10,8 +10,8 @@ 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 ;