Datasets:

Multilinguality:
multilingual
Size Categories:
1M<n<10M
Language Creators:
found
Annotations Creators:
no-annotation
Source Datasets:
extended|c4
ArXiv:
Tags:
License:
hc4 / hc4.py
Sean MacAvaney
update dataset version
6e7c86a
import gzip
import json
import os
import datasets
_BASE_URL = "https://huggingface.co/datasets/neuclir/hc4/resolve/main/data/"
_URLS = {
"fas": _BASE_URL + "fas-00000-of-00001.jsonl.gz",
"rus": _BASE_URL + "rus-00000-of-00001.jsonl.gz",
"zho": _BASE_URL + "zho-00000-of-00001.jsonl.gz",
}
class Hc4(datasets.GeneratorBasedBuilder):
VERSION = datasets.Version("1.0.2")
def _info(self):
return datasets.DatasetInfo(
features=datasets.Features({
"id": datasets.Value("string"),
"cc_file": datasets.Value("string"),
"time": datasets.Value("string"),
"title": datasets.Value("string"),
"text": datasets.Value("string"),
"url": datasets.Value("string"),
}),
)
def _split_generators(self, dl_manager):
paths = dl_manager.download(_URLS)
return [
datasets.SplitGenerator(
name=lang,
gen_kwargs={
"filepath": paths[lang]
})
for lang in _URLS
]
def _generate_examples(self, filepath):
with gzip.open(filepath) as f:
for key, row in enumerate(f):
data = json.loads(row)
yield key, data