白日梦的构想图
Browse files
v-corpus-zh/Laplacian/白日梦的构想图/c.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2ff0233d35be0288b34c56bb56a8a5ac57811b54ea46103b01acb4eb41577d49
|
3 |
+
size 703221
|
v-corpus-zh/Laplacian/白日梦的构想图/scn2json.bat
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
chcp 65001
|
2 |
+
|
3 |
+
@echo off
|
4 |
+
setlocal enabledelayedexpansion
|
5 |
+
|
6 |
+
set "source_dir=E:\tmp\白日梦的构想图_\scn"
|
7 |
+
set "tool_path=D:\scn\FreeMoteToolkit\PsbDecompile.exe"
|
8 |
+
echo %source_dir%
|
9 |
+
|
10 |
+
for %%f in ("%source_dir%\*.scn") do (
|
11 |
+
set "file_path=%%f"
|
12 |
+
echo Processing !file_path!
|
13 |
+
"%tool_path%" "!file_path!"
|
14 |
+
)
|
15 |
+
|
16 |
+
echo All files processed.
|
17 |
+
|
18 |
+
endlocal
|
v-corpus-zh/Laplacian/白日梦的构想图/白日梦的构想图_scn.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().strip(r'\n').replace('\n', '\\n').replace('\r', '')
|
31 |
+
|
32 |
+
return _clearT
|
33 |
+
|
34 |
+
|
35 |
+
clearT = clearT()
|
36 |
+
|
37 |
+
# =================
|
38 |
+
|
39 |
+
a = get_all_files_in_directory(r'E:\tmp\白日梦的构想图_\scn', ext='.txt.json')
|
40 |
+
b = r'E:\tmp\白日梦的构想图_\txt'
|
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 |
+
"祥子": "祥子",
|
71 |
+
"有岛": "有岛",
|
72 |
+
"上层研究员": "上层研究员",
|
73 |
+
"里樱": "里樱",
|
74 |
+
"?": "?",
|
75 |
+
"渡边": "渡边",
|
76 |
+
"女学生": "女学生",
|
77 |
+
"男学生": "男学生",
|
78 |
+
"字节组长": "字节组长",
|
79 |
+
"品尝大妈": "品尝大妈",
|
80 |
+
"无毛的叔叔": "无毛的叔叔",
|
81 |
+
"鱼店老板": "鱼店老板",
|
82 |
+
"??": "?",
|
83 |
+
"熟客1": "熟客1",
|
84 |
+
"威尔": "威尔",
|
85 |
+
"熟客2": "熟客2",
|
86 |
+
"爱德": "爱德",
|
87 |
+
"罗布": "罗布",
|
88 |
+
"街人": "街人",
|
89 |
+
"看守1": "看守1",
|
90 |
+
"看守2": "看守2",
|
91 |
+
"团体顾客": "团体顾客",
|
92 |
+
"托马斯": "托马斯",
|
93 |
+
"琪琪&托马斯": "琪琪&托马斯",
|
94 |
+
"马洛": "马洛",
|
95 |
+
"布&爱德": "布&爱德",
|
96 |
+
"听众1": "听众1",
|
97 |
+
"听众2": "听众2",
|
98 |
+
"琪琪&托马斯&威尔": "琪琪&托马斯&威尔",
|
99 |
+
"赫米娅": "赫米娅",
|
100 |
+
"拉山德": "拉山德",
|
101 |
+
"帕克": "帕克",
|
102 |
+
"海伦": "海伦",
|
103 |
+
"一同": "一同",
|
104 |
+
"观客1": "观客1",
|
105 |
+
"观客2": "观客2",
|
106 |
+
"观客1&观客2": "观客1&观客2",
|
107 |
+
"哈姆雷特": "哈姆雷特",
|
108 |
+
"警官": "警官",
|
109 |
+
"警长": "警长",
|
110 |
+
"看守": "看守",
|
111 |
+
"伊丽莎白女王": "伊丽莎白女王",
|
112 |
+
"全员": "全员",
|
113 |
+
"安奈": "安奈",
|
114 |
+
"梓姬&康奈": "梓姬&康奈",
|
115 |
+
"男老师": "男老师",
|
116 |
+
"梓姫&李": "梓姫&李",
|
117 |
+
"接待老伯": "接待老伯",
|
118 |
+
"李&梓姬": "李&梓姬",
|
119 |
+
"斯宾瑟岚山": "斯宾瑟岚山",
|
120 |
+
"工作人员们": "工作人员们"
|
121 |
+
}
|
122 |
+
|
123 |
+
# =================
|
124 |
+
import json
|
125 |
+
|
126 |
+
for path in a:
|
127 |
+
name = path[path.rindex('\\'):]
|
128 |
+
name = name[:2]
|
129 |
+
if name not in sc:
|
130 |
+
sc[name] = []
|
131 |
+
print(name)
|
132 |
+
# =================
|
133 |
+
|
134 |
+
with open(path, 'r', encoding='utf-8') as json_file:
|
135 |
+
data = json.load(json_file)
|
136 |
+
|
137 |
+
# =================
|
138 |
+
for texts in data['scenes']:
|
139 |
+
try:
|
140 |
+
for texts in texts['texts']:
|
141 |
+
# print(texts)
|
142 |
+
n = texts[0]
|
143 |
+
if texts[1][0][0] is not None:
|
144 |
+
n = texts[1][0][0]
|
145 |
+
if n is None:
|
146 |
+
n = '旁白'
|
147 |
+
else:
|
148 |
+
if n in _n:
|
149 |
+
n = _n[n]
|
150 |
+
else:
|
151 |
+
_n[n] = clearT(n).replace('・', '&')
|
152 |
+
print(texts, n)
|
153 |
+
|
154 |
+
# =================
|
155 |
+
d = clearT(texts[1][0][1])
|
156 |
+
if d:
|
157 |
+
sc[name].append(n + ':' + d)
|
158 |
+
|
159 |
+
except KeyError:
|
160 |
+
if type(texts) is not dict:
|
161 |
+
print(texts)
|
162 |
+
|
163 |
+
# =================
|
164 |
+
|
165 |
+
for k, v in sc.items():
|
166 |
+
if v:
|
167 |
+
with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
|
168 |
+
f.write('\n'.join(v))
|
169 |
+
|
170 |
+
# =================
|
171 |
+
import json
|
172 |
+
tmp = json.dumps(_n, ensure_ascii=False, indent=4)
|