Datasets:

Languages:
Chinese
Tags:
Not-For-All-Audiences
License:
Limour commited on
Commit
b6ac404
·
verified ·
1 Parent(s): 93d319c

Upload 3 files

Browse files
v-corpus-zh/Smilesenki/是谁杀了知更鸟/0.txt.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:130c63722b23e2873223610b630b53f84febcb4ac4634376542b720c14532e15
3
+ size 209319
v-corpus-zh/Smilesenki/是谁杀了知更鸟/nt2txt.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # https://nnnewb.github.io/blog/p/go%E8%AF%AD%E8%A8%80%E5%AE%9E%E6%88%98%E4%B9%8B%E8%A7%A3%E5%AF%86ons%E8%84%9A%E6%9C%AC/
2
+ with open(r'H:\【MINE】【KR移植ONS】【汉化】是谁杀了知更鸟\onscript.nt2', 'rb') as fi:
3
+ buf = bytearray(fi.read())
4
+ nt2 = True
5
+ if nt2:
6
+ for i in range(len(buf)):
7
+ buf[i] = (buf[i] ^ (0x85 & 0x97)) - 1
8
+ else:
9
+ for i in range(len(buf)):
10
+ buf[i] ^= 0x84
11
+ with open(r'E:\tmp\小鸟\0.txt', 'wb') as fo:
12
+ fo.write(buf)
v-corpus-zh/Smilesenki/是谁杀了知更鸟/是谁杀了知更鸟_ns.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 listRfind_idx(_i, _data, _condition):
39
+ for j in range(_i - 1, -1, -1):
40
+ if _condition(_data[j]):
41
+ return j
42
+ return _i
43
+
44
+
45
+ def listRfind(_i, _data, _condition, _filter, delta=1):
46
+ return list(filter(_filter, _data[listRfind_idx(_i, _data, _condition) + delta:_i + 1]))
47
+
48
+
49
+ def startsWithAny(s: str, keys):
50
+ for x in keys:
51
+ if s.startswith(x):
52
+ return x
53
+ else:
54
+ return False
55
+
56
+
57
+ # =================
58
+
59
+ a = get_all_files_in_directory(r'E:\tmp\小鸟', ext='.txt')
60
+ b = r'D:\datasets\tmp'
61
+
62
+ # =================
63
+
64
+ sc = {}
65
+
66
+ _n = {
67
+ "window": "旁白",
68
+ "window_k": "小鸟",
69
+ "window_r": "兰老师",
70
+ "window_h": "翔"
71
+ }
72
+
73
+ # =================
74
+ for path in a:
75
+ name = path[path.rindex('\\'):]
76
+ name = name[:11]
77
+ if name not in sc:
78
+ sc[name] = []
79
+ print(name)
80
+ # =================
81
+
82
+ with open(path, 'r', encoding='utf-8') as f:
83
+ data = [x.strip() for x in f.readlines() if not x.startswith(';')]
84
+
85
+ for i, line in enumerate(data):
86
+ if not line.endswith('\\'):
87
+ continue
88
+
89
+ tmp = listRfind(i, data, lambda x: (not x) or x.endswith('\\'),
90
+ lambda x: x
91
+ and not startsWithAny(x, ('voice', 'lsp ', 'mov ', 'evs', 'csp', 'bgmstop',
92
+ '*k', '*r', 'quake'))
93
+ and not (x.isascii() and ' ' in x),
94
+ delta=1)
95
+ if not tmp:
96
+ continue
97
+ tmp[-1] = tmp[-1].rstrip('\\')
98
+ if tmp[0].isascii():
99
+ n = tmp[0]
100
+ if n in _n:
101
+ n = _n[n]
102
+ else:
103
+ _n[n] = clearT(n)
104
+ print(tmp)
105
+ else:
106
+ n = '旁白'
107
+
108
+ d = '\\n'.join(x for x in tmp if not x.isascii())
109
+ d = clearT(d)
110
+ if d:
111
+ sc[name].append(n + ':' + d)
112
+
113
+ # =================
114
+
115
+ for k, v in sc.items():
116
+ with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
117
+ f.write('\n'.join(v))
118
+
119
+ # =================
120
+ import json
121
+ tmp = json.dumps(_n, ensure_ascii=False, indent=2)