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 ;
oper
ConjSS : Type = SS ** {firstSS : ConjType => Str} ;
ConjSS : Type = {s : ConjType => Str} ;
baseSS : SS -> SS -> ConjSS = \s1,s2 -> s2 ** {
firstSS = mkFirstSS s1 ;
baseSS : SS -> SS -> ConjSS = \s1,s2 -> {
s = \\conj => glue s1.s (conjTable ! NStar ! conj) ++ s2.s ;
} ;
consSS : SS -> ConjSS -> ConjSS = \s,ss -> ss ** {
firstSS = \\conj =>
mkFirstSS s ! conj ++ ss.firstSS ! conj ;
s = \\conj => glue s.s (conjTable ! NStar ! conj) ++ ss.s ! 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 ++ "," ;
s = co.s1 ++ ss.s ! co.c
} ;
-- 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 ** {
firstSS = \\conj =>
s.s ++ SOFT_BIND ++ "," ++ ss.firstSS ! conj ;
s = \\conj => s.s
++ 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
[S], [RS] = ResKor.Sentence ** {firstS : ConjType => Str} ;
@@ -115,7 +101,7 @@ lin
oper
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

View File

@@ -37,7 +37,7 @@ lin
-- : Digit -> Sub100 ; -- 10 + d
pot1to19 d = let newS = xPlus "십" "열" d.s in d ** {
s = newS ;
n = Pl ;
n = numNumber ;
ord = newS ! NK ! Attrib ++ "번째" ;
} ;
@@ -98,7 +98,7 @@ oper
SK => \\_ => sk ;
NK => table {Indep => nk ; _ => nkAttr }
} ;
n = Pl ;
n = numNumber ;
numtype = IsNum ;
isTwo = False ;
ten = ten ;
@@ -117,7 +117,7 @@ oper
potTimes : (sk,nk : Str) -> ResKor.Numeral -> ResKor.Numeral = \sk,nk,num ->
let newS = xTimes sk nk num.s in num ** {
s = newS ;
n = Pl ;
n = numNumber ;
ord = newS ! NK ! Attrib ++ "번째" ; -- TODO check
} ;
@@ -136,7 +136,7 @@ lin
-- : Dig -> Digits -> Digits ; -- 876
IIDig d i = {
s = \\o => d.s ! NCard ++ BIND ++ i.s ! o ;
n = Pl
n = numNumber
} ;
D_0 = mkDig "0" ;
@@ -151,7 +151,7 @@ lin
D_9 = mkDig "9" ;
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 + "번째") ;
mk3Dig : Str -> Str -> ResKor.Number -> TDigit = \c,o,n -> {
@@ -163,4 +163,6 @@ oper
n : ResKor.Number ;
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 =>
rp.s ++ vp.adv ++ vp.nObj ++
case cltyp of {
WithConj => vp.s ! VStem ;
WithConj => vp.s ! VStem p ;
_ => vp.s ! VAttr p } ;
} ;

View File

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