Upload 8 files
Browse files- v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/@.txt.gz +3 -0
- v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/A.txt.gz +3 -0
- v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/B.txt.gz +3 -0
- v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/C.txt.gz +3 -0
- v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/D.txt.gz +3 -0
- v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/E.txt.gz +3 -0
- v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/R.txt.gz +3 -0
- v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/haruno_ks.py +247 -0
v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/@.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:64f3b001be10dea75c2a17c795235f81dce7521bbdbf22c3933055d05e0307bd
|
3 |
+
size 213123
|
v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/A.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:43c763af9a9e923623e78fb48828ef415e533406d0f89f9c511338a9d67322ef
|
3 |
+
size 158254
|
v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/B.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eb249801ccd1c6f2091a2a02a6d895d74fdaf98df884d6ab4c65db47f5f7a938
|
3 |
+
size 86823
|
v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/C.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cb2a52063e645b27ffccc8761ab89fa842032e878225f47c0170e0ebfd3e2b25
|
3 |
+
size 152945
|
v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/D.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:602fb355c1631674eddbb998cb64bcbdcfaabacd9af8a692b8a881638e684d0f
|
3 |
+
size 175141
|
v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/E.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8ddc23d245708da4a36a132c704029055d3107f2e94e742a58247cf9fade4aa7
|
3 |
+
size 34388
|
v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/R.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5a7173168819318f02f017afa5cfe2da4fbe64917d82e0aad9dae680fd5a7eed
|
3 |
+
size 138222
|
v-corpus-zh/Parasol/晴霁之后定是菜花盛开的好天气/haruno_ks.py
ADDED
@@ -0,0 +1,247 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.lstrip('n').strip().strip(r'\n').replace('\n', '\\n')
|
31 |
+
|
32 |
+
return _clearT
|
33 |
+
|
34 |
+
|
35 |
+
clearT = clearT()
|
36 |
+
|
37 |
+
# =================
|
38 |
+
|
39 |
+
a = get_all_files_in_directory(r'E:\tmp\haruno\scenario', ext='.ks')
|
40 |
+
b = r'D:\datasets\tmp'
|
41 |
+
|
42 |
+
# =================
|
43 |
+
|
44 |
+
sc = {}
|
45 |
+
|
46 |
+
_n = {
|
47 |
+
"心の声": "旁白",
|
48 |
+
"晴真": "晴真",
|
49 |
+
"菜乃花": "菜乃花",
|
50 |
+
"???《彩菜》": "?/彩菜",
|
51 |
+
"クラスメイトの女子A": "同班女生A",
|
52 |
+
"クラスメイトの女子B": "同班女生B",
|
53 |
+
"晴真&菜乃花《菜乃花》": "晴真&菜乃花",
|
54 |
+
"潤": "润",
|
55 |
+
"祐希": "祐希",
|
56 |
+
"玲於奈": "玲于奈",
|
57 |
+
"花梨": "花梨",
|
58 |
+
"雨音": "雨音",
|
59 |
+
"花梨&祐希": "花梨&祐希",
|
60 |
+
"このみ": "木乃实",
|
61 |
+
"晴真の母親": "晴真母亲",
|
62 |
+
"???": "???",
|
63 |
+
"菜乃花&玲於奈": "菜乃花&玲于奈",
|
64 |
+
"心の声《花梨》": "旁白/花梨",
|
65 |
+
"女生徒B《花梨の同級生B》": "女学生B/与花梨同年级",
|
66 |
+
"女生徒A《花梨の同級生A》": "女学生A/与花梨同年级",
|
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 |
+
"ジュンニーナ:潤《潤》": "Junnina:润",
|
95 |
+
"アーヤ:花梨《花梨》": "Arya:花梨",
|
96 |
+
"コノリーン:このみ《このみ》": "Conolene:木乃实",
|
97 |
+
"王様:祐希《祐希》": "国王:祐希",
|
98 |
+
"エレオナ:玲於奈《玲於奈》": "Eleona:玲于奈",
|
99 |
+
"王子様:晴真": "王子:晴真",
|
100 |
+
"女生徒《ソフト部部長》": "女学生/软件部部长",
|
101 |
+
"女の子《あんず》": "女子/杏铃",
|
102 |
+
"あんず": "杏铃",
|
103 |
+
"晴真&花梨《花梨》": "晴真&花梨/花梨",
|
104 |
+
"晴真&あんず《あんず》": "晴真&杏铃/杏铃",
|
105 |
+
"???《祐希》": "?/祐希",
|
106 |
+
"???《ソフト部部長》": "?/软件部部长",
|
107 |
+
"ソフト部部長": "软件部部长",
|
108 |
+
"みんな《菜乃花&祐希》": "大家/菜乃花&祐希",
|
109 |
+
"雨音&玲於奈": "雨音&玲于奈",
|
110 |
+
"みんな《菜乃花&花梨&雨音&玲於奈&祐希》": "大家/菜乃花&花梨&雨音&玲于奈&祐希",
|
111 |
+
"みんな《菜乃花&雨音&玲於奈&祐希》": "大家/菜乃花&雨音&玲于奈&祐希",
|
112 |
+
"みんな《菜乃花&雨音&玲於奈》": "大家/菜乃花&雨音&玲于奈",
|
113 |
+
"晴真&祐希《祐希》": "晴真&祐希/祐希",
|
114 |
+
"みんな《このみ&玲於奈&祐希》": "大家/木乃实&玲于奈&祐希",
|
115 |
+
"ソフト部員A": "软件部员A",
|
116 |
+
"ソフト部員B": "软件部员B",
|
117 |
+
"ソフト部員C": "软件部员C",
|
118 |
+
"みんな《雨音&玲於奈&祐希》": "大家/雨音&玲于奈&祐希",
|
119 |
+
"このみ&雨音": "木乃实&雨音",
|
120 |
+
"晴真&雨音《雨音》": "晴真&雨音/雨音",
|
121 |
+
"男の子1": "男子1",
|
122 |
+
"男の子2": "男子2",
|
123 |
+
"男の子3": "男子3",
|
124 |
+
"先生": "先生",
|
125 |
+
"アナウンス": "广播",
|
126 |
+
"女の人《時雨》": "女人/时雨",
|
127 |
+
"???《死者を送る者》": "?/送死人的人",
|
128 |
+
"村人1": "村人1",
|
129 |
+
"村人2": "村人2",
|
130 |
+
"村人3": "村人3",
|
131 |
+
"村長": "村长",
|
132 |
+
"桜木": "桜木",
|
133 |
+
"妄想このみ《このみ》": "妄想木乃实/木乃实",
|
134 |
+
"???《花梨》": "?/花梨",
|
135 |
+
"女子生徒《花梨》": "女学生/花梨",
|
136 |
+
"男子生徒《祐希》": "男学生/祐希》",
|
137 |
+
"女子生徒&男子生徒《花梨&祐希》": "女学生&男学生/花梨&祐希",
|
138 |
+
"晴真&女子生徒&男子生徒《花梨&祐希》": "晴真&女学生&男学生/花梨&祐希",
|
139 |
+
"???《真澄》": "?/真澄",
|
140 |
+
"晴真&このみ《このみ》": "晴真&木乃实/木乃实",
|
141 |
+
"このみ&潤": "木乃实&润",
|
142 |
+
"担任の先生": "班主任",
|
143 |
+
"菜乃花&花梨&祐希": "菜乃花&花梨&祐希",
|
144 |
+
"女子店員A": "女店员A",
|
145 |
+
"女子店員B": "女店员B",
|
146 |
+
"菜乃花&花梨": "菜乃花&花梨",
|
147 |
+
"晴真&菜乃花&花梨&祐希《菜乃花&花梨&祐希》": "晴真&菜乃花&花梨&祐希/菜乃花&花梨&祐希",
|
148 |
+
"晴真&花梨&祐希《花梨&祐希》": "晴真&花梨&祐希/花梨&祐希",
|
149 |
+
"晴真&雨音&祐希《雨音&祐希》": "晴真&雨音&祐希/雨音&祐希",
|
150 |
+
"ファンの男性A": "男粉丝A",
|
151 |
+
"マネージャーさん": "经理",
|
152 |
+
"ファンの男性B": "男粉丝B",
|
153 |
+
"菜乃花&このみ": "菜乃花&木乃实",
|
154 |
+
"チャラそうな金髪": "蓬松的金发",
|
155 |
+
"チャラそうな鼻ピアス": "可爱的鼻环", # ?
|
156 |
+
"ガタイがいいボス": "体格健壮的老板",
|
157 |
+
"野球少年A": "野球少年A",
|
158 |
+
"野球少年B": "野球少年B",
|
159 |
+
"菜乃花&潤": "菜乃花&润",
|
160 |
+
"一同《菜乃花&花梨&雨音&玲於奈&祐希》": "一同/菜乃花&花梨&雨音&玲于奈&祐希",
|
161 |
+
"心の声《菜乃花》": "旁白/菜乃花",
|
162 |
+
"氷雨": "冰雨", # 雨音线,时雨妹妹,雨音前世
|
163 |
+
"時雨&氷雨": "时雨&冰雨"
|
164 |
+
}
|
165 |
+
|
166 |
+
# =================
|
167 |
+
import re
|
168 |
+
reg_n = re.compile(r'\[Talk( [^] ]+?)? name=([^] ]+?)]')
|
169 |
+
reg_macCmd = re.compile(r'\[macCmd num=(\d) text=([^] ]+?)]')
|
170 |
+
# =================
|
171 |
+
for path in a:
|
172 |
+
name = path[path.rindex('\\'):]
|
173 |
+
name = name[:2]
|
174 |
+
if name not in sc:
|
175 |
+
sc[name] = []
|
176 |
+
print(name)
|
177 |
+
# =================
|
178 |
+
|
179 |
+
with open(path, 'r', encoding='utf-8') as f:
|
180 |
+
data = f.readlines()
|
181 |
+
|
182 |
+
# =================
|
183 |
+
macCmd = []
|
184 |
+
Hitret = True
|
185 |
+
for i,line in enumerate(data):
|
186 |
+
line = line.strip()
|
187 |
+
if line.startswith('[Hitret]'):
|
188 |
+
Hitret = True
|
189 |
+
continue
|
190 |
+
if 'exp="f.selans' in line:
|
191 |
+
|
192 |
+
try:
|
193 |
+
d = '选择:' + macCmd.pop()
|
194 |
+
sc[name].append('旁白' + ':' + d)
|
195 |
+
# print(d, line)
|
196 |
+
except IndexError as e:
|
197 |
+
if name == r'\@': # 懒得解析了,硬编码一下
|
198 |
+
break
|
199 |
+
else:
|
200 |
+
raise e
|
201 |
+
else:
|
202 |
+
if line.startswith('[if'):
|
203 |
+
continue
|
204 |
+
if line.startswith(';'):
|
205 |
+
continue
|
206 |
+
if line.isascii():
|
207 |
+
continue
|
208 |
+
tmp = reg_macCmd.findall(line)
|
209 |
+
if len(tmp) == 1:
|
210 |
+
macCmd = [tmp[0][1]] + macCmd
|
211 |
+
# print(macCmd)
|
212 |
+
continue
|
213 |
+
if line.startswith('[mac'):
|
214 |
+
continue
|
215 |
+
n = reg_n.findall(line)
|
216 |
+
# print(n)
|
217 |
+
if len(n) == 1:
|
218 |
+
n = n[0][1]
|
219 |
+
if n in _n:
|
220 |
+
n = _n[n]
|
221 |
+
else:
|
222 |
+
_n[n] = clearT(n)
|
223 |
+
print(line)
|
224 |
+
Hitret = False
|
225 |
+
nn = n
|
226 |
+
continue
|
227 |
+
else:
|
228 |
+
if Hitret:
|
229 |
+
nn = '旁白'
|
230 |
+
if line.startswith('['):
|
231 |
+
print(line)
|
232 |
+
else:
|
233 |
+
Hitret = False
|
234 |
+
if not Hitret:
|
235 |
+
d = clearT(line)
|
236 |
+
sc[name].append(nn + ':' + d)
|
237 |
+
assert not macCmd
|
238 |
+
|
239 |
+
# =================
|
240 |
+
|
241 |
+
for k, v in sc.items():
|
242 |
+
with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
|
243 |
+
f.write('\n'.join(v))
|
244 |
+
|
245 |
+
# =================
|
246 |
+
import json
|
247 |
+
tmp = json.dumps(_n, ensure_ascii=False, indent=2)
|