Datasets:

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

樱之刻-在樱花之森下漫步- @ 绿茶填坑小队 v1.11

Browse files
v-corpus-zh/枕/樱之诗/樱之刻-在樱花之森下漫步-/01.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:89291922dff720cdcf03adb45fa12385dfcf8ae6b72b8db1219b016842ae4b1e
3
+ size 117924
v-corpus-zh/枕/樱之诗/樱之刻-在樱花之森下漫步-/02.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2389c13724812e47b4449ef12b0c9c43e9e6fd295e8b549cd04a3204c0980f92
3
+ size 142117
v-corpus-zh/枕/樱之诗/樱之刻-在樱花之森下漫步-/03.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b3a07688c1732561abb843773e4bbdbb6746099d328335df526e4180af2e37d
3
+ size 224933
v-corpus-zh/枕/樱之诗/樱之刻-在樱花之森下漫步-/03_bad.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b280c6b5ec86cf8c5420b6e1a49cb7631859ceb48cb4bc919b452f6407868939
3
+ size 2115
v-corpus-zh/枕/樱之诗/樱之刻-在樱花之森下漫步-/03_mak.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:08168cd30e4a7a057d7bdbcb522c3b7dd24ae1dc1aaf23ad069ec7a529dd0484
3
+ size 170540
v-corpus-zh/枕/樱之诗/樱之刻-在樱花之森下漫步-/03_mis.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62987cc1fcc53234cb0659001197431d0f6d2dbeeb1bd192b20c5cb87c07a27b
3
+ size 199659
v-corpus-zh/枕/樱之诗/樱之刻-在樱花之森下漫步-/04_kei.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83c70faed702f91254ca51673341d23de8e3da79f977fddd9779c8083d2543e6
3
+ size 109088
v-corpus-zh/枕/樱之诗/樱之刻-在樱花之森下漫步-/05.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0c8fdc8022f1700386a855c6566670278d71208894bc1de01fecd95c1736fd2
3
+ size 248785
v-corpus-zh/枕/樱之诗/樱之刻-在樱花之森下漫步-/gend01.ast.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:caa58405a864a3cd244cfdbc6b64f6149bf89e1d6aa1d5434b09b29fcc098a80
3
+ size 9611
v-corpus-zh/枕/樱之诗/樱之刻-在樱花之森下漫步-/gend02.ast.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cfe3d9929fafb1d361a90628084e02252e74ff32d28749ea1535b5358764c8a0
3
+ size 5724
v-corpus-zh/枕/樱之诗/樱之刻-在樱花之森下漫步-/gend03.ast.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7a38078ec4bf2cfea6e6d9de869f801fa6ac08ab32ed72e200036c0b432746f6
3
+ size 10368
v-corpus-zh/枕/樱之诗/樱之刻-在樱花之森下漫步-/樱之刻_ast.py ADDED
@@ -0,0 +1,438 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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().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\樱之刻_\ast\script', ext='.ast')
226
+ b = r'E:\tmp\樱之刻_\ast\txt'
227
+
228
+ # =================
229
+
230
+ sc = {}
231
+
232
+ _n = {
233
+ "静流": "静流",
234
+ "???": "?",
235
+ "旁白": "旁白",
236
+ "直哉": "直哉",
237
+ "吉泽": "吉泽",
238
+ "美术老师": "美术老师",
239
+ "???/丽华": "?/丽华",
240
+ "丽华": "丽华",
241
+ "???/蓝": "?/蓝",
242
+ "女学生/女学生A": "女学生A",
243
+ "蓝": "蓝",
244
+ "男学生A/男学生A": "男学生A",
245
+ "男学生A/男学生B": "男学生B",
246
+ "男学生A/男学生C": "男学生C",
247
+ "店长": "店长",
248
+ "???/纱希": "?/纱希",
249
+ "纱希": "纱希",
250
+ "女学生/女学生B": "女学生B",
251
+ "女学生/女学生C": "女学生C",
252
+ "女学生/女学生D": "女学生D",
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
+ "青年/男青年A": "男青年A",
286
+ "青年/男青年B": "男青年B",
287
+ "青年/女青年A": "女青年A",
288
+ "青年/女青年B": "女青年B",
289
+ "青年/男青年C": "男青年C",
290
+ "炸货店老板": "炸货店老板",
291
+ "圣鲁昂女子学院校长": "圣鲁昂女子学院校长",
292
+ "???/雾乃": "?/雾乃",
293
+ "雾乃": "雾乃",
294
+ "猫": "猫",
295
+ "???/真琴": "?/真琴",
296
+ "放哉": "放哉",
297
+ "???/放哉": "?/放哉",
298
+ "章一": "章一",
299
+ "???/女性教职员工": "?/女教师",
300
+ "女性教职员工": "女教师",
301
+ "???/佣人": "?/佣人",
302
+ "佣人": "佣人",
303
+ "静流&蓝": "静流&蓝",
304
+ "???/小孩子": "?/小孩子",
305
+ "???/老人": "?/老人",
306
+ "???/女学生A": "?/女学生A",
307
+ "???/女学生B": "?/女学生B",
308
+ "护士": "护士",
309
+ "???/礼次郎": "?/礼次郎",
310
+ "礼次郎": "礼次郎",
311
+ "水产店老板": "水产店老板",
312
+ "肉店老板": "肉店老板",
313
+ "黑衣人/黑衣人B": "黑衣人B",
314
+ "黑衣人/黑衣人C": "黑衣人C",
315
+ "女佣": "女佣",
316
+ "???/心佐夫": "?/心佐夫",
317
+ "心佐夫": "心佐夫",
318
+ "直哉&心铃": "直哉&心铃",
319
+ "???/奈津子": "?/奈津子",
320
+ "???/女教师": "?/女教师",
321
+ "女教师": "女教师",
322
+ "破戒": "破戒",
323
+ "画家": "画家",
324
+ "???/破戒": "?/破戒",
325
+ "吉田": "吉田",
326
+ "老人": "老人",
327
+ "优美": "优美",
328
+ "???/雫": "?/雫",
329
+ "雫": "雫",
330
+ "???/村田": "?/村田",
331
+ "村田": "村田",
332
+ "稟": "禀",
333
+ "???/明石": "?/明石",
334
+ "明石": "明石",
335
+ "警卫": "警卫",
336
+ "???/托马斯": "?/托马斯",
337
+ "客人A": "客人A",
338
+ "客人B": "客人B",
339
+ "???/里奈": "?/里奈",
340
+ "里奈": "里奈",
341
+ "画家A": "画家A",
342
+ "画家B": "画家B",
343
+ "???/香奈": "?/香奈",
344
+ "工作人员": "工作人员",
345
+ "主持人": "主持人",
346
+ "评委A": "评委A",
347
+ "评委B": "评委B",
348
+ "少年": "少年",
349
+ "急救人员": "急救人员",
350
+ "???/优美": "?/优美",
351
+ "托马斯": "托马斯",
352
+ "依瑠": "依瑠",
353
+ "?��?/铃菜": "?/铃菜",
354
+ "视频/托马斯": "视频/托马斯"
355
+ }
356
+
357
+ reg_ast = re.compile(r'^\[\d+]=\{')
358
+ reg_n = re.compile(r'^name=\{name="(.+?)"}?,')
359
+ reg_d = re.compile(r'^"(.+?)",')
360
+ reg_ja = re.compile(r'\s*ja\s*=\s*\{')
361
+ reg_select = re.compile(r'\s*select\s*=\s*\{')
362
+ # =================
363
+ for path in a:
364
+ name: str = path[path.rindex('\\')+1:]
365
+ if name.startswith('g'):
366
+ pass
367
+ else:
368
+ tmp = name.split('_')
369
+ if tmp[1].isdigit():
370
+ name = tmp[0]
371
+ else:
372
+ name = tmp[0]+ '_' + tmp[1][:3]
373
+ if name not in sc:
374
+ sc[name] = []
375
+ print(name)
376
+ # =================
377
+
378
+ with open(path, 'r', encoding='utf-8') as f:
379
+ data = list(filter(lambda x: x,
380
+ (x.rstrip() for x in f.readlines())))
381
+
382
+ # =================
383
+ w_i = -1
384
+ while w_i < len(data) - 1:
385
+ w_i += 1
386
+ line: str = data[w_i]
387
+ # =================
388
+ tmp = reg_select.match(line)
389
+ if tmp is not None:
390
+ tmp = getBracketContent(_start=tmp.end() - 1)[0]
391
+ continue
392
+ tmp = reg_ja.match(line)
393
+ if tmp is None:
394
+ continue
395
+ tmp = getBracketContent(_start=tmp.end() - 1)[0]
396
+ tmp = ast2list(tmp)[0]
397
+ assert len(tmp) == 2
398
+ assert tmp[-1][1] == ''
399
+ tmp = tmp[0][1]
400
+ # =================
401
+ n = '旁白'
402
+ for k,v in tmp:
403
+ if k == 'name':
404
+ tmp2 = []
405
+ for _k,_v in v:
406
+ if _v:
407
+ tmp2.append(_v)
408
+ if tmp2:
409
+ n = '/'.join(tmp2[::-1])
410
+ break
411
+ if n in _n:
412
+ n = _n[n]
413
+ else:
414
+ _n[n] = clearT(n.strip('【】')).replace('???', '?')
415
+ print(n, tmp)
416
+
417
+ # =================
418
+ d = ''
419
+ for k,v in tmp:
420
+ if not k:
421
+ if type(v) is str:
422
+ d += v
423
+
424
+ d = clearT(d)
425
+ if d:
426
+ sc[name].append(n + ':' + d)
427
+ # break
428
+ # =================
429
+
430
+ for k, v in sc.items():
431
+ if v:
432
+ with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
433
+ f.write('\n'.join(v))
434
+
435
+ # =================
436
+ import json
437
+
438
+ tmp = json.dumps(_n, ensure_ascii=False, indent=4)