Delete tistest.py
Browse files- tistest.py +0 -62
tistest.py
DELETED
@@ -1,62 +0,0 @@
|
|
1 |
-
import re
|
2 |
-
|
3 |
-
import datasets
|
4 |
-
|
5 |
-
|
6 |
-
_CITATION = """\
|
7 |
-
@misc{Gokaslan2019OpenWeb,
|
8 |
-
title={TIS LI},
|
9 |
-
author={LI Hamburg},
|
10 |
-
howpublished{\\url{https://li.hamburg.de/}},
|
11 |
-
year={2023}
|
12 |
-
}
|
13 |
-
"""
|
14 |
-
|
15 |
-
_DESCRIPTION = """\
|
16 |
-
An open-source replication of the TIS Data from LI Hamburg.
|
17 |
-
"""
|
18 |
-
|
19 |
-
_N_DATA_FILES = 2
|
20 |
-
_DATA_FILES = ["subsets/urlsf_subset{:02d}.tar".format(i) for i in range(_N_DATA_FILES)]
|
21 |
-
|
22 |
-
|
23 |
-
class TIS(datasets.GeneratorBasedBuilder):
|
24 |
-
|
25 |
-
BUILDER_CONFIGS = [
|
26 |
-
datasets.BuilderConfig(
|
27 |
-
name="plain_text",
|
28 |
-
description="Plain text",
|
29 |
-
version=datasets.Version("1.0.0"),
|
30 |
-
)
|
31 |
-
]
|
32 |
-
|
33 |
-
def _info(self):
|
34 |
-
return datasets.DatasetInfo(
|
35 |
-
description=_DESCRIPTION,
|
36 |
-
features=datasets.Features({"text": datasets.Value("string")}),
|
37 |
-
homepage="https://li.hamburg.de/",
|
38 |
-
citation=_CITATION,
|
39 |
-
)
|
40 |
-
|
41 |
-
def _split_generators(self, dl_manager):
|
42 |
-
archives = dl_manager.download(_DATA_FILES)
|
43 |
-
return [
|
44 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={
|
45 |
-
"archive_iterators": [
|
46 |
-
dl_manager.iter_archive(archive) for archive in archives
|
47 |
-
],
|
48 |
-
"iter_archive": dl_manager.iter_archive
|
49 |
-
}),
|
50 |
-
]
|
51 |
-
|
52 |
-
def _generate_examples(self, archive_iterators, iter_archive):
|
53 |
-
"""Yields examples."""
|
54 |
-
for archive_iterator in archive_iterators:
|
55 |
-
for xz_filepath, xz_f in archive_iterator:
|
56 |
-
if not xz_filepath.endswith(".xz"):
|
57 |
-
continue
|
58 |
-
for txt_filepath, txt_f in iter_archive(xz_f):
|
59 |
-
if not txt_filepath.endswith(".txt"):
|
60 |
-
continue
|
61 |
-
idx = f"{xz_filepath}/{txt_filepath}"
|
62 |
-
yield idx, {"text": re.sub("\n\n\n+", "\n\n", txt_f.read().decode("utf-8")).strip()}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|