(Kor) Add worst case constructors for A and V

This commit is contained in:
Inari Listenmaa
2020-04-07 13:50:48 +02:00
parent 986592c3a2
commit ef06c0d3c0
3 changed files with 31 additions and 15 deletions

View File

@@ -36,7 +36,7 @@ lin big_A = mkA "크다" ;
lin black_A = mkA "검다" ; lin black_A = mkA "검다" ;
-- lin blood_N = mkN "" ; -- lin blood_N = mkN "" ;
-- lin blow_V = mkV "" ; -- lin blow_V = mkV "" ;
lin blue_A = mkA "푸르다" ; lin blue_A = mkA "파랗다" "파래요" "파랗습니다" "파랗지" "파란" ;
-- lin boat_N = mkN "" ; -- lin boat_N = mkN "" ;
-- lin bone_N = mkN "" ; -- lin bone_N = mkN "" ;
-- lin boot_N = mkN "" ; -- lin boot_N = mkN "" ;

View File

@@ -27,6 +27,7 @@ oper
mkA : overload { mkA : overload {
mkA : (adj : Str) -> A ; -- Regular adjective, given in -다 form 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 : (kiga : Str) -> (jakda : A) -> A ; -- Compound adjective, e.g. 키가 작다 'short', literally 'height (is) small'. 키가 'height' given as string, 작다 'small' given as preconstructed A.
mkA : (plain,polite,formal,neg,attr : Str) -> A ; -- Worst case constructor: e.g. mkA "파랗다" "파래요" "파랗습니다" "파랗지" "파란"
} ; } ;
mkA2 : overload { mkA2 : overload {
@@ -43,6 +44,7 @@ oper
mkV : overload { mkV : overload {
mkV : (plain : Str) -> V ; -- Predictable verb. Takes plain, uninflected -다 form, e.g. 가다 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 : (nore : Str) -> (hada : V) -> V ; -- Add a prefix to an existing verb, e.g. 노래+하다
mkV : (plain,polite,formal,neg,attr : Str) -> V ; -- Worst case constructor: e.g. mkV "다르다" "달라요" "다릅니다" "다르지" "다른"
} ; } ;
copula : V ; -- The copula verb '' copula : V ; -- The copula verb ''
@@ -133,6 +135,8 @@ oper
mkA : (adj : Str) -> A = \s -> lin A (mkAdj s) ; mkA : (adj : Str) -> A = \s -> lin A (mkAdj s) ;
mkA : (kiga : Str) -> (jakda : A) -> A = \kiga,jakda -> mkA : (kiga : Str) -> (jakda : A) -> A = \kiga,jakda ->
jakda ** {s = \\af => kiga ++ jakda.s ! af} ; jakda ** {s = \\af => kiga ++ jakda.s ! af} ;
mkA : (x1,_,_,_,x5 : Str) -> A
= \x1,x2,x3,x4,x5 -> lin A (mkAdjReg x1 x2 x3 x4 x5) ;
} ; } ;
mkA2 = overload { mkA2 = overload {
@@ -148,6 +152,8 @@ oper
mkV : (plain : Str) -> V = \v -> lin V (mkVerb v) ; mkV : (plain : Str) -> V = \v -> lin V (mkVerb v) ;
mkV : (nore : Str) -> (hada : V) -> V = \nore,hada -> hada ** { mkV : (nore : Str) -> (hada : V) -> V = \nore,hada -> hada ** {
s = \\vf => nore + hada.s ! vf} ; s = \\vf => nore + hada.s ! vf} ;
mkV : (plain,polite,formal,neg,attr : Str) -> V
= \x1,x2,x3,x4,x5 -> lin V (mkVerbReg x1 x2 x3 x4 x5) ;
} ; } ;
copula = ResKor.copula ; copula = ResKor.copula ;

View File

