Datasets:

Languages:
Chinese
Tags:
Not-For-All-Audiences
License:
Limour commited on
Commit
7956f69
·
verified ·
1 Parent(s): 28fe1c1

Upload 4 files

Browse files
v-corpus-zh/Nanacan/妹调教日记/FD/1.txt.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:20d0c0a0e5f775d14e05200b47e2ade61a222576b8be3bce963ac76f075345e8
3
+ size 146213
v-corpus-zh/Nanacan/妹调教日记/FD/妹调FD_ns.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.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 -1
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
+ def startsWithAlnum(s: str, _l = False):
58
+ retn = ''
59
+ for char in s:
60
+ if char.isalnum() or (_l and char == '_'):
61
+ retn += char
62
+ else:
63
+ break
64
+ return retn
65
+
66
+
67
+ def startsWithCmd(s: str):
68
+ cmd = startsWithAlnum(s, _l=True)
69
+ if cmd:
70
+ return s.startswith(cmd + ' ')
71
+ else:
72
+ return False
73
+
74
+
75
+ # =================
76
+
77
+ a = get_all_files_in_directory(r'E:\tmp\妹调\1', ext='.txt')
78
+ b = r'D:\datasets\tmp'
79
+ # =================
80
+
81
+ sc = {}
82
+
83
+ _n = {
84
+ "a1": "穗奶香",
85
+ "a2": "姬月",
86
+ "a3": "诚",
87
+ "a4": "姬月&穗奶香",
88
+ "a5": "女将",
89
+ "a6": "?",
90
+ "a7": "女子",
91
+ "a8": "伊泽",
92
+ "a9": "小孩子",
93
+ "na": "女性a",
94
+ "nb": "女性b",
95
+ "ta": "路人a",
96
+ "tb": "路人b",
97
+ "tc": "路人c",
98
+ "td": "路人d",
99
+ "te": "路人e",
100
+ "ja": "游客a",
101
+ "jb": "游客b",
102
+ "jc": "游客c",
103
+ "ga": "游客d",
104
+ "gb": "游客e",
105
+ "gc": "游客f",
106
+ "ka": "游客g",
107
+ "kb": "游客h",
108
+ "kc": "游客i",
109
+ }
110
+ # =================
111
+ for path in a:
112
+ name = path[path.rindex('\\'):]
113
+ if name not in sc:
114
+ sc[name] = []
115
+ print(name)
116
+ # =================
117
+
118
+ with open(path, 'r', encoding='utf-8') as f:
119
+ data = list(filter(lambda x: not (x.startswith(';')),
120
+ (x.strip() for x in f.readlines())))
121
+
122
+
123
+ # =================
124
+ csel = {} # 分支选项
125
+ goto = set() # 懒得弄了
126
+ w_i = -1
127
+ while w_i < len(data) - 1:
128
+ w_i += 1
129
+ line = data[w_i]
130
+ if not line:
131
+ continue
132
+ if line.isascii():
133
+ if line.startswith('*'):
134
+ line = line[1:]
135
+ if line in goto:
136
+ continue
137
+ if line in csel:
138
+ line = csel[line]
139
+ tmp = '旁白' + ':' + line
140
+ if not sc[name] or sc[name][-1] != tmp:
141
+ if not sc[name][-1].startswith('旁白:选择:'):
142
+ print(line, sc[name][-1])
143
+ sc[name].append(tmp)
144
+ continue
145
+ else:
146
+ # print(line, csel)
147
+ continue
148
+ elif line.startswith('goto '):
149
+ goto.add(line[6:])
150
+ continue
151
+ elif line.startswith('fselect'):
152
+ while True:
153
+ w_i += 1
154
+ line = data[w_i].split(' ')
155
+ if len(line) != 3:
156
+ if len(line) == 4 and line[-1].startswith('*'):
157
+ csel[line[-1].lstrip('*')] = '选择:' + line[2]
158
+ else:
159
+ w_i -= 1
160
+ break
161
+ csel[line[1]] = '选择:' + line[2]
162
+ continue
163
+ else:
164
+ if line not in _n:
165
+ continue
166
+ if startsWithCmd(line):
167
+ continue
168
+ if line in _n:
169
+ n = _n[line]
170
+ while True:
171
+ w_i += 1
172
+ line = data[w_i]
173
+ if line == 'a0' or not line:
174
+ break
175
+ if line in _n:
176
+ w_i -= 1
177
+ break
178
+ if startsWithCmd(line):
179
+ continue
180
+ tmp = n + ':' + clearT(line)
181
+ sc[name].append(tmp)
182
+ else:
183
+ # print(line)
184
+ tmp = '旁白' + ':' + clearT(line)
185
+ sc[name].append(tmp)
186
+
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=2)
v-corpus-zh/Nanacan/妹调教日记/本体/0.txt.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5da042f9f0ed977589980e9c21ac9d18130fa5073b88e6d6eae47c2c649b248
3
+ size 287054
v-corpus-zh/Nanacan/妹调教日记/本体/妹调_ns.py ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 -1
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
+ def startsWithAlnum(s: str, _l = False):
58
+ retn = ''
59
+ for char in s:
60
+ if char.isalnum() or (_l and char == '_'):
61
+ retn += char
62
+ else:
63
+ break
64
+ return retn
65
+
66
+
67
+ def startsWithCmd(s: str):
68
+ cmd = startsWithAlnum(s, _l=True)
69
+ if cmd:
70
+ return s.startswith(cmd + ' ')
71
+ else:
72
+ return False
73
+
74
+
75
+ # =================
76
+
77
+ a = get_all_files_in_directory(r'E:\tmp\妹调\0', ext='.txt')
78
+ b = r'D:\datasets\tmp'
79
+ # =================
80
+
81
+ sc = {}
82
+
83
+ _n = {
84
+ "誠": "诚",
85
+ "??": "?",
86
+ "姫月": "姫月",
87
+ "穗乃香": "穗乃香",
88
+ "男性教師": "男性教师",
89
+ "小原": "小原",
90
+ "女生": "女生",
91
+ "雪名": "雪名",
92
+ "猫屋敷": "猫屋敷",
93
+ "男生A": "男生A",
94
+ "男生B": "男生B",
95
+ "男": "男",
96
+ "誠&姫月": "诚&姫月",
97
+ "俊成": "俊成",
98
+ "路人": "路人",
99
+ "男A": "男A",
100
+ "男B": "男B",
101
+ "店員": "店员",
102
+ "女性A": "女性A",
103
+ "女性B": "女性B",
104
+ "女性": "女性",
105
+ "男C": "男C",
106
+ "男D": "男D",
107
+ "大叔A": "大叔A",
108
+ "大叔B": "大叔B",
109
+ "女生A": "女生A",
110
+ "女生B": "女生B",
111
+ "女生C": "女生C",
112
+ "女生D": "女生D",
113
+ "女性教師": "女性教师",
114
+ "学生": "学生",
115
+ "男生C": "男生C",
116
+ "男優A": "男优A",
117
+ "男優B": "男优B",
118
+ "雪名&猫屋敷": "雪名&猫屋敷",
119
+ "佐々木": "佐佐木",
120
+ "大婶": "大婶",
121
+ "??\\": "?",
122
+ "清水": "清水",
123
+ "熊井": "熊井",
124
+ "田中": "田中",
125
+ "阪本": "阪本",
126
+ "男生": "男生",
127
+ "穗乃香母": "穗乃香母",
128
+ "快递员": "快递员",
129
+ "山川": "山川"
130
+ }
131
+ # =================
132
+ import re
133
+ cselr = re.compile(r'(",\*)|(,")')
134
+ for path in a:
135
+ name = path[path.rindex('\\'):]
136
+ if name not in sc:
137
+ sc[name] = []
138
+ print(name)
139
+ # =================
140
+
141
+ with open(path, 'r', encoding='utf-8') as f:
142
+ data = list(filter(lambda x: not (x.startswith(';')),
143
+ (x.strip() for x in f.readlines())))
144
+
145
+
146
+ # =================
147
+ csel = {} # 分支选项
148
+ goto = set() # 懒得弄了
149
+ for i, line in enumerate(data):
150
+ if line.isascii():
151
+ if line.startswith('*'):
152
+ line = line[1:]
153
+ if line in goto:
154
+ continue
155
+ if line in csel:
156
+ line = csel[line]
157
+ print(line, csel)
158
+ sc[name].append('旁白' + ':' + line)
159
+ else:
160
+ # print(line, csel)
161
+ continue
162
+ elif line.startswith('goto '):
163
+ goto.add(line[6:])
164
+ continue
165
+ else:
166
+ continue
167
+ if line.startswith('select '):
168
+ line = line[7:]
169
+ line = cselr.split(line)
170
+ assert len(line) % 2 == 0
171
+ line = [x for x in line if (x is not None and x not in ('",*', ',"'))]
172
+ for i in range(0, len(line), 2):
173
+ csel[line[i+1]] = '选择:' + line[i].strip('"')
174
+ continue
175
+ if not line.endswith('\\'):
176
+ continue
177
+ if startsWithCmd(line):
178
+ continue
179
+ tmp = listRfind(i, data,
180
+ lambda x: x.endswith('\\'),
181
+ lambda x: x,
182
+ delta=1)
183
+ tmp[-1] = tmp[-1][:-1]
184
+ tmp = list(filter(lambda x: not (x.isascii() or startsWithCmd(x)), tmp))
185
+ tmp = listRfind(len(tmp)-1, tmp,
186
+ lambda x: x.endswith(':'),
187
+ lambda x: x,
188
+ delta=0)
189
+ if len(tmp) == 1:
190
+ assert not tmp[0].endswith(':')
191
+ n = '旁白'
192
+ elif tmp[0].endswith(':'):
193
+ n = tmp[0][:-1]
194
+ tmp = tmp[1:]
195
+ if n in _n:
196
+ n = _n[n]
197
+ else:
198
+ _n[n] = clearT(n)
199
+ print(n, tmp)
200
+ else:
201
+ # print(tmp)
202
+ n = '旁白'
203
+ d = '\\n'.join(tmp)
204
+ d = clearT(d)
205
+ if d:
206
+ sc[name].append(n + ':' + d)
207
+
208
+ # =================
209
+
210
+ for k, v in sc.items():
211
+ with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
212
+ f.write('\n'.join(v))
213
+
214
+ # =================
215
+ import json
216
+ tmp = json.dumps(_n, ensure_ascii=False, indent=2)