Datasets:

Languages:
Chinese
Tags:
Not-For-All-Audiences
License:
Limour commited on
Commit
61be8b3
·
verified ·
1 Parent(s): 8f4f365

Everlasting Flowers @ Sprite

Browse files
v-corpus-zh/Sprite/EverlastingFlowers/0.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74be90f9870884af5cd60312c24ca365ed99fecb7e85be7ff0e6876039dcbf03
3
+ size 137067
v-corpus-zh/Sprite/EverlastingFlowers/EverlastingFlowers_asset.py ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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().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\EverlastingFlowers_\asset', ext='.asset')
40
+ b = r'E:\tmp\EverlastingFlowers_\text'
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
+ import re
71
+
72
+ reg_removeWait = re.compile(r'\[.+?]')
73
+
74
+
75
+ def removeWait(_line):
76
+ _tmp = reg_removeWait.sub('', _line)
77
+ if _tmp:
78
+ return _tmp
79
+ else:
80
+ return _line
81
+
82
+
83
+ # =================
84
+
85
+ def startsWithAny(s: str, keys):
86
+ for x in keys:
87
+ if s.startswith(x):
88
+ return x
89
+ else:
90
+ return False
91
+
92
+
93
+ def indexWithAny(s: str, keys):
94
+ for x in keys:
95
+ if x in s:
96
+ idx = s.index(x)
97
+ return x, s[:idx], s[idx:]
98
+ else:
99
+ return False
100
+
101
+
102
+ def endsWithAny(s: str, keys):
103
+ for x in keys:
104
+ if s.endswith(x):
105
+ return x
106
+ else:
107
+ return False
108
+
109
+
110
+ def simpleSplit(_s: str, _sp, _st=0, _shift=True):
111
+ _idx = _s.index(_sp, _st)
112
+ if _shift:
113
+ return _s[:_idx], _s[_idx + len(_sp):]
114
+ else:
115
+ return _s[:_idx], _s[_idx:]
116
+
117
+
118
+ re_n = re.compile(r'^\s*zhCnName:\s?(.*)$')
119
+ re_d = re.compile(r'^\s*zhCnText:\s?(.*)$')
120
+ # =================
121
+ for path in a:
122
+ name = path[path.rindex('\\') + 1:]
123
+ print(name)
124
+ name = '0'
125
+ if name not in sc:
126
+ sc[name] = []
127
+ print(name)
128
+ # =================
129
+
130
+ with open(path, 'r', encoding='utf-8') as f:
131
+ data = list(x.rstrip() for x in f.readlines())
132
+ data[0] = data[0].lstrip('\ufeff')
133
+ # print(data[0][0])
134
+ data = list(filter(lambda x: x and (not x.startswith('%')), data))
135
+
136
+ # =================
137
+ w_i = -1
138
+ n = '旁白'
139
+ while w_i < len(data) - 1:
140
+ w_i += 1
141
+ line: str = data[w_i]
142
+ # =================
143
+ tmp = re_n.findall(line)
144
+ if tmp:
145
+ n = tmp[0]
146
+ if not n:
147
+ n = '旁白'
148
+ continue
149
+ if n in _n:
150
+ n = _n[n]
151
+ else:
152
+ _n[n] = clearT(n).replace('???', '?').replace('・', '&').replace('、', '&')
153
+ print(line)
154
+ continue
155
+ tmp = re_d.findall(line)
156
+ if tmp:
157
+ d = clearT(tmp[0])
158
+ if d:
159
+ sc[name].append(n + ':' + d)
160
+
161
+
162
+ # =================
163
+
164
+ for k, v in sc.items():
165
+ if v:
166
+ with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
167
+ f.write('\n'.join(v))
168
+
169
+ # =================
170
+ import json
171
+
172
+ tmp = json.dumps(_n, ensure_ascii=False, indent=4)