Upload 6 files
Browse files- v-corpus-zh/Sprite/苍之彼方的四重奏/本体/0-主线.txt.txt.gz +3 -0
- v-corpus-zh/Sprite/苍之彼方的四重奏/本体/1-明日香路线.txt.txt.gz +3 -0
- v-corpus-zh/Sprite/苍之彼方的四重奏/本体/2-真白路线.txt.txt.gz +3 -0
- v-corpus-zh/Sprite/苍之彼方的四重奏/本体/3-莉佳路线.txt.txt.gz +3 -0
- v-corpus-zh/Sprite/苍之彼方的四重奏/本体/4-美咲路线.txt.txt.gz +3 -0
- v-corpus-zh/Sprite/苍之彼方的四重奏/本体/苍之彼方的四重奏.py +196 -0
v-corpus-zh/Sprite/苍之彼方的四重奏/本体/0-主线.txt.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e267b550d54e7221887382650de8aac49bf893a1c7c5b977d60171a8dcb36bd2
|
3 |
+
size 316869
|
v-corpus-zh/Sprite/苍之彼方的四重奏/本体/1-明日香路线.txt.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ae62b5daed5c9d6a49cb191715a8aa2af70331f72d7f56894cf5332e61fd6c68
|
3 |
+
size 201018
|
v-corpus-zh/Sprite/苍之彼方的四重奏/本体/2-真白路线.txt.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c17c294a30008eaa4344581344c07527800753771cdca973be4929d0a1c0fb83
|
3 |
+
size 175737
|
v-corpus-zh/Sprite/苍之彼方的四重奏/本体/3-莉佳路线.txt.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2ee4e29fbe6535bf10b7b20f18fae4e1240d4f65c25fd0bd134c3c4911733755
|
3 |
+
size 178616
|
v-corpus-zh/Sprite/苍之彼方的四重奏/本体/4-美咲路线.txt.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:33212aa11f5f48df9ddc727033dbddbb254648bd4b74c874b6969690369f47c9
|
3 |
+
size 235646
|
v-corpus-zh/Sprite/苍之彼方的四重奏/本体/苍之彼方的四重奏.py
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
39 |
+
a = get_all_files_in_directory(r'E:\tmp\苍之彼方的四重奏', ext='.txt')
|
40 |
+
b = r'D:\datasets\tmp'
|
41 |
+
|
42 |
+
# =================
|
43 |
+
|
44 |
+
sc = {}
|
45 |
+
|
46 |
+
_n = {
|
47 |
+
"【女孩】": "女孩",
|
48 |
+
"【男孩】": "男孩",
|
49 |
+
"【晶也】": "晶也",
|
50 |
+
"【明日香】": "明日香",
|
51 |
+
"【葵】": "葵",
|
52 |
+
"【同学】": "同学",
|
53 |
+
"【美咲】": "美咲",
|
54 |
+
"【窗果】": "窗果",
|
55 |
+
"【真白】": "真白",
|
56 |
+
"【母亲】": "母亲",
|
57 |
+
"【莉佳】": "莉佳",
|
58 |
+
"【莉佳・晶也】": "莉佳&晶也",
|
59 |
+
"【???】": "?",
|
60 |
+
"【莎泰茵】": "莎泰茵",
|
61 |
+
"【男人】": "男人",
|
62 |
+
"【梓源】": "梓源",
|
63 |
+
"【佐藤院】": "佐藤院",
|
64 |
+
"【紫苑】": "紫苑",
|
65 |
+
"【大家】": "大家",
|
66 |
+
"【未萌】": "未萌",
|
67 |
+
"【白濑】": "白濑",
|
68 |
+
"【美咲・真白】": "美咲&真白",
|
69 |
+
"【真藤】": "真藤",
|
70 |
+
"【高藤女会员A】": "高藤女会员A",
|
71 |
+
"【高藤女会员B】": "高藤女会员B",
|
72 |
+
"【高藤女会员D】": "高藤女会员D",
|
73 |
+
"【高藤女会员E】": "高藤女会员E",
|
74 |
+
"【高藤女会员F】": "高藤女会员F",
|
75 |
+
"【高藤女会员D・E】": "高藤女会员D&E",
|
76 |
+
"【实里】": "实里",
|
77 |
+
"【全体】": "全体",
|
78 |
+
"【高藤女会员ABC】": "高藤女会员ABC",
|
79 |
+
"【高藤女会员C】": "高藤女会员C",
|
80 |
+
"【裁判】": "裁判",
|
81 |
+
"【飞行员】": "飞行员",
|
82 |
+
"【伊莉娜】": "伊莉娜",
|
83 |
+
"【牡丹】": "牡丹",
|
84 |
+
"【有梨华】": "有梨华",
|
85 |
+
"【茧】": "茧",
|
86 |
+
"【特里】": "特里",
|
87 |
+
"【男性教師A】": "男性教师A",
|
88 |
+
"【女店员】": "女店员",
|
89 |
+
"【沙希】": "沙希",
|
90 |
+
"【霞】": "霞",
|
91 |
+
"【观众A】": "观众A",
|
92 |
+
"【观众B】": "观众B",
|
93 |
+
"【观众C】": "观众C",
|
94 |
+
"【晶也・葵】": "晶也&葵",
|
95 |
+
"【老师】": "老师",
|
96 |
+
"【男学生A】": "男学生A",
|
97 |
+
"【女学生A】": "女学生A",
|
98 |
+
"【男学生B】": "男学生B",
|
99 |
+
"【学校广播】": "学校广播",
|
100 |
+
"【美咲・真白・紫苑】": "美咲&真白&紫苑",
|
101 |
+
"【京香】": "京香",
|
102 |
+
"【晶也・明日香】": "晶也&明日香",
|
103 |
+
"【射击店的大叔】": "射击店的大叔",
|
104 |
+
"【阿瓦隆社会员】": "阿瓦隆社会员",
|
105 |
+
"【广播】": "广播",
|
106 |
+
"【明日香・晶也】": "明日香&晶也",
|
107 |
+
"【邪神(真白)】": "邪神(真白)",
|
108 |
+
"【女学生B】": "女学生B",
|
109 |
+
"【久奈浜空竞部全体】": "久奈浜空竞部全体",
|
110 |
+
"【高藤空竞部全体】": "高藤空竞部全体",
|
111 |
+
"【高藤女学生】": "高藤女学生",
|
112 |
+
"【窗果・明日香・美咲】": "窗果&明日香&美咲",
|
113 |
+
"【猪(真白)】": "猪(真白)",
|
114 |
+
"【鸡(真白)】": "鸡(真白)",
|
115 |
+
"【牛(真白)】": "牛(真白)",
|
116 |
+
"【猪(莉佳)】": "猪(莉佳)",
|
117 |
+
"【鸡(莉佳)】": "鸡(莉佳)",
|
118 |
+
"【牛(莉佳)】": "牛(莉佳)",
|
119 |
+
"【莉佳・明日香】": "莉佳&明日香",
|
120 |
+
"【真白・美咲】": "真白&美咲",
|
121 |
+
"【真白・明日香】": "真白&明日香",
|
122 |
+
"【晶也・莉佳・佐藤院】": "晶也&莉佳&佐藤院",
|
123 |
+
"【高藤的会员】": "高藤的会员",
|
124 |
+
"【莉佳・美咲・真白】": "莉佳&美咲&真白",
|
125 |
+
"【明日香・莉佳】": "明日香&莉佳",
|
126 |
+
"【晶也・莉佳】": "晶也&莉佳",
|
127 |
+
"【睦月】": "睦月",
|
128 |
+
"【深雪】": "深雪",
|
129 |
+
"【晶也・明日香・真白】": "晶也&明日香&真白",
|
130 |
+
"【男孩A】": "男孩A",
|
131 |
+
"【男孩B】": "男孩B",
|
132 |
+
"【男孩C】": "男孩C",
|
133 |
+
"【晶也・美咲・明日香】": "晶也&美咲&明日香",
|
134 |
+
"【真白・窗果】": "真白&窗果",
|
135 |
+
"【窗果・真白・莉佳】": "窗果&真白&莉佳",
|
136 |
+
"【晶也・美咲】": "晶也&美咲",
|
137 |
+
"【莉佳・真白】": "莉佳&真白",
|
138 |
+
"【明日香・真白】": "明日香&真白",
|
139 |
+
"【蒙面选手】": "蒙面选手",
|
140 |
+
"【蒙面选手・白濑】": "蒙面选手&白濑",
|
141 |
+
"【晶也・紫苑】": "晶也&紫苑",
|
142 |
+
"【晶也・白濑・紫苑】": "晶也&白濑&紫苑",
|
143 |
+
"【四島】": "四岛",
|
144 |
+
"【美咲・沙希】": "美咲&沙希"
|
145 |
+
}
|
146 |
+
|
147 |
+
# =================
|
148 |
+
for path in a:
|
149 |
+
name = path[path.rindex('\\'):]
|
150 |
+
if name not in sc:
|
151 |
+
sc[name] = []
|
152 |
+
print(name)
|
153 |
+
# =================
|
154 |
+
|
155 |
+
with open(path, 'r', encoding='utf-8') as f:
|
156 |
+
data = list(filter(lambda x: x, (x.strip() for x in f.readlines())))
|
157 |
+
|
158 |
+
w_i = -1
|
159 |
+
while w_i < len(data) - 1:
|
160 |
+
w_i += 1
|
161 |
+
line = data[w_i]
|
162 |
+
line = line.split('␂')
|
163 |
+
assert len(line) == 5
|
164 |
+
line:str = line[-2]
|
165 |
+
|
166 |
+
if ':' in line:
|
167 |
+
if line.startswith('【'):
|
168 |
+
pass
|
169 |
+
else:
|
170 |
+
line = line.lstrip(':')
|
171 |
+
print(line)
|
172 |
+
if line.startswith('【'):
|
173 |
+
assert ':' in line
|
174 |
+
idx = line.index(':')
|
175 |
+
n = line[:idx]
|
176 |
+
if n in _n:
|
177 |
+
n = _n[n]
|
178 |
+
else:
|
179 |
+
_n[n] = clearT(n).strip('【】').replace('・', '&')
|
180 |
+
print(line)
|
181 |
+
line = line[idx + 1:]
|
182 |
+
else:
|
183 |
+
n = '旁白'
|
184 |
+
d = clearT(line)
|
185 |
+
if d:
|
186 |
+
sc[name].append(n + ':' + d)
|
187 |
+
|
188 |
+
# =================
|
189 |
+
|
190 |
+
for k, v in sc.items():
|
191 |
+
with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
|
192 |
+
f.write('\n'.join(v))
|
193 |
+
|
194 |
+
# =================
|
195 |
+
import json
|
196 |
+
tmp = json.dumps(_n, ensure_ascii=False, indent=4)
|