Upload 6 files
Browse files- 视觉小说/format/ChristmasTina/WinterChapter.txt.gz +3 -0
- 视觉小说/format/ChristmasTina/WinterChapterDLC01.txt.gz +3 -0
- 视觉小说/format/ChristmasTina/WinterChapterDLC02_.txt.gz +3 -0
- 视觉小说/format/ChristmasTina/WinterChapterDLC03_.txt.gz +3 -0
- 视觉小说/format/ChristmasTina/WinterChapterDLC04.txt.gz +3 -0
- 视觉小说/format/ChristmasTina/tmp_ChristmasTina.py +88 -0
视觉小说/format/ChristmasTina/WinterChapter.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:67bba65d42cf312badb24d5c7830bd9f595d561f263e8bf9e1d205ec04863b07
|
3 |
+
size 172868
|
视觉小说/format/ChristmasTina/WinterChapterDLC01.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:23ccc4ed42450341caf9fc505378803f8cb85f971b345a2e7e4350df0ad18e65
|
3 |
+
size 7363
|
视觉小说/format/ChristmasTina/WinterChapterDLC02_.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3edd7b626e126c2c352c741baa5d66d8895ccd604ec2df2ffb1e7b95680333e3
|
3 |
+
size 20891
|
视觉小说/format/ChristmasTina/WinterChapterDLC03_.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:152974b87cc42cfdabee0cdd556ff934fad87d98ceadff46f769031f0cfc19fd
|
3 |
+
size 57907
|
视觉小说/format/ChristmasTina/WinterChapterDLC04.txt.gz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:73dc5f608372784cad0dcbff5b8ced35427adfa5c272d5a0b81454e088ae1855
|
3 |
+
size 6738
|
视觉小说/format/ChristmasTina/tmp_ChristmasTina.py
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from opencc import OpenCC
|
2 |
+
cc = OpenCC('t2s') # 't2s'表示繁体转简体
|
3 |
+
from h_corpus import Fileset
|
4 |
+
import unicodedata
|
5 |
+
import json,re
|
6 |
+
|
7 |
+
def fullwidth_to_halfwidth(input_str):
|
8 |
+
return ''.join([unicodedata.normalize('NFKC', char) for char in input_str])
|
9 |
+
|
10 |
+
def clearT(s):
|
11 |
+
s = cc.convert(fullwidth_to_halfwidth(s))
|
12 |
+
return s.lstrip('n').strip().strip(r'\n').replace('\n','\\n')
|
13 |
+
|
14 |
+
def custom_sort_key(s):
|
15 |
+
# 将字符串中的数字部分转换为整数,然后进行排序
|
16 |
+
return [int(x) if x.isdigit() else x for x in re.split('([0-9]+)', s)]
|
17 |
+
|
18 |
+
_n = {
|
19 |
+
"mob": "mob",
|
20 |
+
"emi": "绘美",
|
21 |
+
"kanna": "栞奈",
|
22 |
+
"jin": "萧然",
|
23 |
+
"sakura": "佐仓",
|
24 |
+
"kou": "小墨",
|
25 |
+
"mama": "妈妈",
|
26 |
+
"ryopa": "景怡",
|
27 |
+
"ryoma": "思秋",
|
28 |
+
"sen": "文茜",
|
29 |
+
"chimob": "chimob",
|
30 |
+
"ryou": "和平",
|
31 |
+
"sanae": "早苗",
|
32 |
+
"higuchi": "樋口",
|
33 |
+
"emimama": "emimama"
|
34 |
+
}
|
35 |
+
|
36 |
+
# </.+?> 清除
|
37 |
+
# <ruby=(.+?)> \($1\)
|
38 |
+
|
39 |
+
a = Fileset(r'E:\tmp\ChristmasTina\chapter\MonoBehaviour', ext='.json')
|
40 |
+
sorted_indices = sorted(range(len(a)), key=lambda i: custom_sort_key(a[i]))
|
41 |
+
a = [a[i] for i in sorted_indices]
|
42 |
+
b = r'D:\datasets\tmp'
|
43 |
+
sc = {}
|
44 |
+
for i in range(len(a)):
|
45 |
+
path = a[i]
|
46 |
+
name = path[path.rindex('\\')+1:path.rindex('.')]
|
47 |
+
print(name)
|
48 |
+
if 'DLC01' in name or 'DLC04' in name:
|
49 |
+
name = name.rstrip('.book')
|
50 |
+
else:
|
51 |
+
name = name.rstrip('.book0123456789')
|
52 |
+
if name not in sc:
|
53 |
+
sc[name] = []
|
54 |
+
with open(path, encoding='utf-8') as f:
|
55 |
+
tmp = json.load(f)
|
56 |
+
tmp = tmp['importGridList']
|
57 |
+
for rows in tmp:
|
58 |
+
rows = rows['rows']
|
59 |
+
args = rows[0]['strings']
|
60 |
+
rows = rows[1:]
|
61 |
+
idx_t = args.index('Text')
|
62 |
+
idx_v = args.index('Voice')
|
63 |
+
for row in rows:
|
64 |
+
row = row['strings']
|
65 |
+
if len(row) < idx_t + 1:
|
66 |
+
continue
|
67 |
+
else:
|
68 |
+
d = clearT(row[idx_t])
|
69 |
+
if len(row) < idx_v + 1 or not row[idx_v]:
|
70 |
+
n = '旁白'
|
71 |
+
else:
|
72 |
+
n = row[idx_v]
|
73 |
+
if 'emimama' in n:
|
74 |
+
n = 'emimama'
|
75 |
+
else:
|
76 |
+
if n.startswith('DLC'):
|
77 |
+
n = n[6:]
|
78 |
+
n = n[:n.rindex('/')].rstrip('0123456789')
|
79 |
+
# _n[n] = n
|
80 |
+
n = _n[n]
|
81 |
+
if d:
|
82 |
+
sc[name].append(n + ':' + d)
|
83 |
+
|
84 |
+
for k, v in sc.items():
|
85 |
+
with open(b + f'\\{k}.txt', 'w', encoding='utf-8') as f:
|
86 |
+
f.write('\n'.join(v))
|
87 |
+
|
88 |
+
tmp = json.dumps(_n, ensure_ascii=False, indent=2)
|