Datasets:
Tasks:
Question Answering
Modalities:
Text
Formats:
parquet
Languages:
Italian
Size:
10K - 100K
License:
Commit
•
9a221b5
0
Parent(s):
Update files from the datasets library (from 1.0.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.0.0
- .gitattributes +27 -0
- dataset_infos.json +1 -0
- dummy/0.1.0/dummy_data.zip +3 -0
- squad_it.py +109 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"default": {"description": "SQuAD-it is derived from the SQuAD dataset and it is obtained through semi-automatic translation of the SQuAD dataset \ninto Italian. It represents a large-scale dataset for open question answering processes on factoid questions in Italian.\n The dataset contains more than 60,000 question/answer pairs derived from the original English dataset. The dataset is \n split into training and test sets to support the replicability of the benchmarking of QA systems:\n", "citation": "@InProceedings{10.1007/978-3-030-03840-3_29,\n\tauthor=\"Croce, Danilo and Zelenanska, Alexandra and Basili, Roberto\",\n\teditor=\"Ghidini, Chiara and Magnini, Bernardo and Passerini, Andrea and Traverso, Paolo\",\n\ttitle=\"Neural Learning for Question Answering in Italian\",\n\tbooktitle=\"AI*IA 2018 -- Advances in Artificial Intelligence\",\n\tyear=\"2018\",\n\tpublisher=\"Springer International Publishing\",\n\taddress=\"Cham\",\n\tpages=\"389--402\",\n\tisbn=\"978-3-030-03840-3\"\n}\n", "homepage": "https://github.com/crux82/squad-it", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}}, "supervised_keys": null, "builder_name": "squad_it", "config_name": "default", "version": {"version_str": "0.1.0", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 7870374, "num_examples": 7609, "dataset_name": "squad_it"}, "train": {"name": "train", "num_bytes": 50925634, "num_examples": 54159, "dataset_name": "squad_it"}}, "download_checksums": {"https://github.com/crux82/squad-it/raw/master/SQuAD_it-train.json.gz": {"num_bytes": 7725286, "checksum": "75d4d2832961f7a0f76a43d7e919e56a880ccc55de434ec90ae82cd67bec5d25"}, "https://github.com/crux82/squad-it/raw/master/SQuAD_it-test.json.gz": {"num_bytes": 1051245, "checksum": "25986c617cc7d58e82e916755b8a5684e5efae69835332858a6534a304cd293c"}}, "download_size": 8776531, "dataset_size": 58796008, "size_in_bytes": 67572539}}
|
dummy/0.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:163fe17eb7f55a290dbf9623cc8c85ecd9c877828c261c9de88435319cc4b00f
|
3 |
+
size 2215
|
squad_it.py
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""TODO(squad_it): Add a description here."""
|
2 |
+
|
3 |
+
from __future__ import absolute_import, division, print_function
|
4 |
+
|
5 |
+
import json
|
6 |
+
import os
|
7 |
+
|
8 |
+
import datasets
|
9 |
+
|
10 |
+
|
11 |
+
# TODO(squad_it): BibTeX citation
|
12 |
+
_CITATION = """\
|
13 |
+
@InProceedings{10.1007/978-3-030-03840-3_29,
|
14 |
+
author={Croce, Danilo and Zelenanska, Alexandra and Basili, Roberto},
|
15 |
+
editor={Ghidini, Chiara and Magnini, Bernardo and Passerini, Andrea and Traverso, Paolo",
|
16 |
+
title={Neural Learning for Question Answering in Italian},
|
17 |
+
booktitle={AI*IA 2018 -- Advances in Artificial Intelligence},
|
18 |
+
year={2018},
|
19 |
+
publisher={Springer International Publishing},
|
20 |
+
address={Cham},
|
21 |
+
pages={389--402},
|
22 |
+
isbn={978-3-030-03840-3}
|
23 |
+
}
|
24 |
+
"""
|
25 |
+
|
26 |
+
# TODO(squad_it):
|
27 |
+
_DESCRIPTION = """\
|
28 |
+
SQuAD-it is derived from the SQuAD dataset and it is obtained through semi-automatic translation of the SQuAD dataset
|
29 |
+
into Italian. It represents a large-scale dataset for open question answering processes on factoid questions in Italian.
|
30 |
+
The dataset contains more than 60,000 question/answer pairs derived from the original English dataset. The dataset is
|
31 |
+
split into training and test sets to support the replicability of the benchmarking of QA systems:
|
32 |
+
"""
|
33 |
+
_URL = "https://github.com/crux82/squad-it/raw/master"
|
34 |
+
_TRAIN_FILE = "SQuAD_it-train.json.gz"
|
35 |
+
_TEST_FILE = "SQuAD_it-test.json.gz"
|
36 |
+
|
37 |
+
|
38 |
+
class SquadIt(datasets.GeneratorBasedBuilder):
|
39 |
+
"""TODO(squad_it): Short description of my dataset."""
|
40 |
+
|
41 |
+
# TODO(squad_it): Set up version.
|
42 |
+
VERSION = datasets.Version("0.1.0")
|
43 |
+
|
44 |
+
def _info(self):
|
45 |
+
# TODO(squad_it): Specifies the datasets.DatasetInfo object
|
46 |
+
return datasets.DatasetInfo(
|
47 |
+
# This is the description that will appear on the datasets page.
|
48 |
+
description=_DESCRIPTION,
|
49 |
+
# datasets.features.FeatureConnectors
|
50 |
+
features=datasets.Features(
|
51 |
+
{
|
52 |
+
"id": datasets.Value("string"),
|
53 |
+
"context": datasets.Value("string"),
|
54 |
+
"question": datasets.Value("string"),
|
55 |
+
"answers": datasets.features.Sequence(
|
56 |
+
{
|
57 |
+
"text": datasets.Value("string"),
|
58 |
+
"answer_start": datasets.Value("int32"),
|
59 |
+
}
|
60 |
+
),
|
61 |
+
# These are the features of your dataset like images, labels ...
|
62 |
+
}
|
63 |
+
),
|
64 |
+
# If there's a common (input, target) tuple from the features,
|
65 |
+
# specify them here. They'll be used if as_supervised=True in
|
66 |
+
# builder.as_dataset.
|
67 |
+
supervised_keys=None,
|
68 |
+
# Homepage of the dataset for documentation
|
69 |
+
homepage="https://github.com/crux82/squad-it",
|
70 |
+
citation=_CITATION,
|
71 |
+
)
|
72 |
+
|
73 |
+
def _split_generators(self, dl_manager):
|
74 |
+
"""Returns SplitGenerators."""
|
75 |
+
# TODO(squad_it): Downloads the data and defines the splits
|
76 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to
|
77 |
+
# download and extract URLs
|
78 |
+
urls_to_download = {"train": os.path.join(_URL, _TRAIN_FILE), "test": os.path.join(_URL, _TEST_FILE)}
|
79 |
+
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
80 |
+
|
81 |
+
return [
|
82 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
|
83 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
84 |
+
]
|
85 |
+
|
86 |
+
def _generate_examples(self, filepath):
|
87 |
+
"""Yields examples."""
|
88 |
+
# TODO(squad_it): Yields (key, example) tuples from the dataset
|
89 |
+
with open(filepath, encoding="utf-8") as f:
|
90 |
+
data = json.load(f)
|
91 |
+
for example in data["data"]:
|
92 |
+
for paragraph in example["paragraphs"]:
|
93 |
+
context = paragraph["context"].strip()
|
94 |
+
for qa in paragraph["qas"]:
|
95 |
+
question = qa["question"].strip()
|
96 |
+
id_ = qa["id"]
|
97 |
+
|
98 |
+
answer_starts = [answer["answer_start"] for answer in qa["answers"]]
|
99 |
+
answers = [answer["text"].strip() for answer in qa["answers"]]
|
100 |
+
|
101 |
+
yield id_, {
|
102 |
+
"context": context,
|
103 |
+
"question": question,
|
104 |
+
"id": id_,
|
105 |
+
"answers": {
|
106 |
+
"answer_start": answer_starts,
|
107 |
+
"text": answers,
|
108 |
+
},
|
109 |
+
}
|