Chinese_interactive_novels_3k@mrzjy p1
Browse files
.gitattributes
CHANGED
@@ -53,3 +53,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
53 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
56 |
+
互动小说/Chinese_interactive_novels/[email protected] filter=lfs diff=lfs merge=lfs -text
|
57 |
+
互动小说/Chinese_interactive_novels/[email protected] filter=lfs diff=lfs merge=lfs -text
|
58 |
+
互动小说/Chinese_interactive_novels/[email protected] filter=lfs diff=lfs merge=lfs -text
|
互动小说/Chinese_interactive_novels/[email protected]
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5b21642a8c69c2caa883d91f7472ddbc222fd0b810bc324d2e67cd2ede74817f
|
3 |
+
size 10485760
|
互动小说/Chinese_interactive_novels/[email protected]
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:440e588627f4f6fa19e441b5befd19825cf1d3a973a4268810a657d6f77588ef
|
3 |
+
size 10485760
|
互动小说/Chinese_interactive_novels/[email protected]
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:917d3c4d2329fcb57b851232acbe1802c5a1bb146bded35859446502b4ffc8d6
|
3 |
+
size 10485760
|
互动小说/Chinese_interactive_novels/互动小说.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
|
3 |
+
df = pd.read_parquet(r'E:\tmp\互动小说\0001.parquet')
|
4 |
+
|
5 |
+
|
6 |
+
def clearT():
|
7 |
+
import unicodedata
|
8 |
+
from opencc import OpenCC
|
9 |
+
|
10 |
+
def full2half(input_str):
|
11 |
+
return ''.join([unicodedata.normalize('NFKC', char) for char in input_str])
|
12 |
+
|
13 |
+
cc = OpenCC('t2s') # 't2s'表示繁体转简体
|
14 |
+
|
15 |
+
def _clearT(s):
|
16 |
+
s = cc.convert(full2half(s))
|
17 |
+
return s.strip().replace('\n', '\\n')
|
18 |
+
|
19 |
+
return _clearT
|
20 |
+
|
21 |
+
|
22 |
+
clearT = clearT()
|
23 |
+
|
24 |
+
import json
|
25 |
+
|
26 |
+
z = 2767
|
27 |
+
for a, b, c, d, e, f, g in df.itertuples(index=False, name=None):
|
28 |
+
z += 1
|
29 |
+
print(z)
|
30 |
+
with open(r'E:\tmp\互动小说\tmp' + f'\\{z:05}_' + a + '.txt', 'w', encoding='utf-8') as file:
|
31 |
+
tmp = [a, b, list(c), d, e, f]
|
32 |
+
tmp = json.dumps(tmp, ensure_ascii=False)
|
33 |
+
file.write(tmp + '\n')
|
34 |
+
for h in g:
|
35 |
+
file.write('旁白:章节:' + clearT(h['chapter_title']) + '\n')
|
36 |
+
m = h['content']
|
37 |
+
for n in m:
|
38 |
+
if n['role']:
|
39 |
+
file.write(clearT(n['role']) + ':' + clearT(n['content']) + '\n')
|
40 |
+
else:
|
41 |
+
file.write(clearT(n['content_tag']) + ':' + clearT(n['content']) + '\n')
|
42 |
+
|