巧可甜恋3@魔法猫咪汉化实验室 v1.10
Browse files- v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/chieri.txt.gz +3 -0
- v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/harem.txt.gz +3 -0
- v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/ichika.txt.gz +3 -0
- v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/kaguya.txt.gz +3 -0
- v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/kohana.txt.gz +3 -0
- v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/mikuri.txt.gz +3 -0
- v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/mitsuki.txt.gz +3 -0
- v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/nana.txt.gz +3 -0
- v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/巧克甜恋3.py +147 -0
v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/chieri.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8940f744f731d8f4721861d872857db9da2c5e6a4613d7b5656ed38fb163f0d3
|
3 |
+
size 20175
|
v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/harem.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e21c408b127af7bf1ac6a25fe56ba19af6c221012aa578cd50db22e3833f96e3
|
3 |
+
size 11544
|
v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/ichika.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d6aae0cee9a5ef99635cc3476469deb82026eb404178aac1c3a51d5c910b328e
|
3 |
+
size 19769
|
v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/kaguya.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c340921afae1dfb999bdda9da5618877bab2983d372f71576fd1400f79b28868
|
3 |
+
size 16681
|
v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/kohana.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c57c9b4d9dbf1c477355c71796a754f5e29f2fcfe83bd57bce1de035190ad5b1
|
3 |
+
size 131895
|
v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/mikuri.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:bc20bbc23d70018c150bde4c581dd3e92467b6756f633c49f41d0e4528310ffa
|
3 |
+
size 18965
|
v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/mitsuki.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c0eefc9c5f1b7e31f835d7bb140ff5a6ebe234fa8a362fa47ffdacf61e554fcc
|
3 |
+
size 101862
|
v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/nana.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5888ad6fbed9b3c8fb695ee71d097d76cc749aafe80ccb4be07470a4b6a83f3c
|
3 |
+
size 19812
|
v-corpus-zh/CabbageSoft/巧克甜恋/巧克甜恋3/巧克甜恋3.py
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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().replace('\n', '\\n')
|
31 |
+
|
32 |
+
return _clearT
|
33 |
+
|
34 |
+
|
35 |
+
clearT = clearT()
|
36 |
+
|
37 |
+
brackets = {'「': '」', '(': ')', '『': '』', '【': '】', '“': '”'}
|
38 |
+
|
39 |
+
|
40 |
+
# =================
|
41 |
+
def startsWithAny(s: str, keys):
|
42 |
+
for x in keys:
|
43 |
+
if s.startswith(x):
|
44 |
+
return x
|
45 |
+
else:
|
46 |
+
return False
|
47 |
+
|
48 |
+
|
49 |
+
def startAndEndWith(_line: str, _lr: dict):
|
50 |
+
_tmp = startsWithAny(_line, _lr.keys())
|
51 |
+
|
52 |
+
if _tmp != '(' and _line.endswith(')') and '(' in _line:
|
53 |
+
_var_d = _line[:_line.rindex('(')].rstrip()
|
54 |
+
else:
|
55 |
+
_var_d = _line
|
56 |
+
|
57 |
+
if _tmp and _var_d.endswith(_lr[_tmp]):
|
58 |
+
return _tmp
|
59 |
+
else:
|
60 |
+
return False
|
61 |
+
|
62 |
+
# =================
|
63 |
+
|
64 |
+
a = get_all_files_in_directory(r'E:\tmp\巧可甜恋3_\text_edit', ext='.txt')
|
65 |
+
b = r'E:\tmp\巧可甜恋3_\text'
|
66 |
+
|
67 |
+
# =================
|
68 |
+
|
69 |
+
sc = {}
|
70 |
+
|
71 |
+
_n = {
|
72 |
+
"千绘莉": "千绘莉",
|
73 |
+
"柚希": "柚希",
|
74 |
+
"辉夜": "辉夜",
|
75 |
+
"美久栗": "美久栗",
|
76 |
+
"娜娜": "娜娜",
|
77 |
+
"莓华": "莓华",
|
78 |
+
"美月": "美月",
|
79 |
+
"两人": "两人",
|
80 |
+
"日果": "日果",
|
81 |
+
"小花": "小花",
|
82 |
+
"柚希&小花": "柚希&小花",
|
83 |
+
"搜查官": "搜查官",
|
84 |
+
"父亲": "父亲",
|
85 |
+
"母亲": "母亲",
|
86 |
+
"兽人": "兽人",
|
87 |
+
"阴阳师": "阴阳师",
|
88 |
+
"御园": "御园",
|
89 |
+
"杏子": "杏子",
|
90 |
+
"夏目": "夏目",
|
91 |
+
"小女孩": "小女孩",
|
92 |
+
"花梨": "花梨",
|
93 |
+
"女孩": "女孩"
|
94 |
+
}
|
95 |
+
|
96 |
+
for path in a:
|
97 |
+
tmp = path.split('\\')
|
98 |
+
name = tmp[-2]
|
99 |
+
if name not in sc:
|
100 |
+
sc[name] = []
|
101 |
+
print(name)
|
102 |
+
# =================
|
103 |
+
|
104 |
+
with open(path, 'r', encoding='utf-8') as f:
|
105 |
+
data = list(filter(lambda x: x,
|
106 |
+
(x.rstrip() for x in f.readlines())))
|
107 |
+
# =================
|
108 |
+
n = '旁白'
|
109 |
+
w_i = -1
|
110 |
+
while w_i < len(data) - 1:
|
111 |
+
w_i += 1
|
112 |
+
line: str = data[w_i]
|
113 |
+
# =================
|
114 |
+
if line.startswith('●'):
|
115 |
+
line = line[line.index('●', 2) + 2:].strip()
|
116 |
+
if not line:
|
117 |
+
continue
|
118 |
+
else:
|
119 |
+
continue
|
120 |
+
|
121 |
+
if line.endswith('name▲'):
|
122 |
+
n = line[: -6]
|
123 |
+
if n in _n:
|
124 |
+
n = _n[n]
|
125 |
+
else:
|
126 |
+
_n[n] = clearT(n.strip('【】')).replace('/', '&')
|
127 |
+
print(line)
|
128 |
+
continue
|
129 |
+
|
130 |
+
if startAndEndWith(line, brackets):
|
131 |
+
line = clearT(n) + ':' + clearT(line)
|
132 |
+
else:
|
133 |
+
line = '旁白:' + clearT(line)
|
134 |
+
|
135 |
+
sc[name].append(line)
|
136 |
+
|
137 |
+
|
138 |
+
# =================
|
139 |
+
for k, v in sc.items():
|
140 |
+
if v:
|
141 |
+
with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
|
142 |
+
f.write('\n'.join(v))
|
143 |
+
|
144 |
+
# =================
|
145 |
+
import json
|
146 |
+
|
147 |
+
tmp = json.dumps(_n, ensure_ascii=False, indent=4)
|