与你共睹的梦境@yvu日常汉化
Browse files- v-corpus-zh/Laplacian/与你共睹的梦境/0.txt.gz +3 -0
- v-corpus-zh/Laplacian/与你共睹的梦境/NTM.txt.gz +3 -0
- v-corpus-zh/Laplacian/与你共睹的梦境/fes.txt.gz +3 -0
- v-corpus-zh/Laplacian/与你共睹的梦境/kyo.txt.gz +3 -0
- v-corpus-zh/Laplacian/与你共睹的梦境/mac.txt.gz +3 -0
- v-corpus-zh/Laplacian/与你共睹的梦境/mar.txt.gz +3 -0
- v-corpus-zh/Laplacian/与你共睹的梦境/mik.txt.gz +3 -0
- v-corpus-zh/Laplacian/与你共睹的梦境/mus.txt.gz +3 -0
- v-corpus-zh/Laplacian/与你共睹的梦境/nan.txt.gz +3 -0
- v-corpus-zh/Laplacian/与你共睹的梦境/oma.txt.gz +3 -0
- v-corpus-zh/Laplacian/与你共睹的梦境/shi.txt.gz +3 -0
- v-corpus-zh/Laplacian/与你共睹的梦境/yui.txt.gz +3 -0
- v-corpus-zh/Laplacian/与你共睹的梦境/yum.txt.gz +3 -0
- v-corpus-zh/Laplacian/与你共睹的梦境/与你共睹的梦境_ks.py +280 -0
v-corpus-zh/Laplacian/与你共睹的梦境/0.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9c484320e12ac8a81d8463d4f6423b59acac828ac7b3808dd0fe0faf555f7d28
|
3 |
+
size 56617
|
v-corpus-zh/Laplacian/与你共睹的梦境/NTM.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5713deae1386d4d1a7d4517ed3d91f1f0e22c9bcabf4e30e3049e372d6b51937
|
3 |
+
size 2806
|
v-corpus-zh/Laplacian/与你共睹的梦境/fes.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:baaacabe0fc5a510f7aa3b8b78ee3f44e200f3088cea4cd6c682e73ca2eb2e68
|
3 |
+
size 8954
|
v-corpus-zh/Laplacian/与你共睹的梦境/kyo.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:768e606924d56956ee7f93fbe70af9efb7f826575954702d7caab27b3b2864b0
|
3 |
+
size 67321
|
v-corpus-zh/Laplacian/与你共睹的梦境/mac.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eda4d5b65e09e0579263522a278b84308832b56d9b6b84e6a9355ef97f47031b
|
3 |
+
size 258
|
v-corpus-zh/Laplacian/与你共睹的梦境/mar.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6a8096c0d2c6b41cba40913483b126704e286f9c78111fa3864c062327fef4a6
|
3 |
+
size 55708
|
v-corpus-zh/Laplacian/与你共睹的梦境/mik.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cbb32f3ca3030fccd001d8a4d36da0af8a7b86e763b5889357fcb3497b2c6c43
|
3 |
+
size 28127
|
v-corpus-zh/Laplacian/与你共睹的梦境/mus.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ae6dfcb7e92ef832e50533ffa446ff5c281796ed00112bb3ad9fd49625bf0d7a
|
3 |
+
size 2391
|
v-corpus-zh/Laplacian/与你共睹的梦境/nan.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:04fd6cb8a504b56a7b058302a6e0f5a6b03eaddcdc18c57562f59f35a1fb0340
|
3 |
+
size 71694
|
v-corpus-zh/Laplacian/与你共睹的梦境/oma.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b3ce992ea25538962cdc7f1733c8eaeef2cf793bca050b5a02eabee944d54384
|
3 |
+
size 30901
|
v-corpus-zh/Laplacian/与你共睹的梦境/shi.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1039001e2d0295e7b16005bb5f2dd011916df274ceb244cd2bca81d75c4a911e
|
3 |
+
size 86554
|
v-corpus-zh/Laplacian/与你共睹的梦境/yui.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5ef2e731397aad9d6f4078d4f24662eeadd176dbc31f09a2eedc7016516b6335
|
3 |
+
size 65310
|
v-corpus-zh/Laplacian/与你共睹的梦境/yum.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a79d2e666be54ccc8762fff9a42b37bfe4f497390d4296a43f8e51303a156471
|
3 |
+
size 1007
|
v-corpus-zh/Laplacian/与你共睹的梦境/与你共睹的梦境_ks.py
ADDED
@@ -0,0 +1,280 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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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 |
+
|
39 |
+
a = get_all_files_in_directory(r'E:\tmp\与你共睹的梦境_', ext='.ks')
|
40 |
+
b = r'E:\tmp\与你共睹的梦境_\text'
|
41 |
+
|
42 |
+
|
43 |
+
# =================
|
44 |
+
def startsWithAny(s: str, keys):
|
45 |
+
for x in keys:
|
46 |
+
if s.startswith(x):
|
47 |
+
return x
|
48 |
+
else:
|
49 |
+
return False
|
50 |
+
|
51 |
+
|
52 |
+
def endsWithAny(s: str, keys):
|
53 |
+
for x in keys:
|
54 |
+
if s.endswith(x):
|
55 |
+
return x
|
56 |
+
else:
|
57 |
+
return False
|
58 |
+
|
59 |
+
|
60 |
+
def startsWithAlnum(s: str, _chrs):
|
61 |
+
retn = ''
|
62 |
+
for char in s:
|
63 |
+
if (char.isalnum()) or (char in _chrs):
|
64 |
+
retn += char
|
65 |
+
else:
|
66 |
+
break
|
67 |
+
return retn
|
68 |
+
|
69 |
+
|
70 |
+
def startsWithCmd(s: str, _chrs=None):
|
71 |
+
if _chrs is None:
|
72 |
+
_chrs = {'_', '@'}
|
73 |
+
cmd = startsWithAlnum(s, _chrs)
|
74 |
+
if cmd:
|
75 |
+
return s.startswith(cmd + ' ')
|
76 |
+
else:
|
77 |
+
return False
|
78 |
+
|
79 |
+
|
80 |
+
import re
|
81 |
+
|
82 |
+
reg_removeWait = re.compile(r'\[.+?]')
|
83 |
+
|
84 |
+
|
85 |
+
def removeWait(_line):
|
86 |
+
_tmp = reg_removeWait.sub('', _line)
|
87 |
+
if _tmp:
|
88 |
+
return _tmp
|
89 |
+
else:
|
90 |
+
return _line
|
91 |
+
|
92 |
+
|
93 |
+
def getCmdArgs(_cmd):
|
94 |
+
_args = ['']
|
95 |
+
_i = -1
|
96 |
+
_inQuota = ''
|
97 |
+
while _i < len(_cmd) - 1:
|
98 |
+
_i += 1
|
99 |
+
char = _cmd[_i]
|
100 |
+
if _inQuota:
|
101 |
+
_args[-1] += char
|
102 |
+
if char == _inQuota:
|
103 |
+
_inQuota = ''
|
104 |
+
elif char == '\\':
|
105 |
+
_i += 1
|
106 |
+
char = _cmd[_i]
|
107 |
+
_args[-1] += char
|
108 |
+
else:
|
109 |
+
pass
|
110 |
+
else:
|
111 |
+
if char == ' ':
|
112 |
+
_args.append('')
|
113 |
+
while _i < len(_cmd) - 1:
|
114 |
+
_i += 1
|
115 |
+
char = _cmd[_i]
|
116 |
+
if char != ' ':
|
117 |
+
_i -= 1
|
118 |
+
break
|
119 |
+
continue
|
120 |
+
elif char in {'"', "'"}:
|
121 |
+
_inQuota = char
|
122 |
+
else:
|
123 |
+
pass
|
124 |
+
_args[-1] += char
|
125 |
+
continue
|
126 |
+
return _args
|
127 |
+
|
128 |
+
|
129 |
+
def args2map(_args):
|
130 |
+
retn = {}
|
131 |
+
for _i in range(1, len(_args)):
|
132 |
+
_arg = _args[_i]
|
133 |
+
if '=' not in _arg:
|
134 |
+
if '=' in _arg:
|
135 |
+
_arg = _arg.replace('=', '=')
|
136 |
+
else:
|
137 |
+
continue
|
138 |
+
_idx = _arg.index('=')
|
139 |
+
_k = _arg[:_idx]
|
140 |
+
if '"' in _k or "'" in _k:
|
141 |
+
continue
|
142 |
+
_v = _arg[_idx + 1:]
|
143 |
+
if _v.startswith('"') or _v.startswith("'"):
|
144 |
+
_v = _v[1:len(_v) - 1]
|
145 |
+
retn[_k] = _v
|
146 |
+
return retn
|
147 |
+
|
148 |
+
|
149 |
+
# =================
|
150 |
+
|
151 |
+
sc = {}
|
152 |
+
|
153 |
+
_n = {
|
154 |
+
"???": "?",
|
155 |
+
"君与": "君与",
|
156 |
+
"医者": "医者",
|
157 |
+
"德米特里": "德米特里",
|
158 |
+
"红发少女": "红发少女",
|
159 |
+
"西崎": "西崎",
|
160 |
+
"美希": "美希",
|
161 |
+
"少年A": "少年A",
|
162 |
+
"少年B": "少年B",
|
163 |
+
"由衣": "由衣",
|
164 |
+
"茜": "茜",
|
165 |
+
"和树": "和树",
|
166 |
+
"幸树": "幸树",
|
167 |
+
"和树&幸树": "和树&幸树",
|
168 |
+
"奇怪的男人": "奇怪的男人",
|
169 |
+
"犬太": "犬太",
|
170 |
+
"担任": "担任",
|
171 |
+
"七之羽": "七之羽",
|
172 |
+
"千明": "千明",
|
173 |
+
"真里奈": "真里奈",
|
174 |
+
"班主任": "班主任",
|
175 |
+
"教师": "教师",
|
176 |
+
"中XX": "中?老师", # 中、什么、老师...
|
177 |
+
"初老的男性": "初老的男性",
|
178 |
+
"千岁": "千岁",
|
179 |
+
"东条父": "东条父",
|
180 |
+
"梦中少女": "梦中少女",
|
181 |
+
"时雨": "时雨",
|
182 |
+
"推荐语": "推荐语",
|
183 |
+
"美咲": "美咲",
|
184 |
+
"柊父": "柊父",
|
185 |
+
"老人": "老人",
|
186 |
+
"男学生": "男学生",
|
187 |
+
"女学生": "女学生",
|
188 |
+
"老爷爷": "老爷爷",
|
189 |
+
"众人": "众人",
|
190 |
+
"卢克": "卢克",
|
191 |
+
"美琴": "美琴",
|
192 |
+
"老奶奶": "老奶奶",
|
193 |
+
"千明?": "千明?",
|
194 |
+
"处女膜教授": "处女膜教授",
|
195 |
+
"芥末": "芥末",
|
196 |
+
"女子生徒": "女子生徒",
|
197 |
+
"汉娜": "汉娜",
|
198 |
+
"霞": "��",
|
199 |
+
"部员1": "部员1",
|
200 |
+
"部员2": "部员2",
|
201 |
+
"部员2": "部员2",
|
202 |
+
"部员1": "部员1",
|
203 |
+
"他校生1": "他校生1",
|
204 |
+
"他校生": "他校生",
|
205 |
+
"上都河希": "上都河希",
|
206 |
+
"梦中少女 ": "梦中少女",
|
207 |
+
"桃井犬": "桃井犬",
|
208 |
+
"救护车乘员": "救护车乘员"
|
209 |
+
}
|
210 |
+
|
211 |
+
# =================
|
212 |
+
for path in a:
|
213 |
+
name = path[path.rindex('\\'):]
|
214 |
+
name = name[1:4]
|
215 |
+
if name.isdigit():
|
216 |
+
name = '0'
|
217 |
+
if name not in sc:
|
218 |
+
sc[name] = []
|
219 |
+
print(name)
|
220 |
+
# =================
|
221 |
+
|
222 |
+
with open(path, 'r', encoding='utf-8') as f:
|
223 |
+
next(f)
|
224 |
+
data = list(filter(lambda x: (not x.startswith(';')),
|
225 |
+
(x.rstrip() for x in f.readlines())))
|
226 |
+
# =================
|
227 |
+
w_i = -1
|
228 |
+
gn = '旁白'
|
229 |
+
skip = False
|
230 |
+
while w_i < len(data) - 1:
|
231 |
+
w_i += 1
|
232 |
+
line: str = data[w_i]
|
233 |
+
# =================
|
234 |
+
if not line:
|
235 |
+
continue
|
236 |
+
if line.startswith('@lr'):
|
237 |
+
gn = '旁白'
|
238 |
+
skip = False
|
239 |
+
continue
|
240 |
+
if skip:
|
241 |
+
continue
|
242 |
+
if line.startswith('@noname'):
|
243 |
+
gn = '旁白'
|
244 |
+
continue
|
245 |
+
if line.startswith('@name'):
|
246 |
+
tmp = getCmdArgs(line)
|
247 |
+
tmp = args2map(tmp)
|
248 |
+
# print(tmp)
|
249 |
+
# {'src': '???'}
|
250 |
+
# {'': '君与', 'n': 'キミト'}
|
251 |
+
if 'src' in tmp:
|
252 |
+
n = tmp['src']
|
253 |
+
else:
|
254 |
+
n = tmp['']
|
255 |
+
if n in _n:
|
256 |
+
n = _n[n]
|
257 |
+
else:
|
258 |
+
# _n[n] = clearT(n).replace('/', '&')
|
259 |
+
# print(line)
|
260 |
+
skip = True
|
261 |
+
gn = n
|
262 |
+
continue
|
263 |
+
# =================
|
264 |
+
if startsWithAny(line, {'@', '*', '['}):
|
265 |
+
continue
|
266 |
+
line = removeWait(line)
|
267 |
+
d = clearT(line)
|
268 |
+
if d:
|
269 |
+
sc[name].append(gn + ':' + d)
|
270 |
+
|
271 |
+
# =================
|
272 |
+
|
273 |
+
for k, v in sc.items():
|
274 |
+
if v:
|
275 |
+
with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
|
276 |
+
f.write('\n'.join(v))
|
277 |
+
|
278 |
+
# =================
|
279 |
+
import json
|
280 |
+
tmp = json.dumps(_n, ensure_ascii=False, indent=4)
|