Skip to content

Commit 9622a2c

Browse files
committed
Add Chi, Hin, Tha (testable only with Words300)
(Did not get Jpn to compile.)
1 parent fd9cd2e commit 9622a2c

File tree

16 files changed

+778
-2
lines changed

16 files changed

+778
-2
lines changed

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,15 @@ langs_Geography = Ace Ape Ger Spa
4242
# Tracking the regression of these languages
4343
langs_Geography_track = Ace Ape Ger Spa
4444
langs_Simple = Ace
45-
# Intentionally lacks Ape and Eng
46-
langs_Words300 = Ace Bul Cat Dan Dut Fin Fre Ger Gre Ita Lav Nor Pol Ron Rus Spa Swe Urd
45+
46+
# The Words300 grammar uses a subset of the RGL lexicon.
47+
# We try to include all the RGL languages here, i.e. also some
48+
# that are not included in the above languages lists.
49+
# This list intentionally lacks Ape and Eng.
50+
# TODO: rename 'Ace' to 'Eng' because the RGL English lexicon is not technically an ACE lexicon,
51+
# as it contains "words with spaces".
52+
# TODO: include also Afrikaans, Japanese (currently did not compile), Nepalese, Punjabi, Sindhi.
53+
langs_Words300 = Ace Bul Cat Chi Dan Dut Fin Fre Ger Gre Hin Ita Lav Nor Pol Ron Rus Spa Swe Tha Urd
4754

