Datasets:

Languages:
Chinese
Tags:
Not-For-All-Audiences
License:
Limour commited on
Commit
9f85dcf
·
verified ·
1 Parent(s): 4dcb4ee

Upload 9 files

Browse files
v-corpus-zh/HULOTTE/5分钟的邂逅!时间停止与不可避免的命运/0.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8b795cc6d4faf0ec70e9d926e6453170cc40e50a7cb50c4c6819dd217df4e4fd
3
+ size 77503
v-corpus-zh/HULOTTE/5分钟的邂逅!时间停止与不可避免的命运/a.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c4a3b698bac967b30cf607adcae6de1751cbdf1db7b7167b5a40bc0a4387c6b0
3
+ size 128201
v-corpus-zh/HULOTTE/5分钟的邂逅!时间停止与不可避免的命运/b.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7599dc757d59d8751b0852f2bb1c4f5a585ce0221eda08dcedcbb4c493f68a11
3
+ size 133809
v-corpus-zh/HULOTTE/5分钟的邂逅!时间停止与不可避免的命运/c.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c9aafa27dcc91e4ef1fbd6b3023eaf24c3900451702eaa7a6058aede45ca2b2
3
+ size 131641
v-corpus-zh/HULOTTE/5分钟的邂逅!时间停止与不可避免的命运/d.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afd992404e53d8226dd1a6b96d7948e1d7a0657a51941e51df7f4ce01291974f
3
+ size 124382
v-corpus-zh/HULOTTE/5分钟的邂逅!时间停止与不可避免的命运/e.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:101017867ec135ef88edcaa646e840c3d81f8eeaa023ed569e81374b801af4b5
3
+ size 122893
v-corpus-zh/HULOTTE/5分钟的邂逅!时间停止与不可避免的命运/f.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8372c67252ff11e3629bab81cce906802dcadc9caa9880f8c1721097540740b1
3
+ size 70142
v-corpus-zh/HULOTTE/5分钟的邂逅!时间停止与不可避免的命运/g.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:60cbda74fa67eec6fcb6ab13f1c6f247e1cea18f787ab5b6a3d7937414aae806
3
+ size 57849
v-corpus-zh/HULOTTE/5分钟的邂逅!时间停止与不可避免的命运/时停5分_ks.py ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 startsWithAlnum(s: str, _chrs):
47
+ retn = ''
48
+ for char in s:
49
+ if (char.isalnum()) or (char in _chrs):
50
+ retn += char
51
+ else:
52
+ break
53
+ return retn
54
+
55
+
56
+ def startsWithCmd(s: str, _chrs=None):
57
+ if _chrs is None:
58
+ _chrs = {'_', '@'}
59
+ cmd = startsWithAlnum(s, _chrs)
60
+ if cmd:
61
+ return s.startswith(cmd + ' ')
62
+ else:
63
+ return False
64
+
65
+
66
+ import re
67
+
68
+ reg_removeWait = re.compile(r'\[.+?]')
69
+
70
+
71
+ def removeWait(_line):
72
+ _tmp = reg_removeWait.sub('', _line)
73
+ if _tmp:
74
+ return _tmp
75
+ else:
76
+ return _line
77
+
78
+
79
+ def getCmdArgs(_cmd):
80
+ _args = ['']
81
+ _i = -1
82
+ _inQuota = ''
83
+ while _i < len(_cmd) - 1:
84
+ _i += 1
85
+ char = _cmd[_i]
86
+ if _inQuota:
87
+ _args[-1] += char
88
+ if char == _inQuota:
89
+ _inQuota = ''
90
+ elif char == '\\':
91
+ _i += 1
92
+ char = _cmd[_i]
93
+ _args[-1] += char
94
+ else:
95
+ pass
96
+ else:
97
+ if char == ' ':
98
+ _args.append('')
99
+ while _i < len(_cmd) - 1:
100
+ _i += 1
101
+ char = _cmd[_i]
102
+ if char != ' ':
103
+ _i -= 1
104
+ break
105
+ continue
106
+ elif char in {'"', "'"}:
107
+ _inQuota = char
108
+ else:
109
+ pass
110
+ _args[-1] += char
111
+ continue
112
+ return _args
113
+
114
+
115
+ def args2map(_args):
116
+ retn = {}
117
+ for _i in range(1, len(_args)):
118
+ _arg = _args[_i]
119
+ if '=' not in _arg:
120
+ if '=' in _arg:
121
+ _arg = _arg.replace('=', '=')
122
+ else:
123
+ continue
124
+ _idx = _arg.index('=')
125
+ _k = _arg[:_idx]
126
+ if '"' in _k or "'" in _k:
127
+ continue
128
+ _v = _arg[_idx + 1:]
129
+ if _v.startswith('"') or _v.startswith("'"):
130
+ _v = _v[1:len(_v) - 1]
131
+ retn[_k] = _v
132
+ return retn
133
+
134
+
135
+ # =================
136
+
137
+ a = get_all_files_in_directory(r'E:\tmp\时停5分\ks', ext='.ks')
138
+ b = r'D:\datasets\tmp'
139
+
140
+ # =================
141
+
142
+ sc = {}
143
+
144
+ _n = {
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
+ "同班同学A": "同班同学A",
171
+ "同班同学B": "同班同学B",
172
+ "同班同学A&B": "同班同学A&B",
173
+ "讲师": "讲师",
174
+ "桜良/樱良/???": "樱良/?",
175
+ "瑠璃&樱良": "瑠璃&樱良",
176
+ "瑠璃妈妈/???": "瑠璃妈妈/?",
177
+ "瑠璃爸爸": "瑠璃爸爸",
178
+ "女同学A": "女同学A",
179
+ "女同学B": "女同学B",
180
+ "巡视员": "巡视员",
181
+ "客人": "客人",
182
+ "女路人": "女路人",
183
+ "ノア/诺亚": "诺亚",
184
+ "桜良/樱良": "樱良",
185
+ "搭讪男子A": "搭讪男子A",
186
+ "搭讪男子B": "搭讪男子B",
187
+ "梓/AZ": "���/AZ",
188
+ "男子A": "男子A",
189
+ "男子B": "男子B",
190
+ "男子C": "男子C",
191
+ "迷之男子A": "迷之男子A",
192
+ "迷之男子B": "迷之男子B",
193
+ "迷之男子C": "迷之男子C",
194
+ "ノア/诺亚/悠真&诺亚": "悠真&诺亚",
195
+ "謎の男C/主管人员": "迷之男子C/主管人员",
196
+ "后辈女生": "后辈女生",
197
+ "三年女子/文艺社女生": "3年级女生/文艺社女生",
198
+ "編集長/梓的熟人": "编集长/梓的熟人",
199
+ "总编辑": "总编辑",
200
+ "花音奶奶": "花音奶奶",
201
+ "瑠璃&桜良&ノア&白亜&梓&胡桃&奏斗/大伙": "大伙",
202
+ "3年级女生": "3年级女生",
203
+ "老师": "老师",
204
+ "白亜/悠真&白亚": "悠真&白亚",
205
+ "白亚&樱良": "白亚&樱良",
206
+ "梓/护士": "梓/护士",
207
+ "护士": "护士",
208
+ "女孩": "女孩",
209
+ "男孩": "男孩",
210
+ "女学生A": "女学生A",
211
+ "女学生B": "女学生B"
212
+ }
213
+
214
+ # =================
215
+ for path in a:
216
+ name = path[path.rindex('\\'):]
217
+ name = name[:2]
218
+ if name not in sc:
219
+ sc[name] = []
220
+ print(name)
221
+ # =================
222
+
223
+ with open(path, 'r', encoding='utf-8') as f:
224
+ data = list(filter(lambda x: x,
225
+ (x.rstrip() for x in f.readlines())))
226
+
227
+ # =================
228
+ w_i = -1
229
+ while w_i < len(data) - 1:
230
+ w_i += 1
231
+ line: str = data[w_i]
232
+ # =================
233
+ if not line.startswith('@Talk '):
234
+ continue
235
+ args = args2map(getCmdArgs(line))
236
+ n: str = args['name']
237
+ if n in _n:
238
+ n = _n[n]
239
+ else:
240
+ _n[n] = clearT(n)
241
+ print(line)
242
+ # =================
243
+ tmp = []
244
+ while w_i < len(data) - 1:
245
+ w_i += 1
246
+ line: str = data[w_i]
247
+ if startsWithCmd(line):
248
+ w_i -= 1
249
+ break
250
+ tmp.append(line)
251
+ line = '\\n'.join(tmp)
252
+ # =================
253
+ d = clearT(line)
254
+ if d:
255
+ sc[name].append(n + ':' + d)
256
+
257
+ # =================
258
+
259
+ for k, v in sc.items():
260
+ if v:
261
+ with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
262
+ f.write('\n'.join(v))
263
+
264
+ # =================
265
+ import json
266
+ tmp = json.dumps(_n, ensure_ascii=False, indent=4)