Datasets:

Languages:
Chinese
Tags:
Not-For-All-Audiences
License:
Limour commited on
Commit
09e5b84
·
verified ·
1 Parent(s): 39a4825

Upload 2 files

Browse files
v-corpus-zh/Lose/爱上火车/爱上火车/86.py ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+ import re
4
+ import unicodedata
5
+ from opencc import OpenCC
6
+
7
+
8
+ def get_all_files_in_directory(directory, ext=''):
9
+ custom_sort_key_re = re.compile('([0-9]+)')
10
+
11
+ def custom_sort_key(s):
12
+ # 将字符串中的数字部分转换为整数,然后进行排序
13
+ return [int(x) if x.isdigit() else x for x in custom_sort_key_re.split(s)]
14
+
15
+ all_files = []
16
+ for root, dirs, files in os.walk(directory):
17
+ for file in files:
18
+ if file.endswith(ext):
19
+ file_path = os.path.join(root, file)
20
+ all_files.append(file_path)
21
+ return sorted(all_files, key=custom_sort_key)
22
+
23
+
24
+ def clearT():
25
+ def full2half(input_str):
26
+ return ''.join([unicodedata.normalize('NFKC', char) for char in input_str])
27
+
28
+ cc = OpenCC('t2s') # 't2s'表示繁体转简体
29
+
30
+ def _clearT(s):
31
+ s = cc.convert(full2half(s))
32
+ return s.lstrip('n').strip().strip(r'\n').replace('\n', '\\n')
33
+
34
+ return _clearT
35
+
36
+
37
+ clearT = clearT()
38
+
39
+ a = get_all_files_in_directory(r'E:\tmp\run', ext='.scn.m.json')
40
+
41
+ _n = {
42
+ "清美勝子": "司机",
43
+ "ハチロク": "八六",
44
+ None: '旁白',
45
+ "双鉄": "双铁",
46
+ "凪": "凪",
47
+ "ふかみ": "深美",
48
+ "ポーレット": "波莱特",
49
+ "れいな": "玲奈",
50
+ "日々姫": "日日姬",
51
+ "元忠": "元忠",
52
+ "稀咲": "稀咲",
53
+ "浦上": "浦上",
54
+ "まゆ": "茉祐",
55
+ "真闇": "真闇",
56
+ "機内放送": "机内广播",
57
+ "CA": "CA",
58
+ "おじさん": "大叔",
59
+ "赤井宮司": "赤井宫司",
60
+ "永山": "永山",
61
+ "コン": "空",
62
+ "赤井": "赤井",
63
+ "ニイロク": "二六",
64
+ "路子": "路子",
65
+ "帝鉄職員A": "帝铁职员A",
66
+ "右田泰斗": "帝铁职员B",
67
+ "帝鉄職員C": "帝铁职员C",
68
+ "蓑笠": "蓑笠",
69
+ "登呂流湯主人": "登吕流浴场老板",
70
+ "ナビ": "Navi",
71
+ "学園生A": "学生A",
72
+ "シロ": "四六",
73
+ "斎藤": "斋藤",
74
+ "西瓜": "西瓜",
75
+ "姜": "姜",
76
+ "オリヴィ": "奥莉薇",
77
+ "宗方": "宗方",
78
+ "電車区長": "电车段长",
79
+ "技工A": "技工A",
80
+ "技工B": "技工B",
81
+ "クリーニング屋": "洗衣店老板",
82
+ "雀": "加藤雀",
83
+ "志寰": "志寰",
84
+ "電車姫": "电车公主",
85
+ "後東": "后东",
86
+ "先輩": "前辈",
87
+ "女子A": "女性们",
88
+ "女子B": "女性B",
89
+ "おじいさん": "爷爷",
90
+ "おばあさん": "老奶奶",
91
+ "美馬": "美马",
92
+ "乗客A": "乘客A",
93
+ "乗客B": "乘客B",
94
+ "宮本": "宫本",
95
+ "男性": "男人",
96
+ "透": "透",
97
+ "女性": "女人",
98
+ "女教師": "女教师",
99
+ "男性議員": "男议员",
100
+ "ヤジ": "起哄声",
101
+ "議長": "议长",
102
+ "主審": "主裁判",
103
+ "中村": "中村",
104
+ "会社員": "公司职员",
105
+ "くまくま": "熊熊",
106
+ "十九号": "十九号",
107
+ "おっさん": "大叔",
108
+ "児童": "儿童",
109
+ "ご老人": "老人",
110
+ "流": "流",
111
+ "治": "治",
112
+ "堰": "堰",
113
+ "父": "父亲",
114
+ "母": "母亲",
115
+ "乗客C": "乘客C",
116
+ "車内販売": "车内商店",
117
+ "車椅子の方": "坐轮椅的人",
118
+ "鈴木": "铃木",
119
+ "観光客A": "游客A",
120
+ "観光客B": "游客B",
121
+ "ちびっこ": "小孩",
122
+ "母親": "母亲",
123
+ "女性議員": "女议员",
124
+ "中堅議員": "中坚议员",
125
+ "みくろ": "美玖路",
126
+ "債権者B": "债权人B",
127
+ "債権者A": "债权人A",
128
+ "老議員": "老议员",
129
+ "記者A": "记者A",
130
+ "幸三": "幸三",
131
+ "マイア": "迈娅",
132
+ "ひよこ": "不死鸟",
133
+ "技工": "技工",
134
+ "学園生B": "学生B",
135
+ "雲山": "云山",
136
+ "早瀬流": "早赖流",
137
+ "ざわめきB": "嘈杂声",
138
+ "ざわめきC": "嘈杂声",
139
+ "場内アナウンス": "场内广播",
140
+ "幼女": "幼女",
141
+ "レポーター": "记者",
142
+ "TVアナウンサー": "电视主持人",
143
+ "早瀬堰": "早赖堰",
144
+ "議員": "议员",
145
+ "職員A": "职员A",
146
+ "職員B": "职员B",
147
+ "駐車場係": "停车场管理员",
148
+ "警備員": "保安",
149
+ "経産大臣": "经济产业大臣",
150
+ "文科大臣": "文科大臣",
151
+ "ひかり": "光",
152
+ "新津": "新津",
153
+ "山崎": "山崎",
154
+ "こだま": "小玉",
155
+ "のぞみ": "?",
156
+ "木本": "木本",
157
+ "車掌": "列车长",
158
+ "湯富院市長": "汤布院市长",
159
+ "駅員": "工作人员",
160
+ "乗客D": "乘客D",
161
+ "観光協会": "旅游协会",
162
+ "お店の人": "店员",
163
+ "こけし職人": "木芥子工匠",
164
+ "ご婦人": "妇人",
165
+ "おかあさん": "妈妈",
166
+ "しょうちゃん": "小正",
167
+ "男の子": "男生",
168
+ "児童a": "儿童A",
169
+ "児童b": "儿童B",
170
+ "おばあちゃん": "老奶奶",
171
+ "仲居": "服务员",
172
+ "カップル女": "情侣女",
173
+ "カップル男": "情侣男",
174
+ "サッカー少年A": "踢足球的小孩A",
175
+ "サッカー少年B": "踢足球的小孩B",
176
+ "サッカー少年C": "踢足球的小孩C",
177
+ "観光の老夫人": "游客老夫人",
178
+ "観光の老紳士": "游客老先生",
179
+ "幼子": "孩子",
180
+ "若い母親": "年轻的母亲",
181
+ "栃木": "枥木",
182
+ "特産品売り": "特产店",
183
+ "観光客": "游客",
184
+ "学園長": "校长"
185
+ }
186
+
187
+ b = r'D:\datasets\tmp'
188
+ sc = {}
189
+
190
+ for path in a:
191
+ name = '86'
192
+ if name not in sc:
193
+ sc[name] = []
194
+ print(name)
195
+ with open(path, 'r', encoding='utf-8') as json_file:
196
+ data = json.load(json_file)
197
+
198
+ for texts in data['scenes']:
199
+ try:
200
+ for texts in texts['texts']:
201
+ # print(texts)
202
+ n = texts[0]
203
+ # _n[n] = texts[1][1][0]
204
+ n = _n[n]
205
+ d = clearT(texts[1][1][1])
206
+ if d:
207
+ sc[name].append(n + ':' + d)
208
+ pass
209
+ except KeyError:
210
+ if type(texts) is not dict:
211
+ print(texts)
212
+
213
+
214
+ for k, v in sc.items():
215
+ with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
216
+ f.write('\n'.join(v))
217
+
218
+ tmp = json.dumps(_n, ensure_ascii=False, indent=2)
v-corpus-zh/Lose/爱上火车/爱上火车/86.txt.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a65704295a4f88faabb0a1c2fc60e92588fea5487d1d058209f15f58688819a6
3
+ size 1899714