Datasets:
Matej Klemen
commited on
Commit
•
7990965
1
Parent(s):
89f6522
Nicer private/public distinction in dataset script using separate configs
Browse files- cc_gigafida.py +18 -4
- dataset_infos.json +1 -1
cc_gigafida.py
CHANGED
@@ -8,6 +8,7 @@ import os.path
|
|
8 |
import re
|
9 |
import xml.etree.ElementTree as ET
|
10 |
from copy import deepcopy
|
|
|
11 |
|
12 |
import datasets
|
13 |
|
@@ -52,6 +53,16 @@ class CcGigafida(datasets.GeneratorBasedBuilder):
|
|
52 |
|
53 |
VERSION = datasets.Version("1.0.0")
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
def _info(self):
|
56 |
features = datasets.Features(
|
57 |
{
|
@@ -78,13 +89,16 @@ class CcGigafida(datasets.GeneratorBasedBuilder):
|
|
78 |
)
|
79 |
|
80 |
def _split_generators(self, dl_manager):
|
81 |
-
|
82 |
-
if dl_manager.manual_dir is not None:
|
83 |
-
data_dir = dl_manager.manual_dir
|
84 |
-
else:
|
85 |
urls = _URLS["ccGigafida"]
|
86 |
data_dir = dl_manager.download_and_extract(urls)
|
87 |
data_dir = os.path.join(data_dir, "ccGigafidaV1_0")
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
return [
|
90 |
datasets.SplitGenerator(
|
|
|
8 |
import re
|
9 |
import xml.etree.ElementTree as ET
|
10 |
from copy import deepcopy
|
11 |
+
from typing import Optional
|
12 |
|
13 |
import datasets
|
14 |
|
|
|
53 |
|
54 |
VERSION = datasets.Version("1.0.0")
|
55 |
|
56 |
+
BUILDER_CONFIGS = [
|
57 |
+
datasets.BuilderConfig(name="public", version=VERSION,
|
58 |
+
description="Load the publicly available dataset (ccGigafida)."),
|
59 |
+
datasets.BuilderConfig(name="private", version=VERSION,
|
60 |
+
description="Load the privately available dataset (Gigafida/Gigafida2) by manuallly "
|
61 |
+
"providing the path to the data."),
|
62 |
+
]
|
63 |
+
|
64 |
+
DEFAULT_CONFIG_NAME = "public"
|
65 |
+
|
66 |
def _info(self):
|
67 |
features = datasets.Features(
|
68 |
{
|
|
|
89 |
)
|
90 |
|
91 |
def _split_generators(self, dl_manager):
|
92 |
+
if self.config.name == "public":
|
|
|
|
|
|
|
93 |
urls = _URLS["ccGigafida"]
|
94 |
data_dir = dl_manager.download_and_extract(urls)
|
95 |
data_dir = os.path.join(data_dir, "ccGigafidaV1_0")
|
96 |
+
else:
|
97 |
+
if dl_manager.manual_dir is None or not os.path.exists(dl_manager.manual_dir):
|
98 |
+
logging.warning("data_dir does not point to a valid directory")
|
99 |
+
|
100 |
+
# Allow user to specify path to the private Gigafida directory: `load_dataset(..., data_dir=...)`
|
101 |
+
data_dir = dl_manager.manual_dir
|
102 |
|
103 |
return [
|
104 |
datasets.SplitGenerator(
|
dataset_infos.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"default": {"description": "The ccGigafida corpus contains a subsample of the Gigafida corpus. The Gigafida corpus is an extensive collection of \nSlovene text of various genres, from daily newspapers, magazines, all kinds of books (fiction, non-fiction, textbooks), \nweb pages, transcriptions of parliamentary debates and similar.\n", "citation": "@misc{ccGigafida,\n title = {Written corpus {ccGigafida} 1.0},\n author = {Logar, Nata{\u000b s}a and Erjavec, Toma{\u000b z} and Krek, Simon and Gr{\u000b c}ar, Miha and Holozan, Peter},\n url = {http://hdl.handle.net/11356/1035},\n note = {Slovenian language resource repository {CLARIN}.{SI}},\n copyright = {Creative Commons - Attribution-{NonCommercial}-{ShareAlike} 4.0 International ({CC} {BY}-{NC}-{SA} 4.0)},\n issn = {2820-4042},\n year = {2013}\n}\n", "homepage": "http://eng.slovenscina.eu/korpusi/proste-zbirke", "license": "Creative Commons - Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)", "features": {"id_doc": {"dtype": "string", "id": null, "_type": "Value"}, "doc_title": {"dtype": "string", "id": null, "_type": "Value"}, "authors": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "publish_date": {"dtype": "string", "id": null, "_type": "Value"}, "publisher": {"dtype": "string", "id": null, "_type": "Value"}, "genres": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_tokenized": {"feature": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_lemmas": {"feature": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_msds": {"feature": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_string": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "id_sents": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "cc_gigafida", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 4242404354, "num_examples": 31722, "dataset_name": "cc_gigafida"}}, "download_checksums": {"https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1035/ccGigafidaV1_0.zip": {"num_bytes": 954116273, "checksum": "448e284d6f92d54f123e2b7fa433c9d84d060f2db07c589e9b45a356a1f5242e"}}, "download_size": 954116273, "post_processing_size": null, "dataset_size": 4242404354, "size_in_bytes": 5196520627}}
|
|
|
1 |
+
{"default": {"description": "The ccGigafida corpus contains a subsample of the Gigafida corpus. The Gigafida corpus is an extensive collection of \nSlovene text of various genres, from daily newspapers, magazines, all kinds of books (fiction, non-fiction, textbooks), \nweb pages, transcriptions of parliamentary debates and similar.\n", "citation": "@misc{ccGigafida,\n title = {Written corpus {ccGigafida} 1.0},\n author = {Logar, Nata{\u000b s}a and Erjavec, Toma{\u000b z} and Krek, Simon and Gr{\u000b c}ar, Miha and Holozan, Peter},\n url = {http://hdl.handle.net/11356/1035},\n note = {Slovenian language resource repository {CLARIN}.{SI}},\n copyright = {Creative Commons - Attribution-{NonCommercial}-{ShareAlike} 4.0 International ({CC} {BY}-{NC}-{SA} 4.0)},\n issn = {2820-4042},\n year = {2013}\n}\n", "homepage": "http://eng.slovenscina.eu/korpusi/proste-zbirke", "license": "Creative Commons - Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)", "features": {"id_doc": {"dtype": "string", "id": null, "_type": "Value"}, "doc_title": {"dtype": "string", "id": null, "_type": "Value"}, "authors": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "publish_date": {"dtype": "string", "id": null, "_type": "Value"}, "publisher": {"dtype": "string", "id": null, "_type": "Value"}, "genres": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_tokenized": {"feature": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_lemmas": {"feature": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_msds": {"feature": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_string": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "id_sents": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "cc_gigafida", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 4242404354, "num_examples": 31722, "dataset_name": "cc_gigafida"}}, "download_checksums": {"https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1035/ccGigafidaV1_0.zip": {"num_bytes": 954116273, "checksum": "448e284d6f92d54f123e2b7fa433c9d84d060f2db07c589e9b45a356a1f5242e"}}, "download_size": 954116273, "post_processing_size": null, "dataset_size": 4242404354, "size_in_bytes": 5196520627}, "public": {"description": "The ccGigafida corpus contains a subsample of the Gigafida corpus. The Gigafida corpus is an extensive collection of \nSlovene text of various genres, from daily newspapers, magazines, all kinds of books (fiction, non-fiction, textbooks), \nweb pages, transcriptions of parliamentary debates and similar.\n", "citation": "@misc{ccGigafida,\n title = {Written corpus {ccGigafida} 1.0},\n author = {Logar, Nata{\u000b s}a and Erjavec, Toma{\u000b z} and Krek, Simon and Gr{\u000b c}ar, Miha and Holozan, Peter},\n url = {http://hdl.handle.net/11356/1035},\n note = {Slovenian language resource repository {CLARIN}.{SI}},\n copyright = {Creative Commons - Attribution-{NonCommercial}-{ShareAlike} 4.0 International ({CC} {BY}-{NC}-{SA} 4.0)},\n issn = {2820-4042},\n year = {2013}\n}\n", "homepage": "http://eng.slovenscina.eu/korpusi/proste-zbirke", "license": "Creative Commons - Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)", "features": {"id_doc": {"dtype": "string", "id": null, "_type": "Value"}, "doc_title": {"dtype": "string", "id": null, "_type": "Value"}, "authors": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "publish_date": {"dtype": "string", "id": null, "_type": "Value"}, "publisher": {"dtype": "string", "id": null, "_type": "Value"}, "genres": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_tokenized": {"feature": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_lemmas": {"feature": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_msds": {"feature": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_string": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "id_sents": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "cc_gigafida", "config_name": "public", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 4242404354, "num_examples": 31722, "dataset_name": "cc_gigafida"}}, "download_checksums": {"https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1035/ccGigafidaV1_0.zip": {"num_bytes": 954116273, "checksum": "448e284d6f92d54f123e2b7fa433c9d84d060f2db07c589e9b45a356a1f5242e"}}, "download_size": 954116273, "post_processing_size": null, "dataset_size": 4242404354, "size_in_bytes": 5196520627}, "private": {"description": "The ccGigafida corpus contains a subsample of the Gigafida corpus. The Gigafida corpus is an extensive collection of \nSlovene text of various genres, from daily newspapers, magazines, all kinds of books (fiction, non-fiction, textbooks), \nweb pages, transcriptions of parliamentary debates and similar.\n", "citation": "@misc{ccGigafida,\n title = {Written corpus {ccGigafida} 1.0},\n author = {Logar, Nata{\u000b s}a and Erjavec, Toma{\u000b z} and Krek, Simon and Gr{\u000b c}ar, Miha and Holozan, Peter},\n url = {http://hdl.handle.net/11356/1035},\n note = {Slovenian language resource repository {CLARIN}.{SI}},\n copyright = {Creative Commons - Attribution-{NonCommercial}-{ShareAlike} 4.0 International ({CC} {BY}-{NC}-{SA} 4.0)},\n issn = {2820-4042},\n year = {2013}\n}\n", "homepage": "http://eng.slovenscina.eu/korpusi/proste-zbirke", "license": "Creative Commons - Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)", "features": {"id_doc": {"dtype": "string", "id": null, "_type": "Value"}, "doc_title": {"dtype": "string", "id": null, "_type": "Value"}, "authors": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "publish_date": {"dtype": "string", "id": null, "_type": "Value"}, "publisher": {"dtype": "string", "id": null, "_type": "Value"}, "genres": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_tokenized": {"feature": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_lemmas": {"feature": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_msds": {"feature": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "doc_string": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}, "id_sents": {"feature": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "cc_gigafida", "config_name": "private", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 0, "num_examples": 0, "dataset_name": "cc_gigafida"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 0, "size_in_bytes": 0}}
|