Datasets:
Size:
10B<n<100B
License:
File size: 2,859 Bytes
036116b 3b67eb4 798d60b 6558d97 9ff61d7 036116b 3b67eb4 17eb974 3b67eb4 798d60b 036116b a938bc2 036116b 798d60b a938bc2 036116b 6558d97 036116b 6558d97 036116b 3b67eb4 036116b 3b67eb4 6558d97 3b67eb4 036116b 3b67eb4 6558d97 3b67eb4 036116b 3b67eb4 6558d97 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
import datasets
import gzip
import os
from typing import List
_URL = "http://nl.ijs.si/nikola/dedup_hbs/"
_URLS = {
"macocu_hbs": _URL + "macocu.hbs.translit.dedup.lines.gz",
"hr_news": _URL + "hr_news.translit.dedup.lines.gz",
"bswac": _URL + "bswac.translit.dedup.lines.gz",
"cc100_hr": _URL + "cc100-hr.translit.dedup.lines.gz",
"cc100_sr": _URL + "cc100-sr.translit.dedup.lines.gz",
"classla_sr": _URL + "classla-sr.translit.dedup.lines.gz",
"classla_hr": _URL + "classla-hr.translit.dedup.lines.gz",
"classla_bs": _URL + "classla-bs.translit.dedup.lines.gz",
"cnrwac": _URL + "cnrwac.translit.dedup.lines.gz",
"hrwac": _URL + "hrwac.translit.dedup.lines.gz",
"mC4": _URL + "mC4.sr.translit.dedup.lines.gz",
"riznica": _URL + "riznica.translit.dedup.lines.gz",
"srwac": _URL + "srwac.translit.dedup.lines.gz",
}
_HOMEPAGE = _URL
_DESCRIPTION = """\
Data used to train XLM-Roberta-Bertić.
"""
_CITATION = r"""
To be added soon."""
class BerticData(datasets.GeneratorBasedBuilder):
"""Bertic dataset, used for training Bertic model."""
VERSION = datasets.Version("1.0.0")
# This is an example of a dataset with multiple configurations.
# If you don't want/need to define several sub-sets in your dataset,
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
# If you need to make complex sub-parts in the datasets with configurable options
# You can create your own builder configuration class to store attribute, inheriting from BerticDataConfig
# BUILDER_CONFIG_CLASS = MyBuilderConfig
# You will be able to load one or the other configurations in the following list with
# data = datasets.load_dataset('my_dataset', 'first_domain')
# data = datasets.load_dataset('my_dataset', 'second_domain')
def _info(self):
features = datasets.Features(
{
"text": datasets.Value("string"),
}
)
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=features,
homepage=_HOMEPAGE,
citation=_CITATION,
)
def _split_generators(self, dl_manager):
downloaded_files = dl_manager.download_and_extract(_URLS)
return [
datasets.SplitGenerator(
name=url,
gen_kwargs={"filepath": downloaded_files[url]},
)
for url in _URLS
]
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
def _generate_examples(self, filepath):
key = 0
for name in [filepath]:
# with gzip.open(name, "rb") as f:
with open(name, "r") as f:
for line in f.readlines():
yield key, {"text": line.rstrip()}
key += 1
|