1
0
forked from GitHub/gf-rgl
This commit is contained in:
krangelov
2020-04-14 11:10:03 +02:00
57 changed files with 2436 additions and 381 deletions

View File

@@ -5,6 +5,7 @@ Ara,Arabic,arabic,,,,,,y,,y
Bul,Bulgarian,bulgarian,,,y,,,,,y
Cat,Catalan,catalan,Romance,,y,,,,y,y
Chi,Chinese (simplified),chinese,,,,,,,,y
Cze,Czech,czech,,,n,n,n,n,n,n
Dan,Danish,danish,Scand,,y,,,,,y
Dut,Dutch,dutch,,,y,,,,,y
Eng,English,english,,,y,,,,y,y
@@ -22,7 +23,7 @@ Ice,Icelandic,icelandic,,,,,,n,,y
Ina,Interlingua,interlingua,,,y,,n,n,,n
Ita,Italian,italian,Romance,,y,,,,y,y
Jpn,Japanese,japanese,,,,,,,,y
Kor,Korean,korean,,,n,n,n,n,n,n
Kor,Korean,korean,,,n,y,y,y,n,n
Lat,Latin,latin,,,,,y,y,n,y
Lav,Latvian,latvian,,,,,,,y,y
Mlt,Maltese,maltese,,,,,,,,y
1 Code Name Directory Functor Unlexer Present All Try Symbolic Compatibility Synopsis
5 Bul Bulgarian bulgarian y y
6 Cat Catalan catalan Romance y y y
7 Chi Chinese (simplified) chinese y
8 Cze Czech czech n n n n n n
9 Dan Danish danish Scand y y
10 Dut Dutch dutch y y
11 Eng English english y y y
23 Ina Interlingua interlingua y n n n
24 Ita Italian italian Romance y y y
25 Jpn Japanese japanese y
26 Kor Korean korean n n y n y n y n n
27 Lat Latin latin y y n y
28 Lav Latvian latvian y y
29 Mlt Maltese maltese y

View File

@@ -0,0 +1,9 @@
--# -path=.:alltenses:prelude
resource CombinatorsCze = Combinators with
(Cat = CatCze),
(Structural = StructuralCze),
(Constructors = ConstructorsCze)
** open MissingCze in {}

View File

@@ -1,4 +1,4 @@
--# -path=.:alltenses:prelude:src/korean
--# -path=.:alltenses:prelude:../korean
resource CombinatorsKor = Combinators with
(Cat = CatKor),

View File

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

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

@@ -0,0 +1,6 @@
--# -path=.:../czech:../common:../abstract:../prelude
resource SymbolicCze = Symbolic with
(Symbol = SymbolCze),
(Grammar = GrammarCze)
** open MissingCze in {}

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

@@ -0,0 +1,4 @@
--# -path=.:./alltenses:../prelude
instance SyntaxCze of Syntax =
ConstructorsCze, CatCze, StructuralCze, CombinatorsCze ;

View File

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

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

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

23
src/czech/AdjectiveCze.gf Normal file
View File

@@ -0,0 +1,23 @@
concrete AdjectiveCze of Adjective = CatCze ** open ResCze, Prelude in {
lin
PositA a = adjFormsAdjective a ** {isPost = False} ;
AdAP ada ap = ap ** {s = \\g,n,c => ada.s ++ ap.s ! g ! n ! c} ;
ComplA2 a np =
let ap = adjFormsAdjective a
in
ap ** {
s = \\g,n,c => ap.s ! g ! n ! c ++ a.c.s ++ np.s ! a.c.c ;
isPost = True ;
} ;
UseA2 a = adjFormsAdjective a ** {isPost = False} ;
UseComparA a = adjFormsAdjective a ** {isPost = False} ; ---- TODO: this gives positive forms
AdvAP ap adv = ap ** {s = \\g,n,c => ap.s ! g ! n ! c ++ adv.s} ;
}

9
src/czech/AdverbCze.gf Normal file
View File

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

6
src/czech/AllCze.gf Normal file
View File

@@ -0,0 +1,6 @@
--# -path=.:../abstract:../common:../api
concrete AllCze of AllCzeAbs =
LangCze
;

6
src/czech/AllCzeAbs.gf Normal file
View File

@@ -0,0 +1,6 @@
--# -path=.:../abstract:../common:prelude
abstract AllCzeAbs =
Lang
;

70
src/czech/CatCze.gf Normal file
View File

@@ -0,0 +1,70 @@
concrete CatCze of Cat =
--- CommonX **
open ResCze, Prelude in {
lincat
Text = {s : Str} ;
Phr = {s : Str} ;
Utt = {s : Str} ;
S = {s : Str} ;
Cl = {subj,clit,compl : Str ; verb : VerbForms ; a : Agr} ;
Comp = {s : Agr => Str} ;
QS = {s : Str} ; ---- TODO: indirect questions
QCl = {subj,clit,compl : Str ; verb : VerbForms ; a : Agr} ; -- = Cl ---- check if enough
IAdv = {s : Str} ;
RS = {s : Agr => Str} ;
RCl = {subj,clit,compl : Agr => Str ; verb : VerbForms} ; ---- RAgr with composite RP
RP = AdjForms ;
VP = {verb : VerbForms ; clit,compl : Agr => Str} ; ---- more fields probably needed
VPSlash = {verb : VerbForms ; clit,compl : Agr => Str ; c : ComplementCase} ; ----
V = ResCze.VerbForms ;
V2 = ResCze.VerbForms ** {c : ComplementCase} ;
A = ResCze.AdjForms ;
AP = ResCze.Adjective ** {isPost : Bool} ; -- {s : Gender => Number => Case => Str}
A2 = ResCze.AdjForms ** {c : ComplementCase} ;
AdA = {s : Str} ;
N = ResCze.NounForms ;
CN = ResCze.Noun ; -- {s : Number => Case => Str ; g : Gender}
NP = {s,clit,prep : Case => Str ; a : Agr ; hasClit : Bool} ; -- clit,prep differ for pronouns
PN = {s : Case => Str ; g : Gender} ;
Det = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ; -- can contain a numeral, therefore NumSize
Quant = {s : Gender => Number => Case => Str} ; -- same as AP
Num = Determiner ;
Card = Determiner ; -- {s : Gender => Case => Str ; size : NumSize} ;
Pron = PronForms ;
Adv = {s : Str} ;
Prep = ResCze.ComplementCase ; -- {s : Str ; c : Case ; hasPrep : Bool} ;
Conj = {s1,s2 : Str} ; ---- may need a number
Pol = {s : Str ; p : Bool} ;
Temp = {s : Str ; t : CTense} ;
Tense = {s : Str ; t : CTense} ;
Ant = {s : Str ; t : CTense} ;
PConj = {s : Str} ;
Voc = {s : Str} ;
AdN = {s : Str} ;
AdV = {s : Str} ;
CAdv = {s : Str} ;
SC = {s : Str} ;
linref
N = \s -> s.snom ;
A = \s -> s.msnom ;
lincat Numeral = Determiner ; ---- TODO: should contain Ord as well
lincat Digits = {s:Str ; size : NumSize} ;
}

View File

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

19
src/czech/GrammarCze.gf Normal file
View File

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

5
src/czech/IdiomCze.gf Normal file
View File

@@ -0,0 +1,5 @@
concrete IdiomCze of Idiom = CatCze ** open Prelude, ResCze in {
}

10
src/czech/LangCze.gf Normal file
View File

@@ -0,0 +1,10 @@
--# -path=.:../abstract:../common:../api
concrete LangCze of Lang =
GrammarCze,
LexiconCze
-- ,ConstructionCze
-- ,DocumentationCze --# notpresent
** {
}

59
src/czech/LexiconCze.gf Normal file
View File

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

102
src/czech/MissingCze.gf Normal file
View File

@@ -0,0 +1,102 @@
resource MissingCze = open GrammarCze, Prelude in {
-- temporary definitions to enable the compilation of RGL API
oper AAnter : Ant = notYet "AAnter" ;
oper AdAdv : AdA -> Adv -> Adv = notYet "AdAdv" ;
oper AdNum : AdN -> Card -> Card = notYet "AdNum" ;
oper AdVVP : AdV -> VP -> VP = notYet "AdVVP" ;
oper AdjOrd : Ord -> AP = notYet "AdjOrd" ;
oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ;
oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ;
oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ;
oper AdvS : Adv -> S -> S = notYet "AdvS" ;
oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ;
oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ;
oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ;
oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ;
oper CompCN : CN -> Comp = notYet "CompCN" ;
oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ;
oper CompIP : IP -> IComp = notYet "CompIP" ;
oper ComparA : A -> NP -> AP = notYet "ComparA" ;
oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ;
oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ;
oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ;
oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ;
oper ComplVA : VA -> AP -> VP = notYet "ComplVA" ;
oper ComplVQ : VQ -> QS -> VP = notYet "ComplVQ" ;
oper ComplVS : VS -> S -> VP = notYet "ComplVS" ;
oper ComplVV : VV -> VP -> VP = notYet "ComplVV" ;
oper DetNP : Det -> NP = notYet "DetNP" ;
oper DetQuantOrd : Quant -> Num -> Ord -> Det = notYet "DetQuantOrd" ;
oper EmbedQS : QS -> SC = notYet "EmbedQS" ;
oper EmbedS : S -> SC = notYet "EmbedS" ;
oper EmbedVP : VP -> SC = notYet "EmbedVP" ;
oper ExistIP : IP -> QCl = notYet "ExistIP" ;
oper ExistNP : NP -> Cl = notYet "ExistNP" ;
oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ;
oper GenericCl : VP -> Cl = notYet "GenericCl" ;
oper IdetCN : IDet -> CN -> IP = notYet "IdetCN" ;
oper IdetIP : IDet -> IP = notYet "IdetIP" ;
oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ;
oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ;
oper ImpVP : VP -> Imp = notYet "ImpVP" ;
oper ImpersCl : VP -> Cl = notYet "ImpersCl" ;
oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ;
oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ;
oper OrdSuperl : A -> Ord = notYet "OrdSuperl" ;
oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ;
oper PassV2 : V2 -> VP = notYet "PassV2" ;
oper PositAdvAdj : A -> Adv = notYet "PositAdvAdj" ;
oper PossPron : Pron -> Quant = notYet "PossPron" ;
oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ;
oper PredetNP : Predet -> NP -> NP = notYet "PredetNP" ;
oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ;
oper ProgrVP : VP -> VP = notYet "ProgrVP" ;
oper QuestIAdv : IAdv -> Cl -> QCl = notYet "QuestIAdv" ;
oper QuestIComp : IComp -> NP -> QCl = notYet "QuestIComp" ;
oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ;
oper QuestVP : IP -> VP -> QCl = notYet "QuestVP" ;
oper ReflA2 : A2 -> AP = notYet "ReflA2" ;
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
oper RelCl : Cl -> RCl = notYet "RelCl" ;
oper RelNP : NP -> RS -> NP = notYet "RelNP" ;
oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ;
oper SentAP : AP -> SC -> AP = notYet "SentAP" ;
oper SentCN : CN -> SC -> CN = notYet "SentCN" ;
oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ;
oper Slash3V3 : V3 -> NP -> VPSlash = notYet "Slash3V3" ;
oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ;
oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ;
oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ;
oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ;
oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ;
oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ;
oper SlashVP : NP -> VPSlash -> ClSlash = notYet "SlashVP" ;
oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ;
oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ;
oper SubjS : Subj -> S -> Adv = notYet "SubjS" ;
oper TCond : Tense = notYet "TCond" ;
oper TFut : Tense = notYet "TFut" ;
oper TPast : Tense = notYet "TPast" ;
oper Use2N3 : N3 -> N2 = notYet "Use2N3" ;
oper UseN2 : N2 -> CN = notYet "UseN2" ;
oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ;
oper UttCard : Card -> Utt = notYet "UttCard" ;
oper UttIAdv : IAdv -> Utt = notYet "UttIAdv" ;
oper UttIP : IP -> Utt = notYet "UttIP" ;
oper UttImpPl : Pol -> Imp -> Utt = notYet "UttImpPl" ;
oper UttImpPol : Pol -> Imp -> Utt = notYet "UttImpPol" ;
oper UttImpSg : Pol -> Imp -> Utt = notYet "UttImpSg" ;
oper UttQS : QS -> Utt = notYet "UttQS" ;
oper UttVP : VP -> Utt = notYet "UttVP" ;
oper by8agent_Prep : Prep = notYet "by8agent_Prep" ;
oper it_Pron : Pron = notYet "it_Pron" ;
oper they_Pron : Pron = notYet "they_Pron" ;
oper we_Pron : Pron = notYet "we_Pron" ;
oper whatSg_IP : IP = notYet "whatSg_IP" ;
oper which_IQuant : IQuant = notYet "which_IQuant" ;
oper whoSg_IP : IP = notYet "whoSg_IP" ;
oper youPl_Pron : Pron = notYet "youPl_Pron" ;
oper youPol_Pron : Pron = notYet "youPol_Pron" ;
}

100
src/czech/NounCze.gf Normal file
View File

@@ -0,0 +1,100 @@
concrete NounCze of Noun =
CatCze
**
open ResCze, Prelude in {
lin
DetCN det cn = {
s,prep,clit = \\c => det.s ! cn.g ! c ++ numSizeForm cn.s det.size c ;
a = numSizeAgr cn.g det.size P3 ;
hasClit = False ;
} ;
MassNP cn = {
s,prep,clit = \\c => cn.s ! Sg ! c ;
a = Ag cn.g Sg P3 ;
hasClit = False ;
} ;
DetQuant quant num = {
s = \\g,c => num.s ! g ! c ++ quant.s ! g ! numSizeNumber num.size ! c ;
size = num.size
} ;
DefArt = {s = \\_,_,_ => []} ;
IndefArt = {s = \\_,_,_ => []} ;
NumPl = {s = \\_,_ => [] ; size = Num2_4} ; ---- size
NumSg = {s = \\_,_ => [] ; size = Num1} ;
UsePron pron = {
s = table {
Nom | Voc => pron.nom ;
Gen => pron.gen ;
Dat => pron.dat ;
Acc => pron.acc ;
Loc => pron.loc ;
Ins => pron.ins
} ;
clit = table {
Nom => pron.cnom ;
Voc => pron.nom ;
Gen => pron.cgen ;
Dat => pron.cdat ;
Acc => pron.cacc ;
Loc => pron.loc ;
Ins => pron.ins
} ;
prep = table {
Nom | Voc => pron.nom ;
Gen => pron.pgen ;
Dat => pron.pdat ;
Acc => pron.pacc ;
Loc => pron.loc ;
Ins => pron.pins
} ;
a = pron.a ;
hasClit = True ;
} ;
UsePN pn = {
s,clit,prep = \\c => pn.s ! c ;
a = Ag pn.g Sg P3 ;
hasClit = False ;
} ;
AdjCN ap cn = {
s = \\n,c => ap.s ! cn.g ! n ! c ++ cn.s ! n ! c ;
g = cn.g
} ;
RelCN cn rs = {
s = \\n,c => cn.s ! n ! c ++ rs.s ! Ag cn.g n P3 ;
g = cn.g
} ;
AdvCN cn adv = {
s = \\n,c => cn.s ! n ! c ++ adv.s ;
g = cn.g
} ;
AdvNP np adv = {
s,clit = \\c => np.s ! c ++ adv.s ;
prep = \\c => np.prep ! c ++ adv.s ;
a = np.a ;
hasClit = False ;
} ;
UseN n = nounFormsNoun n ;
ApposCN cn np = {
s = \\n,c => cn.s ! n ! c ++ np.s ! c ; ---- TODO check apposition order
g = cn.g
} ;
NumCard c = c ;
NumDigits ds = ds ** {s = \\_,_ => ds.s} ;
NumNumeral nu = nu ;
}

120
src/czech/NumeralCze.gf Normal file
View File

