Update metadata
Browse files- cst-wikinews.py +6 -2
- cst_wikinews.py +0 -85
- dataset_infos.json +1 -1
cst-wikinews.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
"""CST Wikinews classification dataset."""
|
2 |
|
3 |
import csv
|
@@ -14,8 +15,9 @@ _URLS = {
|
|
14 |
"test": "https://huggingface.co/datasets/clarin-pl/cst-wikinews/resolve/main/test.csv",
|
15 |
}
|
16 |
|
|
|
17 |
|
18 |
-
_LABELS
|
19 |
"Brak_relacji",
|
20 |
"Dalsze_informacje",
|
21 |
"Krzyżowanie_się",
|
@@ -42,10 +44,12 @@ class CSTWikinews(datasets.GeneratorBasedBuilder):
|
|
42 |
"sentence_1": datasets.Value("string"),
|
43 |
"sentence_2": datasets.Value("string"),
|
44 |
"label": datasets.features.ClassLabel(
|
45 |
-
names=_LABELS,
|
|
|
46 |
),
|
47 |
}
|
48 |
),
|
|
|
49 |
)
|
50 |
|
51 |
def _split_generators(
|
|
|
1 |
+
|
2 |
"""CST Wikinews classification dataset."""
|
3 |
|
4 |
import csv
|
|
|
15 |
"test": "https://huggingface.co/datasets/clarin-pl/cst-wikinews/resolve/main/test.csv",
|
16 |
}
|
17 |
|
18 |
+
_HOMEPAGE = "https://clarin-pl.eu/dspace/handle/11321/305"
|
19 |
|
20 |
+
_LABELS=[
|
21 |
"Brak_relacji",
|
22 |
"Dalsze_informacje",
|
23 |
"Krzyżowanie_się",
|
|
|
44 |
"sentence_1": datasets.Value("string"),
|
45 |
"sentence_2": datasets.Value("string"),
|
46 |
"label": datasets.features.ClassLabel(
|
47 |
+
names=_LABELS,
|
48 |
+
num_classes=len(_LABELS)
|
49 |
),
|
50 |
}
|
51 |
),
|
52 |
+
homepage=_HOMEPAGE,
|
53 |
)
|
54 |
|
55 |
def _split_generators(
|
cst_wikinews.py
DELETED
@@ -1,85 +0,0 @@
|
|
1 |
-
"""CST Wikinews classification dataset."""
|
2 |
-
|
3 |
-
import csv
|
4 |
-
from pathlib import Path
|
5 |
-
from typing import List, Tuple, Dict, Generator
|
6 |
-
|
7 |
-
import datasets
|
8 |
-
|
9 |
-
|
10 |
-
_DESCRIPTION = """CST Wikinews dataset."""
|
11 |
-
|
12 |
-
_URLS = {
|
13 |
-
"train": "https://huggingface.co/datasets/clarin-pl/cst-wikinews/resolve/main/train.csv",
|
14 |
-
"test": "https://huggingface.co/datasets/clarin-pl/cst-wikinews/resolve/main/test.csv",
|
15 |
-
}
|
16 |
-
|
17 |
-
|
18 |
-
_LABELS = [
|
19 |
-
"Brak_relacji",
|
20 |
-
"Dalsze_informacje",
|
21 |
-
"Krzyżowanie_się",
|
22 |
-
"Opis",
|
23 |
-
"Parafraza",
|
24 |
-
"Spełnienie",
|
25 |
-
"Streszczenie",
|
26 |
-
"Tożsamość",
|
27 |
-
"Tło_historyczne",
|
28 |
-
"Uszczegółowienie",
|
29 |
-
"Zawieranie",
|
30 |
-
"Źródło",
|
31 |
-
]
|
32 |
-
|
33 |
-
|
34 |
-
class CSTWikinews(datasets.GeneratorBasedBuilder):
|
35 |
-
"""AG News topic classification dataset."""
|
36 |
-
|
37 |
-
def _info(self) -> datasets.DatasetInfo:
|
38 |
-
return datasets.DatasetInfo(
|
39 |
-
description=_DESCRIPTION,
|
40 |
-
features=datasets.Features(
|
41 |
-
{
|
42 |
-
"sentence_1": datasets.Value("string"),
|
43 |
-
"sentence_2": datasets.Value("string"),
|
44 |
-
"label": datasets.features.ClassLabel(
|
45 |
-
names=_LABELS, num_classes=len(_LABELS)
|
46 |
-
),
|
47 |
-
}
|
48 |
-
),
|
49 |
-
)
|
50 |
-
|
51 |
-
def _split_generators(
|
52 |
-
self, dl_manager: datasets.DownloadManager
|
53 |
-
) -> List[datasets.SplitGenerator]:
|
54 |
-
urls_to_download = _URLS
|
55 |
-
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
56 |
-
return [
|
57 |
-
datasets.SplitGenerator(
|
58 |
-
name=datasets.Split.TRAIN,
|
59 |
-
gen_kwargs={"filepath": downloaded_files["train"]},
|
60 |
-
),
|
61 |
-
datasets.SplitGenerator(
|
62 |
-
name=datasets.Split.TEST,
|
63 |
-
gen_kwargs={"filepath": downloaded_files["test"]},
|
64 |
-
),
|
65 |
-
]
|
66 |
-
|
67 |
-
def _generate_examples(
|
68 |
-
self, filepath: str
|
69 |
-
) -> Generator[Tuple[int, Dict[str, str]], None, None]:
|
70 |
-
"""Generate AG News examples."""
|
71 |
-
with Path(filepath, encoding="utf-8").open() as csv_file:
|
72 |
-
csv_reader = csv.reader(
|
73 |
-
csv_file,
|
74 |
-
delimiter=",",
|
75 |
-
quoting=csv.QUOTE_ALL,
|
76 |
-
skipinitialspace=True,
|
77 |
-
)
|
78 |
-
next(csv_reader, None) # skip the headers
|
79 |
-
for row_id, (s1, s2, label) in enumerate(csv_reader):
|
80 |
-
label = int(label)
|
81 |
-
yield row_id, {
|
82 |
-
"sentence_1": s1,
|
83 |
-
"sentence_2": s2,
|
84 |
-
"label": label,
|
85 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset_infos.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"default": {"description": "CST Wikinews dataset.", "citation": "", "homepage": "", "license": "", "features": {"sentence_1": {"dtype": "string", "id": null, "_type": "Value"}, "sentence_2": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 12, "names": ["Brak_relacji", "Dalsze_informacje", "Krzy\u017cowanie_si\u0119", "Opis", "Parafraza", "Spe\u0142nienie", "Streszczenie", "To\u017csamo\u015b\u0107", "T\u0142o_historyczne", "Uszczeg\u00f3\u0142owienie", "Zawieranie", "\u0179r\u00f3d\u0142o"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "cst_wikinews", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 393238, "num_examples": 1534, "dataset_name": "cst_wikinews"}, "test": {"name": "test", "num_bytes": 99071, "num_examples": 384, "dataset_name": "cst_wikinews"}}, "download_checksums": {"https://huggingface.co/datasets/clarin-pl/cst-wikinews/resolve/main/train.csv": {"num_bytes": 378607, "checksum": "2e0533aba3abd5171a52f347d9554e906198c8ccf61f5d01d756623ea8ae2e58"}, "https://huggingface.co/datasets/clarin-pl/cst-wikinews/resolve/main/test.csv": {"num_bytes": 95413, "checksum": "c337cb053ed35e7e91032179efc12e5f8a4d1312b5d7f29b7b76b5ccc9e73562"}}, "download_size": 474020, "post_processing_size": null, "dataset_size": 492309, "size_in_bytes": 966329}}
|
|
|
1 |
+
{"default": {"description": "CST Wikinews dataset.", "citation": "", "homepage": "https://clarin-pl.eu/dspace/handle/11321/305", "license": "", "features": {"sentence_1": {"dtype": "string", "id": null, "_type": "Value"}, "sentence_2": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 12, "names": ["Brak_relacji", "Dalsze_informacje", "Krzy\u017cowanie_si\u0119", "Opis", "Parafraza", "Spe\u0142nienie", "Streszczenie", "To\u017csamo\u015b\u0107", "T\u0142o_historyczne", "Uszczeg\u00f3\u0142owienie", "Zawieranie", "\u0179r\u00f3d\u0142o"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "cst_wikinews", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 393238, "num_examples": 1534, "dataset_name": "cst_wikinews"}, "test": {"name": "test", "num_bytes": 99071, "num_examples": 384, "dataset_name": "cst_wikinews"}}, "download_checksums": {"https://huggingface.co/datasets/clarin-pl/cst-wikinews/resolve/main/train.csv": {"num_bytes": 378607, "checksum": "2e0533aba3abd5171a52f347d9554e906198c8ccf61f5d01d756623ea8ae2e58"}, "https://huggingface.co/datasets/clarin-pl/cst-wikinews/resolve/main/test.csv": {"num_bytes": 95413, "checksum": "c337cb053ed35e7e91032179efc12e5f8a4d1312b5d7f29b7b76b5ccc9e73562"}}, "download_size": 474020, "post_processing_size": null, "dataset_size": 492309, "size_in_bytes": 966329}}
|