-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
# https://huggingface.co/datasets/Salesforce/wikitext
# https://shibamoulilahiri.github.io/gutenberg_dataset.html
# Use `parquet-tools csv` to mangle the dataset into a text file
# Run this with PyPy for SPEEED
from encode import _clean_text
with open('gutenberg-dirty') as f:
lines = f.readlines()
print(len(lines))
with open('gutenberg', 'w') as f:
for i, l in enumerate(lines):
if len(l) < 200:
# Skip junk
continue
cleaned = _clean_text(l)
if len(cleaned) > 200:
f.write(cleaned + '\n')
print(i)