Skip to content

Commit 83d670c

Browse files
committed
configure node
1 parent a43c4cc commit 83d670c

File tree

4 files changed

+121
-43
lines changed

4 files changed

+121
-43
lines changed

data/CMakeLists.txt

+12-12
Original file line numberDiff line numberDiff line change
@@ -212,36 +212,36 @@ foreach(DICT ${DICTS})
212212
endforeach(DICT)
213213

214214
set(CONFIG_FILES
215-
config/hk2s.json
216-
config/hk2t.json
217-
config/jp2t.json
218-
config/s2hk.json
219-
config/s2t.json
220-
config/s2tw.json
221-
config/t2hk.json
222-
config/t2jp.json
223-
config/t2s.json
224-
config/t2tw.json
225-
config/tw2s.json
226-
config/tw2t.json
227215
config/hk2cnp.json
228216
config/hk2myp.json
217+
config/hk2s.json
229218
config/hk2sgp.json
219+
config/hk2t.json
220+
config/jp2t.json
230221
config/s2cnp.json
222+
config/s2hk.json
231223
config/s2hkp.json
232224
config/s2mop.json
233225
config/s2myp.json
234226
config/s2sgp.json
227+
config/s2t.json
228+
config/s2tw.json
235229
config/s2twp.json
236230
config/t2cnp.json
231+
config/t2hk.json
237232
config/t2hkp.json
233+
config/t2jp.json
238234
config/t2mop.json
239235
config/t2myp.json
236+
config/t2s.json
240237
config/t2sgp.json
238+
config/t2tw.json
241239
config/t2twp.json
242240
config/tw2cnp.json
243241
config/tw2myp.json
242+
config/tw2s.json
244243
config/tw2sgp.json
244+
config/tw2t.json
245245
)
246246