@@ -0,0 +1,120 @@
concrete NumeralCze of Numeral =
CatCze **
open
ResCze,
Prelude
in {
-- from gf-contrib/numerals/czech.gf, added inflections
-- AR 2020-03-20
---- TODO ordinal forms
oper LinNumeral = Determiner ; -- {s : NumeralForms ; size : NumSize} ;
oper LinDigit = {unit : Gender => Case => Str ; teen, ten, hundred : Str ; size : NumSize} ;
lincat Digit = LinDigit ;
lincat Sub10 = LinDigit ;
lincat Sub100 = LinNumeral ;
lincat Sub1000 = LinNumeral ;
lincat Sub1000000 = LinNumeral ;
oper mkNum : Determiner -> Str -> Str -> Str -> LinDigit =
\dva, dvanast, dvadsat, dveste -> {
unit = dva.s ;
teen = dvanast + "náct" ;
ten = dvadsat ;
hundred = dveste ;
size = dva.size ;
} ;
oper mk2Num : Determiner -> Str -> Str -> Str -> LinDigit =
\unit, teenbase, tenbase, hundred ->
mkNum unit teenbase (tenbase + "cet") hundred ;
oper mk5Num : Str -> Str -> Str -> Str -> LinDigit =
\unit,uniti, teenbase, tenbase ->
mkNum (regNumeral unit uniti) teenbase (tenbase + "desát") (unit ++ "set") ;
oper bigNumeral : Str -> LinNumeral = \s -> invarNumeral s ;
lin num x = x ;
lin n2 = mk2Num twoNumeral "dva" "dva" ("dvě" ++ "stě") ;
lin n3 = mk2Num threeNumeral "tři" "tři" ("tři" ++ "sta") ;
lin n4 = mk2Num fourNumeral "čtr" "čtyři" ("čtyři" ++ "sta") ;
lin n5 = mk5Num "pět" "pěti" "pat" "pa" ;
lin n6 = mk5Num "šest" "šesti" "šest" "še" ;
lin n7 = mk5Num "sedm" "sedmi" "sedm" "sedm";
lin n8 = mk5Num "osm" "osmi" "osm" "osm";
lin n9 = mk5Num "devět" "devíti" "devate" "deva" ;
lin pot01 = {
unit = oneNumeral.s ; hundred = "sto" ; ten = "deset" ; teen = "jedenáct" ;
size = Num1
} ;
lin pot0 d = d ;
lin pot110 = bigNumeral "deset" ;
lin pot111 = bigNumeral "jedenáct" ;
lin pot1to19 d = bigNumeral d.teen ;
lin pot0as1 n = {s = n.unit ; size = n.size} ;
lin pot1 d = bigNumeral d.ten ;
lin pot1plus d e = {
s = (invarNumeral (d.ten ++ determinerStr (e ** {s = e.unit}))).s ; ---- TODO inflection?
size = tfSize e.size
} ;
---- variants { d.s ! ten ++ e.s ! unit ; glue (glue (e.s ! unit) "a") (d.s ! ten)} ; size = tfSize e.size} ;
lin pot1as2 n = n ;
lin pot2 d = bigNumeral d.hundred ;
lin pot2plus d e = {
s = (invarNumeral (d.hundred ++ determinerStr e)).s ; ---- TODO inflection?
size = tfSize e.size
} ;
lin pot2as3 n = n ;
lin pot3 n = bigNumeral (mkTh (determinerStr n) n.size) ;
lin pot3plus n m = {
s = (invarNumeral (mkTh (determinerStr n) n.size ++ determinerStr m)).s ; ---- TODO inflection?
size = tfSize m.size
} ;
oper tfSize : NumSize -> NumSize = \sz ->
table {Num1 => Num5 ; other => other} ! sz ;
oper mkTh : Str -> NumSize -> Str = \attr,size ->
case size of {
Num1 => "tisíc" ;
Num2_4 => attr ++ "tisíce" ;
Num5 => attr ++ "tisíc"
} ;
oper determinerStr : Determiner -> Str = \d -> d.s ! Masc Anim ! Nom ;
-- -- Numerals as sequences of digits have a separate, simpler grammar
lincat Dig = {s:Str ; size : NumSize} ;
lin
IDig d = d ;
IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s ; size = Num5} ; ---- leading zeros ??
D_0 = { s = "0" ; size = Num1} ; ---- ??
D_1 = { s = "1" ; size = Num1} ;
D_2 = { s = "2" ; size = Num2_4} ;
D_3 = { s = "3" ; size = Num2_4} ;
D_4 = { s = "4" ; size = Num2_4} ;
D_5 = { s = "5" ; size = Num5} ;
D_6 = { s = "6" ; size = Num5} ;
D_7 = { s = "7" ; size = Num5} ;
D_8 = { s = "8" ; size = Num5} ;
D_9 = { s = "9" ; size = Num5} ;
}

141
src/czech/ParadigmsCze.gf Normal file
View File

@@ -0,0 +1,141 @@
resource ParadigmsCze = open CatCze, ResCze, Prelude in {
----------------
-- Parameters
oper
singular : Number
= Sg ;
plural : Number
= Pl ;
mascAnimate : Gender
= Masc Anim ;
mascInanimate : Gender
= Masc Inanim ;
feminine : Gender
= Fem ;
neuter : Gender
= Neutr ;
nominative : Case
= Nom ;
genitive : Case
= Gen ;
dative : Case
= Dat ;
accusative : Case
= Acc ;
vocative : Case
= ResCze.Voc ;
locative : Case
= Loc ;
instrumental : Case
= Ins ;
------------------------------
-- Nouns
oper
mkN = overload {
mkN : (nom : Str) -> N
= \nom -> lin N (guessNounForms nom) ;
mkN : (nom,gen : Str) -> Gender -> N
= \nom,gen,g -> lin N (declensionNounForms nom gen g) ;
} ;
-- The following standard declensions can be used with good accuracy.
-- However, they have some defaults that may have to be overwritten.
-- This can be done easily by overriding those formes with record extension (**).
-- The default extensions are shown in comments; if the default is correct, no extension is needed.
panN : Str -> N -- default ** {pnom = +i}
= \s -> lin N (declPAN s) ;
predsedaN : Str -> N -- default ** {sgen = +i}
= \s -> lin N (declPREDSEDA s) ;
hradN : Str -> N -- default ** {sgen,sloc = +u}
= \s -> lin N (declHRAD s) ;
zenaN : Str -> N -- default ** {pgen = zen}
= \s -> lin N (declZENA s) ;
mestoN : Str -> N -- default ** {sloc = +u ; pgen = mest ; ploc = +ech}
= \s -> lin N (declMESTO s) ;
muzN : Str -> N
= \s -> lin N (declMUZ s) ;
soudceN : Str -> N -- default ** {sdat,sloc = +i ; pnom = +i}
= \s -> lin N (declSOUDCE s) ;
strojN : Str -> N
= \s -> lin N (declSTROJ s) ;
ruzeN : Str -> N
= \s -> lin N (declRUZE s) ;
pisenN : Str -> N
= \s -> lin N (declPISEN s) ;
kostN : Str -> N
= \s -> lin N (declKOST s) ;
kureN : Str -> N
= \s -> lin N (declKURE s) ;
moreN : Str -> N -- default ** {pgen = +í}
= \s -> lin N (declMORE s) ;
staveniN : Str -> N
= \s -> lin N (declSTAVENI s) ;
-- The full definition of the noun record is
-- {
-- snom,sgen,sdat,sacc,svoc,sloc,sins, pnom,pgen,pdat,pacc,ploc,pins : Str ;
-- g : Gender
-- }
---------------------
-- Adjectives
-- Only positive forms so far ----
mkA = overload {
mkA : Str -> A
= \s -> lin A (case s of {
_ + "ý" => mladyAdjForms s ;
_ + "í" => jarniAdjForms s ;
_ + "ův" => otcuvAdjForms s ;
_ + "in" => matcinAdjForms s ;
_ => Predef.error ("no mkA for" ++ s)
}) ;
} ;
mladyA : Str -> A
= \s -> lin A (mladyAdjForms s) ;
jarniA : Str -> A
= \s -> lin A (jarniAdjForms s) ;
otcuvA : Str -> A
= \s -> lin A (otcuvAdjForms s) ;
matcinA : Str -> A
= \s -> lin A (matcinAdjForms s) ;
mkA2 : A -> Prep -> A2
= \a,p -> lin A2 (a ** {c = p}) ;
-------------------------
-- Verbs
mkV2 = overload {
mkV2 : VerbForms -> VerbForms ** {c : ComplementCase}
= \vf -> vf ** {c = {s = [] ; c = Acc ; hasPrep = False}} ;
mkV2 : VerbForms -> Case -> VerbForms ** {c : ComplementCase}
= \vf,c -> vf ** {c = {s = [] ; c = c ; hasPrep = False}} ;
mkV2 : VerbForms -> ComplementCase -> VerbForms ** {c : ComplementCase}
= \vf,c -> vf ** {c = c} ;
} ;
------------------------
-- Adverbs, prepositions, conjunctions, ...
mkAdv : Str -> Adv
= \s -> lin Adv {s = s} ;
mkPrep : Str -> Case -> Prep
= \s,c -> lin Prep {s = s ; c = c ; hasPrep = True} ; ---- True if s /= ""
mkConj : Str -> Conj
= \s -> lin Conj {s1 = [] ; s2 = s} ;
}

19
src/czech/PhraseCze.gf Normal file
View File

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

7
src/czech/QuestionCze.gf Normal file
View File

@@ -0,0 +1,7 @@
concrete QuestionCze of Question = CatCze **
open ResCze, Prelude in {
lin
QuestCl cl = cl ; ----
}

18
src/czech/RelativeCze.gf Normal file
View File

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

884
src/czech/ResCze.gf Normal file
View File