4855
# Compile application grammars in all languages
4956
all_grammars:
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
concrete AttemptoChi of Attempto = SymbolsC, NumeralChi, NullVPS **
2+
AttemptoI - [
3+
VPS, VPSQ, BaseVPS, BaseVPSQ, ConsVPS, ConsVPSQ, ListVPS, ListVPSQ,
4+
vp_as_posVPS, vp_as_posVPSQ, vpq_as_posVPSQ,
5+
vp_as_negVPS, vp_as_negVPSQ, vpq_as_negVPSQ,
6+
np_coord_VPS, np_coord_VPSQ, npq_coord_VPS] with
7+
(Syntax = SyntaxChi),
8+
(Symbolic = SymbolicChi),
9+
(LexAttempto = LexAttemptoChi) ** {
10+
11+
oper S2QS : Syntax.S -> Syntax.QS = variants {};
12+
13+
lin ipNPQ ip = variants {};
14+
15+
} ;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
concrete AttemptoHin of Attempto = SymbolsC, NumeralHin, NullVPS **
2+
AttemptoI - [
3+
nobody_IPron, nothing_IPron, noNP, noNPQ, if_thenS,
4+
VPS, VPSQ, BaseVPS, BaseVPSQ, ConsVPS, ConsVPSQ, ListVPS, ListVPSQ,
5+
vp_as_posVPS, vp_as_posVPSQ, vpq_as_posVPSQ,
6+
vp_as_negVPS, vp_as_negVPSQ, vpq_as_negVPSQ,
7+
np_coord_VPS, np_coord_VPSQ, npq_coord_VPS] with
8+
(Syntax = SyntaxHin),
9+
(Symbolic = SymbolicHin),
10+
(LexAttempto = LexAttemptoHin) ** {
11+
12+
oper S2QS : Syntax.S -> Syntax.QS = variants {};
13+
14+
lin ipNPQ ip = variants {};
15+
16+
} ;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
concrete AttemptoTha of Attempto = SymbolsC, NumeralTha, NullVPS **
2+
AttemptoI - [
3+
VPS, VPSQ, BaseVPS, BaseVPSQ, ConsVPS, ConsVPSQ, ListVPS, ListVPSQ,
4+
vp_as_posVPS, vp_as_posVPSQ, vpq_as_posVPSQ,
5+
vp_as_negVPS, vp_as_negVPSQ, vpq_as_negVPSQ,
6+
np_coord_VPS, np_coord_VPSQ, npq_coord_VPS] with
7+
(Syntax = SyntaxTha),
8+
(Symbolic = SymbolicTha),
9+
(LexAttempto = LexAttemptoTha) ** {
10+
11+
oper S2QS : Syntax.S -> Syntax.QS = variants {};
12+
13+
lin ipNPQ ip = variants {};
14+
15+
} ;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
concrete ExtraTha of ExtraThaAbs = CatTha **
2+
open ResTha, Prelude in {
3+
4+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
abstract ExtraThaAbs = Cat ** { } ;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
instance LexAttemptoChi of LexAttempto =
2+
open
3+
SyntaxChi,
4+
ParadigmsChi,
5+
ConstructX,
6+
(E = ExtraChi),
7+
(L = LangChi)
8+
in {
9+
10+
flags coding=utf8 ;
11+
12+
oper
13+
false_A = mkA "TODO" ;
14+
15+
adj_thatCl : A -> S -> Cl = \a,s -> mkCl (mkVP (mkAP (mkAP a) s)) ;
16+
17+
exactly_AdN = ConstructX.mkAdN "TODO" ;
18+
19+
} ;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
instance LexAttemptoHin of LexAttempto =
2+
open
3+
SyntaxHin,
4+
ParadigmsHin,
5+
ConstructX,
6+
(E = ExtraHin),
7+
(L = LangHin)
8+
in {
9+
10+
flags coding=utf8 ;
11+
12+
oper
13+
false_A = mkA "TODO" ;
14+
15+
adj_thatCl : A -> S -> Cl = \a,s -> mkCl (mkVP (mkAP (mkAP a) s)) ;
16+
17+
exactly_AdN = variants {} ;
18+
19+
} ;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
instance LexAttemptoTha of LexAttempto =
2+
open
3+
SyntaxTha,
4+
ParadigmsTha,
5+
ConstructX,
6+
(E = ExtraTha),
7+
(L = LangTha)
8+
in {
9+
10+
flags coding=utf8 ;
11+
12+
oper
13+
false_A = mkA "TODO" ;
14+
15+
adj_thatCl : A -> S -> Cl = \a,s -> mkCl (mkVP (mkAP (mkAP a) s)) ;
16+
17+
exactly_AdN = ConstructX.mkAdN "TODO" ;
18+
19+
} ;
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
concrete NumeralChi of Numeral = CatChi [Numeral,Digits] ** open ResChi, Prelude in {
2+
3+
flags coding = utf8 ;
4+
5+
6+
param Qform = bai | bai0 | shiwan | shiwan0 ;
7+
param Bform = shi | shi0 | wan | wan0 ;
8+
param Zero = zero | nozero ;
9+
oper ling : Zero * Zero => Str =
10+
table {<zero,z> => "零" ;
11+
<z,zero> => "零" ;
12+
<nozero,nozero> => []} ;
13+
oper Wan : Zero => Str =
14+
table {zero => "万" ;
15+
nozero => []} ;
16+
17+
oper mkD : Str -> Str -> Str = \x,_ -> word x ; -- hiding the "formal" version
18+
19+
lincat Digit = {s,p : Str} ;
20+
lincat Sub10 = {s,p : Str} ;
21+
lincat Sub100 = {inh : Zero ; s,p : Bform => Str} ;
22+
lincat Sub1000 = {inh : Zero ; s,p : Qform => Str} ;
23+
lincat Sub1000000 = {s,p : Str} ;
24+
lin num x0 = x0 ;
25+
26+
-- 一二三四五六七八九十一百千
27+
--
28+
29+
lin n2 =
30+
{s = mkD "二" "贰" ; p = "两"} ;
31+
lin n3 =
32+
{s,p = mkD "三" "叁"} ;
33+
lin n4 =
34+
{s,p = mkD "四" "肆"} ;
35+
lin n5 =
36+
{s,p = mkD "五" "伍"} ;
37+
lin n6 =
38+
{s,p = mkD "六" "陆"} ;
39+
lin n7 =
40+
{s,p = mkD "七" "柒"} ;
41+
lin n8 =
42+
{s,p = mkD "八" "捌"} ;
43+
lin n9 =
44+
{s,p = mkD "九" "玖"} ;
45+
lin pot01 =
46+
{s,p = mkD "一" "壹"} ;
47+
lin pot0 d =
48+
{s = d.s ; p = d.p} ;
49+
lin pot110 =
50+
{inh = nozero ;
51+
s,p = table {
52+
shi => mkD "一十" "壹拾" ;
53+
shi0 => mkD "一十" "壹拾" ;
54+
wan => mkD "一万" "壹万" ;
55+
wan0 => mkD "一万" "壹万"}} ;
56+
lin pot111 =
57+
{inh = nozero ;
58+
s,p = table {
59+
shi => mkD "十一" "拾壹" ;
60+
shi0 => mkD "一十一" "壹拾壹" ;
61+
wan => mkD "一万一千" "壹万壹千" ; -- 11.16 by chenpeng wan => mkD "十一万" "拾壹万" ;
62+
wan0 => mkD "一万一千" "壹万壹千"}} ; -- 11.16 by chenpeng wan0 => mkD "十一万" "拾壹万"}} ;
63+
lin pot1to19 d =
64+
{inh = nozero ;
65+
s,p = table {
66+
shi => mkD "一十" "壹拾" ++ d.s ;
67+
shi0 => mkD "一十" "壹拾" ;
68+
wan => mkD "一万" "壹万" ++ d.s ++ mkD "千" "仟" ;
69+
wan0 => mkD "一万" "壹万" ++ d.s ++ mkD "千" "仟"}} ;
70+
lin pot0as1 n =
71+
{inh = zero ;
72+
s = table {
73+
shi => n.s ;
74+
shi0 => n.s ;
75+
wan => n.s ++ mkD "千" "仟" ;
76+
wan0 => n.s ++ mkD "千" "仟"} ;
77+
p = table {
78+
shi => n.p ;
79+
shi0 => n.s ;
80+
wan => n.s ++ mkD "千" "仟" ;
81+
wan0 => n.s ++ mkD "千" "仟"}
82+
} ;
83+
lin pot1 d =
84+
{inh = nozero ; -- inh = zero
85+
s,p = table {
86+
shi => d.s ++ mkD "十" "拾" ;
87+
shi0 => d.s ++ mkD "十" "拾" ;
88+
wan0 => d.s ++ "万" ;
89+
wan => d.s ++ "万"}} ;
90+
lin pot1plus d e =
91+
{inh = nozero ;
92+
s,p = table {
93+
shi => d.s ++ mkD "十" "拾" ++ e.s ;
94+
shi0 => d.s ++ mkD "十" "拾" ++ e.s ;
95+
wan => d.s ++ "万" ++ e.s ++ mkD "千" "仟" ;
96+
wan0 => d.s ++ "万" ++ e.s ++ mkD "千" "仟"}} ;
97+
lin pot1as2 n =
98+
{inh = zero ;
99+
s = table {
100+
bai => n.s ! shi ;
101+
bai0 => n.s ! shi ;
102+
shiwan => n.s ! wan ;
103+
shiwan0 => n.s ! wan0} ;
104+
p = table {
105+
bai => n.p ! shi ;
106+
bai0 => n.s ! shi ;
107+
shiwan => n.s ! wan ;
108+
shiwan0 => n.s ! wan0}} ;
109+
lin pot2 d =
110+
{inh = zero ;
111+
s,p = table {
112+
bai => d.s ++ mkD "百" "佰" ;
113+
bai0 => d.s ++ mkD "百" "佰" ;
114+
shiwan0 => d.s ++ mkD "十万" "拾万" ;
115+
shiwan => d.s ++ mkD "十万" "拾万"}} ;
116+
lin pot2plus d e =
117+
{inh = nozero ;
118+
s,p = table {
119+
bai => d.s ++ mkD "百" "佰" ++ (ling ! <e.inh,e.inh>) ++ e.s ! shi0 ; --why omit "百"? i add it /chenpeng
120+
bai0 => d.s ++ mkD "百" "佰" ++ (ling ! <e.inh,e.inh>) ++ e.s ! shi0 ; --why omit "百"? i add it /chenpeng
121+
shiwan => d.s ++ mkD "十" "拾" ++ (Wan ! (e.inh)) ++ e.s ! wan ; --why omit "十"? i add it /chenpeng
122+
shiwan0 => d.s ++ mkD "十" "拾" ++ (Wan ! (e.inh)) ++ e.s ! wan0}} ;--why omit "十"? i add it /chenpeng
123+
lin pot2as3 n =
124+
{s = n.s ! bai ; p = n.p ! bai} ;
125+
lin pot3 n =
126+
{s,p = n.s ! shiwan} ;
127+
lin pot3plus n m =
128+
{s,p = (n.s ! shiwan0) ++ (ling ! <n.inh,m.inh>) ++ m.s ! bai0} ;
129+
130+
131+
-- numerals as sequences of digits
132+
133+
lincat
134+
Dig = SS ;
135+
136+
lin
137+
IDig d = d ;
138+
139+
IIDig d i = ss (d.s ++ i.s) ;
140+
141+
D_0 = ss "0" ;
142+
D_1 = ss "1" ;
143+
D_2 = ss "2" ;
144+
D_3 = ss "3" ;
145+
D_4 = ss "4" ;
146+
D_5 = ss "5" ;
147+
D_6 = ss "6" ;
148+
D_7 = ss "7" ;
149+
D_8 = ss "8" ;
150+
D_9 = ss "9" ;
151+
152+
}

0 commit comments

Comments
 (0)