(Kor) Add counters to N* + preliminary support for numerals

This commit is contained in:
Inari Listenmaa
2020-03-25 16:00:48 +01:00
parent d83ded2624
commit 115e2f1ffa
3 changed files with 40 additions and 19 deletions

View File

@@ -8,10 +8,19 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in {
-- : Det -> CN -> NP -- : Det -> CN -> NP
DetCN det cn = cn ** {s = DetCN det cn = cn ** {s =
\\c => case det.n of { \\c =>
-- Pl => det.s ++ cn.s ! Bare ++ BIND ++ plural ! c ; let cns : Str = case det.n of {
_ => det.s ++ cn.s ! c } ; -- Pl => n.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 }
} ;
-- : PN -> NP ; -- : PN -> NP ;
-- UsePN pn = pn ** { -- UsePN pn = pn ** {
@@ -50,7 +59,8 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in {
-- : Det -> NP ; -- : Det -> NP ;
DetNP det = det ** { DetNP det = det ** {
s = det.sp s = det.sp ;
c = baseCounter
} ; } ;
-- MassNP : CN -> NP ; -- MassNP : CN -> NP ;
@@ -64,9 +74,8 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in {
-- quantifier and an optional numeral can be discerned. -- quantifier and an optional numeral can be discerned.
-- : Quant -> Num -> Det ; -- : Quant -> Num -> Det ;
DetQuant quant num = quant ** { DetQuant quant num = quant ** num ** {
s = quant.s ++ num.s ! Indep ; s = \\origin => quant.s ++ num.s ! origin ! Attrib
n = num.n
} ; } ;
-- : Quant -> Num -> Ord -> Det ; -- these five best -- : Quant -> Num -> Ord -> Det ; -- these five best
@@ -117,10 +126,8 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in {
-- OrdNumeralSuperl num a = num ** { } ; -- OrdNumeralSuperl num a = num ** { } ;
-- : Quant -- : Quant
DefArt = baseQuant ** {sp = \\_ => []} ; DefArt,
IndefArt = mkQuant [] [] ;
-- : Quant
IndefArt = baseQuant ** {sp = \\_ => []} ;
-- : Pron -> Quant -- : Pron -> Quant
-- PossPron pron = -- PossPron pron =

Binary file not shown.

View File

@@ -3,10 +3,20 @@ resource ResKor = ParamKor ** open Prelude, Predef, ParamKor in {
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Nouns -- Nouns
oper oper
Counter : Type = {
s : Str ;
origin : NumOrigin
} ;
baseCounter : Counter = {
s = "개" ;
origin = NK
} ;
Noun : Type = { Noun : Type = {
s : NForm => Str ; s : NForm => Str ;
p : Phono p : Phono ;
c : Counter ;
} ; } ;
Noun2 : Type = Noun ; -- TODO eventually more parameters? Noun2 : Type = Noun ; -- TODO eventually more parameters?
Noun3 : Type = Noun ; Noun3 : Type = Noun ;
@@ -19,6 +29,7 @@ oper
mkNoun : Str -> Noun = \str -> { mkNoun : Str -> Noun = \str -> {
s = \\cas => str + allomorph cas str ; s = \\cas => str + allomorph cas str ;
p = if_then_else Phono (vowFinal str) Vowel Consonant ; p = if_then_else Phono (vowFinal str) Vowel Consonant ;
c = baseCounter
} ; } ;
useN : Noun -> CNoun = \n -> n ; useN : Noun -> CNoun = \n -> n ;
@@ -58,28 +69,32 @@ oper
-- Det, Quant, Card, Ord -- Det, Quant, Card, Ord
BaseQuant : Type = { BaseQuant : Type = {
s : Str ;
isPoss : Bool ; isPoss : Bool ;
p : Phono p : Phono
} ; } ;
Determiner : Type = BaseQuant ** { Determiner : Type = BaseQuant ** {
s : NumOrigin => Str ; -- Chosen by the counter of CN
sp : NForm => Str ; sp : NForm => Str ;
n : Number ; n : Number ;
-- numtype : NumType ; -- number as in "5" or "Sg/Pl", often makes a difference in lots of things numtype : NumType ; -- Whether its Num component is digit, numeral or Sg/Pl
} ; } ;
Quant : Type = BaseQuant ** { Quant : Type = BaseQuant ** {
s : Str ;
sp : NForm => Str ; sp : NForm => Str ;
} ; } ;
Num : Type = { Num : Type = {
s : DForm => Str ; -- independent or attribute s : NumOrigin -- Sino-Korean or native Korean
n : Number => DForm -- Independent or attribute
=> Str ;
n : Number ;
numtype : NumType ; -- Digit, numeral or Sg/Pl
} ; } ;
baseNum : Num = { baseNum : Num = {
s = \\_ => [] ; s = \\_,_ => [] ;
n = Sg ; n = Sg ;
numtype = NoNum numtype = NoNum
} ; } ;
@@ -89,7 +104,6 @@ oper
} ; } ;
baseQuant : BaseQuant = { baseQuant : BaseQuant = {
s = [] ;
isPoss = False ; isPoss = False ;
p = Vowel ; p = Vowel ;
} ; } ;