1
0
forked from GitHub/gf-rgl

Merge pull request #312 from inariksit/korean

Korean
This commit is contained in:
Inari Listenmaa
2020-04-15 10:02:18 +02:00
committed by GitHub
5 changed files with 24 additions and 35 deletions

View File

@@ -36,43 +36,29 @@ lin
ConjAdv, ConjAdV, ConjIAdv = conjSS ; ConjAdv, ConjAdV, ConjIAdv = conjSS ;
oper oper
ConjSS : Type = SS ** {firstSS : ConjType => Str} ; ConjSS : Type = {s : ConjType => Str} ;
baseSS : SS -> SS -> ConjSS = \s1,s2 -> s2 ** { baseSS : SS -> SS -> ConjSS = \s1,s2 -> {
firstSS = mkFirstSS s1 ; s = \\conj => glue s1.s (conjTable ! NStar ! conj) ++ s2.s ;
} ; } ;
consSS : SS -> ConjSS -> ConjSS = \s,ss -> ss ** { consSS : SS -> ConjSS -> ConjSS = \s,ss -> ss ** {
firstSS = \\conj => s = \\conj => glue s.s (conjTable ! NStar ! conj) ++ ss.s ! conj ;
mkFirstSS s ! conj ++ ss.firstSS ! conj ;
} ; } ;
conjSS : Conj -> ConjSS -> SS = \co,ss -> { conjSS : Conj -> ConjSS -> SS = \co,ss -> {
s = co.s1 ++ ss.firstSS ! co.c ++ ss.s s = co.s1 ++ ss.s ! co.c
} ;
-- Versions with commas, no repeated conjunctions
baseSScomma : SS -> SS -> ConjSS = \s1,s2 -> s2 ** {
firstSS = \\conj => s1.s ++ SOFT_BIND ++ "," ;
} ; } ;
-- Version with commas, no repeated conjunctions!
-- baseSS works for both: always conjunction between penultimate and last.
-- Difference from consSS: conjTable ! NStar ! conj isn't used, only comma.
consSScomma : SS -> ConjSS -> ConjSS = \s,ss -> ss ** { consSScomma : SS -> ConjSS -> ConjSS = \s,ss -> ss ** {
firstSS = \\conj => s = \\conj => s.s
s.s ++ SOFT_BIND ++ "," ++ ss.firstSS ! conj ; ++ SOFT_BIND ++ "," -- Don't add conjunction, only comma
++ ss.s ! 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 lincat
[S], [RS] = ResKor.Sentence ** {firstS : ConjType => Str} ; [S], [RS] = ResKor.Sentence ** {firstS : ConjType => Str} ;
@@ -115,7 +101,7 @@ lin
oper oper
mkFirstAP : ResKor.AdjPhrase -> VForm => ConjType => Str = \ap -> mkFirstAP : ResKor.AdjPhrase -> VForm => ConjType => Str = \ap ->
\\af,conj => ap.compar ++ glue (ap.s ! VStem) (conjTable ! VStar ! conj) ; \\af,conj => ap.compar ++ glue (ap.s ! VStem Pos) (conjTable ! VStar ! conj) ;
{- {-
lincat lincat

View File

@@ -37,7 +37,7 @@ lin
-- : Digit -> Sub100 ; -- 10 + d -- : Digit -> Sub100 ; -- 10 + d
pot1to19 d = let newS = xPlus "십" "열" d.s in d ** { pot1to19 d = let newS = xPlus "십" "열" d.s in d ** {
s = newS ; s = newS ;
n = Pl ; n = numNumber ;
ord = newS ! NK ! Attrib ++ "번째" ; ord = newS ! NK ! Attrib ++ "번째" ;
} ; } ;
@@ -98,7 +98,7 @@ oper
SK => \\_ => sk ; SK => \\_ => sk ;
NK => table {Indep => nk ; _ => nkAttr } NK => table {Indep => nk ; _ => nkAttr }
} ; } ;
n = Pl ; n = numNumber ;
numtype = IsNum ; numtype = IsNum ;
isTwo = False ; isTwo = False ;
ten = ten ; ten = ten ;
@@ -117,7 +117,7 @@ oper
potTimes : (sk,nk : Str) -> ResKor.Numeral -> ResKor.Numeral = \sk,nk,num -> potTimes : (sk,nk : Str) -> ResKor.Numeral -> ResKor.Numeral = \sk,nk,num ->
let newS = xTimes sk nk num.s in num ** { let newS = xTimes sk nk num.s in num ** {
s = newS ; s = newS ;
n = Pl ; n = numNumber ;
ord = newS ! NK ! Attrib ++ "번째" ; -- TODO check ord = newS ! NK ! Attrib ++ "번째" ; -- TODO check
} ; } ;
@@ -136,7 +136,7 @@ lin
-- : Dig -> Digits -> Digits ; -- 876 -- : Dig -> Digits -> Digits ; -- 876
IIDig d i = { IIDig d i = {
s = \\o => d.s ! NCard ++ BIND ++ i.s ! o ; s = \\o => d.s ! NCard ++ BIND ++ i.s ! o ;
n = Pl n = numNumber
} ; } ;
D_0 = mkDig "0" ; D_0 = mkDig "0" ;
@@ -151,7 +151,7 @@ lin
D_9 = mkDig "9" ; D_9 = mkDig "9" ;
oper oper
mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o ResKor.Pl ; mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o numNumber ;
mkDig : Str -> TDigit = \c -> mk2Dig c (c + "번째") ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "번째") ;
mk3Dig : Str -> Str -> ResKor.Number -> TDigit = \c,o,n -> { mk3Dig : Str -> Str -> ResKor.Number -> TDigit = \c,o,n -> {
@@ -163,4 +163,6 @@ oper
n : ResKor.Number ; n : ResKor.Number ;
s : CardOrd => Str s : CardOrd => Str
} ; } ;
numNumber = Sg ; -- No need for 들 with numerals
} }

