Datasets:

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

Upload 7 files

Browse files
v-corpus-zh/BugSystem/真爱的百合被染成红色/s01.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84b9f1542a0852c8cc1b379f2dfe894e51e894dc61eece0bae20c4958871c593
3
+ size 34686
v-corpus-zh/BugSystem/真爱的百合被染成红色/s02.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:18d8145b73025b68ccc2a160cf03fec95290ef72d01f5ba74b9721c0558be3f6
3
+ size 54468
v-corpus-zh/BugSystem/真爱的百合被染成红色/s03.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e17cbb16c0e3f2b096d0aca37f1b639f203e9024e45b3ccb32f9da1a65495c6
3
+ size 23104
v-corpus-zh/BugSystem/真爱的百合被染成红色/s04.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3833c42fb389a579f56a3cfab9781c421803df283332a45000ade5fb0f2895e4
3
+ size 115865
v-corpus-zh/BugSystem/真爱的百合被染成红色/s05.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3e95bf84cdc897c278a2fe6ce73ddb5b79251984370e06f1fed3e87c904dea3
3
+ size 103140
v-corpus-zh/BugSystem/真爱的百合被染成红色/zahb_scn.py ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
39
+ a = get_all_files_in_directory(r'E:\tmp\zabh\scn', ext='.txt.json')
40
+ b = r'D:\datasets\tmp'
41
+
42
+ # =================
43
+
44
+ sc = {}
45
+
46
+ _n = {
47
+ "真奈美": "真奈美",
48
+ "吉泽": "吉泽",
49
+ "爱实": "爱实",
50
+ "女子学徒A": "女学生A",
51
+ "女子学徒B": "女学生B",
52
+ "女子学徒C": "女学生C",
53
+ "真奈美的母亲": "真奈美的母亲",
54
+ "优子": "优子",
55
+ "摇摇晃晃的男人": "摇摇晃晃的男人",
56
+ "机场职员": "机场工作人员",
57
+ "神父": "神父",
58
+ "护士A": "护士A",
59
+ "护士B": "护士B"
60
+ }
61
+
62
+ # =================
63
+ import json
64
+
65
+ for path in a:
66
+ name = path[path.rindex('\\'):]
67
+ name = name[:4]
68
+ if name not in sc:
69
+ sc[name] = []
70
+ print(name)
71
+ # =================
72
+
73
+ with open(path, 'r', encoding='utf-8') as json_file:
74
+ data = json.load(json_file)
75
+
76
+ # =================
77
+ for texts in data['scenes']:
78
+ try:
79
+ for texts in texts['texts']:
80
+ # print(texts)
81
+ n = texts[0]
82
+ if n is None:
83
+ n = '旁白'
84
+ else:
85
+ # _n[n] = clearT(texts[1])
86
+ n = _n[n]
87
+
88
+ # =================
89
+ d = clearT(texts[2])
90
+ if d:
91
+ sc[name].append(n + ':' + d)
92
+
93
+ except KeyError:
94
+ if type(texts) is not dict:
95
+ print(texts)
96
+
97
+ # =================
98
+
99
+ for k, v in sc.items():
100
+ with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
101
+ f.write('\n'.join(v))
102
+
103
+ # =================
104
+ import json
105
+ tmp = json.dumps(_n, ensure_ascii=False, indent=2)
v-corpus-zh/BugSystem/真爱的百合被染成红色/解剖プ.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e1b70fbfed7188b8ce7c99c3fa038bd4e039bbe17a3ef2f333b3bc4a338dbaa8
3
+ size 9291