圣女不死心@小鳥遊クリ
Browse files
v-corpus-zh/VISUAL_ARTS/圣女不死心/0.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:813664a8f3c86a9dc4c61ca06463d3367e2a9178c9da69dbd7e2a6cdeb3e5708
|
3 |
+
size 185267
|
v-corpus-zh/VISUAL_ARTS/圣女不死心/圣女不死心_ast.py
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import sys
|
2 |
+
sys.path.append('..')
|
3 |
+
|
4 |
+
from common import \
|
5 |
+
get_all_files_in_directory, clearT, \
|
6 |
+
getBracketContent, ast2list, astStrip, astGet
|
7 |
+
# https://huggingface.co/datasets/Limour/archvie/blob/main/v-corpus-zh/common.py
|
8 |
+
|
9 |
+
# =================
|
10 |
+
|
11 |
+
a = get_all_files_in_directory(r'E:\galgame\圣女不死心\script', ext='.ast')
|
12 |
+
b = r'E:\galgame\圣女不死心\text'
|
13 |
+
|
14 |
+
# =================
|
15 |
+
|
16 |
+
sc = {}
|
17 |
+
_n = {
|
18 |
+
"少年战士" : "少年战士",
|
19 |
+
"哥布林" : "哥布林",
|
20 |
+
"少年斥候" : "少年斥候",
|
21 |
+
"少女魔法师" : "少女魔法师",
|
22 |
+
"银白色发色的少女" : "银白色发色的少女",
|
23 |
+
"该隐" : "该隐",
|
24 |
+
"芙劳拉" : "芙劳拉",
|
25 |
+
"范高尔" : "范高尔",
|
26 |
+
"???" : "?",
|
27 |
+
"小尤莉" : "小尤莉",
|
28 |
+
"堇" : "堇",
|
29 |
+
"小阿列克" : "小阿列克",
|
30 |
+
"尤莉西娅" : "尤莉西娅",
|
31 |
+
"士兵" : "士兵",
|
32 |
+
"居民A" : "居民A",
|
33 |
+
"居民B" : "居民B",
|
34 |
+
"乌尔菲洛斯" : "乌尔菲洛斯",
|
35 |
+
"萨娜托莉娅" : "萨娜托莉娅",
|
36 |
+
"贵族" : "贵族",
|
37 |
+
"居民C" : "居民C",
|
38 |
+
"阿列克" : "阿列克",
|
39 |
+
"圣母骑士团" : "圣母骑士团",
|
40 |
+
"科迪斯" : "科迪斯",
|
41 |
+
"埃梅劳达斯" : "埃梅劳达斯",
|
42 |
+
"埃尔迈耶" : "埃尔迈耶",
|
43 |
+
"乌尔菲" : "乌尔菲",
|
44 |
+
"冒险者A" : "冒险者A",
|
45 |
+
"冒险者B" : "冒险者B",
|
46 |
+
"冒险者C" : "冒险者C",
|
47 |
+
"小混混" : "小混混",
|
48 |
+
"少年" : "少年",
|
49 |
+
"菲达" : "菲达",
|
50 |
+
"英灵少女" : "英灵少女",
|
51 |
+
"朱赞娜" : "朱赞娜",
|
52 |
+
"女骑士" : "女骑士",
|
53 |
+
"安娜梅丽" : "安娜梅丽",
|
54 |
+
"黑发侍女" : "黑发侍女",
|
55 |
+
"侍女们" : "侍女们",
|
56 |
+
"绿发侍女" : "绿发侍女",
|
57 |
+
"金发侍女" : "金发侍女",
|
58 |
+
"侍女" : "侍女",
|
59 |
+
"西莫尔" : "西莫尔",
|
60 |
+
"蕾娜" : "蕾娜",
|
61 |
+
"尤娜" : "尤娜",
|
62 |
+
"玛娜" : "玛娜",
|
63 |
+
"保姆" : "保姆",
|
64 |
+
"涅比罗斯" : "涅比罗斯",
|
65 |
+
"王都卫兵" : "王都卫兵",
|
66 |
+
"王都卫兵 A" : "王都卫兵A",
|
67 |
+
"王都卫兵B" : "王都卫兵B",
|
68 |
+
"王都卫兵C" : "王都卫兵C",
|
69 |
+
"僵尸" : "僵尸",
|
70 |
+
"骷髅" : "骷髅",
|
71 |
+
"鬼魂" : "鬼魂",
|
72 |
+
"警备队员A" : "警备队员A",
|
73 |
+
"警备队员B" : "警备队员B",
|
74 |
+
"巴克贝亚德" : "巴克贝亚德",
|
75 |
+
"骷髅死灵术士" : "骷髅死灵术士",
|
76 |
+
"涅比拉" : "涅比拉",
|
77 |
+
"安娜斯塔西娅" : "安娜斯塔西娅",
|
78 |
+
"女学生A" : "女学生A",
|
79 |
+
"女学生B" : "女学生B",
|
80 |
+
"欧尔坦丝" : "欧尔坦丝",
|
81 |
+
"随从学生" : "随从学生",
|
82 |
+
"卡洛特莉娜" : "卡洛特莉娜",
|
83 |
+
"女学生C" : "女学生C",
|
84 |
+
"小鸟" : "小鸟",
|
85 |
+
"爱德华" : "爱德华",
|
86 |
+
"卡梅伦" : "卡梅伦",
|
87 |
+
"尤莉西娅&卡梅伦" : "尤莉西娅&卡梅伦",
|
88 |
+
"尤娜&玛娜&蕾娜" : "尤娜&玛娜&蕾娜",
|
89 |
+
"司会" : "司会",
|
90 |
+
"皮娜" : "皮娜",
|
91 |
+
"娜迪亚" : "娜迪亚",
|
92 |
+
"夏洛特" : "夏洛特",
|
93 |
+
"兰斯洛特" : "兰斯洛特",
|
94 |
+
"乌尔菲 & 涅比拉" : "乌尔菲&涅比拉",
|
95 |
+
"幽灵们" : "幽灵们",
|
96 |
+
"圣导女" : "圣导女",
|
97 |
+
"埃尔玛莉亚" : "埃尔玛莉亚",
|
98 |
+
"达雷斯" : "达雷斯",
|
99 |
+
"伊依尔" : "伊依尔"
|
100 |
+
}
|
101 |
+
|
102 |
+
# =================
|
103 |
+
import re
|
104 |
+
|
105 |
+
reg_ast = re.compile(r'^\s*cn\s*=\s*\{')
|
106 |
+
# =================
|
107 |
+
|
108 |
+
for path in a:
|
109 |
+
name: str = path[path.rindex('\\') + 1:]
|
110 |
+
name = '0'
|
111 |
+
if name not in sc:
|
112 |
+
sc[name] = []
|
113 |
+
print(name)
|
114 |
+
|
115 |
+
# =================
|
116 |
+
try:
|
117 |
+
f = open(path, 'r', encoding='utf-8')
|
118 |
+
data = list(x.rstrip() for x in f.readlines())
|
119 |
+
except UnicodeDecodeError:
|
120 |
+
f = open(path, 'r', encoding='gbk')
|
121 |
+
data = list(x.rstrip() for x in f.readlines())
|
122 |
+
finally:
|
123 |
+
f.close()
|
124 |
+
# =================
|
125 |
+
data[0] = data[0].lstrip('\ufeff')
|
126 |
+
# print(data[0][0])
|
127 |
+
def _filter(x: str):
|
128 |
+
if not x:
|
129 |
+
return False
|
130 |
+
return True
|
131 |
+
data = list(filter(_filter, data))
|
132 |
+
# =================
|
133 |
+
n = ''
|
134 |
+
w_i = -1
|
135 |
+
while w_i < len(data) - 1:
|
136 |
+
w_i += 1
|
137 |
+
line: str = data[w_i]
|
138 |
+
# =================
|
139 |
+
tmp = reg_ast.match(line)
|
140 |
+
if tmp is None:
|
141 |
+
continue
|
142 |
+
w_i, *tmp = getBracketContent(data, w_i, _start=tmp.end() - 1)
|
143 |
+
tmp = tmp[0]
|
144 |
+
tmp = ast2list(tmp)[0]
|
145 |
+
tmp = astStrip(tmp, {'text'}, {'rt2', 'txruby'})
|
146 |
+
assert len(tmp) == 1
|
147 |
+
tmp = tmp[0][1]
|
148 |
+
# print(tmp)
|
149 |
+
n = astGet(tmp, 'name')
|
150 |
+
if n:
|
151 |
+
n = n[-1][1]
|
152 |
+
if n in _n:
|
153 |
+
n = _n[n]
|
154 |
+
else:
|
155 |
+
_n[n] = clearT(n).replace('・', '&')
|
156 |
+
else:
|
157 |
+
n = '旁白'
|
158 |
+
d = astGet(tmp)
|
159 |
+
if d:
|
160 |
+
sc[name].append(n + ':' + d)
|
161 |
+
|
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)
|