Binary file not shown.

View File

@@ -10,7 +10,7 @@ lin
s = \\t,a,p,cltyp => s = \\t,a,p,cltyp =>
rp.s ++ vp.adv ++ vp.nObj ++ rp.s ++ vp.adv ++ vp.nObj ++
case cltyp of { case cltyp of {
WithConj => vp.s ! VStem ; WithConj => vp.s ! VStem p ;
_ => vp.s ! VAttr p } ; _ => vp.s ! VAttr p } ;
} ; } ;

View File

@@ -153,7 +153,7 @@ oper
mkAdj : Str -> Adjective = \plain -> mkAdj : Str -> Adjective = \plain ->
let v : Verb = mkVerb plain ; let v : Verb = mkVerb plain ;
stem : Str = v.s ! VStem ; stem : Str = v.s ! VStem Pos ;
attrpos : Str = add_N stem ; attrpos : Str = add_N stem ;
in v2a attrpos v ; in v2a attrpos v ;
@@ -207,7 +207,8 @@ oper
mkVerbFull : (x1,_,_,_,_,_,_,_,x9 : Str) -> Verb = mkVerbFull : (x1,_,_,_,_,_,_,_,x9 : Str) -> Verb =
\stem,attrpos,attrneg,plain,polite,formal,planeg,polneg,formneg -> { \stem,attrpos,attrneg,plain,polite,formal,planeg,polneg,formneg -> {
s = table { s = table {
VStem => stem ; VStem Pos => stem ;
VStem Neg => stem + "지" ++ "않" ;
VAttr Pos => attrpos ; VAttr Pos => attrpos ;
VAttr Neg => attrneg ; VAttr Neg => attrneg ;
VF Plain Pos => plain ; VF Plain Pos => plain ;
@@ -359,7 +360,7 @@ oper
s = \\t,a,p,cltyp => s = \\t,a,p,cltyp =>
let vf = case cltyp of { let vf = case cltyp of {
Subord => VAttr p ; Subord => VAttr p ;
WithConj => VStem ; WithConj => VStem p ;
_ => VF Polite p } -- TODO: more tenses, politeness _ => VF Polite p } -- TODO: more tenses, politeness
in np in np
++ vp.nObj -- an object, not copula complement ++ vp.nObj -- an object, not copula complement