Datasets:
Support latest HF datasets loading changes
Browse files- README.md +21 -12
- data/TiQuAD-v1-dev.json → dev.parquet +2 -2
- tiquad.py +0 -115
- data/TiQuAD-v1-train.json → train.parquet +2 -2
README.md
CHANGED
@@ -28,9 +28,9 @@ configs:
|
|
28 |
- config_name: default
|
29 |
data_files:
|
30 |
- split: train
|
31 |
-
path: "
|
32 |
- split: validation
|
33 |
-
path: "
|
34 |
---
|
35 |
|
36 |
# TiQuAD: Tigrinya Question Answering Dataset
|
@@ -74,22 +74,30 @@ The dataset was constructed through a careful multi-stage process:
|
|
74 |
|
75 |
## How to Load TiQuAD
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
```python
|
78 |
from datasets import load_dataset
|
79 |
|
80 |
# Load the dataset
|
81 |
-
tiquad = load_dataset("fgaim/tiquad"
|
82 |
print(tiquad)
|
83 |
```
|
84 |
|
|
|
|
|
85 |
```python
|
86 |
DatasetDict({
|
87 |
train: Dataset({
|
88 |
-
features: ['id', '
|
89 |
num_rows: 4452
|
90 |
-
})
|
91 |
validation: Dataset({
|
92 |
-
features: ['id', '
|
93 |
num_rows: 934
|
94 |
})
|
95 |
})
|
@@ -97,13 +105,14 @@ DatasetDict({
|
|
97 |
|
98 |
### Data Fields
|
99 |
|
100 |
-
- **`id`**: Unique identifier for each question
|
101 |
-
- **`
|
102 |
- **`context`**: The paragraph containing the answer (in Tigrinya)
|
103 |
-
- **`
|
104 |
-
-
|
105 |
-
- `
|
106 |
-
|
|
|
107 |
|
108 |
### Sample Entry
|
109 |
|
|
|
28 |
- config_name: default
|
29 |
data_files:
|
30 |
- split: train
|
31 |
+
path: "train.parquet"
|
32 |
- split: validation
|
33 |
+
path: "dev.parquet"
|
34 |
---
|
35 |
|
36 |
# TiQuAD: Tigrinya Question Answering Dataset
|
|
|
74 |
|
75 |
## How to Load TiQuAD
|
76 |
|
77 |
+
Install the `datasets` library installed by running `pip install -U datasets` in the terminal.
|
78 |
+
|
79 |
+
> Make sure the latest `datasets` library is installed as older versions may not properly load the data.
|
80 |
+
|
81 |
+
Then pull and load the dataset using Python, as follows:
|
82 |
+
|
83 |
```python
|
84 |
from datasets import load_dataset
|
85 |
|
86 |
# Load the dataset
|
87 |
+
tiquad = load_dataset("fgaim/tiquad")
|
88 |
print(tiquad)
|
89 |
```
|
90 |
|
91 |
+
That will print the dataset features:
|
92 |
+
|
93 |
```python
|
94 |
DatasetDict({
|
95 |
train: Dataset({
|
96 |
+
features: ['id', 'question', 'context', 'answers', 'article_title', 'context_id'],
|
97 |
num_rows: 4452
|
98 |
+
})
|
99 |
validation: Dataset({
|
100 |
+
features: ['id', 'question', 'context', 'answers', 'article_title', 'context_id'],
|
101 |
num_rows: 934
|
102 |
})
|
103 |
})
|
|
|
105 |
|
106 |
### Data Fields
|
107 |
|
108 |
+
- **`id`**: Unique identifier for each question
|
109 |
+
- **`question`**: The question to be answered (in Tigrinya)
|
110 |
- **`context`**: The paragraph containing the answer (in Tigrinya)
|
111 |
+
- **`answers`**: A list of dictionaries of candidate answers, each entry containing:
|
112 |
+
- `text`: An answer string (training data has one answer per question)
|
113 |
+
- `answer_start`: A starting position of answer string in the context
|
114 |
+
- **`article_title`**: Title of the source article
|
115 |
+
- **`context_id`**: Unique identifier of the context in the data split
|
116 |
|
117 |
### Sample Entry
|
118 |
|
data/TiQuAD-v1-dev.json → dev.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:10488d8c729d3bea063c08888a8751391f77c0c5305d8fd786aa8eb32dd6d117
|
3 |
+
size 160568
|
tiquad.py
DELETED
@@ -1,115 +0,0 @@
|
|
1 |
-
"""TiQuAD: Tigrinya Question-Answering Dataset."""
|
2 |
-
|
3 |
-
import json
|
4 |
-
|
5 |
-
import datasets
|
6 |
-
|
7 |
-
|
8 |
-
_HOMEPAGE = "https://github.com/fgaim/tiquad"
|
9 |
-
|
10 |
-
_DESCRIPTION = """\
|
11 |
-
TiQuAD is a manually annotated extractive Question-Answering (QA) dataset for the Tigrinya language.
|
12 |
-
"""
|
13 |
-
|
14 |
-
_CITATION = """\
|
15 |
-
@inproceedings{gaim-etal-2023-tiquad,
|
16 |
-
title = "{Question-Answering in a Low-resourced Language: Benchmark Dataset and Models for Tigrinya}",
|
17 |
-
author = "Fitsum Gaim and Wonsuk Yang and Hancheol Park and Jong C. Park",
|
18 |
-
booktitle = "Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
|
19 |
-
month = jul,
|
20 |
-
year = "2023",
|
21 |
-
address = "Toronto, Canada",
|
22 |
-
publisher = "Association for Computational Linguistics",
|
23 |
-
url = "https://aclanthology.org/2023.acl-long.661",
|
24 |
-
pages = "11857--11870",
|
25 |
-
}
|
26 |
-
"""
|
27 |
-
|
28 |
-
_LICENSE = "Creative Commons Attribution-ShareAlike 4.0"
|
29 |
-
|
30 |
-
_DATA_PATHS = {
|
31 |
-
"train": "data/TiQuAD-v1-train.json",
|
32 |
-
"dev": "data/TiQuAD-v1-dev.json",
|
33 |
-
}
|
34 |
-
|
35 |
-
|
36 |
-
class TiQuADConfig(datasets.BuilderConfig):
|
37 |
-
"""BuilderConfig for TiQuAD"""
|
38 |
-
|
39 |
-
def __init__(self, **kwargs):
|
40 |
-
"""BuilderConfig for TiQuAD.
|
41 |
-
Args:
|
42 |
-
**kwargs: keyword arguments forwarded to super.
|
43 |
-
"""
|
44 |
-
super(TiQuADConfig, self).__init__(**kwargs)
|
45 |
-
|
46 |
-
|
47 |
-
class TiQuAD(datasets.GeneratorBasedBuilder):
|
48 |
-
"""TiQuAD dataset."""
|
49 |
-
|
50 |
-
VERSION = datasets.Version("1.0.0")
|
51 |
-
|
52 |
-
def _info(self):
|
53 |
-
return datasets.DatasetInfo(
|
54 |
-
description=_DESCRIPTION,
|
55 |
-
features=datasets.Features(
|
56 |
-
{
|
57 |
-
"id": datasets.Value("string"),
|
58 |
-
"title": datasets.Value("string"),
|
59 |
-
"context": datasets.Value("string"),
|
60 |
-
"question": datasets.Value("string"),
|
61 |
-
"answers": datasets.features.Sequence(
|
62 |
-
{
|
63 |
-
"text": datasets.Value("string"),
|
64 |
-
"answer_start": datasets.Value("int32"),
|
65 |
-
}
|
66 |
-
),
|
67 |
-
}
|
68 |
-
),
|
69 |
-
homepage=_HOMEPAGE,
|
70 |
-
citation=_CITATION,
|
71 |
-
license=_LICENSE,
|
72 |
-
)
|
73 |
-
|
74 |
-
def _split_generators(self, dl_manager):
|
75 |
-
"""Returns SplitGenerators."""
|
76 |
-
downloaded_files = dl_manager.download_and_extract(_DATA_PATHS)
|
77 |
-
|
78 |
-
return [
|
79 |
-
datasets.SplitGenerator(
|
80 |
-
name=datasets.Split.TRAIN,
|
81 |
-
gen_kwargs={"filepath": downloaded_files["train"]},
|
82 |
-
),
|
83 |
-
datasets.SplitGenerator(
|
84 |
-
name=datasets.Split.VALIDATION,
|
85 |
-
gen_kwargs={"filepath": downloaded_files["dev"]},
|
86 |
-
)
|
87 |
-
]
|
88 |
-
|
89 |
-
def _generate_examples(self, filepath):
|
90 |
-
"""Yields TiQuAD examples."""
|
91 |
-
with open(filepath, encoding="utf-8") as fin:
|
92 |
-
_quad = json.load(fin)
|
93 |
-
for example in _quad["data"]:
|
94 |
-
title = example.get("title", "")
|
95 |
-
for paragraph in example["paragraphs"]:
|
96 |
-
context = paragraph["context"]
|
97 |
-
for qa in paragraph["qas"]:
|
98 |
-
_id = qa["id"]
|
99 |
-
answers = [
|
100 |
-
{
|
101 |
-
"text": answer["text"],
|
102 |
-
"answer_start": answer["answer_start"],
|
103 |
-
}
|
104 |
-
for answer in qa["answers"]
|
105 |
-
]
|
106 |
-
yield (
|
107 |
-
_id,
|
108 |
-
{
|
109 |
-
"id": _id,
|
110 |
-
"title": title,
|
111 |
-
"context": context,
|
112 |
-
"question": qa["question"],
|
113 |
-
"answers": answers,
|
114 |
-
},
|
115 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/TiQuAD-v1-train.json → train.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:def707dcc1bb14400a05b6e4e0acdec07f9d32a81433a5c04bd0c0de894679b2
|
3 |
+
size 704162
|