Upload 6 files
Browse files- v-corpus-zh/UGUISUKAGURA/纸上的魔法使/kisaki.txt.gz +3 -0
- v-corpus-zh/UGUISUKAGURA/纸上的魔法使/rio.txt.gz +3 -0
- v-corpus-zh/UGUISUKAGURA/纸上的魔法使/special.ks.txt.gz +3 -0
- v-corpus-zh/UGUISUKAGURA/纸上的魔法使/tmp_zsmfs.py +99 -0
- v-corpus-zh/UGUISUKAGURA/纸上的魔法使/yoruko.txt.gz +3 -0
- v-corpus-zh/UGUISUKAGURA/纸上的魔法使/主线.txt.gz +3 -0
v-corpus-zh/UGUISUKAGURA/纸上的魔法使/kisaki.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f68166c6ed11e2715f84db226a03c4a3718eb55a45281c4c9838a369e8506c56
|
3 |
+
size 28985
|
v-corpus-zh/UGUISUKAGURA/纸上的魔法使/rio.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fde92d20f048b05a054432161e7e80e3f168b8fc1eee1293b980d9ea5888c1e1
|
3 |
+
size 49841
|
v-corpus-zh/UGUISUKAGURA/纸上的魔法使/special.ks.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:02e1f4e3bfb2d1366944bf55e6535c22ad7fca9bcd013fc196143b03769c1f07
|
3 |
+
size 19873
|
v-corpus-zh/UGUISUKAGURA/纸上的魔法使/tmp_zsmfs.py
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import os
|
3 |
+
import re
|
4 |
+
import unicodedata
|
5 |
+
from opencc import OpenCC
|
6 |
+
|
7 |
+
|
8 |
+
def fullwidth_to_halfwidth(input_str):
|
9 |
+
return ''.join([unicodedata.normalize('NFKC', char) for char in input_str])
|
10 |
+
|
11 |
+
|
12 |
+
cc = OpenCC('t2s') # 't2s'表示繁体转简体
|
13 |
+
|
14 |
+
|
15 |
+
def clearT(s):
|
16 |
+
s = cc.convert(fullwidth_to_halfwidth(s))
|
17 |
+
return s.lstrip('n').strip().strip(r'\n').replace('\n', '\\n')
|
18 |
+
|
19 |
+
|
20 |
+
custom_sort_key_re = re.compile('([0-9]+)')
|
21 |
+
|
22 |
+
|
23 |
+
def custom_sort_key(s):
|
24 |
+
# 将字符串中的数字部分转换为整数,然后进行排序
|
25 |
+
return [int(x) if x.isdigit() else x for x in custom_sort_key_re.split(s)]
|
26 |
+
|
27 |
+
|
28 |
+
def get_all_files_in_directory(directory, ext=''):
|
29 |
+
all_files = []
|
30 |
+
for root, dirs, files in os.walk(directory):
|
31 |
+
for file in files:
|
32 |
+
if file.endswith(ext):
|
33 |
+
file_path = os.path.join(root, file)
|
34 |
+
all_files.append(file_path)
|
35 |
+
return sorted(all_files, key=lambda x: custom_sort_key(x))
|
36 |
+
|
37 |
+
|
38 |
+
def s_in(s, ss, es):
|
39 |
+
return [x.split(es)[0] for x in re.split(ss, s, flags=re.MULTILINE) if es in x]
|
40 |
+
|
41 |
+
|
42 |
+
a = get_all_files_in_directory(r'E:\tmp\zsmfs\ks', ext='.ks')
|
43 |
+
|
44 |
+
_n = {
|
45 |
+
"夜子": "夜子",
|
46 |
+
"琉璃": "瑠璃",
|
47 |
+
"妃": "妃",
|
48 |
+
"暗子": "暗子",
|
49 |
+
"理央": "理央",
|
50 |
+
"汀": "汀",
|
51 |
+
"彼方": "彼方",
|
52 |
+
"岬": "岬",
|
53 |
+
"学生": "学生",
|
54 |
+
"奏": "奏",
|
55 |
+
"父亲": "父亲",
|
56 |
+
"母亲": "母亲",
|
57 |
+
"医者": "医者",
|
58 |
+
"克丽索贝莉露": "莉露",
|
59 |
+
"クリソベリル": "瑠璃",
|
60 |
+
"かなた": "彼方",
|
61 |
+
"瑠璃": "瑠璃"
|
62 |
+
}
|
63 |
+
|
64 |
+
b = r'D:\datasets\tmp'
|
65 |
+
|
66 |
+
sc = {}
|
67 |
+
reg_n = re.compile(r'\[name fn=([^] ]+?)]')
|
68 |
+
reg_c = re.compile(r'(\[[^]]+?]| )')
|
69 |
+
|
70 |
+
for path in a:
|
71 |
+
tmp = path.split('_')
|
72 |
+
name = tmp[1]
|
73 |
+
if name.isdigit():
|
74 |
+
name = '主线'
|
75 |
+
if name not in sc:
|
76 |
+
sc[name] = []
|
77 |
+
print(name)
|
78 |
+
with open(path, encoding='utf-8') as f:
|
79 |
+
tmp = s_in(f.read(), r'^\*label[\d\-]+\|$', '[ps]')
|
80 |
+
for line in tmp:
|
81 |
+
n = reg_n.findall(line)
|
82 |
+
# print(n)
|
83 |
+
if len(n) == 1:
|
84 |
+
n = n[0]
|
85 |
+
# _n[n] = clearT(n)
|
86 |
+
n = _n[n]
|
87 |
+
else:
|
88 |
+
n = '旁白'
|
89 |
+
# if '「' in line:
|
90 |
+
# print(line)
|
91 |
+
line = clearT(reg_c.sub('', line))
|
92 |
+
if line and not line.startswith(r';'):
|
93 |
+
sc[name].append(n + ':' + line)
|
94 |
+
|
95 |
+
for k, v in sc.items():
|
96 |
+
with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
|
97 |
+
f.write('\n'.join(v))
|
98 |
+
|
99 |
+
tmp = json.dumps(_n, ensure_ascii=False, indent=2)
|
v-corpus-zh/UGUISUKAGURA/纸上的魔法使/yoruko.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6bfac55f69f757dfe16548114447f1c3862d6e88bbacbe772fc00e839c09d5b8
|
3 |
+
size 47543
|
v-corpus-zh/UGUISUKAGURA/纸上的魔法使/主线.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:831ad0018bfe0d96c631d57875d6a29ec58ba36ea8392465a4f1c23679e90adc
|
3 |
+
size 712176
|