Datasets:

Languages:
Chinese
Tags:
Not-For-All-Audiences
License:
Limour commited on
Commit
727010e
·
verified ·
1 Parent(s): f56350f
v-corpus-zh/Madosoft/灵感满溢的甜蜜创想/1共通.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:abc64370e14347fac5817214d78e04858f26dbdf0aad0dac2b0a1fea5a42c667
3
+ size 421148
v-corpus-zh/Madosoft/灵感满溢的甜蜜创想/2锦.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe5fcfb7e4ad79cafc18dd82b328165482e61e8f59517855430f383f054686a9
3
+ size 182481
v-corpus-zh/Madosoft/灵感满溢的甜蜜创想/3妹妹.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d470edfe5aa7b556d398f287de7e7ba65e65de73d92c9a9e11a520493525fcc
3
+ size 224136
v-corpus-zh/Madosoft/灵感满溢的甜蜜创想/4常磐.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9b22d13c87478ca5a4c1eb93657152aa979f01c04a87cad4f14427e2da9fd8da
3
+ size 221811
v-corpus-zh/Madosoft/灵感满溢的甜蜜创想/5诗樱.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae944eaba8ae8e596764416d45a2fcea0a26f6144144d5ac7043e2c543b7e62c
3
+ size 186642
v-corpus-zh/Madosoft/灵感满溢的甜蜜创想/灵感满溢的甜蜜创想_ast.py ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # =================
144
+
145
+ a = get_all_files_in_directory(r'E:\tmp\富婆妹_\script', ext='.ast')
146
+ b = r'E:\tmp\富婆妹_\text'
147
+
148
+ # =================
149
+
150
+ sc = {}
151
+
152
+ _n = {
153
+ "旁白": "旁白",
154
+ "妃愛": "妃爱", # 和泉妃爱
155
+ "智宏": "智宏",
156
+ "あすみ": "明日海", # 锦明日海
157
+ "女性店員": "女性店员",
158
+ "里": "里",
159
+ "華乃": "华乃", # 常磐华乃
160
+ "詩桜": "诗樱", # 镰仓诗樱
161
+ "天梨": "天梨", # 龙闲天梨
162
+ "鳴門": "鸣门",
163
+ "妄想パパ": "妄想爸爸",
164
+ "広夢": "广梦", # 新川广梦
165
+ "偉い人": "伟大的人",
166
+ "莉々子": "莉莉子", # 圣莉莉子
167
+ "資正": "资正",
168
+ "女子生徒A": "女子生徒A",
169
+ "女子生徒B": "女子生徒B",
170
+ "男子生徒A": "男子生徒A",
171
+ "男子生徒B": "男子生徒B",
172
+ "宅配員": "宅配员",
173
+ "店員A": "店员A",
174
+ "店員B": "店员B",
175
+ "マンションの住人A": "公寓的住户A",
176
+ "他校の女子生徒A": "其他学校女生A",
177
+ "他校の女子生徒B": "其他学校女生B",
178
+ "他校の男子生徒A": "其他学校男生A",
179
+ "他校の男子生徒B": "其他学校男生B",
180
+ "他校の女子生徒C": "其他学校女生C",
181
+ "妃愛のマネージャー": "妃爱的经纪人",
182
+ "サッカー部部長": "足球部部长",
183
+ "黒髪美人": "黒发美人",
184
+ "華道部部長": "花道部部长",
185
+ "華道部女子A": "花道部女子A",
186
+ "華道部女子B": "花道部女子B",
187
+ "3年生ギャルA": "3年生女生A",
188
+ "3年生ギャルB": "3年生女生B",
189
+ "2年生ギャルA": "2年生女生A",
190
+ "誰?": "?",
191
+ "客A": "客A",
192
+ "客B": "客B",
193
+ "カメコA": "カメコA", # ???
194
+ "女将": "女将",
195
+ "リーダー": "领导",
196
+ "おばあちゃん": "奶奶",
197
+ "地元の消防団員": "本地消防员",
198
+ "釣り船屋": "钓鱼码头",
199
+ "陽キャA": "阳光A", # ???
200
+ "陽キャB": "阳光B",
201
+ "白ギャル": "白辣妹",
202
+ "黒ギャル": "黒辣妹",
203
+ "男子生徒C": "男学生C",
204
+ "男子生徒D": "男学生D",
205
+ "イベント客": "客户",
206
+ "おばば": "大婶",
207
+ "1年生女子A": "1年级女生A",
208
+ "1年生女子B": "1年级女生B",
209
+ "1年生女子C": "1年级女生C",
210
+ "悠羽": "悠羽",
211
+ "願ギマル": "祈愿",
212
+ "3年生男子A": "3年级男生A",
213
+ "3年生男子B": "3年级男生B",
214
+ "3年生男子C": "3年级男生C",
215
+ "3年生男子D": "3年级男生D",
216
+ "選挙管理委員会": "选举管理委员会",
217
+ "おじいちゃん": "爷爷",
218
+ "地元の人A": "本地人A",
219
+ "地元の人B": "本地人B",
220
+ "地元の人C": "本地人C",
221
+ "看護師": "护士"
222
+ }
223
+
224
+ reg_ast = re.compile(r'^\[\d+]=\{')
225
+ reg_n = re.compile(r'^name=\{name="(.+?)"}?,')
226
+ reg_d = re.compile(r'^"(.+?)",')
227
+ # =================
228
+ for path in a:
229
+ name = path[path.rindex('\\'):]
230
+ name = name[:3]
231
+ if name not in sc:
232
+ sc[name] = []
233
+ print(name)
234
+ # =================
235
+
236
+ with open(path, 'r', encoding='utf-8') as f:
237
+ data = list(filter(lambda x: x,
238
+ (x.rstrip() for x in f.readlines())))
239
+
240
+ # =================
241
+ w_i = -1
242
+ while w_i < len(data) - 1:
243
+ w_i += 1
244
+ line: str = data[w_i]
245
+ # =================
246
+ tmp = reg_ast.match(line)
247
+ if tmp is None:
248
+ continue
249
+ n = '旁白'
250
+ while w_i < len(data) - 1:
251
+ w_i += 1
252
+ line: str = data[w_i]
253
+ tmp = reg_ast.match(line)
254
+ if tmp is not None:
255
+ w_i -= 1
256
+ break
257
+ tmp = reg_n.findall(line)
258
+ if tmp:
259
+ n = tmp[0]
260
+ continue
261
+ tmp = reg_d.findall(line)
262
+ if tmp:
263
+ d = tmp[0]
264
+ continue
265
+
266
+ if n in _n:
267
+ n = _n[n]
268
+ else:
269
+ _n[n] = clearT(n.strip('【】')).replace('/', '&')
270
+ print(line)
271
+
272
+ d = clearT(d)
273
+ if d:
274
+ sc[name].append(n + ':' + d)
275
+
276
+ # =================
277
+
278
+ for k, v in sc.items():
279
+ if v:
280
+ with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
281
+ f.write('\n'.join(v))
282
+
283
+ # =================
284
+ import json
285
+
286
+ tmp = json.dumps(_n, ensure_ascii=False, indent=4)