Datasets:

Languages:
Chinese
Tags:
Not-For-All-Audiences
License:
Limour commited on
Commit
f13403b
·
verified ·
1 Parent(s): 727010e

世界末日陨落之星

Browse files
v-corpus-zh/Fluorite/世界末日陨落之星/0.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d83c1f40a49bcb36e81c7d7d85d7a48686d51f0a42abc9d4cbcdb4838ba8514
3
+ size 137685
v-corpus-zh/Fluorite/世界末日陨落之星/a.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad2bf4981741743381fe6ccda9585c0d7203b56744b654da278ac504ab6ec5f0
3
+ size 456366
v-corpus-zh/Fluorite/世界末日陨落之星/b.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e854973730b531118cf17417cdba8d5103bae583cd61b277a57c75f15ff97746
3
+ size 94803
v-corpus-zh/Fluorite/世界末日陨落之星/c.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6c7276a600d563cda36913040361d5e7a48616fa53b489c18898dde5b9a8dbc
3
+ size 327768
v-corpus-zh/Fluorite/世界末日陨落之星/世界末日陨落之星_ast.py ADDED
@@ -0,0 +1,497 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def get_all_files_in_directory(directory, ext=''):
2
+ import os
3
+ import re
4
+ custom_sort_key_re = re.compile('([0-9]+)')
5
+
6
+ def custom_sort_key(s):
7
+ # 将字符串中的数字部分转换为整数,然后进行排序
8
+ return [int(x) if x.isdigit() else x for x in custom_sort_key_re.split(s)]
9
+
10
+ all_files = []
11
+ for root, dirs, files in os.walk(directory):
12
+ for file in files:
13
+ if file.endswith(ext):
14
+ file_path = os.path.join(root, file)
15
+ all_files.append(file_path)
16
+ return sorted(all_files, key=custom_sort_key)
17
+
18
+
19
+ def clearT():
20
+ import unicodedata
21
+ from opencc import OpenCC
22
+
23
+ def full2half(input_str):
24
+ return ''.join([unicodedata.normalize('NFKC', char) for char in input_str])
25
+
26
+ cc = OpenCC('t2s') # 't2s'表示繁体转简体
27
+
28
+ def _clearT(s):
29
+ s = cc.convert(full2half(s))
30
+ return s.strip().strip(r'\n').replace('\n', '\\n')
31
+
32
+ return _clearT
33
+
34
+
35
+ clearT = clearT()
36
+
37
+
38
+ def startsWithAny(s: str, keys):
39
+ for x in keys:
40
+ if s.startswith(x):
41
+ return x
42
+ else:
43
+ return False
44
+
45
+
46
+ def endsWithAny(s: str, keys):
47
+ for x in keys:
48
+ if s.endswith(x):
49
+ return x
50
+ else:
51
+ return False
52
+
53
+
54
+ def startsWithAlnum(s: str, _chrs):
55
+ retn = ''
56
+ for char in s:
57
+ if (char.isalnum()) or (char in _chrs):
58
+ retn += char
59
+ else:
60
+ break
61
+ return retn
62
+
63
+
64
+ def startsWithCmd(s: str, _chrs=None):
65
+ if _chrs is None:
66
+ _chrs = {'_', '@'}
67
+ cmd = startsWithAlnum(s, _chrs)
68
+ if cmd:
69
+ return s.startswith(cmd + ' ')
70
+ else:
71
+ return False
72
+
73
+
74
+ import re
75
+
76
+ reg_removeWait = re.compile(r'\[.+?]')
77
+
78
+
79
+ def removeWait(_line):
80
+ _tmp = reg_removeWait.sub('', _line)
81
+ if _tmp:
82
+ return _tmp
83
+ else:
84
+ return _line
85
+
86
+
87
+ def getCmdArgs(_cmd):
88
+ _args = ['']
89
+ _i = -1
90
+ _inQuota = ''
91
+ while _i < len(_cmd) - 1:
92
+ _i += 1
93
+ char = _cmd[_i]
94
+ if _inQuota:
95
+ _args[-1] += char
96
+ if char == _inQuota:
97
+ _inQuota = ''
98
+ elif char == '\\':
99
+ _i += 1
100
+ char = _cmd[_i]
101
+ _args[-1] += char
102
+ else:
103
+ pass
104
+ else:
105
+ if char == ' ':
106
+ _args.append('')
107
+ while _i < len(_cmd) - 1:
108
+ _i += 1
109
+ char = _cmd[_i]
110
+ if char != ' ':
111
+ _i -= 1
112
+ break
113
+ continue
114
+ elif char in {'"', "'"}:
115
+ _inQuota = char
116
+ else:
117
+ pass
118
+ _args[-1] += char
119
+ continue
120
+ return _args
121
+
122
+
123
+ def args2map(_args):
124
+ retn = {}
125
+ for _i in range(1, len(_args)):
126
+ _arg = _args[_i]
127
+ if '=' not in _arg:
128
+ if '=' in _arg:
129
+ _arg = _arg.replace('=', '=')
130
+ else:
131
+ continue
132
+ _idx = _arg.index('=')
133
+ _k = _arg[:_idx]
134
+ if '"' in _k or "'" in _k:
135
+ continue
136
+ _v = _arg[_idx + 1:]
137
+ if _v.startswith('"') or _v.startswith("'"):
138
+ _v = _v[1:len(_v) - 1]
139
+ retn[_k] = _v
140
+ return retn
141
+
142
+
143
+ def getBracketContent(_left='{', _right='}', _start=0):
144
+ global data, w_i
145
+ retn = _left
146
+ _start += 1
147
+ w_i -= 1
148
+ while w_i < len(data) - 1:
149
+ w_i += 1
150
+ _line: str = data[w_i] + '\n'
151
+ # =================
152
+ w_j = _start - 1
153
+ _inQuota = ''
154
+ while w_j < len(_line) - 1:
155
+ w_j += 1
156
+ char = _line[w_j]
157
+ # =================
158
+ if _inQuota:
159
+ retn += char
160
+ if char == _inQuota:
161
+ _inQuota = ''
162
+ elif char == '\\':
163
+ w_j += 1
164
+ char = _line[w_j]
165
+ retn += char
166
+ else:
167
+ pass
168
+ else:
169
+ if char in {'"', "'"}:
170
+ _inQuota = char
171
+ retn += char
172
+ elif char == _left:
173
+ _retn, _line, w_j = getBracketContent(_left, _right, w_j)
174
+ retn += _retn
175
+ elif char == _right:
176
+ retn += char
177
+ return retn, _line, w_j
178
+ else:
179
+ retn += char
180
+ _start = 0
181
+ return retn, '', 0
182
+
183
+
184
+ def ast2list(_ast: str, _start=0):
185
+ retn = [['', '']]
186
+ # =================
187
+ w_j = _start
188
+ _inQuota = ''
189
+ while w_j < len(_ast) - 1:
190
+ w_j += 1
191
+ char = _ast[w_j]
192
+ # =================
193
+ if _inQuota:
194
+ if char == _inQuota:
195
+ _inQuota = ''
196
+ elif char == '\\':
197
+ retn[-1][1] += char
198
+ w_j += 1
199
+ char = _ast[w_j]
200
+ retn[-1][1] += char
201
+ else:
202
+ retn[-1][1] += char
203
+ else:
204
+ if char in {'"', "'"}:
205
+ _inQuota = char
206
+ # retn[-1][1] += char
207
+ elif char == '{':
208
+ _retn, w_j = ast2list(_ast, w_j)
209
+ retn[-1][1] = _retn
210
+ elif char == '}':
211
+ return retn, w_j
212
+ elif char == ',':
213
+ retn.append(['', ''])
214
+ elif char == '=':
215
+ pass
216
+ else:
217
+ if char.strip():
218
+ retn[-1][0] += char
219
+
220
+ return [['', '']], 0
221
+
222
+
223
+ # =================
224
+
225
+ a = get_all_files_in_directory(r'E:\tmp\世界末日陨落之星_\script', ext='.ast')
226
+ b = r'E:\tmp\世界末日陨落之星_\text'
227
+
228
+ # =================
229
+
230
+ sc = {}
231
+
232
+ _n = {
233
+ "旁白": "旁白",
234
+ "笃志": "笃志",
235
+ "公辉": "公辉",
236
+ "三条": "三条",
237
+ "???": "?",
238
+ "仲代": "仲代",
239
+ "女仆": "女仆",
240
+ "美由纪": "美由纪",
241
+ "逸城": "逸城",
242
+ "梓": "梓",
243
+ "美子": "美子",
244
+ "亚琪娜": "亚琪娜",
245
+ "自警团A": "自警团A",
246
+ "自警团B": "自警团B",
247
+ "校长": "校长",
248
+ "米娅": "米娅",
249
+ "女学生A": "女学生A",
250
+ "莉莉": "莉莉",
251
+ "食堂的大婶": "食堂的大婶",
252
+ "贵族学生A": "贵族学生A",
253
+ "贵族学生B": "贵族学生B",
254
+ "店里的大婶": "店里的大婶",
255
+ "阿兹莉雅": "阿兹莉雅",
256
+ "3人": "3人",
257
+ "米娅&阿兹莉雅": "米娅&阿兹莉雅",
258
+ "诺诺": "诺诺",
259
+ "普利德尼亚的选手们": "普利德尼亚的选手们",
260
+ "蔻蔻": "蔻蔻",
261
+ "露露": "露露",
262
+ "保健老师": "保健老师",
263
+ "悠米": "悠米",
264
+ "艾琉西奥女生A": "艾琉西奥女生A",
265
+ "艾琉西奥女生B": "艾琉西奥女生B",
266
+ "艾琉西奥男生A": "艾琉西奥男生A",
267
+ "艾琉西奥男生B": "艾琉西奥男生B",
268
+ "老师": "老师",
269
+ "尤兹莉哈": "尤兹莉哈",
270
+ "4人": "4人",
271
+ "艾琉西奥的学生们": "艾琉西奥的学生们",
272
+ "公辉&米娅": "公辉&米娅",
273
+ "湘晋的队长": "湘晋的队长",
274
+ "湘晋D": "湘晋D",
275
+ "湘晋B": "湘晋B",
276
+ "湘晋的选手们": "湘晋的选手们",
277
+ "湘晋C": "湘晋C",
278
+ "红丽": "红丽",
279
+ "艾琉西奥女生C": "艾琉西奥女生C",
280
+ "艾琉西奥女生D": "艾琉西奥女生D",
281
+ "保健医生": "保健医生",
282
+ "主持人": "主持人",
283
+ "5人": "5人",
284
+ "苍月": "苍月",
285
+ "黑莲": "黑莲",
286
+ "白花": "白花",
287
+ "亚琪娜&阿兹莉雅": "亚琪娜&阿兹莉雅",
288
+ "辛德尔特伯爵": "辛德尔特伯爵",
289
+ "批发商": "批发商",
290
+ "米兹盖尔兹C": "米兹盖尔兹C",
291
+ "米兹盖尔兹B": "米兹盖尔兹B",
292
+ "米兹盖尔兹D": "米兹盖尔兹D",
293
+ "米兹盖尔兹队长": "米兹盖尔兹队长",
294
+ "米兹盖尔兹选手们": "米兹盖尔兹选手们",
295
+ "先生": "先生",
296
+ "艾琉西奥女子A": "艾琉西奥女子A",
297
+ "艾琉西奥女子B": "艾琉西奥女子B",
298
+ "艾琉西奥女子C": "艾琉西奥女子C",
299
+ "青春的女子": "青春的女子",
300
+ "宁宁": "宁宁",
301
+ "艾琉西奥女子D": "艾琉西奥女子D",
302
+ "妮可": "妮可",
303
+ "阿兹莉雅&妮可": "阿兹莉雅&妮可",
304
+ "艾琉西奥男子C": "艾琉西奥男子C",
305
+ "艾琉西奥男子A": "艾琉西奥男子A",
306
+ "宠物店店员": "宠物店店员",
307
+ "宝石店店員": "宝石店店员",
308
+ "阿兹莉雅母亲": "阿兹莉雅母亲",
309
+ "丽姿蒂娅": "丽姿蒂娅",
310
+ "男人": "男人",
311
+ "受付": "受付",
312
+ "普利德尼亚C": "普利德尼亚C",
313
+ "男": "男",
314
+ "艾琉西奥女生A&B": "艾琉西奥女生A&B",
315
+ "亚琪娜&公辉": "亚琪娜&公辉",
316
+ "商店店员A": "商店店员A",
317
+ "商店店员B": "商店店员B",
318
+ "亚琪娜&米娅": "亚琪娜&米娅",
319
+ "克雷哈": "克雷哈",
320
+ "2人": "2人",
321
+ "班同学们": "班同学们",
322
+ "公辉&亚琪娜": "公辉&亚琪娜",
323
+ "佣人": "佣人",
324
+ "艾蕾娜": "艾蕾娜",
325
+ "普利德尼亚D": "普利德尼亚D",
326
+ "见美子": "见美子",
327
+ "米娅&亚琪娜": "米娅&亚琪娜",
328
+ "店员": "店员",
329
+ "艾琉西奥男子B": "艾琉西奥男子B",
330
+ "信": "信",
331
+ "其他宿舍女生A": "其他宿舍女生A",
332
+ "其他宿舍女生B": "其他宿舍女生B",
333
+ "湘晋队长": "湘晋队长",
334
+ "同班同学们": "同班同学们",
335
+ "女学生B": "女学生B",
336
+ "米娅&尤兹莉哈": "米娅&尤兹莉哈",
337
+ "男子3人": "男子3人",
338
+ "男学生A": "男学生A",
339
+ "男学生B": "男学生B",
340
+ "男学生C": "男学生C",
341
+ "艾琉西奥的女生们": "艾琉西奥的女生们",
342
+ "湘晋住宿生": "湘晋住宿生",
343
+ "艾琉西奥住宿生": "艾琉西奥住宿生",
344
+ "米兹盖尔兹住宿生": "米兹盖尔兹住宿生",
345
+ "放哨人A": "放哨人A",
346
+ "放哨人B": "放哨人B",
347
+ "卫兵A": "卫兵A",
348
+ "卫兵B": "卫兵B",
349
+ "卫兵C": "卫兵C",
350
+ "维多利亚": "维多利亚",
351
+ "工作人员": "工作人员",
352
+ "领主": "领主",
353
+ "敌兵A": "敌兵A",
354
+ "敌兵B": "敌兵B",
355
+ "敌兵C": "敌兵C",
356
+ "亚琪娜&莉莉": "亚琪娜&莉莉",
357
+ "女学生C": "女学生C",
358
+ "女学生E": "女学生E",
359
+ "女学生F": "女学生F",
360
+ "女学生G": "女学生G",
361
+ "公辉&悠米": "公辉&悠米",
362
+ "女学生D": "女学生D",
363
+ "政变派A": "政变派A",
364
+ "政变派B": "政变派B",
365
+ "阿兹莉雅&悠米": "阿兹莉雅&悠米",
366
+ "村人A": "村人A",
367
+ "村人B": "村人B",
368
+ "村人C": "村人C",
369
+ "女孩子A": "女孩子A",
370
+ "女孩子B": "女孩子B",
371
+ "女孩子C": "女孩子C",
372
+ "怪物": "怪物",
373
+ "村长": "村长",
374
+ "亚琪娜&自警团A": "亚琪娜&自警团A",
375
+ "街上的人A": "街上的人A",
376
+ "政变派C": "政变派C",
377
+ "政变派D": "政变派D",
378
+ "自警団A": "自警団A",
379
+ "罗德": "罗德",
380
+ "公辉&罗德": "公辉&罗德",
381
+ "外貌扭曲的人类A": "外貌扭曲的人类A",
382
+ "外貌扭曲的人类B": "外貌扭曲的人类B",
383
+ "外貌扭曲的人类C": "外貌扭曲的人类C",
384
+ "明菜": "明菜",
385
+ "凛凛花": "凛凛花",
386
+ "野乃实": "野乃实",
387
+ "柚子": "柚子",
388
+ "丧尸人类": "丧尸人类",
389
+ "长角的人类": "长角的人类",
390
+ "长角的人": "长角的人",
391
+ "救援队": "救援队",
392
+ "艾琉西奥寮女子一同": "艾琉西奥寮女子一同",
393
+ "公萨": "公萨",
394
+ "阿梓拉": "阿梓拉",
395
+ "旅人": "旅人",
396
+ "客A": "客A",
397
+ "客B": "客B",
398
+ "街上的人B": "街上的人B",
399
+ "小孩子": "小孩子",
400
+ "小孩子": "小孩子",
401
+ "魔女的余孽": "魔女的余孽",
402
+ "贵族的从者": "贵族的从者",
403
+ "林德利亚": "林德利亚",
404
+ "阿梓拉&林德利亚": "阿梓拉&林德利亚",
405
+ "阿兹莉雅&莉莉": "阿兹莉雅&莉莉",
406
+ "公德": "公德",
407
+ "公德的母亲": "公德的母亲",
408
+ "公德的父亲": "公德的父亲",
409
+ "克兹诺哈": "克兹诺哈",
410
+ "兰朵儿": "兰朵儿",
411
+ "普利德尼亚": "普利德尼亚",
412
+ "魔法王国士兵A": "魔法王国士兵A",
413
+ "———": "——", # 舍弃掉了我的名字
414
+ "艾琉西奥学生": "艾琉西奥学生",
415
+ "普利德尼亚学生": "普利德尼亚学生",
416
+ "湘晋学生": "湘晋学生",
417
+ "反叛组织的首领": "反叛组织的首领",
418
+ "尤弥尔": "尤弥尔",
419
+ "反叛组织的女性": "反叛组织的女性",
420
+ "魔法王国士兵B": "魔法王国士兵B",
421
+ "敌国士兵A": "敌国士兵A",
422
+ "敌国士兵队长": "敌国士兵队长",
423
+ "敌国士兵B": "敌国士兵B",
424
+ "敌国士兵C": "敌国士兵C",
425
+ "普利德尼亚全員": "普利德尼亚全员",
426
+ "政变派的学生们": "政变派的学生们",
427
+ "6人": "6人",
428
+ "强盗A": "强盗A",
429
+ "强盗B": "强盗B",
430
+ "少女": "少女"
431
+ }
432
+
433
+ reg_ast = re.compile(r'^\[\d+]=\{')
434
+ reg_n = re.compile(r'^name=\{name="(.+?)"}?,')
435
+ reg_d = re.compile(r'^"(.+?)",')
436
+ reg_ja = re.compile(r'^\s*ja\s*=\s*\{')
437
+ # =================
438
+ for path in a:
439
+ name = path[path.rindex('\\'):]
440
+ name = name[:2]
441
+ if name not in sc:
442
+ sc[name] = []
443
+ print(name)
444
+ # =================
445
+
446
+ with open(path, 'r', encoding='utf-8') as f:
447
+ data = list(filter(lambda x: x,
448
+ (x.rstrip() for x in f.readlines())))
449
+
450
+ # =================
451
+ w_i = -1
452
+ while w_i < len(data) - 1:
453
+ w_i += 1
454
+ line: str = data[w_i]
455
+ # =================
456
+ tmp = reg_ja.match(line)
457
+ if tmp is None:
458
+ continue
459
+ tmp = getBracketContent(_start=tmp.end() - 1)[0]
460
+ tmp = ast2list(tmp)[0]
461
+ # =================
462
+ n = '旁白'
463
+ for k,v in tmp:
464
+ if k == 'name':
465
+ for _k,_v in v:
466
+ if _k == 'text':
467
+ n = _v
468
+ break
469
+ break
470
+ if n in _n:
471
+ n = _n[n]
472
+ else:
473
+ _n[n] = clearT(n.strip('【】')).replace('/', '&')
474
+ print(n, tmp)
475
+ # =================
476
+ for k,v in tmp:
477
+ if not k:
478
+ d = ''
479
+ for _k,_v in v:
480
+ if type(_v) is str:
481
+ d += _v
482
+
483
+ d = clearT(d)
484
+ if d:
485
+ sc[name].append(n + ':' + d)
486
+ # break
487
+ # =================
488
+
489
+ for k, v in sc.items():
490
+ if v:
491
+ with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
492
+ f.write('\n'.join(v))
493
+
494
+ # =================
495
+ import json
496
+
497
+ tmp = json.dumps(_n, ensure_ascii=False, indent=4)