Upload 6 files
Browse files- v-corpus-zh/SilverBullet/妹びらいざー!/00main.scn.txt.gz +3 -0
- v-corpus-zh/SilverBullet/妹びらいざー!/01saki.scn.txt.gz +3 -0
- v-corpus-zh/SilverBullet/妹びらいざー!/02yui.scn.txt.gz +3 -0
- v-corpus-zh/SilverBullet/妹びらいざー!/03mizuumi.scn.txt.gz +3 -0
- v-corpus-zh/SilverBullet/妹びらいざー!/04izumi.scn.txt.gz +3 -0
- v-corpus-zh/SilverBullet/妹びらいざー!/妹锁_ks.py +128 -0
v-corpus-zh/SilverBullet/妹びらいざー!/00main.scn.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0cb049f96a9aecdb8baf74c22e4ec5195b7173705101ce67d33d6b754b47d919
|
3 |
+
size 93452
|
v-corpus-zh/SilverBullet/妹びらいざー!/01saki.scn.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d0dabae75d7e59ad2b0c563777b0ddce2b47c05a4d21a213184938431f3b4289
|
3 |
+
size 99840
|
v-corpus-zh/SilverBullet/妹びらいざー!/02yui.scn.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d31ca00bb4fee8305d81fc3d3716645f7cce9534f2c337e0deffca1d32b356fd
|
3 |
+
size 66948
|
v-corpus-zh/SilverBullet/妹びらいざー!/03mizuumi.scn.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9ea62e2608de63e4d4ab90ac3e73355af02c587431961086f7d4b9366a1bd7f7
|
3 |
+
size 69764
|
v-corpus-zh/SilverBullet/妹びらいざー!/04izumi.scn.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:28b3abf385e731a1f77cfba0045face7d14d1b90e50ffbd367861313840a22c7
|
3 |
+
size 67107
|
v-corpus-zh/SilverBullet/妹びらいざー!/妹锁_ks.py
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
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 |
+
|
57 |
+
a = get_all_files_in_directory(r'E:\tmp\妹锁\ks\scn', ext='.scn')
|
58 |
+
b = r'D:\datasets\tmp'
|
59 |
+
|
60 |
+
# =================
|
61 |
+
|
62 |
+
sc = {}
|
63 |
+
|
64 |
+
_n = {
|
65 |
+
"???": "?",
|
66 |
+
"咲姬": "咲姬",
|
67 |
+
"丈": "丈",
|
68 |
+
"湖": "湖",
|
69 |
+
"唯": "唯",
|
70 |
+
"恶友A": "恶友A",
|
71 |
+
"恶友B": "恶友B",
|
72 |
+
"恶友C": "恶友C",
|
73 |
+
"老师": "老师",
|
74 |
+
"泉美": "泉美",
|
75 |
+
"三人": "三人",
|
76 |
+
"悪友A": "悪友A",
|
77 |
+
"悪友B": "悪友B",
|
78 |
+
"教師": "教师"
|
79 |
+
}
|
80 |
+
|
81 |
+
# =================
|
82 |
+
for path in a:
|
83 |
+
name = path[path.rindex('\\'):]
|
84 |
+
if name not in sc:
|
85 |
+
sc[name] = []
|
86 |
+
print(name)
|
87 |
+
# =================
|
88 |
+
|
89 |
+
with open(path, 'r', encoding='utf-16-le') as f:
|
90 |
+
next(f) # BOM
|
91 |
+
data = list(filter(lambda x: not x.startswith('//'), (x.rstrip() for x in f.readlines())))
|
92 |
+
|
93 |
+
w_i = -1
|
94 |
+
while w_i < len(data) - 1:
|
95 |
+
w_i += 1
|
96 |
+
line = data[w_i]
|
97 |
+
if not (startsWithAny(line, (' ', '【')) or line.endswith('」')):
|
98 |
+
continue
|
99 |
+
if line.endswith('」'):
|
100 |
+
assert line.startswith('【')
|
101 |
+
if line.startswith('【'):
|
102 |
+
assert '】' in line
|
103 |
+
idx = line.index('】')
|
104 |
+
n = line[1:idx]
|
105 |
+
if n in _n:
|
106 |
+
n = _n[n]
|
107 |
+
else:
|
108 |
+
_n[n] = clearT(n)
|
109 |
+
print(line)
|
110 |
+
line = line[idx+1:]
|
111 |
+
tmp = startsWithAlnum(line, {'(', ')', '_'})
|
112 |
+
if tmp:
|
113 |
+
line = line[len(tmp):]
|
114 |
+
else:
|
115 |
+
n = '旁白'
|
116 |
+
d = clearT(line)
|
117 |
+
if d:
|
118 |
+
sc[name].append(n + ':' + d)
|
119 |
+
|
120 |
+
# =================
|
121 |
+
|
122 |
+
for k, v in sc.items():
|
123 |
+
with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
|
124 |
+
f.write('\n'.join(v))
|
125 |
+
|
126 |
+
# =================
|
127 |
+
import json
|
128 |
+
tmp = json.dumps(_n, ensure_ascii=False, indent=2)
|