Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
---
|
| 5 |
+
```py
|
| 6 |
+
import json
|
| 7 |
+
import os
|
| 8 |
+
import ftfy
|
| 9 |
+
|
| 10 |
+
dataset = []
|
| 11 |
+
for filename in sorted(os.listdir("./visual-novels-parsed/TXT")):
|
| 12 |
+
txt_path = os.path.join(TXT_DIR, filename)
|
| 13 |
+
|
| 14 |
+
with open(txt_path, "r") as f:
|
| 15 |
+
txt_data = ftfy.fix_text(f.read()).strip()
|
| 16 |
+
|
| 17 |
+
dataset.append(
|
| 18 |
+
{
|
| 19 |
+
"name": ftfy.fix_text(filename.replace(".txt", "")).strip(),
|
| 20 |
+
"text": txt_data,
|
| 21 |
+
}
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
with open("./visual-novels-parsed/train.json", "w") as f:
|
| 25 |
+
json.dump(dataset, f, indent=2)
|
| 26 |
+
```
|