@@ -144,15 +144,23 @@ oper
Adjective : Type = {s : VForm => Str} ; -- Adjectives are verbs Adjective : Type = {s : VForm => Str} ; -- Adjectives are verbs
Adjective2 : Type = Adjective ** {p2 : Postposition} ; Adjective2 : Type = Adjective ** {p2 : Postposition} ;
mkAdj : Str -> Adjective = \plain ->
let stem = init plain ;
verb = mkVerb plain ; v2a : (attrpos : Str) -> Verb -> Adjective = \attrpos,v -> {
in {
s = table { s = table {
VAttr Pos => add_N stem ; -- Positive Attr form is different in VAttr Pos => attrpos ; -- Positive Attr is different in
vf => verb.s ! vf } -- adjectives, otherwise adj forms == verb forms. vf => v.s ! vf } -- adjectives, otherwise adj forms == verb forms.
} ; } ;
mkAdj : Str -> Adjective = \plain ->
let v : Verb = mkVerb plain ;
stem : Str = v.s ! VStem ;
attrpos : Str = add_N stem ;
in v2a attrpos v ;
mkAdjReg : (x1,_,_,_,x5 : Str) -> Adjective = \plain,polite,formal,neg,attr ->
v2a attr (mkVerbReg plain polite formal neg attr) ;
atoa2 : Adjective -> Adjective2 = \a -> a ** {c2=Bare ; p2=emptyPP} ; atoa2 : Adjective -> Adjective2 = \a -> a ** {c2=Bare ; p2=emptyPP} ;
AdjPhrase : Type = Adjective ** {compar : Str} ; AdjPhrase : Type = Adjective ** {compar : Str} ;
@@ -173,12 +181,13 @@ oper
mkVerb : (plain : Str) -> Verb = \plain -> mkVerb : (plain : Str) -> Verb = \plain ->
let stem = init plain ; let stem = init plain ;
informal = add_eo stem ; -- not used in grammar yet informal = add_eo stem ; -- not used in grammar yet
polpres = informal + "요" ; polite = informal + "요" ;
formalpres = case vowFinal stem of { formal = case vowFinal stem of {
True => add_B stem + "니다" ; True => add_B stem + "니다" ;
False => stem + "습니다" } ; False => stem + "습니다" } ;
neg = stem + "지" ; neg = stem + "지" ;
in mkVerbReg plain polpres formalpres neg ; attrpos = stem + "는" ;
in mkVerbReg plain polite formal neg attrpos ;
mkVerb2 : (plain : Str) -> Verb2 = \plain -> vtov2 (mkVerb plain) ; mkVerb2 : (plain : Str) -> Verb2 = \plain -> vtov2 (mkVerb plain) ;
mkVerb3 : (plain : Str) -> Verb3 = \plain -> v2tov3 (mkVerb2 plain) ; mkVerb3 : (plain : Str) -> Verb3 = \plain -> v2tov3 (mkVerb2 plain) ;
@@ -186,10 +195,10 @@ oper
vtov2 : Verb -> Verb2 = \v -> v ** {c2 = Object ; p2 = emptyPP} ; vtov2 : Verb -> Verb2 = \v -> v ** {c2 = Object ; p2 = emptyPP} ;
v2tov3 : Verb2 -> Verb3 = \v -> v ** {c3 = Bare ; p3 = datPP} ; v2tov3 : Verb2 -> Verb3 = \v -> v ** {c3 = Bare ; p3 = datPP} ;
mkVerbReg : (x1,_,_,x4 : Str) -> Verb = -- ㄹ-irregulars, ㅎ-irregular
\plain,polite,formal,neg -> mkVerbReg : (x1,_,_,_,x5 : Str) -> Verb =
\plain,polite,formal,neg,attrpos ->
let stem = init plain ; let stem = init plain ;
attrpos = stem + "는" ; -- TODO: ㄹ-irregulars
attrneg = neg ++ "않는" ; attrneg = neg ++ "않는" ;
planeg = neg ++ negForms ! Plain ; planeg = neg ++ negForms ! Plain ;
polneg = neg ++ negForms ! Polite ; polneg = neg ++ negForms ! Polite ;
@@ -246,7 +255,8 @@ oper
"하다" "하다"
"해요" "해요"
"합니다" "합니다"
"하지" ; "하지"
"한" ;
negForms : Style => Str = negForms : Style => Str =
table { Plain => "않다" ; table { Plain => "않다" ;