1
0
forked from GitHub/gf-rgl

(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 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 "" ;

View File

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

View File

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