@@ -0,0 +1,884 @@
resource ResCze = open Prelude in {
-- AR March 2020
-- sources:
-- Wiki = https://en.wikipedia.org/wiki/Czech_declension, https://en.wikipedia.org/wiki/Czech_conjugation
-- CEG = J. Naughton, Czech: an Essential Grammar, Routledge 2005.
-- parameters
param
Number = Sg | Pl ;
Animacy = Anim | Inanim ;
Gender = Masc Animacy | Fem | Neutr ;
Case = Nom | Gen | Dat | Acc | Voc | Loc | Ins ; -- traditional order
Person = P1 | P2 | P3 ;
Agr = Ag Gender Number Person ;
CTense = CTPres | CTPast ; ----- TODO complete the tense system to match Czech verb morphology
-- phonology
oper
hardConsonant : pattern Str = #("d"|"t"|"g"|"h"|"k"|"n"|"r") ;
softConsonant : pattern Str = #("ť"|"ď"|"j"|"ň"|"ř"|"š"|"c"|"č"|"ž") ;
neutralConsonant : pattern Str = #("b"|"f"|"l"|"m"|"p"|"s"|"v") ;
consonant : pattern Str =
#(
"d" | "t" | "g" | "h" | "k" | "n" | "r" |
"ť" | "ď" | "j" | "ň" | "ř" | "š" | "c" | "č" | "ž" |
"b" | "f" | "l" | "m" | "p" | "s" | "v"
) ;
dropFleetingE : Str -> Str = \s -> case s of {
x + "e" + c@("k"|"c") => 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
---------------
-- novel idea (for RGL): lexical items stored as records rather than tables
-- advantages:
-- - easier to make exceptions to paradigms (by ** {})
-- - easier to keep the number of forms minimal
-- - easier to see what is happening than with lots of anonymous arguments to mkN, mkA, mkV
-- so this is the lincat of N
NounForms : Type = {snom,sgen,sdat,sacc,svoc,sloc,sins, pnom,pgen,pdat,pacc,ploc,pins : Str ; g : Gender} ;
-- But traditional tables make agreement easier to handle in syntax
-- so this is the lincat of CN
Noun : Type = {s : Number => Case => Str ; g : Gender} ;
-- this is used in UseN
nounFormsNoun : NounForms -> Noun
= \forms -> {
s = table {
Sg => table {
Nom => forms.snom ;
Gen => forms.sgen ;
Dat => forms.sdat ;
Acc => forms.sacc ;
Voc => forms.svoc ;
Loc => forms.sloc ;
Ins => forms.sins
} ;
Pl => table {
Nom | Voc => forms.pnom ;
Gen => forms.pgen ;
Dat => forms.pdat ;
Acc => forms.pacc ;
Loc => forms.ploc ;
Ins => forms.pins
}
} ;
g = forms.g
} ;
-- terminology of CEG
DeclensionType : Type = Str -> NounForms ;
declensionNounForms : (nom,gen : Str) -> Gender -> NounForms
= \nom,gen,g ->
let decl : DeclensionType = case <g, nom, gen> of {
<Masc Anim, _ + #hardConsonant, _ + "a"> => declPAN ;
<Masc Anim, _ + "a" , _ + "a"> => declPREDSEDA ;
<Masc Inanim, _ + #hardConsonant, _ + "u"> => declHRAD ;
<Fem, _ + "a" , _ + "y"> => declZENA ;
<Neutr, _ + "o" , _ + "a"> => declMESTO ;
<Masc Anim, _ + #softConsonant, _ + "e"> => declMUZ ;
<Masc Anim, _ + "tel" , _ + "e"> => declMUZ ;
<Masc Anim, _ + "ce" , _ + "e"> => declSOUDCE ;
<Masc Inanim, _ + #softConsonant, _ + "e"> => declSTROJ ;
<Fem, _ + ("e"|"ě") , _ + ("e"|"ě")> => declRUZE ;
<Fem, _ + #softConsonant, _ + "e"> => declPISEN ;
<Fem, _ + "ost" , _ + "i"> => declKOST ; --- also many other "st" 3.6.3
<Neutr, _ + "e" , _+"ete"> => declKURE ;
<Neutr, _ + "e" , _ + "e"> => declMORE ;
<Neutr, _ + "í" , _ + "í"> => declSTAVENI ;
_ => Predef.error ("cannot infer declension type for" ++ nom ++ gen)
}
in decl nom ;
-- the "smartest" one-argument mkN
guessNounForms : Str -> NounForms
= \s -> case s of {
_ + "ost" => declKOST s ;
_ + "tel" => declMUZ s ;
_ + #hardConsonant => declHRAD s ;
_ + #softConsonant => declSTROJ s ;
_ + "a" => declZENA s ;
_ + "o" => declMESTO s ;
_ + "ce" => declSOUDCE s ;
_ + "e" => declMORE s ;
_ + "í" => declSTAVENI s ;
_ => Predef.error ("cannot guess declension type for" ++ s)
} ;
-- the traditional declensions, in both CEG and Wiki
-- they are also exported in ParadigmsCze with names panN etc
declPAN : DeclensionType = \pan -> --- plural nom ové|i|é can be changed with ** {pnom = ...} CEG 3.5.1
{
snom = pan ;
sgen,sacc = pan + "a" ;
sdat,sloc = pan + "ovi" ; --- pánu
svoc = shortenVowel pan + "e" ; --- "irregular shortening" 3.5.1
sins = pan + "em" ;
pnom = addI pan ; -- pani, kluk-kluci --- panové, host-hosté
pgen = pan + "ů" ;
pdat = pan + "ům" ;
pacc,pins = pan + "y" ;
ploc = addEch pan ;
g = Masc Anim
} ;
declPREDSEDA : DeclensionType = \predseda -> --- 3.5.4: sgen y/i
let predsed = init predseda
in
{
snom = predseda ;
sgen = predsed + "y" ; -- pacc,pins --- i
sdat,sloc = predsed + "ovi" ;
sacc = predsed + "u" ;
svoc = predsed + "o" ;
sins = predsed + "ou" ;
pnom = case predseda of {
tur + "ista" => tur + "isté" ;
_ => predsed + "ové"
} ;
pgen = predsed + "ů" ;
pdat = predsed + "ům" ;
pacc,pins = predsed + "y" ;
ploc = addEch predsed ;
g = Masc Anim
} ;
declHRAD : DeclensionType = \hrad -> --- 3.5.2: sloc u/ě/e extra arg, sport-u, hrad-ě ; sgen u/a
let hrd = dropFleetingE hrad
in
{
snom,sacc = hrad ;
sgen,sdat = hrd + "u" ; --- Berlín-a
sloc = hrd + "u" ; --- addE hrad ; -- stůl-stole
svoc = hrd + "e" ;
sins = hrd + "em" ;
pnom,pacc,pins = hrd + "y" ;
pgen = hrd + "ů" ;
pdat = hrd + "ům" ;
ploc = addEch hrd ;
g = Masc Inanim
} ;
declZENA : DeclensionType = \zena -> --- 3.6.1 sge y/i ; pgen sometimes shortening
let zen = init zena
in
{
snom = zena ;
sgen = zen + "y" ; --- i after soft cons sometimes
sdat,sloc = zen + "ě" ; --- i after soft cons sometimes ; skol+e
sacc = zen + "u" ;
svoc = shortenVowel zen + "o" ; ---- shorten ?
sins = zen + "ou" ;
pnom,pacc = zen + "y" ; --- also sgen
pgen = zen ; --- sometimes with vowel shortening
pdat = zen + "ám" ;
ploc = zen + "ách" ;
pins = zen + "ami" ;
g = Fem
} ;
declMESTO : DeclensionType = \mesto -> --- 3.7.1 sloc u/e ; pgen vowel shortening sometimes ; ploc variations
let mest = init mesto
in
{
snom,sacc,svoc = mesto ;
sgen = mest + "a" ;
sdat = mest + "u" ;
sloc = mest + "u" ; --- "ě"
sins = mest + "em" ;
pnom,pacc = mest + "a" ;
pgen = mest ; --- léta - let
pdat = mest + "ům" ;
ploc = mest + "ech" ; --- with variations
pins = mest + "y" ;
g = Neutr
} ;
declMUZ : DeclensionType = \muz_ -> --- 3.5.3 : sdat,sloc ; pnom
let muz = dropFleetingE muz_
in
{
snom = muz_ ;
sgen,sacc = muz + "e" ; --- pacc
sdat,sloc = muz + "i" ; --- muzovi
svoc = case muz_ of {
chlap + "ec" => chlap + "če" ;
_ => muz + "i"
} ;
sins = muz + "em" ;
pnom = case muz_ of {
uci + "tel" => uci + "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
---- TODO other degrees than positive
AdjForms : Type = {
msnom, fsnom, nsnom : Str ; -- svoc = snom
msgen, fsgen : Str ; -- nsgen = msgen, pacc = fsgen
msdat, fsdat : Str ; -- nsdat = msdat
fsacc : Str ; -- amsacc = msgen, imsacc = msnom, nsacc = nsnom
msloc : Str ; -- fsloc = fsdat, nsloc = msloc
msins, fsins : Str ; -- nsins = msins, pdat = msins
mpnom,fpnom : Str ; -- pvoc = pnom, impnom = fpnom, npnom = fsnom
pgen : Str ; -- ploc = pgen
pins : Str ;
} ;
-- used in PositA but will also work in Compar and Superl by calling their record fields
adjFormsAdjective : AdjForms -> Adjective = \afs -> {
s = \\g,n,c => case <n,c,g> of {
<Sg, Nom|Voc, Masc _>
| <Sg, Acc, Masc Inanim> => afs.msnom ;
<Sg, Nom|Voc, Fem>
| <Pl, Nom|Acc|Voc, Neutr> => afs.fsnom ;
<Sg, Nom|Acc|Voc, Neutr> => afs.nsnom ;
<Sg, Gen, Masc _ | Neutr>
| <Sg,Acc,Masc Anim> => afs.msgen ;
<Sg, Gen, Fem>
| <Pl,Acc,Masc _|Fem> => afs.fsgen ;
<Sg, Dat, Masc _|Neutr> => afs.msdat ;
<Sg, Dat|Loc, Fem> => afs.fsdat ;
<Sg, Acc, Fem> => afs.fsacc ;
<Sg, Loc, Masc _|Neutr> => afs.msloc ;
<Sg, Ins, Masc _|Neutr>
| <Pl,Dat,_> => afs.msins ;
<Sg, Ins, Fem> => afs.fsins ;
<Pl, Nom|Voc, Masc Anim> => afs.mpnom ;
<Pl, Nom|Voc, Masc Inanim|Fem> => afs.fpnom ;
<Pl, Gen|Loc,_> => afs.pgen ;
<Pl, Ins,_> => afs.pins
}
} ;
-- hard declension
mladyAdjForms : Str -> AdjForms = \mlady ->
let mlad = init mlady
in {
msnom = mlad + "ý" ;
fsnom = mlad + "á" ;
nsnom,fsgen,fsdat,fpnom = mlad + "é" ;
msgen = mlad + "ého" ;
msdat = mlad + "ému" ;
fsacc,fsins = mlad + "ou" ;
msloc = mlad + "ém" ;
msins,pdat = mlad + "ým" ;
mpnom = addAdjI mlad ;
pgen = mlad + "ých" ;
pins = mlad + "ými" ;
} ;
-- soft declension
jarniAdjForms : Str -> AdjForms = \jarni ->
{
msnom,fsnom,nsnom,
fsgen,fsdat,fsacc,fsins,
mpnom,fpnom = jarni ;
msgen = jarni + "ho" ;
msdat = jarni + "mu" ;
msloc,msins = jarni + "m" ;
pgen = jarni + "ch" ;
pins = jarni + "mi" ;
} ;
-- masculine possession: the same endings as in feminine
otcuvAdjForms : Str -> AdjForms = \otcuv ->
let otcov = Predef.tk 2 otcuv + "ov"
in
matcinAdjForms otcov ** {msnom = otcuv} ;
-- feminine possession
matcinAdjForms : Str -> AdjForms = \matcin ->
{
msnom = matcin ;
fsnom,msgen = matcin + "a" ;
nsnom = matcin + "o" ;
fsgen,fpnom = matcin + "y" ;
msdat,fsacc = matcin + "u" ;
fsdat,msloc = matcin + "ě" ;
msins = matcin + "ým" ;
fsins = matcin + "ou" ;
mpnom = matcin + "i" ;
pgen = matcin + "ých" ;
pins = matcin + "ými" ;
} ;
---------------------
-- Verbs
VerbForms : Type = { ---- TODO more forms to add
inf,
pressg1, pressg2, pressg3,
prespl1, prespl2, prespl3,
pastpartsg, pastpartpl,
---- passpart,
negpressg3 : Str -- matters only for copula
} ;
ComplementCase : Type = {s : Str ; c : Case ; hasPrep : Bool} ;
verbAgr : VerbForms -> Agr -> Bool -> Str ---- TODO tenses
= \vf,a,b -> case a of {
Ag _ Sg P1 => vf.pressg1 ;
Ag _ Sg P2 => vf.pressg2 ;
Ag _ Sg P3 => case b of {
True => vf.pressg3 ;
False => vf.negpressg3 -- matters only for copula
} ;
Ag _ Pl P1 => vf.prespl1 ;
Ag _ Pl P2 => vf.prespl2 ;
Ag _ Pl P3 => vf.prespl3
} ;
copulaVerbForms : VerbForms = {
inf = "být" ;
pressg1 = "jsem" ;
pressg2 = "jsi" ;
pressg3 = "je" ;
prespl1 = "jsme" ;
prespl2 = "jste" ;
prespl3 = "jsou" ;
pastpartsg = "byl" ;
pastpartpl = "byli" ;
negpressg3 = "ní" ; -- ne is added to this
} ;
haveVerbForms : VerbForms = {
inf = "mít" ;
pressg1 = "mám" ;
pressg2 = "máš" ;
pressg3, negpressg3 = "má" ;
prespl1 = "máme" ;
prespl2 = "máte" ;
prespl3 = "mají" ;
pastpartsg = "měl" ;
pastpartpl = "měli" ;
} ;
-- just an example of a traditional paradigm
---- TODO other traditional paradigms
iii_kupovatVerbForms : Str -> VerbForms = \kupovat ->
let
kupo = Predef.tk 3 kupovat ;
kupu = Predef.tk 1 kupo + "u"
in
{
inf = kupovat ;
pressg1 = kupu + "ji" ; --- kupuju
pressg2 = kupu + "ješ" ;
pressg3, negpressg3 = kupu + "je" ;
prespl1 = kupu + "jeme" ;
prespl2 = kupu + "jete" ;
prespl3 = kupu + "jí" ; --- kupujou
pastpartsg = kupo + "val" ;
pastpartpl = kupo + "vali" ;
} ;
---------------------------
-- Pronouns
PronForms : Type = {
nom, cnom, -- cnom is the pro-drop subject
gen, cgen,pgen, -- bare, clitic, prepositional
acc, cacc,pacc,
dat, cdat,pdat,
loc,
ins,pins : Str ;
a : Agr
} ;
---- TODO: possessives
personalPron : Agr -> PronForms = \a ->
{a = a ; cnom = []} **
case a of {
Ag _ Sg P1 => {
nom = "já" ;
gen,acc,pgen,pacc = "mne" ;
cgen,cacc = "mě" ;
dat,pdat,loc = "mně" ;
cdat = "mi" ;
ins,pins = "mnou"
} ;
Ag _ Sg P2 => {
nom = "ty" ;
gen,acc,pgen,pacc = "tebe" ;
cgen,cacc = "tě" ;
dat,pdat,loc = "tobě" ;
cdat = "ti" ;
ins,pins = "tebou"
} ;
Ag (Masc _) Sg P3 => {
nom = "on" ;
gen,acc = "jeho" ;
cgen,cacc = "ho" ;
pgen,pacc = "něho" ;
dat = "jemu" ;
cdat = "mu" ;
pdat = "němu" ;
loc = "něm" ;
ins = "jím" ;
pins = "ním" ;
} ;
Ag Fem Sg P3 => {
nom = "ona" ;
gen = "její" ;
dat,acc,cgen,cacc,cdat,ins = "ji" ;
pgen,pdat,pacc,loc,pins = "ní" ;
} ;
Ag Neutr Sg P3 => {
nom = "ono" ;
gen = "jeho" ;
cgen,cacc = "ho" ;
pgen = "něho" ;
dat = "jemu" ;
acc = "je" ;
pacc = "ně" ;
cdat = "mu" ;
pdat = "němu" ;
loc = "něm" ;
ins = "jím" ;
pins = "ním" ;
} ;
Ag _ Pl P1 => {
nom = "my" ;
gen,acc,
cgen,cacc,
pgen,pacc,
loc = "nás" ;
dat,cdat,pdat = "nám" ;
ins,pins = "námi" ;
} ;
Ag _ Pl P2 => {
nom = "vy" ;
gen,acc,
cgen,cacc,
pgen,pacc,
loc = "vás" ;
dat,cdat,pdat = "vám" ;
ins,pins = "vámi" ;
} ;
Ag g Pl P3 => {
nom = case g of {
Masc _ => "oni" ;
Fem => "ony" ;
Neutr => "ona"
} ;
gen,cgen = "jich" ;
pgen = "nich" ;
dat,cdat = "jim" ;
pdat = "nim" ;
acc,cacc = "je" ;
pacc = "ně" ;
loc = "nich" ;
ins = "jimi" ;
pins = "nimi" ;
}
} ;
--------------------------------
-- demonstrative pronouns, used for Quant and Det
oper
DemPronForms : Type = {
msnom, fsnom, nsnom,
msgen, fsgen,
msdat, -- fsdat = fsgen unlike AdjForms
fsacc,
msloc,
msins, fsins,
mpnom, fpnom, -- mpacc = fpacc = fpnom
pgen,
pdat, -- NOT msins like AdjForms
pins : Str
} ;
demPronFormsAdjective : DemPronForms -> Str -> Adjective =
\dem,s ->
let
demAdj = dem ** {fsdat = dem.fsgen} ;
adjAdj = adjFormsAdjective demAdj
in {
s = \\g,n,c => case <g,n,c> of {
<_,Pl,Dat> => dem.pdat ;
<Masc _ | Fem, Pl, Acc> => dem.fpnom ;
_ => adjAdj.s ! g ! n ! c
} + s
} ;
Determiner : Type = {
s : Gender => Case => Str ;
size : NumSize
} ;
mkDemPronForms : Str -> DemPronForms = \t -> {
msnom = t + "en" ;
fsnom = t + "a" ;
nsnom = t + "o" ;
msgen = t + "oho" ;
fsgen = t + "é" ;
msdat = t + "omu" ;
fsacc = t + "u" ;
msloc = t + "om" ;
msins = t + "ím" ;
fsins = t + "ou" ;
mpnom = t + "i" ;
fpnom = t + "y" ;
pgen = t + "ěch" ;
pdat = t + "ěm" ;
pins = t + "ěmi" ;
} ;
invarDemPronForms : Str -> DemPronForms = \s -> {
msnom, fsnom, nsnom, msgen, fsgen,
msdat, fsacc, msloc, msins, fsins,
mpnom, fpnom, pgen, pdat, pins = s ;
} ;
-- interrogatives
kdoForms : Case => Str = table {
Nom => "kdo" ;
Gen | Acc | Voc => "koho" ;
Dat => "komu" ;
Loc => "kom" ;
Ins => "kým"
} ;
coForms : Case => Str = table {
Nom|Acc|Voc => "co" ;
Gen => "čeho" ;
Dat => "čemu" ;
Loc => "čem" ;
Ins => "čím"
} ;
-- Numerals
-- singular forms of demonstratives
NumeralForms : Type = {
msnom, fsnom, nsnom,
msgen, fsgen,
msdat,
fsacc,
msloc,
msins, fsins : Str
} ;
numeralFormsDeterminer : NumeralForms -> NumSize -> Determiner =
\nume,size ->
let
dem = nume **
{mpnom, fpnom, pgen, pdat, pins = nume.msnom} ; --- plural forms not used
demAdj = dem ** {fsdat = dem.fsgen} ;
adjAdj = adjFormsAdjective demAdj
in {
s = \\g,c => adjAdj.s ! g ! Sg ! c ;
size = size
} ;
-- example: number 1
oneNumeral : Determiner = numeralFormsDeterminer (mkDemPronForms "jed") Num1 ;
-- numbers 2,3,4 ---- to check if everything comes out right with the determiner type
twoNumeral : Determiner =
let forms = {
msnom = "dva" ; fsnom, nsnom, fsacc = "dvě" ;
msgen, fsgen, msloc = "dvou" ;
msdat, msins, fsins = "dvěma"
}
in numeralFormsDeterminer forms Num2_4 ;
threeNumeral : Determiner =
let forms = {
msnom, fsnom, nsnom, fsacc, msgen, fsgen = "tři" ;
msdat = "třem" ;
msloc = "třech" ;
msins,fsins = "třemi" ;
}
in numeralFormsDeterminer forms Num2_4 ;
fourNumeral : Determiner =
let forms = {
msnom, fsnom, nsnom, fsacc = "čtyři" ;
msgen, fsgen = "čtyř" ;
msdat = "čtyřem" ;
msloc = "čtyřech" ;
msins,fsins = "čtyřmi" ;
}
in numeralFormsDeterminer forms Num2_4 ;
-- for the numbers 5 upwards
regNumeral : Str -> Str -> Determiner = \pet,peti ->
let forms = {
msnom,fsnom,nsnom = pet ;
msgen, fsgen, msdat, fsacc, msloc, msins, fsins = peti
}
in numeralFormsDeterminer forms Num5 ;
invarDeterminer : Str -> NumSize -> Determiner = \sto,size ->
regNumeral sto sto ;
invarNumeral : Str -> Determiner = \s -> invarDeterminer s Num5 ;
--------------------------------
-- combining nouns with numerals
param
NumSize = Num1 | Num2_4 | Num5 ; -- CEG 6.1
oper
numSizeForm : (Number => Case => Str) -> NumSize -> Case -> Str
= \cns,n,c -> case n of {
Num1 => cns ! Sg ! c ;
Num2_4 => cns ! Pl ! c ;
Num5 => case c of {
Nom | Acc => cns ! Pl ! Gen ;
_ => cns ! Pl ! c
}
} ;
numSizeAgr : Gender -> NumSize -> Person -> Agr
= \g,ns,p -> case ns of {
Num5 => Ag Neutr Sg p ; -- essential grammar 6.1.4
Num2_4 => Ag g Pl p ;
Num1 => Ag g Sg p
} ;
numSizeNumber : NumSize -> Number = \ns -> case ns of {
Num1 => Sg ;
_ => Pl ---- TO CHECK
} ;
}

32
src/czech/SentenceCze.gf Normal file
View File

@@ -0,0 +1,32 @@
concrete SentenceCze of Sentence = CatCze **
open Prelude, ResCze in {
lin
PredVP np vp = {
subj = case np.hasClit of {
True => np.clit ! Nom ; -- pro-drop
False => np.s ! Nom
} ;
verb = vp.verb ;
clit = vp.clit ! np.a ;
compl = vp.compl ! np.a ;
a = np.a ;
} ;
UseCl temp pol cl = {
s = temp.s ++ cl.subj ++ cl.clit ++ pol.s ++ verbAgr cl.verb cl.a pol.p ++ cl.compl ;
} ;
--- TODO is inversion the standard? ; add indirect questions
UseQCl temp pol cl = {
s = temp.s ++ cl.clit ++ pol.s ++ verbAgr cl.verb cl.a pol.p ++ cl.subj ++ cl.compl ;
} ;
UseRCl temp pol rcl = {
s = \\a => temp.s ++
rcl.subj ! a ++ rcl.clit ! a ++
pol.s ++ verbAgr rcl.verb a pol.p ++
rcl.compl ! a ;
} ;
}

View File

@@ -0,0 +1,27 @@
concrete StructuralCze of Structural = CatCze **
open ParadigmsCze, ResCze, Prelude in {
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 ; ----
many_Det = regNumeral "mnoho" "mnoha" ; -- CEG 6.8 ----
or_Conj = mkConj "nebo" ;
somePl_Det = regNumeral "několik" "několika" ; -- CEG 6.8 ----
something_NP = {s,clit,prep = \\c => "ně" + coForms ! c ; a = Ag Neutr Sg P3 ; hasClit = False} ; -- CEG 5.6.3
possess_Prep = mkPrep "" Gen ;
that_Quant = demPronFormsAdjective (mkDemPronForms "tamt") "" ;
this_Quant = demPronFormsAdjective (mkDemPronForms "t") "to" ;
to_Prep = mkPrep "do" Gen ;
with_Prep = mkPrep (pre {"s"|"z" => "se" ; _ => "s"}) Ins ; ----
i_Pron = personalPron (Ag (Masc Anim) Sg P1) ;
youSg_Pron = personalPron (Ag (Masc Anim) Sg P2) ;
he_Pron = personalPron (Ag (Masc Anim) Sg P3) ;
she_Pron = personalPron (Ag Fem Sg P3) ;
}

11
src/czech/SymbolCze.gf Normal file
View File

@@ -0,0 +1,11 @@
--# -path=.:../abstract:../common:../prelude
concrete SymbolCze of Symbol = CatCze ** open Prelude, ResCze in {
lincat
Symb = {s : Str} ;
lin
MkSymb s = s ;
SymbPN s = lin PN {s = \\_ => s.s ; g = Neutr} ;
}

20
src/czech/TenseCze.gf Normal file
View File

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

8
src/czech/TextCze.gf Normal file
View File

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

48
src/czech/VerbCze.gf Normal file
View File

@@ -0,0 +1,48 @@
concrete VerbCze of Verb = CatCze ** open ResCze, Prelude in {
lin
UseV v = {
verb = v ;
clit,compl = \\_ => []
} ;
ComplSlash vps np = case <np.hasClit, vps.c.hasPrep> of {
<True,False> => vps ** {
clit = \\a => vps.clit ! a ++ np.clit ! vps.c.c
} ;
_ => vps ** {
compl = \\a => vps.compl ! a ++ vps.c.s ++ np.s ! vps.c.c
}
} ;
SlashV2a v = {
verb = v ;
clit,compl = \\_ => [] ;
c = v.c
} ;
UseComp comp = {
verb = copulaVerbForms ;
clit = \\_ => [] ;
compl = comp.s
} ;
CompAP ap = {
s = \\a => case a of {
Ag g n p_ => ap.s ! g ! n ! Nom
}
} ;
CompNP np = {
s = \\a_ => np.s ! Nom ; ---- InstrC in Pol
} ;
CompAdv adv = {
s = \\a_ => adv.s
} ;
AdvVP vp adv = vp ** {
compl = \\a => vp.compl ! a ++ adv.s
} ;
}

View File

@@ -23,40 +23,40 @@ param
oper
NP : Type = {s : Style => Str ; prepositive : Style => Str ; needPart : Bool ;
NP : Type = {s : Style => Str ; prepositive : Style => Str ; needPart : Bool ;
changePolar : Bool ; meaning : Speaker ; anim : Animateness} ;
VP : Type = {verb : Speaker => Animateness => Style => TTense => Polarity => Str ;
a_stem, i_stem : Speaker => Animateness => Style => Str ;
VP : Type = {verb : Speaker => Animateness => Style => TTense => Polarity => Str ;
a_stem, i_stem : Speaker => Animateness => Style => Str ;
te, ba : Speaker => Animateness => Style => Polarity => Str ;
prep : Str ; obj : Style => Str ; prepositive : Style => Str ;
needSubject : Bool} ;
Noun : Type = {s : Number => Style => Str ; anim : Animateness ;
Noun : Type = {s : Number => Style => Str ; anim : Animateness ;
counter : Str ; counterReplace : Bool ; counterTsu : Bool} ;
PropNoun : Type = {s : Style => Str ; anim : Animateness} ;
Adj : Type = {pred : Style => TTense => Polarity => Str ; attr, dropNaEnging : Str ;
te, ba, adv : Polarity => Str} ;
Adj2 : Type = {pred : Style => TTense => Polarity => Str ; attr, dropNaEnging,
prep : Str ; te, ba, adv : Polarity => Str} ;
te, ba, adv : Polarity => Str} ;
Adj2 : Type = {pred : Style => TTense => Polarity => Str ; attr, dropNaEnging,
prep : Str ; te, ba, adv : Polarity => Str} ;
Adverb : Type = {s : Style => Str ; prepositive : Bool} ;
Pronoun : Type = {s : Style => Str ; Pron1Sg : Bool ; anim : Animateness} ;
Determiner : Type = {quant : Style => Str ; postpositive : Str ; num : Str ; n : Number ;
Determiner : Type = {quant : Style => Str ; postpositive : Str ; num : Str ; n : Number ;
inclCard : Bool ; sp : Style => Str ; no : Bool ; tenPlus : Bool} ;
Num : Type = {s : Str ; postpositive : Str ; n : Number ; inclCard : Bool ;
Num : Type = {s : Str ; postpositive : Str ; n : Number ; inclCard : Bool ;
tenPlus : Bool} ;
Preposition : Type = {s : Str ; null : Str} ;
Verb : Type = {s : Style => TTense => Polarity => Str ; a_stem, i_stem : Str ;
Verb : Type = {s : Style => TTense => Polarity => Str ; a_stem, i_stem : Str ;
te, ba : Polarity => Str ; needSubject : Bool} ;
Verb2 : Type = {s, pass : Style => TTense => Polarity => Str ; a_stem, i_stem, pass_a_stem,
Verb2 : Type = {s, pass : Style => TTense => Polarity => Str ; a_stem, i_stem, pass_a_stem,
pass_i_stem, prep : Str ; te, ba, pass_te, pass_ba : Polarity => Str} ;
Verb3 : Type = {s : Speaker => Style => TTense => Polarity => Str ; a_stem, i_stem :
Verb3 : Type = {s : Speaker => Style => TTense => Polarity => Str ; a_stem, i_stem :
Speaker => Str ; te, ba : Speaker => Polarity => Str ; prep1, prep2 : Str} ;
VV : Type = {s : Speaker => Style => TTense => Polarity => Str ; a_stem, i_stem :
VV : Type = {s : Speaker => Style => TTense => Polarity => Str ; a_stem, i_stem :
Speaker => Str ; te, ba : Speaker => Polarity => Str ; sense : ModSense} ;
Conjunction : Type = {s : Str ; null : Str ; type : ConjType} ;
Subjunction : Type = {s : Str ; type : SubjType} ;
mkNoun : Str -> Str -> Str -> Str -> Animateness -> Str -> Bool -> Bool -> Noun =
mkNoun : Str -> Str -> Str -> Str -> Animateness -> Str -> Bool -> Bool -> Noun =
\man1,man2,man3,man4,a,c,b1,b2 -> {
s = table {
Sg => table {
@@ -73,24 +73,24 @@ oper
counterReplace = b1 ;
counterTsu = b2
} ;
regNoun : Str -> Animateness -> Str -> Bool -> Bool -> Noun = \s,a,c,b1,b2 ->
regNoun : Str -> Animateness -> Str -> Bool -> Bool -> Noun = \s,a,c,b1,b2 ->
mkNoun s s s s a c b1 b2 ;
styleNoun : Str -> Str -> Animateness -> Str -> Bool -> Bool -> Noun = \kane,okane,a,c,b1,b2 ->
mkNoun kane okane kane okane a c b1 b2 ;
numberNoun : Str -> Animateness -> Str -> Bool -> Str -> Bool -> Noun = \n,a,c,b1,pl,b2 ->
numberNoun : Str -> Animateness -> Str -> Bool -> Str -> Bool -> Noun = \n,a,c,b1,pl,b2 ->
mkNoun n n pl pl a c b1 b2 ;
regAdj : Str -> Adj = \a -> case a of {
chiisa + "い" => i_mkAdj a ;
_ => na_mkAdj a -- ooki + ("な"|"の") => na_mkAdj a
} ;
i_mkAdj : Str -> Adj = \chiisai ->
i_mkAdj : Str -> Adj = \chiisai ->
let
chiisa = init chiisai ;
chiisa = init chiisai ;
in {
pred = table {
Resp => table {
@@ -110,43 +110,43 @@ oper
} ;
TPast => table {
Pos => chiisa + "かった" ;
Neg => chiisa + "くなかった"
Neg => chiisa + "くなかった"
}
}
} ;
attr = chiisai ;
te = table {
te = table {
Pos => chiisa + "くて" ;
Neg => chiisa + "くなくて"
Neg => chiisa + "くなくて"
} ;
ba = table {
Pos => chiisa + "ければ" ;
Neg => chiisa + "くなければ"
ba = table {
Pos => chiisa + "ければ" ;
Neg => chiisa + "くなければ"
} ;
adv = table {
adv = table {
Pos => chiisa + "く" ;
Neg => chiisa + "くなく"
} ;
dropNaEnging = chiisai
} ;
na_mkAdj : Str -> Adj = \ookina ->
} ;
na_mkAdj : Str -> Adj = \ookina ->
let
ooki = init ookina
ooki = init ookina
in {
pred = \\st,t,p => ooki ++ mkCopula.s ! st ! t ! p ;
attr = ookina ;
te = table {
te = table {
Pos => ooki + "で" ;
Neg => ooki + "ではなくて"
} ;
ba = \\p => ooki ++ mkCopula.ba ! p ;
adv = table {
adv = table {
Pos => ooki + "に" ;
Neg => ooki + "ではなく"
Neg => ooki + "ではなく"
} ;
dropNaEnging = ooki
} ;
} ;
-- Added by IL 2017-07. Used in NounJpn and SymbolJpn.
mkOrd : SS -> Adj = \symb -> {
@@ -158,23 +158,23 @@ oper
dropNaEnging = symb.s ++ "番目の"
} ;
VerbalA : Str -> Str -> Adj = \kekkonshiteiru,kikonno ->
VerbalA : Str -> Str -> Adj = \kekkonshiteiru,kikonno ->
let
kekkonshite = Predef.tk 2 kekkonshiteiru
kekkonshite = Predef.tk 2 kekkonshiteiru
in {
pred = \\st,t,p => kekkonshite ++ mkExistV.verb ! SomeoneElse ! Anim ! st ! t ! p ;
pred = \\st,t,p => kekkonshite + mkExistV.verb ! SomeoneElse ! Anim ! st ! t ! p ;
attr = kikonno ;
te = \\p => kekkonshite ++ mkExistV.te ! SomeoneElse ! Anim ! Resp ! p ;
ba = \\p => kekkonshite ++ mkExistV.ba ! SomeoneElse ! Anim ! Resp ! p ;
adv = table {
adv = table {
Pos => init kikonno + "で" ;
Neg => init kikonno + "ではなく"
} ;
dropNaEnging = init kikonno
} ;
mkVerb : Str -> VerbGroup -> Verb =
\yomu,gr ->
} ;
mkVerb : Str -> VerbGroup -> Verb =
\yomu,gr ->
let
yoma = mk_a_stem yomu gr ;
yomi = mk_i_stem yomu gr ;
@@ -207,7 +207,7 @@ oper
yon + "だ" => yon + "で" ;
yon + "た" => yon + "て"
} ;
Neg => yoma + "ないで"
Neg => yoma + "ないで"
} ;
a_stem = yoma ;
i_stem = yomi ;
@@ -217,9 +217,9 @@ oper
} ;
needSubject = True
} ;
mkVerb2 : Str -> Str -> VerbGroup -> Verb2 =
\yomu,p,gr ->
mkVerb2 : Str -> Str -> VerbGroup -> Verb2 =
\yomu,p,gr ->
let
yoma = mk_a_stem yomu gr ;
in {
@@ -256,7 +256,7 @@ oper
Gr1 => yoma + "れませんでした" ;
Gr2 => yoma + "られませんでした" ;
Suru => Predef.tk 2 yomu + "されませんでした" ;
Kuru => "来られませんでした"
Kuru => "来られませんでした"
}
}
} ;
@@ -303,7 +303,7 @@ oper
Gr2 => yoma + "られないで" ;
Suru => Predef.tk 2 yomu + "されないで" ;
Kuru => "来られないで"
}
}
} ;
pass_a_stem = case gr of {
Gr1 => yoma + "れ" ;
@@ -329,12 +329,12 @@ oper
Gr2 => yoma + "られなければ" ;
Suru => Predef.tk 2 yomu + "されなければ" ;
Kuru => "来られなければ"
}
}
} ;
needSubject = True
} ;
mkVerb3 : Str -> Str -> Str -> VerbGroup -> Verb3 =
mkVerb3 : Str -> Str -> Str -> VerbGroup -> Verb3 =
\uru,p1,p2,gr -> {
s = \\sp => (mkVerb uru gr).s ;
te = \\sp => (mkVerb uru gr).te ;
@@ -344,13 +344,13 @@ oper
prep1 = p1 ;
prep2 = p2
} ;
mkCopula : Verb = {
s = table {
Resp => table {
(TPres|TFut) => table {
Pos => "です" ;
Neg => "ではありません"
Neg => "ではありません"
} ;
TPast => table {
Pos => "でした" ;
@@ -367,7 +367,7 @@ oper
Neg => "ではなかった"
}
}
} ;
} ;
te = table {
Pos => "だって" ;
Neg => "ではなくて"
@@ -379,11 +379,11 @@ oper
a_stem, i_stem = "で" ; -- not used
needSubject = True -- not used
} ;
mkExistV : VP = {
verb = \\sp => table {
Anim => \\st,t,p => (mkVerb "いる" Gr2).s ! st ! t ! p ;
Inanim => table {
Inanim => table {
Resp => table {
(TPres|TFut) => table {
Pos => "あります" ;
@@ -404,7 +404,7 @@ oper
Neg => "なかった"
}
}
}
}
} ;
te = \\sp => table {
Anim => \\st => table {
@@ -438,11 +438,11 @@ oper
prepositive, obj = \\st => [] ;
needSubject = True
} ;
mkWant : VV = {
s = table {
Me => \\st,t,p => (i_mkAdj "たい").pred ! st ! t ! p ;
SomeoneElse => \\st,t,p => "たがって" ++ (mkVerb "いる" Gr2).s ! st ! t ! p
SomeoneElse => \\st,t,p => "たがって" ++ (mkVerb "いる" Gr2).s ! st ! t ! p
} ;
te = table {
Me => table {
@@ -456,7 +456,7 @@ oper
} ;
a_stem = table {
Me => "たいで" ;
SomeoneElse => "たがってい"
SomeoneElse => "たがってい"
} ;
i_stem = table {
Me => "たいで" ;
@@ -474,21 +474,21 @@ oper
} ;
sense = Wish
} ;
mkCan : VV = {
s = \\sp,st,t,p => (mkVerb "できる" Gr2).s ! st ! t ! p ;
te = \\sp => table {
Pos => "できて" ;
Neg => "できないで"
Neg => "できないで"
} ;
a_stem, i_stem = \\sp => "でき" ;
ba = \\sp => table {
Pos => "できれば" ;
Neg => "できなければ"
Neg => "できなければ"
} ;
sense = Abil
} ;
mkMust : VV = {
s = \\sp,st,t,p => (mkVerb "なる" Gr1).s ! st ! t ! Neg ;
te = \\sp,p => "ならなくて" ;
@@ -505,7 +505,7 @@ oper
i_stem = \\sp => (mkVerb yomu gr).i_stem ;
ba = \\sp => (mkVerb yomu gr).ba ;
sense = Abil
} ;
} ;
mkGive : Verb3 = {
s = table {
@@ -518,19 +518,19 @@ oper
} ;
a_stem, i_stem = table {
Me => "呉れ" ;
SomeoneElse => "上げ"
SomeoneElse => "上げ"
} ;
ba = table {
Me => (mkVerb "呉れる" Gr2).ba ;
SomeoneElse => (mkVerb "上げる" Gr2).ba
} ;
prep1 = "に" ;
prep2 = "を"
prep2 = "を"
} ;
mkGo : Verb = {
s = table {
Resp => (mkVerb "行く" Gr1).s ! Resp ;
Resp => (mkVerb "行く" Gr1).s ! Resp ;
Plain => table {
(TPres|TFut) => (mkVerb "行く" Gr1).s ! Plain ! TPres ;
TPast => table {
@@ -541,7 +541,7 @@ oper
} ;
te = table {
Pos => "行って" ;
Neg => "行かないで"
Neg => "行かないで"
} ;
a_stem = "行か" ;
i_stem = "行き" ;
@@ -556,13 +556,13 @@ oper
inclCard = False ;
tenPlus = False
} ;
regPron : Str -> Bool -> Animateness -> Pronoun = \kare,b,a -> {
s = \\st => kare ;
Pron1Sg = b ;
anim = a
} ;
} ;
mkDet : Str -> Str -> Number -> Determiner = \q,sp,n -> {
quant = \\st => q ;
postpositive = [] ;
@@ -573,7 +573,7 @@ oper
no = False ;
tenPlus = False
} ;
stylePron : Str -> Str -> Bool -> Animateness -> Pronoun = \boku,watashi,b,a -> {
s = table {
Plain => boku ;
@@ -581,8 +581,8 @@ oper
} ;
Pron1Sg = b ;
anim = a
} ;
} ;
regPN : Str -> PropNoun = \paris -> {
s = table {
Plain => paris ;
@@ -590,7 +590,7 @@ oper
} ;
anim = Inanim
} ;
personPN : Str -> Str -> PropNoun = \jon,jonsan -> {
s = table {
Plain => jon ;
@@ -598,27 +598,27 @@ oper
} ;
anim = Anim
} ;
mkAdv : Str -> Adverb = \adv -> {
s = \\st => adv ;
s = \\st => adv ;
prepositive = False
} ;
mkNP : Str -> Bool -> Bool -> Animateness -> NP = \np,b1,b2,a -> {
s = \\st => np ;
s = \\st => np ;
prepositive = \\st => [] ;
needPart = b1 ;
changePolar = b2 ;
meaning = SomeoneElse ;
needPart = b1 ;
changePolar = b2 ;
meaning = SomeoneElse ;
anim = a
} ;
mkConj : Str -> ConjType -> Conjunction = \c,t -> {
s = c ;
null = "" ;
type = t
} ;
mkPrep : Str -> Preposition = \p -> {
s = p ;
null = "" ;
@@ -692,10 +692,10 @@ oper
"つ" => init neru + "てば" ;
_ => init neru + "えば"
} ;
mkFirst : Adj = {
pred = \\st,t,p => "一番目" ++ mkCopula.s ! st ! t ! p ;
attr = "一番目の" ;
attr = "一番目の" ;
te = \\p => "一番目" ++ mkCopula.te ! p ;
ba = \\p => "一番目" ++ mkCopula.ba ! p ;
adv = table {
@@ -704,12 +704,12 @@ oper
} ;
dropNaEnging = "一番目"
} ;
mkRain : Verb = {
s = \\st,t,p => "雨が" ++ (mkVerb "降っている" Gr2).s ! st ! t ! p ; -- "ame ga furu"
te = table {
Pos => "雨が降っていて" ;
Neg => "雨が降っていないで"
Neg => "雨が降っていないで"
} ;
a_stem = "雨が降ってい" ;
i_stem = "雨が降ってい" ;
@@ -720,4 +720,3 @@ oper
needSubject = False
} ;
}

View File

@@ -1,4 +1,5 @@
concrete AdjectiveKor of Adjective = CatKor ** open ResKor, Prelude in {
concrete AdjectiveKor of Adjective = CatKor **
open ResKor, Prelude in {
flags optimize=all_subs ;
@@ -11,11 +12,14 @@ concrete AdjectiveKor of Adjective = CatKor ** open ResKor, Prelude in {
-- : A -> NP -> AP ;
ComparA a np = a ** {
compar = np.s ! Bare
s = \\vf => "더" ++ a.s ! vf ;
compar = glue (np.s ! Bare) "보다" ;
} ;
-- : A2 -> NP -> AP ; -- married to her
-- ComplA2 a2 np = a2 ** { } ;
ComplA2 a2 np = a2 ** {
compar = (prepNP a2.c2 a2.p2 np).s ;
} ;
-- : A2 -> AP ; -- married to itself
-- ReflA2 a2 = a2 ** { } ;
@@ -24,10 +28,10 @@ concrete AdjectiveKor of Adjective = CatKor ** open ResKor, Prelude in {
UseA2 = PositA ;
-- : A -> AP ; -- warmer
-- UseComparA a = a ** {
-- s = \\af => "???" ++ a.s ! af ;
-- compar = []
-- } ;
UseComparA a = a ** {
s = \\af => "" ++ a.s ! af ;
compar = [] ;
} ;
-- : CAdv -> AP -> NP -> AP ; -- as cool as John
@@ -37,7 +41,6 @@ concrete AdjectiveKor of Adjective = CatKor ** open ResKor, Prelude in {
-- : Ord -> AP ; -- warmest
AdjOrd ord = ord ** {
s = \\_ => ord.s ;
compar = []
} ;

View File

@@ -11,11 +11,7 @@ lin
-- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs
-- : Prep -> NP -> Adv ;
PrepNP prep np = {
s = case prep.attaches of {
True => glue (np.s ! Bare) prep.s ;
False => np.s ! Bare ++ prep.s }
} ;
PrepNP = prepNP Bare ;
-- Adverbs can be modified by 'adadjectives', just like adjectives.

View File

@@ -8,8 +8,8 @@ concrete CatKor of Cat = CommonX ** open ResKor, Prelude in {
-- Constructed in SentenceKor, and also in IdiomKor
S = ResKor.Sentence ;
QS = SS ;
RS = SS ;
QS = SS ; -- Questions not implemented yet
RS = ResKor.Sentence ;
-- relative sentence. Tense and polarity fixed,
-- but agreement may depend on the CN/NP it modifies.
@@ -66,7 +66,7 @@ concrete CatKor of Cat = CommonX ** open ResKor, Prelude in {
Quant = ResKor.Quant ;
Num = ResKor.Num ;
Ord = {
s : Str ; -- AForm => Str ; -- Ord can come from AP and become AP again
s : VForm => Str ; -- Ord can come from AP and become AP again
n : Number -- Ord can come from Num, which has inherent number
} ;
DAP = ResKor.Determiner ;
@@ -116,7 +116,7 @@ concrete CatKor of Cat = CommonX ** open ResKor, Prelude in {
N = ResKor.Noun ;
N2 = ResKor.Noun2 ;
N3 = ResKor.Noun3 ;
PN = ResKor.PNoun ;
PN = ResKor.NounPhrase ;
linref
V, V2, V3, VP = linVerb ;

View File

@@ -1,5 +1,5 @@
concrete ConjunctionKor of Conjunction =
CatKor ** open ResKor, Coordination, Prelude in {
CatKor ** open ResKor, Prelude in {
flags optimize=all_subs ;
@@ -25,54 +25,78 @@ concrete ConjunctionKor of Conjunction =
ConsAdv = consrSS comma ;
ConjAdv = conjunctSS ;
--}
-}
-- Adverb and other simple {s : Str} types.
lincat
[Adv],[AdV],[IAdv] = {s1,s2 : Str} ;
lin
BaseAdv, BaseAdV, BaseIAdv = twoSS ;
ConsAdv, ConsAdV, ConsIAdv = consrSS comma ;
ConjAdv, ConjAdV, ConjIAdv = conjunctDistrSS ;
{-
-- RS depends on X, Y and Z, otherwise exactly like previous.
-- RS can modify CNs, which are open for …, and have inherent …
lincat
[RS] = {s1,s2 : … => Str} ;
lin
BaseRS = twoTable3 … ;
ConsRS = consrTable3 … comma ;
ConjRS = conjunctRSTable ;
-}
lincat
[S] = ResKor.Sentence ** {firstS : ConjType => Str} ;
[Adv],[AdV],[IAdv] = ConjSS ;
lin
BaseAdv, BaseAdV, BaseIAdv = baseSS ;
ConsAdv, ConsAdV, ConsIAdv = consSS ;
ConjAdv, ConjAdV, ConjIAdv = conjSS ;
oper
ConjSS : Type = SS ** {firstSS : ConjType => 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
} ;
-- 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
++ ss.firstSS ! co.c
++ co.s2
++ ss.s
} ;
oper
mkFirstSS : SS -> ConjType => Str = \s ->
\\conj => glue s.s (conjTable ! VStar ! conj) ;
lincat
[S], [RS] = ResKor.Sentence ** {firstS : ConjType => Str} ;
lin
BaseS s1 s2 = s2 ** {
BaseS,BaseRS = \s1,s2 -> s2 ** {
firstS = mkFirstS s1
} ;
ConsS s ss = ss ** {
ConsS,ConsRS = \s,ss -> ss ** {
firstS = \\conj =>
mkFirstS s ! conj ++ ss.firstS ! conj ;
} ;
ConjS co ss = ss ** {
ConjS,ConjRS = \co,ss -> ss ** {
s = \\st => co.s1 ++ ss.firstS ! co.c ++ ss.s ! st
} ;
oper
mkFirstS : ResKor.Sentence -> ConjType => Str = \s ->
\\conj => glue (s.s ! Subord) (conjTable ! NStar ! conj) ;
\\conj => glue (s.s ! WithConj) (conjTable ! VStar ! conj) ;
lincat
[AP] = ResKor.AdjPhrase ** {firstAP : AForm => ConjType => Str} ;
[AP] = ResKor.AdjPhrase ** {firstAP : VForm => ConjType => Str} ;
lin
BaseAP a1 a2 = a2 ** {
@@ -90,10 +114,8 @@ lin
oper
mkFirstAP : ResKor.AdjPhrase -> AForm => ConjType => Str = \ap ->
\\af,conj => case af of {
AAttr => glue (ap.s ! AAttr) (conjTable ! NStar ! conj) ;
APred _ => glue (ap.s ! APred VStem) (conjTable ! VStar ! conj) } ;
mkFirstAP : ResKor.AdjPhrase -> VForm => ConjType => Str = \ap ->
\\af,conj => ap.compar ++ glue (ap.s ! VStem) (conjTable ! VStar ! conj) ;
{-
lincat
@@ -130,5 +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
} ;
}

View File

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

View File

@@ -183,6 +183,7 @@ oper
"기" | "끼" | "니" | "디" | "띠" | "리" | "미" | "비" | "삐" | "시" | "씨" | "이" | "지" | "찌" | "치" | "키" | "티" | "피" | "히" ) ;
a : pattern Str = #("가" | "까" | "나" | "다" | "따" | "라" | "마" | "바" | "빠" | "사" | "싸" | "아" | "자" | "짜" | "차" | "카" | "타" | "파" | "하") ;
e : pattern Str = #("게" | "께" | "네" | "데" | "떼" | "레" | "메" | "베" | "뻬" | "세" | "쎄" | "에" | "제" | "쩨" | "체" | "케" | "테" | "페" | "헤") ;
eo : pattern Str = #("거" | "꺼" | "너" | "더" | "떠" | "러" | "머" | "버" | "뻐" | "서" | "써" | "어" | "저" | "쩌" | "처" | "커" | "터" | "퍼" | "허") ;
eu : pattern Str = #("그" | "끄" | "느" | "드" | "뜨" | "르" | "므" | "브" | "쁘" | "스" | "쓰" | "으" | "즈" | "쯔" | "츠" | "크" | "트" | "프" | "흐") ;
i : pattern Str = #("기" | "끼" | "니" | "디" | "띠" | "리" | "미" | "비" | "삐" | "시" | "씨" | "이" | "지" | "찌" | "치" | "키" | "티" | "피" | "히") ;

View File

@@ -1,5 +1,5 @@
concrete LexiconKor of Lexicon = CatKor **
open ParadigmsKor, ResKor in {
open ParadigmsKor, ResKor, StructuralKor in {
----
-- A
@@ -33,10 +33,10 @@ lin big_A = mkA "크다" ;
-- lin bike_N = mkN "" ;
-- lin bird_N = mkN "" ;
-- lin bite_V2 = mkV2 "" ;
-- lin black_A = mkA "" ;
lin black_A = mkA "검다" ;
-- lin blood_N = mkN "" ;
-- lin blow_V = mkV "" ;
lin blue_A = mkA "푸르다" ;
lin blue_A = mkA "파랗다" "파래요" "파랗습니다" "파란" ;
-- lin boat_N = mkN "" ;
-- lin bone_N = mkN "" ;
-- lin boot_N = mkN "" ;
@@ -59,7 +59,7 @@ lin bread_N = mkN "빵" ;
-- lin camera_N = mkN "" ;
-- lin cap_N = mkN "" ;
-- lin car_N = mkN "" ;
lin car_N = mkN "자동차" "대" ;
-- lin carpet_N = mkN "" ;
lin cat_N = mkN "고양이" ;
-- lin ceiling_N = mkN "" ;
@@ -72,7 +72,7 @@ lin cat_N = mkN "고양이" ;
-- lin clever_A = mkA "" ;
-- lin close_V2 = mkV2 "" ;
-- lin cloud_N = mkN "" ;
-- lin coat_N = mkN "" ;
lin coat_N = mkN "코트" ;
-- lin cold_A = mkA "" ;
lin come_V = mkV "오다" ;
-- lin computer_N = mkN "" ;
@@ -95,7 +95,7 @@ lin do_V2 = mkV2 do_V ;
-- lin doctor_N = mkN "" ;
-- lin dog_N = mkN "" ;
-- lin door_N = mkN "" ;
-- lin drink_V2 = mkV2 "" ;
lin drink_V2 = mkV2 "마시다" ;
-- lin dry_A = mkA "" ;
-- lin dull_A = mkA "" ;
-- lin dust_N = mkN "" ;
@@ -209,7 +209,7 @@ lin laugh_V = mkV "웃다" ;
-- lin leave_V2 = mkV2 "" ;
-- lin leg_N = mkN "" ;
-- lin lie_V = mkV "" ;
-- lin like_V2 = mkV2 "" ;
lin like_V2 = mkV2 (mkV "좋아" do_V) topic object ;
-- lin listen_V2 = mkV2 "" ;
-- lin live_V = mkV "";
-- lin liver_N = mkN "" ;
@@ -223,7 +223,7 @@ lin laugh_V = mkV "웃다" ;
-- M
lin man_N = mkN "남자" ;
-- lin married_A2 = mkA "" ;
lin married_A2 = mkA2 (mkA "결혼했다" "결혼했어요" "결혼했습니다" "결혼한") with_Prep ; -- TODO check: forced past tense
-- lin meat_N = mkN "" ;
lin milk_N = mkN "우유" ;
-- lin moon_N = mkN "" ;
@@ -258,7 +258,7 @@ lin now_Adv = mkAdv "지금" ;
-- lin paris_PN = mkPN "Paris" ;
-- lin peace_N = mkN "" ;
-- lin pen_N = mkN "" ;
lin person_N = mkN "사람" ;
lin person_N = mkN "사람" "명" ;
-- lin planet_N = mkN "" ;
-- lin plastic_N = mkN "" ;
-- lin play_V = mkV "" ;
@@ -279,7 +279,7 @@ lin person_N = mkN "사람" ;
-- lin read_V2 = mkV2 "" ;
-- lin ready_A = mkA "" ;
-- lin reason_N = mkN "" ;
-- lin red_A = mkA "" ;
lin red_A = mkA "빨갛다" "빨개요" "빨갛습니다" "빨간" ;
-- lin religion_N = mkN "" ;
-- lin restaurant_N = mkN "" ;
-- lin river_N = mkN "" ;
@@ -314,7 +314,7 @@ lin see_V2 = mkV2 "보다" ;
-- lin sharp_A = mkA "" ;
-- lin sheep_N = mkN "" fem ;
-- lin ship_N = mkN "" ;
-- lin shirt_N = mkN "" ;
lin shirt_N = mkN "셔츠" "벌" ;
-- lin shoe_N = mkN "" ;
-- lin shop_N = mkN "" ;
lin short_A = mkA "키가" small_A ; -- "height is small"

View File

@@ -9,18 +9,13 @@ oper AddAdvQVP : QVP -> IAdv -> QVP = notYet "AddAdvQVP" ;
oper AdjDAP : DAP -> AP -> DAP = notYet "AdjDAP" ;
oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ;
oper AdvAP : AP -> Adv -> AP = notYet "AdvAP" ;
oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ;
oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ;
oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ;
oper AdvNP : NP -> Adv -> NP = notYet "AdvNP" ;
oper AdvQVP : VP -> IAdv -> QVP = notYet "AdvQVP" ;
oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ;
oper ApposCN : CN -> NP -> CN = notYet "ApposCN" ;
oper BaseAdV : AdV -> AdV -> ListAdV = notYet "BaseAdV" ;
oper BaseAdv : Adv -> Adv -> ListAdv = notYet "BaseAdv" ;
oper BaseCN : CN -> CN -> ListCN = notYet "BaseCN" ;
oper BaseIAdv : IAdv -> IAdv -> ListIAdv = notYet "BaseIAdv" ;
oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ;
oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ;
oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ;
oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ;
@@ -28,7 +23,6 @@ oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ;
oper CompIP : IP -> IComp = notYet "CompIP" ;
oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ;
oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ;
oper ComplA2 : A2 -> NP -> AP = notYet "ComplA2" ;
oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ;
oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ;
oper ComplSlashIP : VPSlash -> IP -> QVP = notYet "ComplSlashIP" ;
@@ -37,23 +31,16 @@ oper ComplVQ : VQ -> QS -> VP = notYet "ComplVQ" ;
oper ComplVS : VS -> S -> VP = notYet "ComplVS" ;
oper ComplVV : VV -> VP -> VP = notYet "ComplVV" ;
oper ConjAdV : Conj -> ListAdV -> AdV = notYet "ConjAdV" ;
oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ;
oper ConjCN : Conj -> ListCN -> CN = notYet "ConjCN" ;
oper ConjDet : Conj -> ListDAP -> Det = notYet "ConjDet" ;
oper ConjIAdv : Conj -> ListIAdv -> IAdv = notYet "ConjIAdv" ;
oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ;
oper ConsAdV : AdV -> ListAdV -> ListAdV = notYet "ConsAdV" ;
oper ConsAdv : Adv -> ListAdv -> ListAdv = notYet "ConsAdv" ;
oper ConsCN : CN -> ListCN -> ListCN = notYet "ConsCN" ;
oper ConsIAdv : IAdv -> ListIAdv -> ListIAdv = notYet "ConsIAdv" ;
oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ;
oper CountNP : Det -> NP -> NP = notYet "CountNP" ;
oper D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 : Dig = notYet "D_9" ;
oper DetDAP : Det -> DAP = notYet "DetDAP" ;
oper DetQuantOrd : Quant -> Num -> Ord -> Det = notYet "DetQuantOrd" ;
oper EmbedQS : QS -> SC = notYet "EmbedQS" ;
oper EmbedS : S -> SC = notYet "EmbedS" ;
oper EmbedVP : VP -> SC = notYet "EmbedVP" ;
oper ExistIP : IP -> QCl = notYet "ExistIP" ;
oper ExistIPAdv : IP -> Adv -> QCl = notYet "ExistIPAdv" ;
oper ExistNP : NP -> Cl = notYet "ExistNP" ;
@@ -61,9 +48,6 @@ oper ExistNPAdv : NP -> Adv -> Cl = notYet "ExistNPAdv" ;
oper ExtAdvVP : VP -> Adv -> VP = notYet "ExtAdvVP" ;
oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ;
oper GenericCl : VP -> Cl = notYet "GenericCl" ;
oper IDig : Dig -> Digits = notYet "IDig" ;
oper IIDig : Dig -> Digits -> Digits = notYet "IIDig" ;
oper IdRP : RP = notYet "IdRP" ;
oper IdetCN : IDet -> CN -> IP = notYet "IdetCN" ;
oper IdetIP : IDet -> IP = notYet "IdetIP" ;
oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ;
@@ -71,12 +55,9 @@ oper ImpP3 : NP -> VP -> Utt = notYet "ImpP3" ;
oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ;
oper ImpVP : VP -> Imp = notYet "ImpVP" ;
oper ImpersCl : VP -> Cl = notYet "ImpersCl" ;
oper MassNP : CN -> NP = notYet "MassNP" ;
oper NumDigits : Digits -> Card = notYet "NumDigits" ;
oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ;
oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ;
oper OrdNumeralSuperl : Numeral -> A -> Ord = notYet "OrdNumeralSuperl" ;
oper OrdSuperl : A -> Ord = notYet "OrdSuperl" ;
oper PConjConj : Conj -> PConj = notYet "PConjConj" ;
oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ;
oper PartNP : CN -> NP -> CN = notYet "PartNP" ;
@@ -84,8 +65,6 @@ oper PassV2 : V2 -> VP = notYet "PassV2" ;
oper PositAdAAdj : A -> AdA = notYet "PositAdAAdj" ;
oper PositAdvAdj : A -> Adv = notYet "PositAdvAdj" ;
oper PossNP : CN -> NP -> CN = notYet "PossNP" ;
oper PossPron : Pron -> Quant = notYet "PossPron" ;
oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ;
oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ;
oper ProgrVP : VP -> VP = notYet "ProgrVP" ;
oper QuestCl : Cl -> QCl = notYet "QuestCl" ;
@@ -96,18 +75,14 @@ oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ;
oper QuestVP : IP -> VP -> QCl = notYet "QuestVP" ;
oper ReflA2 : A2 -> AP = notYet "ReflA2" ;
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
oper RelCN : CN -> RS -> CN = notYet "RelCN" ;
oper RelCl : Cl -> RCl = notYet "RelCl" ;
oper RelNP : NP -> RS -> NP = notYet "RelNP" ;
oper RelS : S -> RS -> S = notYet "RelS" ;
oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ;
oper RelVP : RP -> VP -> RCl = notYet "RelVP" ;
oper SSubjS : S -> Subj -> S -> S = notYet "SSubjS" ;
oper SelfAdVVP : VP -> VP = notYet "SelfAdVVP" ;
oper SelfAdvVP : VP -> VP = notYet "SelfAdvVP" ;
oper SelfNP : NP -> NP = notYet "SelfNP" ;
oper SentAP : AP -> SC -> AP = notYet "SentAP" ;
oper SentCN : CN -> SC -> CN = notYet "SentCN" ;
oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ;
oper Slash3V3 : V3 -> NP -> VPSlash = notYet "Slash3V3" ;
oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ;
@@ -122,22 +97,15 @@ oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ;
oper SubjS : Subj -> S -> Adv = notYet "SubjS" ;
oper Use2N3 : N3 -> N2 = notYet "Use2N3" ;
oper Use3N3 : N3 -> N2 = notYet "Use3N3" ;
oper UseComparA : A -> AP = notYet "UseComparA" ;
oper UsePN : PN -> NP = notYet "UsePN" ;
oper UsePron : Pron -> NP = notYet "UsePron" ;
oper UseRCl : Temp -> Pol -> RCl -> RS = notYet "UseRCl" ;
oper UseQCl : Temp -> Pol -> QCl -> QS = notYet "UseQCl" ;
oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ;
oper UttAP : AP -> Utt = notYet "UttAP" ;
oper UttAdv : Adv -> Utt = notYet "UttAdv" ;
oper UttCN : CN -> Utt = notYet "UttCN" ;
oper UttCard : Card -> Utt = notYet "UttCard" ;
oper UttIAdv : IAdv -> Utt = notYet "UttIAdv" ;
oper UttIP : IP -> Utt = notYet "UttIP" ;
oper UttImpPl : Pol -> Imp -> Utt = notYet "UttImpPl" ;
oper UttImpPol : Pol -> Imp -> Utt = notYet "UttImpPol" ;
oper UttImpSg : Pol -> Imp -> Utt = notYet "UttImpSg" ;
oper UttInterj : Interj -> Utt = notYet "UttInterj" ;
oper UttNP : NP -> Utt = notYet "UttNP" ;
oper UttVP : VP -> Utt = notYet "UttVP" ;
oper UttQS : QS -> Utt = notYet "UttQS" ;
oper VPSlashPrep : VP -> Prep -> VPSlash = notYet "VPSlashPrep" ;
oper VocNP : NP -> Voc = notYet "VocNP" ;
oper above_Prep : Prep = notYet "above_Prep" ;
@@ -176,7 +144,6 @@ oper between_Prep : Prep = notYet "between_Prep" ;
oper bike_N : N = notYet "bike_N" ;
oper bird_N : N = notYet "bird_N" ;
oper bite_V2 : V2 = notYet "bite_V2" ;
oper black_A : A = notYet "black_A" ;
oper blood_N : N = notYet "blood_N" ;
oper blow_V : V = notYet "blow_V" ;
oper boat_N : N = notYet "boat_N" ;
@@ -195,8 +162,6 @@ oper burn_V : V = notYet "burn_V" ;
oper but_PConj : PConj = notYet "but_PConj" ;
oper butter_N : N = notYet "butter_N" ;
oper buy_V2 : V2 = notYet "buy_V2" ;
oper by8agent_Prep : Prep = notYet "by8agent_Prep" ;
oper by8means_Prep : Prep = notYet "by8means_Prep" ;
oper camera_N : N = notYet "camera_N" ;
oper can8know_VV : VV = notYet "can8know_VV" ;
oper can_VV : VV = notYet "can_VV" ;
@@ -213,7 +178,6 @@ oper clean_A : A = notYet "clean_A" ;
oper clever_A : A = notYet "clever_A" ;
oper close_V2 : V2 = notYet "close_V2" ;
oper cloud_N : N = notYet "cloud_N" ;
oper coat_N : N = notYet "coat_N" ;
oper cold_A : A = notYet "cold_A" ;
oper computer_N : N = notYet "computer_N" ;
oper correct_A : A = notYet "correct_A" ;
@@ -241,7 +205,6 @@ oper dn1000000c : Dig -> Dig -> Dig -> Dig -> Dig -> Dig -> Sub1000000 = notYet
oper doctor_N : N = notYet "doctor_N" ;
oper dog_N : N = notYet "dog_N" ;
oper door_N : N = notYet "door_N" ;
oper drink_V2 : V2 = notYet "drink_V2" ;
oper dry_A : A = notYet "dry_A" ;
oper dull_A : A = notYet "dull_A" ;
oper during_Prep : Prep = notYet "during_Prep" ;
@@ -267,7 +230,6 @@ oper father_N2 : N2 = notYet "father_N2" ;
oper fear_V2 : V2 = notYet "fear_V2" ;
oper fear_VS : VS = notYet "fear_VS" ;
oper feather_N : N = notYet "feather_N" ;
oper few_Det : Det = notYet "few_Det" ;
oper few_X_short_of_Y : NP -> CN -> CN -> S = notYet "few_X_short_of_Y" ;
oper fight_V2 : V2 = notYet "fight_V2" ;
oper find_V2 : V2 = notYet "find_V2" ;
@@ -305,7 +267,6 @@ oper has_age_VP : Card -> VP = notYet "has_age_VP" ;
oper hat_N : N = notYet "hat_N" ;
oper hate_V2 : V2 = notYet "hate_V2" ;
oper have_name_Cl : NP -> NP -> Cl = notYet "have_name_Cl" ;
oper he_Pron : Pron = notYet "he_Pron" ;
oper head_N : N = notYet "head_N" ;
oper hear_V2 : V2 = notYet "hear_V2" ;
oper heart_N : N = notYet "heart_N" ;
@@ -328,7 +289,6 @@ oper how_old_QCl : NP -> QCl = notYet "how_old_QCl" ;
oper hungry_VP : VP = notYet "hungry_VP" ;
oper hunt_V2 : V2 = notYet "hunt_V2" ;
oper husband_N : N = notYet "husband_N" ;
oper i_Pron : Pron = notYet "i_Pron" ;
oper ice_N : N = notYet "ice_N" ;
oper if_Subj : Subj = notYet "if_Subj" ;
oper if_then_Conj : Conj = notYet "if_then_Conj" ;
@@ -359,7 +319,6 @@ oper left_Ord : Ord = notYet "left_Ord" ;
oper leg_N : N = notYet "leg_N" ;
oper less_CAdv : CAdv = notYet "less_CAdv" ;
oper lie_V : V = notYet "lie_V" ;
oper like_V2 : V2 = notYet "like_V2" ;
oper listen_V2 : V2 = notYet "listen_V2" ;
oper live_V : V = notYet "live_V" ;
oper liver_N : N = notYet "liver_N" ;
@@ -368,7 +327,6 @@ oper lose_V2 : V2 = notYet "lose_V2" ;
oper louse_N : N = notYet "louse_N" ;
oper love_N : N = notYet "love_N" ;
oper love_V2 : V2 = notYet "love_V2" ;
oper many_Det : Det = notYet "many_Det" ;
oper married_A2 : A2 = notYet "married_A2" ;
oper married_Cl : NP -> NP -> Cl = notYet "married_Cl" ;
oper meat_N : N = notYet "meat_N" ;
@@ -406,12 +364,10 @@ oper oil_N : N = notYet "oil_N" ;
oper old_A : A = notYet "old_A" ;
oper on_Prep : Prep = notYet "on_Prep" ;
oper open_V2 : V2 = notYet "open_V2" ;
oper or_Conj : Conj = notYet "or_Conj" ;
oper otherwise_PConj : PConj = notYet "otherwise_PConj" ;
oper paint_V2A : V2A = notYet "paint_V2A" ;
oper paper_N : N = notYet "paper_N" ;
oper paris_PN : PN = notYet "paris_PN" ;
oper part_Prep : Prep = notYet "part_Prep" ;
oper peace_N : N = notYet "peace_N" ;
oper pen_N : N = notYet "pen_N" ;
oper planet_N : N = notYet "planet_N" ;
@@ -435,7 +391,6 @@ oper read_V2 : V2 = notYet "read_V2" ;
oper ready_A : A = notYet "ready_A" ;
oper ready_VP : VP = notYet "ready_VP" ;
oper reason_N : N = notYet "reason_N" ;
oper red_A : A = notYet "red_A" ;
oper religion_N : N = notYet "religion_N" ;
oper restaurant_N : N = notYet "restaurant_N" ;
oper right_Ord : Ord = notYet "right_Ord" ;
@@ -465,10 +420,8 @@ oper sell_V3 : V3 = notYet "sell_V3" ;
oper send_V3 : V3 = notYet "send_V3" ;
oper sew_V : V = notYet "sew_V" ;
oper sharp_A : A = notYet "sharp_A" ;
oper she_Pron : Pron = notYet "she_Pron" ;
oper sheep_N : N = notYet "sheep_N" ;
oper ship_N : N = notYet "ship_N" ;
oper shirt_N : N = notYet "shirt_N" ;
oper shoe_N : N = notYet "shoe_N" ;
oper shop_N : N = notYet "shop_N" ;
oper silver_N : N = notYet "silver_N" ;
@@ -484,10 +437,7 @@ oper snake_N : N = notYet "snake_N" ;
oper snow_N : N = notYet "snow_N" ;
oper so_AdA : AdA = notYet "so_AdA" ;
oper sock_N : N = notYet "sock_N" ;
oper somePl_Det : Det = notYet "somePl_Det" ;
oper someSg_Det : Det = notYet "someSg_Det" ;
oper somebody_NP : NP = notYet "somebody_NP" ;
oper something_NP : NP = notYet "something_NP" ;
oper somewhere_Adv : Adv = notYet "somewhere_Adv" ;
oper song_N : N = notYet "song_N" ;
oper speak_V2 : V2 = notYet "speak_V2" ;
@@ -583,8 +533,5 @@ oper worm_N : N = notYet "worm_N" ;
oper write_V2 : V2 = notYet "write_V2" ;
oper year_N : N = notYet "year_N" ;
oper yellow_A : A = notYet "yellow_A" ;
oper youPl_Pron : Pron = notYet "youPl_Pron" ;
oper youPol_Pron : Pron = notYet "youPol_Pron" ;
oper youSg_Pron : Pron = notYet "youSg_Pron" ;
oper young_A : A = notYet "young_A" ;
}

View File

@@ -10,24 +10,23 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in {
DetCN det cn = cn ** {s =
\\c =>
let cns : Str = case det.n of {
-- Pl => cn.s ! Bare ++ BIND ++ plural ! c ;
_Sg => cn.s ! c } ;
Pl => cn.s ! Bare ++ BIND ++ plural ! c ;
Sg => cn.s ! c } ;
dets : Str = det.s ! cn.c.origin ;
detnum : Str = case det.numtype of {
IsNum => dets ++ cn.c.s ;
IsDig => glue dets cn.c.s ;
NoNum => dets } ;
in case isNum det of {
True => cns ++ detnum ;
False => detnum ++ cns }
True => cn.rs ++ cns ++ detnum ;
False => cn.rs ++ detnum ++ cns }
} ;
-- : PN -> NP ;
-- UsePN pn = pn ** {
-- } ;
UsePN pn = pn ;
-- : Pron -> NP ;
-- UsePron pron = pron ;
UsePron pron = pron ** {empty = []};
-- : Predet -> NP -> NP ; -- only the man
PredetNP predet np = np ** {s =
@@ -48,8 +47,13 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in {
-- PPartNP np v2 = np ** {
-- s = \\c => v2.s ! ??? ++ np.s ! c } ; ----
-- : NP -> Adv -> NP ; -- Paris today ; boys, such as ..
--AdvNP,ExtAdvNP = \np,adv -> np ** {} ;
-- : NP -> Adv -> NP ; -- Paris today
AdvNP np adv = np ** {
s = \\nf => adv.s ++ np.s ! nf
} ; -- TODO test
-- : NP -> Adv -> NP ; -- boys, such as ..
-- ExtAdvNP np adv = np ** {} ;
-- : NP -> RS -> NP ; -- Paris, which is here
-- RelNP np rs = np ** {
@@ -64,9 +68,9 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in {
} ;
-- MassNP : CN -> NP ;
-- MassNP cn = useN cn ** {
-- } ;
MassNP cn = cn ** {
s = \\nf => cn.rs ++ cn.s ! nf
} ;
--2 Determiners
@@ -97,7 +101,11 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in {
NumCard card = card ;
-- : Digits -> Card ;
-- NumDigits dig =
NumDigits dig = baseNum ** {
s = \\_,_ => dig.s ! NCard ;
n = dig.n ;
numtype = IsDig
} ;
-- : Numeral -> Card ;
NumNumeral num = num ;
@@ -115,10 +123,10 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in {
-- } ;
-- : A -> Ord ;
-- OrdSuperl a = {
-- s = \\af => "제일" ++ a.s ! af ;
-- n = Sg -- ?? is this meaningful?
-- } ;
OrdSuperl a = {
s = \\vf => "가장" ++ a.s ! vf ;
n = Sg -- ?? is this meaningful?
} ;
-- One can combine a numeral and a superlative.
@@ -130,10 +138,7 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in {
IndefArt = mkQuant [] [] ;
-- : Pron -> Quant
-- PossPron pron =
-- let p = pron.poss ;
-- in DefArt ** {
-- } ;
PossPron pron = pron.poss ;
--2 Common nouns
@@ -155,23 +160,28 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in {
-- Use3N3 n3 = lin N2 n3 ;
-- : AP -> CN -> CN
AdjCN ap cn = cn ** {
s = \\nf => ap.s ! AAttr ++ cn.s ! nf
s = \\nf => ap.compar ++ ap.s ! VAttr Pos ++ cn.s ! nf
} ;
-- : CN -> RS -> CN ;
-- RelCN cn rs = cn ** {
-- } ;
RelCN cn rs = cn ** {
rs = cn.rs ++ rs.s ! Subord
} ;
{-
-- : CN -> Adv -> CN ;
AdvCN cn adv = cn ** { } ;
AdvCN cn adv = cn ** {
rs = cn.rs ++ adv.s
} ;
-- Nouns can also be modified by embedded sentences and questions.
-- For some nouns this makes little sense, but we leave this for applications
-- to decide. Sentential complements are defined in VerbKor.
-- : CN -> SC -> CN ; -- question where she sleeps
SentCN cn sc = cn ** { } ;
SentCN cn sc = cn ** {
rs = cn.rs ++ sc.s
} ;
--2 Apposition
@@ -179,8 +189,9 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in {
-- This is certainly overgenerating.
-- : CN -> NP -> CN ; -- city Paris (, numbers x and y)
ApposCN cn np = cn ** { s = } ;
-}
ApposCN cn np = cn ** {
s = \\nf => np.s ! Bare ++ cn.s ! nf -- TODO which form of NP?
} ;
--2 Possessive and partitive constructs

View File

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

View File

@@ -4,16 +4,27 @@ oper
--2 Parameters
--
-- To abstract over number, valency and (some) case names,
-- To abstract over number, valency and (some) CaseParticle names,
-- we define the following identifiers. The application programmer
-- should always use these constants instead of the constructors
-- defined in $ResKor$.
CaseParticle : Type ; -- Arguments to give to V2, V3
topic : CaseParticle ; -- 은 or 는
subject : CaseParticle ; -- 이 or 가
object : CaseParticle ; -- 을 or 를
noCase : CaseParticle ; -- No case particle
NumOrigin : Type ; -- Arguments to give to N
nativeKorean : NumOrigin ; -- Native Korean variant of numerals: 하나, 둘, 셋 , …
sinoKorean : NumOrigin ; -- Sino-Korean variant of numerals: 일, 이, 삼
--2 Nouns
mkN : overload {
mkN : (noun : Str) -> N ; -- Predictable nouns
mkN : (noun : Str) -> N ; -- Predictable nouns with classifier 개. When quantified by a numeral, the numeral is of native Korean origin: 하나/둘/셋 , not 일/이/삼.
mkN : (noun,counter : Str) -> N ; -- Noun and classifier given as arguments. Takes numerals of native Korean origin.
mkN : (noun,counter : Str) -> NumOrigin -> N ; -- Noun, classifier and origin of numerals. E.g. `mkN "사람" "명" nativeKorean`
} ;
--2 Adjectives
@@ -21,23 +32,33 @@ oper
mkA : overload {
mkA : (adj : Str) -> A ; -- Regular adjective, given in -다 form
mkA : (kiga : Str) -> (jakda : A) -> A ; -- Compound adjective, e.g. 키가 작다 'short', literally 'height (is) small'. 키가 'height' given as string, 작다 'small' given as preconstructed A.
mkA : (jaemi : Str) -> (itda : V) -> A ; -- Compound adjective from 있다/없다 (or any other preconstructed verb), e.g. 재미있다 'amusing; entertaining', literally from parts 'fun' (Str) and 'have' (V).
mkA : (plain,polite,formal,attr : Str) -> A ; -- Worst case constructor: e.g. mkA "파랗다" "파래요" "파랗습니다" "파란"
} ;
-- mkA2 : Str -> Prep -> A2 ;
mkA2 : overload {
mkA2 : Str -> A2 ; -- Regular adjective, given in -다 form, no postposition for complement.
mkA2 : Str -> Str -> A2 ; -- Adjective given in -다 form, postposition given as a string. If you want to use a postposition that has different forms for after vowel/after consonant, use the next constructor that takes a preconstructed Prep.
mkA2 : A -> Prep -> A2 ; -- Preconstructed adjective and postposition for complement.
} ;
mkPN : Str -> PN
= \s -> lin PN (mkNoun s) ;
--2 Verbs
-- Verbs
mkV : overload {
mkV : (plain : Str) -> V ; -- Predictable verb. Takes plain, uninflected -다 form, e.g. 가다
mkV : (nore : Str) -> (hada : V) -> V ; -- Add a prefix to an existing verb, e.g. 노래+하다
mkV : (plain,polite,formal,attr : Str) -> V ; -- Worst case constructor: e.g. mkV "다르다" "달라요" "다릅니다" "다른"
} ;
copula : V ; -- The copula verb ''
mkV2 : overload {
mkV2 : (plain : Str) -> V2 ; -- Regular verb. Takes plain, uninflected -다 form, object particle is 를.
mkV2 : V -> V2 ; -- Takes preconstructed V, object particle is 를.
mkV2 : (plain : Str) -> V2 ; -- Regular verb. Takes plain, uninflected -다 form, subject particle is 가/이 and object particle is 를/을.
mkV2 : V -> V2 ; -- Takes preconstructed V, subject particle is 가/이 and object particle is 를/을.
mkV2 : V -> (subj,obj : CaseParticle) -> V2 ; -- Takes preconstructed V, and subject and object particles. E.g. `mkV2 좋다_V topic subject` for "as for <SUBJ>는, <OBJ>가 is good".
} ;
-- mkV3 : overload {
@@ -66,7 +87,8 @@ oper
--2 Structural categories
mkPrep : overload {
mkPrep : (e : Str) -> Prep ; -- Particle like 에, attaches to the NP.
mkPrep : (e : Str) -> Prep ; -- Particle/postposition like 에: same form after vowel and consonant, attaches to the NP. Despite the name Prep, these are always postpositions.
mkPrep : (ro,euro : Str) -> Prep ; -- Particle like 로/으로: first argument is the form after vowel, second argument after consonant. Attaches to the NP.
mkPrep : (dwie : Str) -> (attaches : Bool) -> Prep ; -- `mkPrep "뒤에" False` for a postposition that doesn't attach to the NP.
} ;
@@ -91,10 +113,26 @@ oper
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
CaseParticle : Type = ResKor.NForm ;
topic = Topic ;
subject = Subject ;
object = Object ;
noCase = Bare ;
NumOrigin : Type = ResKor.NumOrigin ;
nativeKorean = NK ;
sinoKorean = SK ;
mkN = overload {
mkN : Str -> N = \s -> lin N (mkNoun s) ;
mkN : Str -> N = \s -> lin N (mkNoun s) ;
mkN : (noun,counter : Str) -> N = \n,c -> mkNCounter n c nativeKorean ;
mkN : (noun,counter : Str) -> NumOrigin -> N = mkNCounter
} ;
mkNCounter : (noun,counter : Str) -> NumOrigin -> N = \n,c,o ->
let noun : Noun = mkNoun n ;
counter : Counter = mkCounter c o ;
in lin N (noun ** {c = counter}) ;
mkN2 = overload {
mkN2 : Str -> N2 = \s -> lin N2 (mkNoun s) ;
@@ -108,12 +146,27 @@ oper
mkA : (adj : Str) -> A = \s -> lin A (mkAdj s) ;
mkA : (kiga : Str) -> (jakda : A) -> A = \kiga,jakda ->
jakda ** {s = \\af => kiga ++ jakda.s ! af} ;
mkA : (plain,polite,formal,attr : Str) -> A
= \x1,x2,x3,x4 -> lin A (mkAdjReg x1 x2 x3 x4) ;
mkA : (jaemi : Str) -> (itda : V) -> A
= \jaemi,itda -> lin A ({s = \\vf => jaemi ++ itda.s ! vf}) ;
} ;
mkA2 = overload {
mkA2 : Str -> A2 = \s -> lin A2 (atoa2 (mkAdj s)) ;
mkA2 : Str -> Str -> A2
= \s,p -> let adj : Adjective = mkAdj s ;
prep : Prep = mkPrep p
in lin A2 (atoa2 adj ** {p2 = prep}) ;
mkA2 : A -> Prep -> A2 = \a,p -> lin A2 (atoa2 a ** {p2 = p}) ;
} ;
mkV = overload {
mkV : (plain : Str) -> V = \v -> lin V (mkVerb v) ;
mkV : (nore : Str) -> (hada : V) -> V = \nore,hada -> hada ** {
s = \\vf => nore + hada.s ! vf} ;
mkV : (plain,polite,formal,attr : Str) -> V
= \x1,x2,x3,x4 -> lin V (mkVerbReg x1 x2 x3 x4) ;
} ;
copula = ResKor.copula ;
@@ -124,6 +177,8 @@ oper
mkV2 = overload {
mkV2 : (plain : Str) -> V2 = \v2 -> lin V2 (mkVerb2 v2) ;
mkV2 : V -> V2 = vtov2 ;
mkV2 : V -> (subj,obj : CaseParticle) -> V2 = \v,sc,c2 ->
vtov2 v ** {sc = sc ; c2 = c2} ;
} ;
mkV3 = overload {
@@ -136,6 +191,8 @@ oper
mkPrep = overload {
mkPrep : (e : Str) -> Prep -- Particle like 에, attaches to the NP.
= \e -> lin Prep (ResKor.mkPrep e) ;
mkPrep : (ro,euro : Str) -> Prep
= \ro,euro -> lin Prep (ResKor.mkPrep2 ro euro) ;
mkPrep : (dwie : Str) -> (attaches : Bool) -> Prep -- `mkPrep "뒤에" False` for a postposition that doesn't attach to the NP.
= \dwie,f -> lin Prep (ResKor.mkPrep dwie ** {attaches = f}) ;
} ;

Binary file not shown.

View File

@@ -6,20 +6,21 @@ concrete PhraseKor of Phrase = CatKor ** open Prelude, ResKor in {
UttS s = {s = s.s ! Statement} ;
UttQS qs = qs ;
UttIAdv iadv = iadv ;
UttAdv adv = adv ;
UttInterj i = i ;
{-
UttImpSg pol imp =
UttImpPl pol imp =
UttImpPol = UttImpSg ;
-}
UttIP ip = {s = ip.s ! Bare} ;
UttNP np = {s = np.s ! Bare} ;
UttVP vp = {s = linVP vp} ;
UttCN cn = {s = cn.rs ++ cn.s ! Bare} ;
UttCard n = {s = n.s ! NK ! Indep} ;
UttAP ap = { s = ap.compar ++ ap.s ! VF Plain Pos} ;
UttIP ip = {s = ip.s ! } ;
UttNP np = {s = np.s ! } ;
UttVP vp = {s = } ;
UttAdv adv = {s = } ;
UttCN n = {s = } ;
UttCard n = {s = } ;
UttAP ap = { s = ap.s ! } ;
UttInterj i = i ;
-}
NoPConj = {s = []} ;
-- PConjConj conj = {s = conj.s1 ++ conj.s2 ! …} ;

View File

@@ -1,22 +1,35 @@
concrete RelativeKor of Relative = CatKor ** open
ResKor, Prelude, (NS=NounKor), (SS=StructuralKor) in {
{-
lin
-- : Cl -> RCl ; -- such that John loves her
-- RelCl cl = ;
RelCl = relSlash (ss "") ;
-- : RP -> VP -> RCl ;
RelVP rp vp =
RelVP rp vp = { -- TODO no tenses yet in the grammar
s = \\t,a,p,cltyp =>
rp.s ++ vp.adv ++ vp.nObj ++
case cltyp of {
WithConj => vp.s ! VStem ;
_ => vp.s ! VAttr p } ;
} ;
-- : RP -> ClSlash -> RCl ; -- whom John loves
RelSlash rp cls =
RelSlash = relSlash ;
-- : RP ;
IdRP = {s = ""} ;
-- : Prep -> NP -> RP -> RP ; -- the mother of whom
--FunRP prep np rp = {} ;
-}
oper
relSlash : SS -> ClSlash -> ResKor.RClause = \rp,cls -> {
s = \\t,a,p,cltyp => rp.s ++
case cltyp of {
WithConj => cls.s ! t ! a ! p ! WithConj ;
_ => cls.s ! t ! a ! p ! Subord } ;
} ;
}

View File

@@ -13,76 +13,75 @@ oper
origin = NK
} ;
Noun : Type = {
mkCounter : Str -> NumOrigin -> Counter = \s,o -> baseCounter ** {
s = s ;
origin = o ;
} ;
BaseNoun : Type = {
s : NForm => Str ;
p : Phono ;
} ;
Noun : Type = BaseNoun ** {
c : Counter ;
} ;
Noun2 : Type = Noun ; -- TODO eventually more parameters?
Noun3 : Type = Noun ;
CNoun : Type = Noun ** {
rs : Str ; -- Relative clause comes before determiner
} ;
PNoun : Type = Noun ;
mkNoun : Str -> Noun = \str -> {
s = \\cas => str + allomorph cas str ;
p = if_then_else Phono (vowFinal str) Vowel Consonant ;
c = baseCounter
} ;
useN : Noun -> CNoun = \n -> n ;
useN : Noun -> CNoun = \n -> n ** {
rs = []
} ;
---------------------------------------------
-- NP
-- BaseNP : Type = {
-- a : Agreement ;
-- isPron : Bool ;
-- empty : Str ; -- standard trick for pro-drop
-- } ;
--
-- emptyNP : NounPhrase = {
-- s = \\_ => [] ;
-- a = Sg3 Masc ;
-- isPron = False ;
-- empty = [] ;
-- } ;
--
-- indeclNP : Str -> NounPhrase = \s -> emptyNP ** {s = \\c => s} ;
--NounPhrase : Type = BaseNP ** {s : NForm => Str} ;
NounPhrase = Noun ;
NounPhrase = BaseNoun ** {
-- empty : Str ; -- standard trick for pro-drop
} ;
--------------------------------------------------------------------------------
-- Pronouns
Pronoun : Type = NounPhrase ** {
-- poss : { -- for PossPron : Pron -> Quant
-- } ;
sp : NForm => Str ;
Pronoun : Type = BaseNoun ** {
poss : Quant ;
} ;
mkPron = overload {
mkPron : (stem,poss : Str) -> Pronoun = \s,poss -> mkNoun s ** {
poss = mkQuant poss (poss ++ "것") ;
} ;
mkPron : (stem : Str) -> Pronoun = \s -> mkNoun s ** {
poss = mkQuant (s + "의") (s + "의" ++ "것") ;
}
} ;
--------------------------------------------------------------------------------
-- Det, Quant, Card, Ord
BaseQuant : Type = {
sp : NForm => Str ;
isPoss : Bool ;
p : Phono
} ;
Determiner : Type = BaseQuant ** {
s : NumOrigin => Str ; -- Chosen by the counter of CN
sp : NForm => Str ;
n : Number ;
numtype : NumType ; -- Whether its Num component is digit, numeral or Sg/Pl
} ;
Quant : Type = BaseQuant ** {
s : Str ;
sp : NForm => Str ;
} ;
Num : Type = {
@@ -104,6 +103,7 @@ oper
} ;
baseQuant : BaseQuant = {
sp = \\_ => [] ;
isPoss = False ;
p = Vowel ;
} ;
@@ -114,6 +114,13 @@ oper
p = (mkNoun sp).p ;
} ;
mkDet : Str -> Number -> Determiner = \s,num -> baseQuant ** {
s = \\_ => (mkNoun s).s ! Bare ; -- NumOrigin irrelevant for non-numbers
sp = (mkNoun s).s ;
n = num ;
numtype = NoNum ;
} ;
plural : NForm => Str = table {
Bare => "들" ;
nf => "들" + allomorph nf "들"
@@ -121,9 +128,13 @@ oper
--------------------------------------------------------------------------------
-- Postpositions
Postposition : Type = {s : Str ; attaches : Bool} ;
Postposition : Type = {s : Phono => Str ; attaches : Bool} ;
mkPrep : Str -> Postposition = \str -> {s=str ; attaches=True} ;
mkPrep : Str -> Postposition = \str -> {s=\\_ => str ; attaches=True} ;
mkPrep2 : (ro,euro : Str) -> Postposition = \ro,euro -> {
s = table {Vowel => ro ; Consonant => euro} ;
attaches = True
} ;
emptyPP : Postposition = mkPrep [] ** {attaches=False} ;
datPP : Postposition = mkPrep "에게" ;
@@ -131,16 +142,25 @@ oper
--------------------------------------------------------------------------------
-- Adjectives
Adjective : Type = {s : AForm => Str} ;
Adjective2 : Type = Adjective ;
Adjective : Type = {s : VForm => Str} ; -- Adjectives are verbs
Adjective2 : Type = Adjective ** {c2 : NForm ; p2 : Postposition} ;
v2a : (attrpos : Str) -> Verb -> Adjective = \attrpos,v -> {
s = table {
VAttr Pos => attrpos ; -- Positive Attr is different in
vf => v.s ! vf } -- adjectives, otherwise adj forms == verb forms.
} ;
mkAdj : Str -> Adjective = \plain ->
let stem = init plain ;
verb = mkVerb plain ;
in {
s = table { AAttr => add_N stem ;
APred vf => verb.s ! vf }
} ;
let v : Verb = mkVerb plain ;
stem : Str = v.s ! VStem ;
attrpos : Str = add_N stem ;
in v2a attrpos v ;
mkAdjReg : (x1,_,_,x4 : Str) -> Adjective = \plain,polite,formal,attr ->
v2a attr (mkVerbReg plain polite formal attr) ;
atoa2 : Adjective -> Adjective2 = \a -> a ** {c2=Bare ; p2=emptyPP} ;
AdjPhrase : Type = Adjective ** {compar : Str} ;
--------------------------------------------------------------------------------
@@ -159,16 +179,13 @@ oper
mkVerb : (plain : Str) -> Verb = \plain ->
let stem = init plain ;
-- plainpres = case vowFinal stem of { -- not used in grammar yet
-- True => add_N stem + "다" ;
-- False => stem + "는다" } ;
informal = add_eo stem ; -- not used in grammar yet
polpres = informal + "요" ;
formalpres = case vowFinal stem of {
polite = informal + "요" ;
formal = case vowFinal stem of {
True => add_B stem + "니다" ;
False => stem + "습니다" } ;
neg = stem + "" ;
in mkVerbReg plain polpres formalpres neg ;
attrpos = stem + "" ;
in mkVerbReg plain polite formal attrpos ;
mkVerb2 : (plain : Str) -> Verb2 = \plain -> vtov2 (mkVerb plain) ;
mkVerb3 : (plain : Str) -> Verb3 = \plain -> v2tov3 (mkVerb2 plain) ;
@@ -176,18 +193,23 @@ oper
vtov2 : Verb -> Verb2 = \v -> v ** {c2 = Object ; p2 = emptyPP} ;
v2tov3 : Verb2 -> Verb3 = \v -> v ** {c3 = Bare ; p3 = datPP} ;
-- ㄹ-irregulars, ㅎ-irregular
mkVerbReg : (x1,_,_,x4 : Str) -> Verb =
\plain,polite,formal,neg ->
\plain,polite,formal,attrpos ->
let stem = init plain ;
neg = stem + "지" ;
attrneg = neg ++ "않는" ;
planeg = neg ++ negForms ! Plain ;
polneg = neg ++ negForms ! Polite ;
formneg = neg ++ negForms ! Formal ;
in mkVerbFull stem plain polite formal planeg polneg formneg ;
in mkVerbFull stem attrpos attrneg plain polite formal planeg polneg formneg ;
mkVerbFull : (x1,_,_,_,_,_,x7 : Str) -> Verb =
\stem,plain,polite,formal,planeg,polneg,formneg -> {
mkVerbFull : (x1,_,_,_,_,_,_,_,x9 : Str) -> Verb =
\stem,attrpos,attrneg,plain,polite,formal,planeg,polneg,formneg -> {
s = table {
VStem => stem ;
VAttr Pos => attrpos ;
VAttr Neg => attrneg ;
VF Plain Pos => plain ;
VF Plain Neg => planeg ;
VF Polite Pos => polite ;
@@ -200,6 +222,8 @@ oper
copula : Verb = mkVerbFull
"이"
"이는" -- TODO does this exist?
"아니는" -- TODO does this exist?
"이다"
"이에요"
"입니다"
@@ -209,6 +233,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 +241,8 @@ oper
have_V : Verb = mkVerbFull
"있"
"있는"
"없는"
"있다"
"있어요"
"있습니다"
@@ -223,11 +250,19 @@ oper
"없어요"
"없습니다" ;
-- For building an adjective. Different attr from do_V.
do_A : Verb = mkVerbReg
"하다"
"해요"
"합니다"
"한" ;
hada_A = do_A ; -- Exposing both names (hada=transliteration, do=translation)
do_V : Verb = mkVerbReg
"하다"
"해요"
"합니다"
"하" ;
"하" ;
negForms : Style => Str =
table { Plain => "않다" ;
@@ -239,26 +274,37 @@ oper
Adverb : Type = SS ;
prepNP : NForm -> Postposition -> NounPhrase -> Adverb = \nf,pp,np -> {
s = case pp.attaches of {
True => glue (np.s ! nf) (pp.s ! np.p) ;
False => np.s ! nf ++ (pp.s ! np.p)}
} ;
------------------
-- Conj
Conj : Type = {
s1 : Str ;
s1, s2 : Str ;
c : ConjType ; -- if it's And, Or, …
-- Need to add conjunction already in ConsX funs.
n : Number ;
} ;
-- Do not remove this. Used in a particular application grammar.
commaConj : Conj = {
s1, s2 = [] ;
c = Comma ;
n = Pl ;
} ;
------------------
-- VP
Complement : Type = {
s : VForm => Str ;
-- compar : Str ; -- comparative is discontinuous
} ;
emptyComp : Complement = {
s = \\_ => [] ;
-- compar : Str ;
} ;
BaseVP : Type = {
@@ -285,7 +331,7 @@ oper
useVc : Verb2 -> VPSlash = \v2 -> baseVP ** v2 ;
insertComp : VPSlash -> NounPhrase -> VerbPhrase = \v2,np -> useV v2 ** {
nObj = np.s ! v2.c2 ++ v2.p2.s
nObj = np.s ! v2.c2 ++ v2.p2.s ! np.p
} ;
insertAdv : VerbPhrase -> SS -> VerbPhrase = \vp,adv -> vp ** {adv = adv.s} ;
@@ -302,16 +348,20 @@ oper
QClause : Type = Clause ;
RClause : Type = {s : NForm => Tense => Anteriority => Polarity => Str} ;
RClause : Type = Clause ;
Sentence : Type = {s : ClType => Str} ;
predVP : NounPhrase -> VerbPhrase -> ClSlash = \np,vp -> vp ** {
predVP : NounPhrase -> VerbPhrase -> ClSlash = \np,vp ->
let npstr : Str = np.s ! vp.sc in predVP' npstr vp ;
predVP' : (np : Str) -> VerbPhrase -> ClSlash = \np,vp -> vp ** {
s = \\t,a,p,cltyp =>
let vf = case cltyp of {
Subord => VStem ;
_ => VF Polite p } -- TODO: more tenses, politeness
in np.s ! vp.sc
Subord => VAttr p ;
WithConj => VStem ;
_ => VF Polite p } -- TODO: more tenses, politeness
in np
++ vp.nObj -- an object, not copula complement
++ vp.adv
++ vp.s ! vf
@@ -321,5 +371,6 @@ oper
-- linrefs
linVerb : Verb -> Str = \v -> v.s ! linVF ;
linVP : VerbPhrase -> Str = \vp -> vp.nObj ++ vp.adv ++ vp.s ! linVF ;
}

View File

@@ -11,7 +11,7 @@ lin
PredVP = predVP ;
-- : SC -> VP -> Cl ; -- that she goes is good (Saeed p. 94)
--PredSCVP sc vp = ;
PredSCVP sc vp = predVP' sc.s vp ;
--2 Clauses missing object noun phrases
-- : NP -> VPSlash -> ClSlash ;
@@ -35,16 +35,16 @@ lin
ImpVP vp = {s = \\num,pol => linVP (VImp num pol) Statement vp} ;
--2 Embedded sentences
-}
-- : S -> SC ;
EmbedS s = {s = s.s ! True} ; -- choose subordinate
EmbedS s = {s = s.s ! Subord ++ "것이"} ; -- TODO check subject case
-- : QS -> SC ;
-- EmbedQS qs = { } ;
-- : VP -> SC ;
EmbedVP vp = {s = infVP vp} ;
-}
EmbedVP vp = {s = vp.s ! VAttr Pos ++ "것이"} ;
--2 Sentences
-- : Temp -> Pol -> Cl -> S ;
@@ -56,7 +56,7 @@ lin
UseQCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! Statement} ;
-- : Temp -> Pol -> RCl -> RS ;
-- UseRCl t p cl = {s = } ;
UseRCl t p rcl = {s = \\c => t.s ++ p.s ++ rcl.s ! t.t ! t.a ! p.p ! c} ;
-- AdvS : Adv -> S -> S ; -- then I will go home
AdvS = advS "" ;

View File

@@ -38,16 +38,15 @@ lin there_Adv = ss "" ;
-------
-- Conj
and_Conj = {
lin and_Conj = {
s1 = [] ;
-- no need for strings here, actual values come from ParamKor.conjTable
-- s2 = \\phono => table {
-- VStar => "고" ;
-- NStar => "하고"} ;
-- no need for string, actual values come from ParamKor.conjTable
s2 = [] ; -- this is only used in the base/cons functions with comma.
-- another application can use commas and just one conjunction.
n = Pl ;
c = And
} ;
-- lin or_Conj = {s2 = \\_ => "" ; s1 = [] ; n = Sg} ;
lin or_Conj = {s1,s2 = [] ; n = Sg ; c = Or} ;
-- lin if_then_Conj = mkConj
-- lin both7and_DConj = mkConj "" "" pl ;
-- lin either7or_DConj = {s2 = \\_ => "" ; s1 = "" ; n = Sg} ;
@@ -68,17 +67,16 @@ lin all_Predet = {s = \\_ => "마다" ; p = Vowel} ;
lin only_Predet = {s = \\_ => "만" ; p = Consonant} ;
--lin most_Predet = {s = ""} ;
{-
lin every_Det = R.defDet [] pl **
{ s = mkVow } ;
lin few_Det = R.indefDet "" pl ;
lin many_Det = R.indefDet "" pl ;
lin much_Det = R.indefDet "" sg ;
lin somePl_Det =
lin someSg_Det =
lin no_Quant =
-}
--lin every_Det = ;
lin few_Det = mkDet "조금의" Pl ;
lin many_Det = mkDet "많은" Pl ;
-- lin much_Det = ;
lin somePl_Det = mkDet "어떤" Pl ;
lin someSg_Det = mkDet "어떤" Sg ;
--lin no_Quant =
lin that_Quant = mkQuant "그" "그것" ;
lin this_Quant = mkQuant "이" "이것" ;
{-lin which_IQuant =
@@ -92,11 +90,8 @@ lin everything_NP = defNP "" N.NumSg ;
lin nobody_NP = mkVerb; ""
lin nothing_NP = defNP "" N.NumSg ;
lin somebody_NP = defNP "" N.NumSg ;
lin something_NP = defNP "" N.NumSg ;
oper
defNP : Str -> Num -> NP = {} ;
-}
lin something_NP = mkNoun "무엇" ;
-------
-- Prep
@@ -106,8 +101,8 @@ oper
-- lin before_Prep = mkPrep "" ;
lin behind_Prep = mkPrep "뒤에" False ;
-- lin between_Prep = = mkPrep "" ;
-- lin by8agent_Prep = mkPrep ;
-- lin by8means_Prep = mkPrep ;
lin by8agent_Prep = mkPrep "에 의해" ; -- TODO check
lin by8means_Prep = mkPrep "에 인해" ; -- TODO check
-- lin during_Prep = mkPrep ;
-- lin except_Prep = mkPrep ;
lin for_Prep = mkPrep "에게" ;
@@ -115,12 +110,12 @@ lin for_Prep = mkPrep "에게" ;
-- lin in8front_Prep = mkPrep "" ;
lin in_Prep = mkPrep "에서" ;
-- lin on_Prep = mkPrep "에서" ;
-- lin part_Prep = mkPrep ;
lin part_Prep = mkPrep "의" ;
lin possess_Prep = mkPrep "의" ;
-- lin through_Prep = mkPrep ;
lin to_Prep = mkPrep "에";
-- lin under_Prep = mkPrep "" ;
-- lin with_Prep = mkPrep "" ;
lin with_Prep = mkPrep "와" "과" ;
-- lin without_Prep = mkPrep "" ;
@@ -129,13 +124,15 @@ lin to_Prep = mkPrep "에";
-- Pronouns are closed class, no constructor in ParadigmsKor.
-- it_Pron =
-- i_Pron =
-- youPol_Pron,
-- youSg_Pron =
-- he_Pron =
-- she_Pron =
i_Pron = let iReg : Pronoun = mkPron "저" "제" in
iReg ** {s = table {Subject => "제가"; nf => iReg.s ! nf}
} ;
youPol_Pron = mkPron "당신" ;
youSg_Pron = mkPron "너" ; -- NB. this is very informal, best not used
he_Pron = mkPron "그" ;
she_Pron = mkPron "그녀" ;
-- we_Pron =
-- youPl_Pron =
youPl_Pron = mkPron "너희" ;
-- they_Pron =
--lin whatPl_IP = ;

View File

@@ -1,7 +1,7 @@
--# -path=.:../abstract:../common:../prelude
concrete SymbolKor of Symbol = CatKor **
open Prelude, ParadigmsKor, ResKor, (NS=NounKor) in {
open Prelude, ResKor, (NK=NounKor), (VK=VerbKor) in {
lin
@@ -15,28 +15,40 @@ lin
FloatPN i = mkPN i.s ;
-- : Card -> PN ; -- twelve [as proper name]
NumPN i = mkPN i.s ;
NumPN i = mkPN (i.s ! NK ! Indep) ;
oper
mkPN : Str -> NounPhrase = \s -> {
s = \\_ => s ;
p = Consonant ; -- ??
} ;
{-
lin
-- CNIntNP cn i = {} ;
-- : CN -> Int -> NP
CNIntNP cn i = NK.MassNP (cn ** {
s = \\nf => cn.s ! nf ++ i.s}) ;
-- : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and y
CNSymbNP det cn xs =
let cnSymb = cn ** { comp = cn.comp ++ xs.s }
in NS.DetCN det cnSymb ;
let cnSymb : CN = cn ** {s = \\nf => cn.s ! nf ++ xs.s}
in NK.DetCN det cnSymb ;
-- : CN -> Card -> NP ; -- level five ; level 5
CNNumNP cn i = NS.MassNP (cn ** { comp = cn.comp ++ i.s }) ;
CNNumNP cn i = NK.MassNP (cn ** {
s = \\nf => cn.s ! nf ++ i.s ! cn.c.origin ! Indep}) ;
-- : Symb -> S ;
SymbS sy = {s = } ;
SymbS sy = {s = \\_ => sy.s} ;
-- : Symb -> Card ;
SymbNum sy = { s = sy.s ; n = Pl } ;
SymbNum sy = baseNum ** {s = \\_,_ => sy.s} ;
-- : Symb -> Ord ;
SymbOrd sy = { s =} ;
-}
SymbOrd sy =
let comp : Comp = VK.CompAdv (lin Adv sy)
in {s = comp.s ; n=Pl} ;
lincat
Symb, [Symb] = SS ;

View File

@@ -111,7 +111,7 @@ lin
-- : AP -> Comp ;
CompAP ap = emptyComp ** {
s = \\vf => ap.s ! APred vf
s = \\vf => ap.compar ++ ap.s ! vf
} ;
-- : CN -> Comp ;

View File

@@ -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: 제가 고양이 &+ 보다 더 작은 여자 &+ 예요

View File

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

View File

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

View File

@@ -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: 저는 저를 좋아하는 고양이가 좋아요

View File

@@ -0,0 +1,22 @@
-- Subject as subject case
-- LangEng: I see a cat
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant IndefArt NumSg) (UseN cat_N)))))) NoVoc
LangKor: 제가 고양이를 봐요
-- Double subject case
-- LangEng: the cat is short
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseComp (CompAP (PositA short_A)))))) NoVoc
LangKor: 고양이가 키가 작아요
-- Topic as subject case
-- LangEng: I have a cat
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a have_V2) (DetCN (DetQuant IndefArt NumSg) (UseN cat_N)))))) NoVoc
LangKor: 저는 고양이가 있어요
-- Topic + object
-- LangEng: I like cats
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a like_V2) (DetCN (DetQuant IndefArt NumPl) (UseN cat_N)))))) NoVoc
LangKor: 저는 고양이를 좋아해요