247247
install(

node/configs.gypi

+17-1
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,35 @@
55
"copies": [{
66
"destination": "<(PRODUCT_DIR)",
77
"files": [
8+
"../data/config/hk2cnp.json",
9+
"../data/config/hk2myp.json",
810
"../data/config/hk2s.json",
11+
"../data/config/hk2sgp.json",
912
"../data/config/hk2t.json",
1013
"../data/config/jp2t.json",
14+
"../data/config/s2cnp.json",
1115
"../data/config/s2hk.json",
16+
"../data/config/s2hkp.json",
17+
"../data/config/s2mop.json",
18+
"../data/config/s2myp.json",
19+
"../data/config/s2sgp.json",
1220
"../data/config/s2t.json",
1321
"../data/config/s2tw.json",
1422
"../data/config/s2twp.json",
23+
"../data/config/t2cnp.json",
1524
"../data/config/t2hk.json",
25+
"../data/config/t2hkp.json",
1626
"../data/config/t2jp.json",
27+
"../data/config/t2mop.json",
28+
"../data/config/t2myp.json",
1729
"../data/config/t2s.json",
30+
"../data/config/t2sgp.json",
1831
"../data/config/t2tw.json",
32+
"../data/config/t2twp.json",
33+
"../data/config/tw2cnp.json",
34+
"../data/config/tw2myp.json",
1935
"../data/config/tw2s.json",
20-
"../data/config/tw2sp.json",
36+
"../data/config/tw2sgp.json",
2137
"../data/config/tw2t.json",
2238
]
2339
}]

node/dicts.gypi

+78-29
Original file line numberDiff line numberDiff line change
@@ -42,73 +42,122 @@
4242
"outputs": ["<(output_prefix)TSPhrases.ocd2"],
4343
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
4444
}, {
45-
"action_name": "TWVariants",
45+
"action_name": "CNVocabulary.txt",
46+
"inputs": ["<(cmd)"],
47+
"outputs": ["<(output_prefix)CNVocabulary.txt"],
48+
"action": ["python", "<(dict_merge)", "<(input_prefix)CNVocabToponym.txt", "<(input_prefix)CNVocabSciTech.txt", "<(input_prefix)CNVocabOthers.txt", "<@(_outputs)"]
49+
}, {
50+
"action_name": "CNVocabulary",
4651
"variables": {
47-
"input": "<(input_prefix)TWVariants.txt",
52+
"input": "<(output_prefix)CNVocabulary.txt",
4853
},
4954
"inputs": ["<(input)"],
50-
"outputs": ["<(output_prefix)TWVariants.ocd2"],
55+
"outputs": ["<(output_prefix)CNVocabulary.ocd2"],
5156
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
5257
}, {
53-
"action_name": "TWVariantsRevPhrases",
58+
"action_name": "HKVocabulary.txt",
59+
"inputs": ["<(cmd)"],
60+
"outputs": ["<(output_prefix)HKVocabulary.txt"],
61+
"action": ["python", "<(dict_merge)", "<(input_prefix)HKVocabToponym.txt", "<(input_prefix)HKVocabSciTech.txt", "<(input_prefix)HKVocabOthers.txt", "<@(_outputs)"]
62+
}, {
63+
"action_name": "HKVocabulary",
5464
"variables": {
55-
"input": "<(input_prefix)TWVariantsRevPhrases.txt",
65+
"input": "<(output_prefix)HKVocabulary.txt",
5666
},
5767
"inputs": ["<(input)"],
58-
"outputs": ["<(output_prefix)TWVariantsRevPhrases.ocd2"],
68+
"outputs": ["<(output_prefix)HKVocabulary.ocd2"],
5969
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
6070
}, {
61-
"action_name": "JPVariants",
71+
"action_name": "MOVocabulary.txt",
72+
"inputs": ["<(cmd)"],
73+
"outputs": ["<(output_prefix)MOVocabulary.txt"],
74+
"action": ["python", "<(dict_merge)", "<(input_prefix)MOVocabToponym.txt", "<(input_prefix)MOVocabSciTech.txt", "<(input_prefix)MOVocabOthers.txt", "<@(_outputs)"]
75+
}, {
76+
"action_name": "MOVocabulary",
6277
"variables": {
63-
"input": "<(input_prefix)JPVariants.txt",
78+
"input": "<(output_prefix)MOVocabulary.txt",
6479
},
6580
"inputs": ["<(input)"],
66-
"outputs": ["<(output_prefix)JPVariants.ocd2"],
81+
"outputs": ["<(output_prefix)MOVocabulary.ocd2"],
6782
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
6883
}, {
69-
"action_name": "TWPhrases.txt",
84+
"action_name": "MYVocabulary.txt",
7085
"inputs": ["<(cmd)"],
71-
"outputs": ["<(output_prefix)TWPhrases.txt"],
72-
"action": ["python", "<(dict_merge)", "<(input_prefix)TWPhrasesIT.txt", "<(input_prefix)TWPhrasesName.txt", "<(input_prefix)TWPhrasesOther.txt", "<@(_outputs)"]
86+
"outputs": ["<(output_prefix)MYVocabulary.txt"],
87+
"action": ["python", "<(dict_merge)", "<(input_prefix)MYVocabToponym.txt", "<(input_prefix)MYVocabSciTech.txt", "<(input_prefix)MYVocabOthers.txt", "<@(_outputs)"]
7388
}, {
74-
"action_name": "TWVariantsRev.txt",
89+
"action_name": "MYVocabulary",
7590
"variables": {
76-
"input": "<(input_prefix)TWVariants.txt",
91+
"input": "<(output_prefix)MYVocabulary.txt",
7792
},
7893
"inputs": ["<(input)"],
79-
"outputs": ["<(output_prefix)TWVariantsRev.txt"],
80-
"action": ["python", "<(dict_reverse)", "<(input)", "<@(_outputs)"]
94+
"outputs": ["<(output_prefix)MYVocabulary.ocd2"],
95+
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
96+
}, {
97+
"action_name": "SGVocabulary.txt",
98+
"inputs": ["<(cmd)"],
99+
"outputs": ["<(output_prefix)SGVocabulary.txt"],
100+
"action": ["python", "<(dict_merge)", "<(input_prefix)SGVocabToponym.txt", "<(input_prefix)SGVocabSciTech.txt", "<(input_prefix)SGVocabOthers.txt", "<@(_outputs)"]
81101
}, {
82-
"action_name": "TWPhrasesRev.txt",
102+
"action_name": "SGVocabulary",
83103
"variables": {
84-
"input": "<(output_prefix)TWPhrases.txt",
104+
"input": "<(output_prefix)SGVocabulary.txt",
85105
},
86106
"inputs": ["<(input)"],
87-
"outputs": ["<(output_prefix)TWPhrasesRev.txt"],
88-
"action": ["python", "<(dict_reverse)", "<(input)", "<@(_outputs)"]
107+
"outputs": ["<(output_prefix)SGVocabulary.ocd2"],
108+
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
109+
}, {
110+
"action_name": "TWVocabulary.txt",
111+
"inputs": ["<(cmd)"],
112+
"outputs": ["<(output_prefix)TWVocabulary.txt"],
113+
"action": ["python", "<(dict_merge)", "<(input_prefix)TWVocabToponym.txt", "<(input_prefix)TWVocabSciTech.txt", "<(input_prefix)TWVocabOthers.txt", "<@(_outputs)"]
89114
}, {
90-
"action_name": "TWPhrases",
115+
"action_name": "TWVocabulary",
91116
"variables": {
92-
"input": "<(output_prefix)TWPhrases.txt",
117+
"input": "<(output_prefix)TWVocabulary.txt",
93118
},
94119
"inputs": ["<(input)"],
95-
"outputs": ["<(output_prefix)TWPhrases.ocd2"],
120+
"outputs": ["<(output_prefix)TWVocabulary.ocd2"],
96121
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
97122
}, {
98-
"action_name": "TWVariantsRev",
123+
"action_name": "TWVariants",
99124
"variables": {
100-
"input": "<(output_prefix)TWVariantsRev.txt",
125+
"input": "<(input_prefix)TWVariants.txt",
101126
},
102127
"inputs": ["<(input)"],
103-
"outputs": ["<(output_prefix)TWVariantsRev.ocd2"],
128+
"outputs": ["<(output_prefix)TWVariants.ocd2"],
104129
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
105130
}, {
106-
"action_name": "TWPhrasesRev",
131+
"action_name": "TWVariantsRevPhrases",
107132
"variables": {
108-
"input": "<(output_prefix)TWPhrasesRev.txt",
133+
"input": "<(input_prefix)TWVariantsRevPhrases.txt",
109134
},
110135
"inputs": ["<(input)"],
111-
"outputs": ["<(output_prefix)TWPhrasesRev.ocd2"],
136+
"outputs": ["<(output_prefix)TWVariantsRevPhrases.ocd2"],
137+
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
138+
}, {
139+
"action_name": "JPVariants",
140+
"variables": {
141+
"input": "<(input_prefix)JPVariants.txt",
142+
},
143+
"inputs": ["<(input)"],
144+
"outputs": ["<(output_prefix)JPVariants.ocd2"],
145+
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
146+
}, {
147+
"action_name": "TWVariantsRev.txt",
148+
"variables": {
149+
"input": "<(input_prefix)TWVariants.txt",
150+
},
151+
"inputs": ["<(input)"],
152+
"outputs": ["<(output_prefix)TWVariantsRev.txt"],
153+
"action": ["python", "<(dict_reverse)", "<(input)", "<@(_outputs)"]
154+
}, {
155+
"action_name": "TWVariantsRev",
156+
"variables": {
157+
"input": "<(output_prefix)TWVariantsRev.txt",
158+
},
159+
"inputs": ["<(input)"],
160+
"outputs": ["<(output_prefix)TWVariantsRev.ocd2"],
112161
"action": ["node", "<(cmd)", "<(input)", "<@(_outputs)"]
113162
}, {
114163
"action_name": "HKVariants",

node/test.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,31 @@ const util = require('util');
55
const OpenCC = require('./opencc');
66

77
const configs = [
8+
'hk2myp',
89
'hk2s',
10+
'hk2sgp',
911
'hk2t',
1012
'jp2t',
13+
's2cnp',
1114
's2hk',
15+
's2hkp',
16+
's2mop',
17+
's2myp',
18+
's2sgp',
1219
's2t',
1320
's2tw',
1421
's2twp',
1522
't2hk',
23+
't2hkp',
1624
't2jp',
25+
't2mop',
26+
't2myp',
1727
't2s',
28+
't2sgp',
29+
'tw2cnp',
30+
'tw2myp',
1831
'tw2s',
19-
'tw2sp',
32+
'tw2sgp',
2033
'tw2t',
2134
];
2235

0 commit comments

Comments
 (0)