-
Notifications
You must be signed in to change notification settings - Fork 1
/
make_xhloopkai.sh
338 lines (294 loc) · 27.4 KB
/
make_xhloopkai.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
#!/bin/bash
set -e
set -x
# BUILD_TYPE="$1"
rm -rf xhloopkai-chs
rm -rf xhloopkai-cht
# 生成繁體
cp -a ./rime-moran/. ./xhloopkai-cht
rm -rf ./xhloopkai-cht/.git
rm -rf ./xhloopkai-cht/.gitignore
rm -rf ./xhloopkai-cht/README.md
rm -rf ./xhloopkai-cht/README-en.md
rm -rf ./xhloopkai-cht/.github/
perl -CSAD -i -pe 's/(^.*ZRM-SPECIFIC)/# $1/' ./xhloopkai-cht/moran.yaml
perl -0777 -i -pe 's/( user_sentence_top:)\n( __append:)\n( __patch:)/$1\n# $2\n# $3/' ./xhloopkai-cht/moran.yaml
# mv ./xhloopkai-cht/punctuation.yaml ./schema
cp ./rime-moran/tools/data/zrmdb.txt ./tools-additional
sed -i 's/ /\t/g' ./tools-additional/zrmdb.txt
# 生成簡體
cd ./xhloopkai-cht/
sed -i "s/^git archive HEAD -o archive.tar/tar -cvf archive.tar .\//g" ./make_simp_dist.sh
sed -i "s/^cp 下载与安装说明/# cp 下载与安装说明/g" ./make_simp_dist.sh
sed -i "s/^sedi 's\/MORAN_VARIANT\/简体\/'/# sedi 's\/MORAN_VARIANT\/简体\/'/g" ./make_simp_dist.sh
sed -i 's/^7z a.*/cp -a .\/dist\/. ..\/xhloopkai-chs/g' ./make_simp_dist.sh
bash -x ./make_simp_dist.sh
cd ..
# 轉換詞庫
cd ./tools-additional
# 轉換繁体詞庫
echo 轉換繁体詞庫...
sed '/\.\.\./q' ../xhloopkai-cht/moran.chars.dict.yaml > ../xhloopkai-cht/moran.chars.dict.yaml.bak
python3 gen_dict_with_shape.py -p xhloopkai -x zrmdb -m -i ../data/zdicdbtonesorted.yaml -o ../xhloopkai-cht/temp.txt
perl -CSAD -i -pe "s/(.*);;/\1/g" ../xhloopkai-cht/temp.txt
# perl -CSAD -i -pe "s/.*\t.*;[a-z]{0,1}\n//g" ../xhloopkai-cht/temp.txt
# perl -CSAD -i -pe "s/.*\t[a-z]{2};;.*\n//g" ../xhloopkai-cht/temp.txt
echo "" >> ../xhloopkai-cht/moran.chars.dict.yaml.bak
cat ../xhloopkai-cht/temp.txt >> ../xhloopkai-cht/moran.chars.dict.yaml.bak
sed '/\.\.\./q' ../xhloopkai-cht/moran.base.dict.yaml > ../xhloopkai-cht/moran.base.dict.yaml.bak
cp ../rime-snow-pinyin/snow_pinyin.base.dict.yaml ../xhloopkai-cht/snow_pinyin.base.dict.yaml
sed -i '0,/\.\.\./d' ../xhloopkai-cht/snow_pinyin.base.dict.yaml
python3 gen_dict_with_shape.py -p xhloopkai -x zrmdb -t -i ../xhloopkai-cht/snow_pinyin.base.dict.yaml -o ../xhloopkai-cht/temp.txt
# echo "" >> ../xhloopkai-cht/moran.base.dict.yaml.bak
cat ../xhloopkai-cht/temp.txt >> ../xhloopkai-cht/moran.base.dict.yaml.bak
rm ../xhloopkai-cht/snow_pinyin.base.dict.yaml
# python3 schemagen.py convert-sp --to=flypy --rime-dict=../../xhloopkai-cht/moran.tencent.dict.yaml > ../../xhloopkai-cht/moran.tencent.dict.yaml.bak
# python3 schemagen.py convert-sp --to=flypy --rime-dict=../../xhloopkai-cht/moran.moe.dict.yaml > ../../xhloopkai-cht/moran.moe.dict.yaml.bak
# python3 schemagen.py convert-sp --to=flypy --rime-dict=../../xhloopkai-cht/moran.computer.dict.yaml > ../../xhloopkai-cht/moran.computer.dict.yaml.bak
# python3 schemagen.py convert-sp --to=flypy --rime-dict=../../xhloopkai-cht/moran.hanyu.dict.yaml > ../../xhloopkai-cht/moran.hanyu.dict.yaml.bak
# python3 schemagen.py convert-sp --to=flypy --rime-dict=../../xhloopkai-cht/moran.words.dict.yaml > ../../xhloopkai-cht/moran.words.dict.yaml.bak
python3 convert_sp.py -i ../xhloopkai-cht/zrlf.dict.yaml -o ../xhloopkai-cht/zrlf.dict.yaml.bak
sed '/#----------詞庫----------#/q' ../xhloopkai-cht/moran_fixed.dict.yaml > ../xhloopkai-cht/moran_fixed.dict.yaml.bak
cp ../data/assess.tiger-code.com/xhloopkai.simpchars.txt ../xhloopkai-cht/xhloopkai.simpchars.txt && opencc -i ../xhloopkai-cht/xhloopkai.simpchars.txt -o ../xhloopkai-cht/temp.txt -c s2t
echo "" >> ../xhloopkai-cht/moran_fixed.dict.yaml.bak
cat ../xhloopkai-cht/temp.txt >> ../xhloopkai-cht/moran_fixed.dict.yaml.bak
opencc -i ../data/assess.tiger-code.com/xhloop.simpwords.txt -o ../xhloopkai-cht/temp.txt -c s2t
echo "" >> ../xhloopkai-cht/moran_fixed.dict.yaml.bak && cat ../xhloopkai-cht/temp.txt >> ../xhloopkai-cht/moran_fixed.dict.yaml.bak
perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fff}\x{3007}\x{3400}-\x{4dbf}\x{20000}-\x{2a6df}\x{2a700}-\x{2b73f}\x{2b740}-\x{2b81f}\x{2b820}-\x{2ceaf}\x{2ceb0}-\x{2ebe0}\x{30000}-\x{3134a}\x{31350}-\x{323af}\x{2ebf0}-\x{2ee5f}]{1}\t[A-Za-z]+.*\n//g" ../xhloopkai-cht/moran_fixed.dict.yaml
perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fff}\x{3007}\x{3400}-\x{4dbf}\x{20000}-\x{2a6df}\x{2a700}-\x{2b73f}\x{2b740}-\x{2b81f}\x{2b820}-\x{2ceaf}\x{2ceb0}-\x{2ebe0}\x{30000}-\x{3134a}\x{31350}-\x{323af}\x{2ebf0}-\x{2ee5f}]{3}\t[A-Za-z]{4}+\n//g" ../xhloopkai-cht/moran_fixed.dict.yaml
perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fff}\x{3007}\x{3400}-\x{4dbf}\x{20000}-\x{2a6df}\x{2a700}-\x{2b73f}\x{2b740}-\x{2b81f}\x{2b820}-\x{2ceaf}\x{2ceb0}-\x{2ebe0}\x{30000}-\x{3134a}\x{31350}-\x{323af}\x{2ebf0}-\x{2ee5f}]{2}\t[A-Za-z]{3,4}+\n//g" ../xhloopkai-cht/moran_fixed.dict.yaml
sed '0,/#----------詞庫----------#/d' ../xhloopkai-cht/moran_fixed.dict.yaml >> ../xhloopkai-cht/moran_fixed.dict.yaml.bak
opencc -i ../data/assess.tiger-code.com/common.simp.words.txt -o ../xhloopkai-cht/temp.txt -c s2t
echo "" >> ../xhloopkai-cht/moran_fixed.dict.yaml.bak && cat ../xhloopkai-cht/temp.txt >> ../xhloopkai-cht/moran_fixed.dict.yaml.bak && perl -i -ne 'print if !$seen{$_}++' ../xhloopkai-cht/moran_fixed.dict.yaml.bak
rm ../xhloopkai-cht/xhloopkai.simpchars.txt
sed '/#----------词库----------#/q' ../xhloopkai-cht/moran_fixed_simp.dict.yaml > ../xhloopkai-cht/moran_fixed_simp.dict.yaml.bak
cp ../data/assess.tiger-code.com/xhloopkai.simpchars.txt ../xhloopkai-cht/xhloopkai.simpchars.txt && cp ../xhloopkai-cht/xhloopkai.simpchars.txt ../xhloopkai-cht/temp.txt
echo "" >> ../xhloopkai-cht/moran_fixed_simp.dict.yaml.bak
cat ../xhloopkai-cht/temp.txt >> ../xhloopkai-cht/moran_fixed_simp.dict.yaml.bak
cp ../data/assess.tiger-code.com/xhloop.simpwords.txt ../xhloopkai-cht/temp.txt
echo "" >> ../xhloopkai-cht/moran_fixed_simp.dict.yaml.bak && cat ../xhloopkai-cht/temp.txt >> ../xhloopkai-cht/moran_fixed_simp.dict.yaml.bak
perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fff}\x{3007}\x{3400}-\x{4dbf}\x{20000}-\x{2a6df}\x{2a700}-\x{2b73f}\x{2b740}-\x{2b81f}\x{2b820}-\x{2ceaf}\x{2ceb0}-\x{2ebe0}\x{30000}-\x{3134a}\x{31350}-\x{323af}\x{2ebf0}-\x{2ee5f}]{1}\t[A-Za-z]+.*\n//g" ../xhloopkai-cht/moran_fixed_simp.dict.yaml
perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fff}\x{3007}\x{3400}-\x{4dbf}\x{20000}-\x{2a6df}\x{2a700}-\x{2b73f}\x{2b740}-\x{2b81f}\x{2b820}-\x{2ceaf}\x{2ceb0}-\x{2ebe0}\x{30000}-\x{3134a}\x{31350}-\x{323af}\x{2ebf0}-\x{2ee5f}]{3}\t[A-Za-z]{4}+\n//g" ../xhloopkai-cht/moran_fixed_simp.dict.yaml
perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fff}\x{3007}\x{3400}-\x{4dbf}\x{20000}-\x{2a6df}\x{2a700}-\x{2b73f}\x{2b740}-\x{2b81f}\x{2b820}-\x{2ceaf}\x{2ceb0}-\x{2ebe0}\x{30000}-\x{3134a}\x{31350}-\x{323af}\x{2ebf0}-\x{2ee5f}]{2}\t[A-Za-z]{3,4}+\n//g" ../xhloopkai-cht/moran_fixed_simp.dict.yaml
sed '0,/#----------词库----------#/d' ../xhloopkai-cht/moran_fixed_simp.dict.yaml >> ../xhloopkai-cht/moran_fixed_simp.dict.yaml.bak
cp ../data/assess.tiger-code.com/common.simp.words.txt ../xhloopkai-cht/temp.txt
echo "" >> ../xhloopkai-cht/moran_fixed_simp.dict.yaml.bak && cat ../xhloopkai-cht/temp.txt >> ../xhloopkai-cht/moran_fixed_simp.dict.yaml.bak && perl -i -ne 'print if !$seen{$_}++' ../xhloopkai-cht/moran_fixed_simp.dict.yaml.bak
rm ../xhloopkai-cht/xhloopkai.simpchars.txt
mv ../xhloopkai-cht/moran.chars.dict.yaml{.bak,}
mv ../xhloopkai-cht/moran.base.dict.yaml{.bak,}
# mv ../xhloopkai-cht/moran.tencent.dict.yaml{.bak,}
# mv ../xhloopkai-cht/moran.moe.dict.yaml{.bak,}
# mv ../xhloopkai-cht/moran.computer.dict.yaml{.bak,}
# mv ../xhloopkai-cht/moran.hanyu.dict.yaml{.bak,}
# mv ../xhloopkai-cht/moran.words.dict.yaml{.bak,}
mv ../xhloopkai-cht/moran_fixed.dict.yaml{.bak,}
mv ../xhloopkai-cht/moran_fixed_simp.dict.yaml{.bak,}
mv ../xhloopkai-cht/zrlf.dict.yaml{.bak,}
# 轉換简体詞庫
echo 轉換简体詞庫...
sed '/\.\.\./q' ../xhloopkai-chs/moran.chars.dict.yaml > ../xhloopkai-chs/moran.chars.dict.yaml.bak
python3 gen_dict_with_shape.py -p xhloopkai -x zrmdb -m -i ../data/zdicdbtonesorted.yaml -o ../xhloopkai-chs/temp.txt
perl -CSAD -i -pe "s/(.*);;/\1/g" ../xhloopkai-chs/temp.txt
# perl -CSAD -i -pe "s/.*\t.*;[a-z]{0,1}\n//g" ../xhloopkai-chs/temp.txt
# perl -CSAD -i -pe "s/.*\t[a-z]{2};;.*\n//g" ../xhloopkai-chs/temp.txt
echo "" >> ../xhloopkai-chs/moran.chars.dict.yaml.bak
cat ../xhloopkai-chs/temp.txt >> ../xhloopkai-chs/moran.chars.dict.yaml.bak
sed '/\.\.\./q' ../xhloopkai-chs/moran.base.dict.yaml > ../xhloopkai-chs/moran.base.dict.yaml.bak
cp ../rime-snow-pinyin/snow_pinyin.base.dict.yaml ../xhloopkai-chs/snow_pinyin.base.dict.yaml
sed -i '0,/\.\.\./d' ../xhloopkai-chs/snow_pinyin.base.dict.yaml
python3 gen_dict_with_shape.py -p xhloopkai -x zrmdb -s -i ../xhloopkai-chs/snow_pinyin.base.dict.yaml -o ../xhloopkai-chs/temp.txt
# echo "" >> ../xhloopkai-chs/moran.base.dict.yaml.bak
cat ../xhloopkai-chs/temp.txt >> ../xhloopkai-chs/moran.base.dict.yaml.bak
rm ../xhloopkai-chs/snow_pinyin.base.dict.yaml
# python3 schemagen.py convert-sp --to=flypy --rime-dict=../../xhloopkai-chs/moran.tencent.dict.yaml > ../../xhloopkai-chs/moran.tencent.dict.yaml.bak
# python3 schemagen.py convert-sp --to=flypy --rime-dict=../../xhloopkai-chs/moran.moe.dict.yaml > ../../xhloopkai-chs/moran.moe.dict.yaml.bak
# python3 schemagen.py convert-sp --to=flypy --rime-dict=../../xhloopkai-chs/moran.computer.dict.yaml > ../../xhloopkai-chs/moran.computer.dict.yaml.bak
# python3 schemagen.py convert-sp --to=flypy --rime-dict=../../xhloopkai-chs/moran.hanyu.dict.yaml > ../../xhloopkai-chs/moran.hanyu.dict.yaml.bak
# python3 schemagen.py convert-sp --to=flypy --rime-dict=../../xhloopkai-chs/moran.words.dict.yaml > ../../xhloopkai-chs/moran.words.dict.yaml.bak
python3 convert_sp.py -i ../xhloopkai-chs/zrlf.dict.yaml -o ../xhloopkai-chs/zrlf.dict.yaml.bak
sed '/#----------詞庫----------#/q' ../xhloopkai-chs/moran_fixed.dict.yaml > ../xhloopkai-chs/moran_fixed.dict.yaml.bak
cp ../data/assess.tiger-code.com/xhloopkai.simpchars.txt ../xhloopkai-chs/xhloopkai.simpchars.txt && opencc -i ../xhloopkai-chs/xhloopkai.simpchars.txt -o ../xhloopkai-chs/temp.txt -c s2t
echo "" >> ../xhloopkai-chs/moran_fixed.dict.yaml.bak
cat ../xhloopkai-chs/temp.txt >> ../xhloopkai-chs/moran_fixed.dict.yaml.bak
opencc -i ../data/assess.tiger-code.com/xhloop.simpwords.txt -o ../xhloopkai-chs/temp.txt -c s2t
echo "" >> ../xhloopkai-chs/moran_fixed.dict.yaml.bak && cat ../xhloopkai-chs/temp.txt >> ../xhloopkai-chs/moran_fixed.dict.yaml.bak
perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fff}\x{3007}\x{3400}-\x{4dbf}\x{20000}-\x{2a6df}\x{2a700}-\x{2b73f}\x{2b740}-\x{2b81f}\x{2b820}-\x{2ceaf}\x{2ceb0}-\x{2ebe0}\x{30000}-\x{3134a}\x{31350}-\x{323af}\x{2ebf0}-\x{2ee5f}]{1}\t[A-Za-z]+.*\n//g" ../xhloopkai-chs/moran_fixed.dict.yaml
perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fff}\x{3007}\x{3400}-\x{4dbf}\x{20000}-\x{2a6df}\x{2a700}-\x{2b73f}\x{2b740}-\x{2b81f}\x{2b820}-\x{2ceaf}\x{2ceb0}-\x{2ebe0}\x{30000}-\x{3134a}\x{31350}-\x{323af}\x{2ebf0}-\x{2ee5f}]{3}\t[A-Za-z]{4}+\n//g" ../xhloopkai-chs/moran_fixed.dict.yaml
perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fff}\x{3007}\x{3400}-\x{4dbf}\x{20000}-\x{2a6df}\x{2a700}-\x{2b73f}\x{2b740}-\x{2b81f}\x{2b820}-\x{2ceaf}\x{2ceb0}-\x{2ebe0}\x{30000}-\x{3134a}\x{31350}-\x{323af}\x{2ebf0}-\x{2ee5f}]{2}\t[A-Za-z]{3,4}+\n//g" ../xhloopkai-chs/moran_fixed.dict.yaml
sed '0,/#----------詞庫----------#/d' ../xhloopkai-chs/moran_fixed.dict.yaml >> ../xhloopkai-chs/moran_fixed.dict.yaml.bak
opencc -i ../data/assess.tiger-code.com/common.simp.words.txt -o ../xhloopkai-chs/temp.txt -c s2t
echo "" >> ../xhloopkai-chs/moran_fixed.dict.yaml.bak && cat ../xhloopkai-chs/temp.txt >> ../xhloopkai-chs/moran_fixed.dict.yaml.bak && perl -i -ne 'print if !$seen{$_}++' ../xhloopkai-chs/moran_fixed.dict.yaml.bak
rm ../xhloopkai-chs/xhloopkai.simpchars.txt
sed '/#----------词库----------#/q' ../xhloopkai-chs/moran_fixed_simp.dict.yaml > ../xhloopkai-chs/moran_fixed_simp.dict.yaml.bak
cp ../data/assess.tiger-code.com/xhloopkai.simpchars.txt ../xhloopkai-chs/xhloopkai.simpchars.txt && cp ../xhloopkai-chs/xhloopkai.simpchars.txt ../xhloopkai-chs/temp.txt
echo "" >> ../xhloopkai-chs/moran_fixed_simp.dict.yaml.bak
cat ../xhloopkai-chs/temp.txt >> ../xhloopkai-chs/moran_fixed_simp.dict.yaml.bak
cp ../data/assess.tiger-code.com/xhloop.simpwords.txt ../xhloopkai-chs/temp.txt
echo "" >> ../xhloopkai-chs/moran_fixed_simp.dict.yaml.bak && cat ../xhloopkai-chs/temp.txt >> ../xhloopkai-chs/moran_fixed_simp.dict.yaml.bak
perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fff}\x{3007}\x{3400}-\x{4dbf}\x{20000}-\x{2a6df}\x{2a700}-\x{2b73f}\x{2b740}-\x{2b81f}\x{2b820}-\x{2ceaf}\x{2ceb0}-\x{2ebe0}\x{30000}-\x{3134a}\x{31350}-\x{323af}\x{2ebf0}-\x{2ee5f}]{1}\t[A-Za-z]+.*\n//g" ../xhloopkai-chs/moran_fixed_simp.dict.yaml
perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fff}\x{3007}\x{3400}-\x{4dbf}\x{20000}-\x{2a6df}\x{2a700}-\x{2b73f}\x{2b740}-\x{2b81f}\x{2b820}-\x{2ceaf}\x{2ceb0}-\x{2ebe0}\x{30000}-\x{3134a}\x{31350}-\x{323af}\x{2ebf0}-\x{2ee5f}]{3}\t[A-Za-z]{4}+\n//g" ../xhloopkai-chs/moran_fixed_simp.dict.yaml
perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fff}\x{3007}\x{3400}-\x{4dbf}\x{20000}-\x{2a6df}\x{2a700}-\x{2b73f}\x{2b740}-\x{2b81f}\x{2b820}-\x{2ceaf}\x{2ceb0}-\x{2ebe0}\x{30000}-\x{3134a}\x{31350}-\x{323af}\x{2ebf0}-\x{2ee5f}]{2}\t[A-Za-z]{3,4}+\n//g" ../xhloopkai-chs/moran_fixed_simp.dict.yaml
sed '0,/#----------词库----------#/d' ../xhloopkai-chs/moran_fixed_simp.dict.yaml >> ../xhloopkai-chs/moran_fixed_simp.dict.yaml.bak
cp ../data/assess.tiger-code.com/common.simp.words.txt ../xhloopkai-chs/temp.txt
echo "" >> ../xhloopkai-chs/moran_fixed_simp.dict.yaml.bak && cat ../xhloopkai-chs/temp.txt >> ../xhloopkai-chs/moran_fixed_simp.dict.yaml.bak && perl -i -ne 'print if !$seen{$_}++' ../xhloopkai-chs/moran_fixed_simp.dict.yaml.bak
rm ../xhloopkai-chs/xhloopkai.simpchars.txt
mv ../xhloopkai-chs/moran.chars.dict.yaml{.bak,}
mv ../xhloopkai-chs/moran.base.dict.yaml{.bak,}
# mv ../xhloopkai-chs/moran.tencent.dict.yaml{.bak,}
# mv ../xhloopkai-chs/moran.moe.dict.yaml{.bak,}
# mv ../xhloopkai-chs/moran.computer.dict.yaml{.bak,}
# mv ../xhloopkai-chs/moran.hanyu.dict.yaml{.bak,}
# mv ../xhloopkai-chs/moran.words.dict.yaml{.bak,}
mv ../xhloopkai-chs/moran_fixed.dict.yaml{.bak,}
mv ../xhloopkai-chs/moran_fixed_simp.dict.yaml{.bak,}
mv ../xhloopkai-chs/zrlf.dict.yaml{.bak,}
cd ..
# 整理文件結構
rm -rf ./xhloopkai-cht/tools
rm -rf ./xhloopkai-cht/make_simp_dist.sh
mkdir -p ./xhloopkai-cht/snow-dicts/
mkdir -p ./xhloopkai-chs/snow-dicts/
# cp -a ./xhloopkai-cht/moran_fixed.dict.yaml ./schema/xhloopkai_fixed.dict.yaml
# cp -a ./xhloopkai-cht/moran_fixed_simp.dict.yaml ./schema/xhloopkai_fixed_simp.dict.yaml
cp -a ./schema/default.custom.xhloopkai.yaml ./xhloopkai-cht/default.custom.yaml
cp -a ./schema/default.custom.xhloopkai.yaml ./xhloopkai-chs/default.custom.yaml
# 刪去詞語簡碼
# perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fa5}A-Za-z0-9\x{3007}\x{ff0c}-\x{ffee}]{2,100}\t[A-Za-z0-9]{1,3}\n//g" ./schema/moran_fixed.dict.yaml
# perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fa5}A-Za-z0-9\x{3007}\x{ff0c}-\x{ffee}]{2,100}\t[A-Za-z0-9]{1,3}\t.*\n//g" ./schema/moran_fixed.dict.yaml
# perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fa5}A-Za-z0-9\x{3007}\x{ff0c}-\x{ffee}]{3,100}\t[A-Za-z0-9]{4}\n//g" ./schema/moran_fixed.dict.yaml
# perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fa5}A-Za-z0-9\x{3007}\x{ff01}-\x{ffee}]{3,100}\t[A-Za-z0-9]{4}\t.*\n//g" ./schema/moran_fixed.dict.yaml
# perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fa5}A-Za-z0-9\x{3007}\x{ff0c}-\x{ffee}]{1,100}\t[A-Za-z0-9]{5,100}\n//g" ./schema/moran_fixed.dict.yaml
# perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fa5}A-Za-z0-9\x{3007}\x{ff0c}-\x{ffee}]{1,100}\t[A-Za-z0-9]{5,100}\t.*\n//g" ./schema/moran_fixed.dict.yaml
# perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fa5}A-Za-z0-9\x{3007}\x{ff0c}-\x{ffee}]{2,100}\t[A-Za-z0-9]{1,3}\n//g" ./schema/moran_fixed_simp.dict.yaml
# perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fa5}A-Za-z0-9\x{3007}\x{ff0c}-\x{ffee}]{2,100}\t[A-Za-z0-9]{1,3}\t.*\n//g" ./schema/moran_fixed_simp.dict.yaml
# perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fa5}A-Za-z0-9\x{3007}\x{ff0c}-\x{ffee}]{3,100}\t[A-Za-z0-9]{4}\n//g" ./schema/moran_fixed_simp.dict.yaml
# perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fa5}A-Za-z0-9\x{3007}\x{ff0c}-\x{ffee}]{3,100}\t[A-Za-z0-9]{4}\t.*\n//g" ./schema/moran_fixed_simp.dict.yaml
# perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fa5}A-Za-z0-9\x{3007}\x{ff0c}-\x{ffee}]{1,100}\t[A-Za-z0-9]{5,100}\n//g" ./schema/moran_fixed_simp.dict.yaml
# perl -CSAD -i -pe "s/^[\x{4e00}-\x{9fa5}A-Za-z0-9\x{3007}\x{ff0c}-\x{ffee}]{1,100}\t[A-Za-z0-9]{5,100}\t.*\n//g" ./schema/moran_fixed_simp.dict.yaml
cd ./tools-additional
# 生成繁體霧凇
python3 gen_dict_with_shape.py -p xhloopkai -x zrmdb -t -i ../rime-snow-pinyin/snow_pinyin.ext.dict.yaml -o ../xhloopkai-cht/snow-dicts/xhloopkai_zrmdb_ext.dict.yaml
# python3 gen_dict_with_shape.py -i ../rime-snow/cn_dicts/8105.dict.yaml -x zrmdb -t -o ../xhloopkai-cht/snow-dicts/flypy_zrmdb_8105.dict.yaml
# python3 gen_dict_with_shape.py -i ../rime-snow/cn_dicts/41448.dict.yaml -x zrmdb -t -o ../xhloopkai-cht/snow-dicts/flypy_zrmdb_41448.dict.yaml
# python3 gen_dict_with_shape.py -i ../rime-snow/cn_dicts/base.dict.yaml -x zrmdb -t -o ../xhloopkai-cht/snow-dicts/flypy_zrmdb_base.dict.yaml
# python3 gen_dict_with_shape.py -i ../rime-snow/cn_dicts/ext.dict.yaml -x zrmdb -t -o ../xhloopkai-cht/snow-dicts/flypy_zrmdb_ext.dict.yaml
# python3 gen_dict_with_shape.py -i ../rime-snow/cn_dicts/others.dict.yaml -x zrmdb -t -o ../xhloopkai-cht/snow-dicts/flypy_zrmdb_others.dict.yaml
python3 gen_dict_with_shape.py -p xhloopkai -x zrmdb -t -i ../rime-snow-pinyin/snow_pinyin.tencent.dict.yaml -o ../xhloopkai-cht/snow-dicts/xhloopkai_zrmdb_tencent.dict.yaml
# 生成簡體霧凇
python3 gen_dict_with_shape.py -p xhloopkai -x zrmdb -s -i ../rime-snow-pinyin/snow_pinyin.ext.dict.yaml -o ../xhloopkai-chs/snow-dicts/xhloopkai_zrmdb_ext.dict.yaml
# python3 gen_dict_with_shape.py -i ../rime-snow/cn_dicts/8105.dict.yaml -x zrmdb -o ../xhloopkai-chs/snow-dicts/flypy_zrmdb_8105.dict.yaml
# python3 gen_dict_with_shape.py -i ../rime-snow/cn_dicts/41448.dict.yaml -x zrmdb -o ../xhloopkai-chs/snow-dicts/flypy_zrmdb_41448.dict.yaml
# python3 gen_dict_with_shape.py -i ../rime-snow/cn_dicts/base.dict.yaml -x zrmdb -o ../xhloopkai-chs/snow-dicts/flypy_zrmdb_base.dict.yaml
# python3 gen_dict_with_shape.py -i ../rime-snow/cn_dicts/ext.dict.yaml -x zrmdb -o ../xhloopkai-chs/snow-dicts/flypy_zrmdb_ext.dict.yaml
# python3 gen_dict_with_shape.py -i ../rime-snow/cn_dicts/others.dict.yaml -x zrmdb -o ../xhloopkai-chs/snow-dicts/flypy_zrmdb_others.dict.yaml
python3 gen_dict_with_shape.py -p xhloopkai -x zrmdb -s -i ../rime-snow-pinyin/snow_pinyin.tencent.dict.yaml -o ../xhloopkai-chs/snow-dicts/xhloopkai_zrmdb_tencent.dict.yaml
cd ..
# 生成ocz
cp ./rime-radical-pinyin/radical.schema.yaml ./xhloopkai-chs
cp ./rime-radical-pinyin/radical.schema.yaml ./xhloopkai-cht
cp ./rime-radical-pinyin/radical_flypy.dict.yaml ./xhloopkai-cht
sed '/\.\.\./q' ./xhloopkai-cht/radical_flypy.dict.yaml > ./xhloopkai-cht/radical_flypy.dict.yaml.bak
python3 ./tools-additional/prepare_chaizi.py -i ./chaizi-re/radical.yaml -o temp.txt -c ./xhloopkai-cht/moran.chars.dict.yaml
echo "" >> ./xhloopkai-cht/radical_flypy.dict.yaml.bak
cat temp.txt >> ./xhloopkai-cht/radical_flypy.dict.yaml.bak
mv ./xhloopkai-cht/radical_flypy.dict.yaml{.bak,}
cp ./xhloopkai-cht/radical_flypy.dict.yaml ./xhloopkai-chs
rm -f temp.txt
rm -f ./xhloopkai-cht/temp.txt
rm -f ./xhloopkai-chs/temp.txt
echo xhloopkai繁體設定檔...
cd xhloopkai-cht
cp recipe.yaml recipe.yaml.bak
sed -i "s/^\( zrlf\*\)$/\1\n radical*/g" ./recipe.yaml
rm recipe.yaml.bak
cp moran.extended.dict.yaml moran.extended.dict.yaml.bak
sed -i "s/\( - moran\.words \)/ - snow-dicts\/xhloopkai_zrmdb_ext # 扩展词库\n\1/g" ./moran.extended.dict.yaml
sed -i "s/\( - moran\.words \)/ - snow-dicts\/xhloopkai_zrmdb_tencent # 腾讯词库\n\1/g" ./moran.extended.dict.yaml
sed -i "s/\( - moran\.tencent\)/# \1/g" ./moran.extended.dict.yaml
sed -i "s/\( - moran\.moe\)/# \1/g" ./moran.extended.dict.yaml
rm moran.extended.dict.yaml.bak
cp moran.schema.yaml xhloopkai.schema.yaml
sed -i "s/^ schema_id: moran$/ schema_id: xhloopkai/g" ./xhloopkai.schema.yaml
sed -i "s/^ name: 魔然$/ name: xhloopkai/g" ./xhloopkai.schema.yaml
sed -i "s/^\( - 方案製作:ksqsf\)$/\1\n - Integrator:jack2game/g" ./xhloopkai.schema.yaml
sed -i "s/^ 爲傳承字設計的自然碼及輔助碼智能整句輸入方案。$/ xhloopkai = moran + xhloop + moranshape + snow/g" ./xhloopkai.schema.yaml
sed -i "s/^ - moran_fixed$/ - xhloopkai_fixed/g" ./xhloopkai.schema.yaml
sed -i "s/^ - moran_sentence$/ - xhloopkai_sentence/g" ./xhloopkai.schema.yaml
sed -i "s/^\( - zrlf\)$/\1\n - radical/g" ./xhloopkai.schema.yaml
sed -i "s/^\( - reverse_lookup_translator@reverse_zrlf\)$/\1\n - reverse_lookup_translator@reverse_radical/g" ./xhloopkai.schema.yaml
sed -i "s/^\(reverse_lookup:\)$/reverse_radical:\n tag: reverse_radical\n dictionary: radical_flypy\n enable_completion: true\n prefix: \"ocz\"\n tips: 〔拆字〕\n __include: reverse_format\n\n\1/g" ./xhloopkai.schema.yaml
sed -i "s/^\( - reverse_zrlf\)$/\1\n - reverse_radical/g" ./xhloopkai.schema.yaml
sed -i "s/^\( reverse_zrlf: \"\^olf\[A-Za-z\]\*\$\"\)$/\1\n reverse_radical: \"^ocz[A-Za-z]*$\"/g" ./xhloopkai.schema.yaml
sed -i 's/\( - xform\/^o(lf\)/\1|cz/g' ./xhloopkai.schema.yaml
sed -i "s/^ enable_quick_code_hint: false$/ enable_quick_code_hint: true/g" ./xhloopkai.schema.yaml
sed -i "s/ alphabet: abcdefghijklmnopqrstuvwxyz/ alphabet: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/g" ./xhloopkai.schema.yaml
sed -i "s/\( - moran:\/key_bindings\/moran_capital_for_last_syllable\)/#\1/g" ./xhloopkai.schema.yaml
cp moran_aux.schema.yaml xhloopkai_aux.schema.yaml
sed -i "s/^ schema_id: moran_aux$/ schema_id: xhloopkai_aux/g" ./xhloopkai_aux.schema.yaml
sed -i "s/^ name: 魔然·輔篩$/ name: xhloopkai輔篩/g" ./xhloopkai_aux.schema.yaml
sed -i "s/^\( - 方案製作:ksqsf\)$/\1\n - Integrator:jack2game/g" ./xhloopkai_aux.schema.yaml
sed -i "s/^ 在輸入完畢雙拼碼後,可以輸入輔助碼篩選候選項,與「魔然」方案不同。$/ 在輸入完畢雙拼碼後,可以輸入輔助碼篩選候選項,與「xhloopkai」方案不同。/g" ./xhloopkai_aux.schema.yaml
# cp moran_bj.schema.yaml xhloopkai_bj.schema.yaml
# sed -i "s/^ schema_id: moran_bj$/ schema_id: xhloopkai_bj/g" ./xhloopkai_bj.schema.yaml
# sed -i "s/^ name: 魔然·並擊G$/ name: xhloopkai並擊/g" ./xhloopkai_bj.schema.yaml
# sed -i "s/^\( - 方案製作:ksqsf\)$/\1\n - Integrator:jack2game/g" ./xhloopkai_bj.schema.yaml
# sed -i "s/^ 爲傳承字設計的自然碼及輔助碼智能整句輸入方案。$/ xhloopkai = moran + xhloop + moranshape + snow/g" ./xhloopkai_bj.schema.yaml
# sed -i "s/^ - moran_fixed$/ - xhloopkai_fixed/g" ./xhloopkai_bj.schema.yaml
# sed -i "s/^ - moran_sentence$/ - xhloopkai_sentence/g" ./xhloopkai_bj.schema.yaml
cp moran_fixed.schema.yaml xhloopkai_fixed.schema.yaml
sed -i "s/^ schema_id: moran_fixed$/ schema_id: xhloopkai_fixed/g" ./xhloopkai_fixed.schema.yaml
sed -i "s/^ name: 魔然·字詞$/ name: xhloopkai字詞/g" ./xhloopkai_fixed.schema.yaml
sed -i "s/^\( - 方案製作:ksqsf\)$/\1\n - Integrator:jack2game/g" ./xhloopkai_fixed.schema.yaml
cp moran_sentence.schema.yaml xhloopkai_sentence.schema.yaml
sed -i "s/^ schema_id: moran_sentence$/ schema_id: xhloopkai_sentence/g" ./xhloopkai_sentence.schema.yaml
sed -i "s/^ name: 魔然·整句$/ name: xhloopkai整句/g" ./xhloopkai_sentence.schema.yaml
sed -i "s/^\( - 方案製作:ksqsf\)$/\1\n - Integrator:jack2game/g" ./xhloopkai_sentence.schema.yaml
cd ..
echo xhloopkai简体設定檔...
cd xhloopkai-chs
cp recipe.yaml recipe.yaml.bak
sed -i "s/^\( zrlf\*\)$/\1\n radical*/g" ./recipe.yaml
rm recipe.yaml.bak
cp moran.extended.dict.yaml moran.extended.dict.yaml.bak
sed -i "s/\( - moran\.words \)/ - snow-dicts\/xhloopkai_zrmdb_ext # 扩展词库\n\1/g" ./moran.extended.dict.yaml
sed -i "s/\( - moran\.words \)/ - snow-dicts\/xhloopkai_zrmdb_tencent # 腾讯词库\n\1/g" ./moran.extended.dict.yaml
sed -i "s/\( - moran\.tencent\)/# \1/g" ./moran.extended.dict.yaml
sed -i "s/\( - moran\.moe\)/# \1/g" ./moran.extended.dict.yaml
rm moran.extended.dict.yaml.bak
cp moran.schema.yaml xhloopkai.schema.yaml
sed -i "s/^ schema_id: moran$/ schema_id: xhloopkai/g" ./xhloopkai.schema.yaml
sed -i "s/^ name: 魔然$/ name: xhloopkai/g" ./xhloopkai.schema.yaml
sed -i "s/^\( - 方案製作:ksqsf\)$/\1\n - Integrator:jack2game/g" ./xhloopkai.schema.yaml
sed -i "s/^ 爲傳承字設計的自然碼及輔助碼智能整句輸入方案。$/ xhloopkai = moran + xhloop + moranshape + snow/g" ./xhloopkai.schema.yaml
sed -i "s/^ - moran_fixed$/ - xhloopkai_fixed/g" ./xhloopkai.schema.yaml
sed -i "s/^ - moran_sentence$/ - xhloopkai_sentence/g" ./xhloopkai.schema.yaml
sed -i "s/^\( - zrlf\)$/\1\n - radical/g" ./xhloopkai.schema.yaml
sed -i "s/^\( - reverse_lookup_translator@reverse_zrlf\)$/\1\n - reverse_lookup_translator@reverse_radical/g" ./xhloopkai.schema.yaml
sed -i "s/^\(reverse_lookup:\)$/reverse_radical:\n tag: reverse_radical\n dictionary: radical_flypy\n enable_completion: true\n prefix: \"ocz\"\n tips: 〔拆字〕\n __include: reverse_format\n\n\1/g" ./xhloopkai.schema.yaml
sed -i "s/^\( - reverse_zrlf\)$/\1\n - reverse_radical/g" ./xhloopkai.schema.yaml
sed -i "s/^\( reverse_zrlf: \"\^olf\[A-Za-z\]\*\$\"\)$/\1\n reverse_radical: \"^ocz[A-Za-z]*$\"/g" ./xhloopkai.schema.yaml
sed -i 's/\( - xform\/^o(lf\)/\1|cz/g' ./xhloopkai.schema.yaml
sed -i "s/^ enable_quick_code_hint: false$/ enable_quick_code_hint: true/g" ./xhloopkai.schema.yaml
sed -i "s/ alphabet: abcdefghijklmnopqrstuvwxyz/ alphabet: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/g" ./xhloopkai.schema.yaml
sed -i "s/\( - moran:\/key_bindings\/moran_capital_for_last_syllable\)/#\1/g" ./xhloopkai.schema.yaml
cp moran_aux.schema.yaml xhloopkai_aux.schema.yaml
sed -i "s/^ schema_id: moran_aux$/ schema_id: xhloopkai_aux/g" ./xhloopkai_aux.schema.yaml
sed -i "s/^ name: 魔然·輔篩$/ name: xhloopkai輔篩/g" ./xhloopkai_aux.schema.yaml
sed -i "s/^\( - 方案製作:ksqsf\)$/\1\n - Integrator:jack2game/g" ./xhloopkai_aux.schema.yaml
sed -i "s/^ 在輸入完畢雙拼碼後,可以輸入輔助碼篩選候選項,與「魔然」方案不同。$/ 在輸入完畢雙拼碼後,可以輸入輔助碼篩選候選項,與「xhloopkai」方案不同。/g" ./xhloopkai_aux.schema.yaml
# cp moran_bj.schema.yaml xhloopkai_bj.schema.yaml
# sed -i "s/^ schema_id: moran_bj$/ schema_id: xhloopkai_bj/g" ./xhloopkai_bj.schema.yaml
# sed -i "s/^ name: 魔然·並擊G$/ name: xhloopkai並擊/g" ./xhloopkai_bj.schema.yaml
# sed -i "s/^\( - 方案製作:ksqsf\)$/\1\n - Integrator:jack2game/g" ./xhloopkai_bj.schema.yaml
# sed -i "s/^ 爲傳承字設計的自然碼及輔助碼智能整句輸入方案。$/ xhloopkai = moran + xhloop + moranshape + snow/g" ./xhloopkai_bj.schema.yaml
# sed -i "s/^ - moran_fixed$/ - xhloopkai_fixed/g" ./xhloopkai_bj.schema.yaml
# sed -i "s/^ - moran_sentence$/ - xhloopkai_sentence/g" ./xhloopkai_bj.schema.yaml
cp moran_fixed.schema.yaml xhloopkai_fixed.schema.yaml
sed -i "s/^ schema_id: moran_fixed$/ schema_id: xhloopkai_fixed/g" ./xhloopkai_fixed.schema.yaml
sed -i "s/^ name: 魔然·字詞$/ name: xhloopkai字詞/g" ./xhloopkai_fixed.schema.yaml
sed -i "s/^\( - 方案製作:ksqsf\)$/\1\n - Integrator:jack2game/g" ./xhloopkai_fixed.schema.yaml
cp moran_sentence.schema.yaml xhloopkai_sentence.schema.yaml
sed -i "s/^ schema_id: moran_sentence$/ schema_id: xhloopkai_sentence/g" ./xhloopkai_sentence.schema.yaml
sed -i "s/^ name: 魔然·整句$/ name: xhloopkai整句/g" ./xhloopkai_sentence.schema.yaml
sed -i "s/^\( - 方案製作:ksqsf\)$/\1\n - Integrator:jack2game/g" ./xhloopkai_sentence.schema.yaml
cd ..