From 7b09a6cf8b18e87ce838cd6289bc10b0fc5d6775 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 1 Apr 2020 17:31:15 +0200 Subject: [PATCH 01/20] (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 02/20] (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 03/20] (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 04/20] (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 05/20] (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 06/20] (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 07/20] (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 08/20] (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 09/20] (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 10/20] (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 11/20] (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 12/20] 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 13/20] (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 14/20] (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 15/20] (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 16/20] (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 17/20] (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 18/20] (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 19/20] (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 20/20] (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" ;