darshijain sumanthd commited on
Commit
514e285
·
0 Parent(s):

Duplicate from ai4bharat/IndicQA

Browse files

Co-authored-by: Sumanth Doddapaneni <sumanthd@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ftz filter=lfs diff=lfs merge=lfs -text
6
+ *.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.h5 filter=lfs diff=lfs merge=lfs -text
8
+ *.joblib filter=lfs diff=lfs merge=lfs -text
9
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
+ *.lz4 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
+ *.npy filter=lfs diff=lfs merge=lfs -text
14
+ *.npz filter=lfs diff=lfs merge=lfs -text
15
+ *.onnx filter=lfs diff=lfs merge=lfs -text
16
+ *.ot filter=lfs diff=lfs merge=lfs -text
17
+ *.parquet filter=lfs diff=lfs merge=lfs -text
18
+ *.pb filter=lfs diff=lfs merge=lfs -text
19
+ *.pickle filter=lfs diff=lfs merge=lfs -text
20
+ *.pkl filter=lfs diff=lfs merge=lfs -text
21
+ *.pt filter=lfs diff=lfs merge=lfs -text
22
+ *.pth filter=lfs diff=lfs merge=lfs -text
23
+ *.rar filter=lfs diff=lfs merge=lfs -text
24
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
25
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
26
+ *.tflite filter=lfs diff=lfs merge=lfs -text
27
+ *.tgz filter=lfs diff=lfs merge=lfs -text
28
+ *.wasm filter=lfs diff=lfs merge=lfs -text
29
+ *.xz filter=lfs diff=lfs merge=lfs -text
30
+ *.zip filter=lfs diff=lfs merge=lfs -text
31
+ *.zst filter=lfs diff=lfs merge=lfs -text
32
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
33
+ # Audio files - uncompressed
34
+ *.pcm filter=lfs diff=lfs merge=lfs -text
35
+ *.sam filter=lfs diff=lfs merge=lfs -text
36
+ *.raw filter=lfs diff=lfs merge=lfs -text
37
+ # Audio files - compressed
38
+ *.aac filter=lfs diff=lfs merge=lfs -text
39
+ *.flac filter=lfs diff=lfs merge=lfs -text
40
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
41
+ *.ogg filter=lfs diff=lfs merge=lfs -text
42
+ *.wav filter=lfs diff=lfs merge=lfs -text
43
+ # Image files - uncompressed
44
+ *.bmp filter=lfs diff=lfs merge=lfs -text
45
+ *.gif filter=lfs diff=lfs merge=lfs -text
46
+ *.png filter=lfs diff=lfs merge=lfs -text
47
+ *.tiff filter=lfs diff=lfs merge=lfs -text
48
+ # Image files - compressed
49
+ *.jpg filter=lfs diff=lfs merge=lfs -text
50
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
51
+ *.webp filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .DS_Store
IndicQA.py ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """TODO(xquad): Add a description here."""
2
+
3
+
4
+ import json
5
+
6
+ import datasets
7
+
8
+
9
+ _CITATION = """\
10
+
11
+ """
12
+
13
+ _DESCRIPTION = """\
14
+
15
+ """
16
+
17
+ _URL = "https://huggingface.co/datasets/ai4bharat/IndicQA/resolve/main/data/"
18
+ _LANG = ["as", "bn", "gu", "hi", "kn", "ml", "mr", "or", "pa", "ta", "te"]
19
+
20
+
21
+ class IndicqaConfig(datasets.BuilderConfig):
22
+
23
+ """BuilderConfig for Indicqa"""
24
+
25
+ def __init__(self, lang, **kwargs):
26
+ """
27
+
28
+ Args:
29
+ lang: string, language for the input text
30
+ **kwargs: keyword arguments forwarded to super.
31
+ """
32
+ super(IndicqaConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
33
+ self.lang = lang
34
+
35
+
36
+ class Xquad(datasets.GeneratorBasedBuilder):
37
+ """TODO(indicqa): Short description of my dataset."""
38
+
39
+ # TODO(indicqa): Set up version.
40
+ VERSION = datasets.Version("1.0.0")
41
+ BUILDER_CONFIGS = [IndicqaConfig(name=f"indicqa.{lang}", description=_DESCRIPTION, lang=lang) for lang in _LANG]
42
+
43
+ def _info(self):
44
+ # TODO(indicqa): Specifies the datasets.DatasetInfo object
45
+ return datasets.DatasetInfo(
46
+ # This is the description that will appear on the datasets page.
47
+ description=_DESCRIPTION,
48
+ # datasets.features.FeatureConnectors
49
+ features=datasets.Features(
50
+ {
51
+ "id": datasets.Value("string"),
52
+ "context": datasets.Value("string"),
53
+ "question": datasets.Value("string"),
54
+ "answers": datasets.features.Sequence(
55
+ {
56
+ "text": datasets.Value("string"),
57
+ "answer_start": datasets.Value("int32"),
58
+ }
59
+ ),
60
+ # These are the features of your dataset like images, labels ...
61
+ }
62
+ ),
63
+ # If there's a common (input, target) tuple from the features,
64
+ # specify them here. They'll be used if as_supervised=True in
65
+ # builder.as_dataset.
66
+ supervised_keys=None,
67
+ # Homepage of the dataset for documentation
68
+ homepage="",
69
+ citation=_CITATION,
70
+ )
71
+
72
+ def _split_generators(self, dl_manager):
73
+ """Returns SplitGenerators."""
74
+ # TODO(indicqa): Downloads the data and defines the splits
75
+ # dl_manager is a datasets.download.DownloadManager that can be used to
76
+ # download and extract URLs
77
+ urls_to_download = {lang: _URL + f"indicqa.{lang}.json" for lang in _LANG}
78
+ downloaded_files = dl_manager.download_and_extract(urls_to_download)
79
+
80
+ return [
81
+ datasets.SplitGenerator(
82
+ name=datasets.Split.TEST,
83
+ # These kwargs will be passed to _generate_examples
84
+ gen_kwargs={"filepath": downloaded_files[self.config.lang]},
85
+ ),
86
+ ]
87
+
88
+ def _generate_examples(self, filepath):
89
+ """Yields examples."""
90
+ # TODO(indicqa): Yields (key, example) tuples from the dataset
91
+ with open(filepath, encoding="utf-8") as f:
92
+ indicqa = json.load(f)
93
+ id_ = 0
94
+ for article in indicqa["data"]:
95
+ for paragraph in article["paragraphs"]:
96
+ context = paragraph["context"].strip()
97
+ for qa in paragraph["qas"]:
98
+ question = qa["question"].strip()
99
+ answer_starts = [answer["answer_start"] for answer in qa["answers"]]
100
+ answers = [answer["text"].strip() for answer in qa["answers"]]
101
+
102
+ # Features currently used are "context", "question", and "answers".
103
+ # Others are extracted here for the ease of future expansions.
104
+ yield id_, {
105
+ "context": context,
106
+ "question": question,
107
+ "id": qa["id"],
108
+ "answers": {
109
+ "answer_start": answer_starts,
110
+ "text": answers,
111
+ },
112
+ }
113
+ id_ += 1
README.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language:
5
+ - pa
6
+ - ta
7
+ - te
8
+ - as
9
+ - bn
10
+ - hi
11
+ - or
12
+ - ml
13
+ - mr
14
+ - kn
15
+ - gu
16
+ language_creators:
17
+ - found
18
+ license:
19
+ - cc-by-4.0
20
+ multilinguality:
21
+ - multilingual
22
+ pretty_name: IndicQA
23
+ size_categories:
24
+ - n<1K
25
+ source_datasets:
26
+ - original
27
+ task_categories:
28
+ - question-answering
29
+ task_ids:
30
+ - closed-domain-qa
31
+ ---
32
+
33
+ # Dataset Card for [Dataset Name]
34
+
35
+ **Description:**
36
+ The Indic QA dataset is designed for question answering tasks, with a focus on Indic languages. It contains questions paired with corresponding contexts and answers. The dataset aims to facilitate research and development in question answering systems for Indic languages.
37
+
38
+ **Dataset Info:**
39
+
40
+ **Features:**
41
+ - **ID:** Identifier for each data instance.
42
+ - **Context:** The passage or context providing information relevant to answering the question.
43
+ - **Question:** The question posed by the user.
44
+ - **Answers:** The possible answers to the question, provided as a sequence.
45
+
46
+ **Languages:**
47
+ - **Assamese (as)**
48
+ - **Bengali (bn)**
49
+ - **Hindi (hi)**
50
+ - **Kannada (kn)**
51
+ - **Marathi (mr)**
52
+ - **Malayalam (ml)**
53
+ - **Punjabi (pa)**
54
+ - **Oriya (or)**
55
+ - **Tamil (ta)**
56
+ - **Telugu (te)**
57
+
58
+
59
+ Thanks to [@github-username](https://github.com/<github-username>) for adding this dataset.
data/.gitattributes ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ indicqa.ta.json filter=lfs diff=lfs merge=lfs -text
2
+ indicqa.te.json filter=lfs diff=lfs merge=lfs -text
3
+ indicqa.as.json filter=lfs diff=lfs merge=lfs -text
4
+ indicqa.bn.json filter=lfs diff=lfs merge=lfs -text
5
+ indicqa.hi.json filter=lfs diff=lfs merge=lfs -text
6
+ indicqa.ml.json filter=lfs diff=lfs merge=lfs -text
7
+ indicqa.pa.json filter=lfs diff=lfs merge=lfs -text
8
+ indicqa.gu.json filter=lfs diff=lfs merge=lfs -text
9
+ indicqa.kn.json filter=lfs diff=lfs merge=lfs -text
10
+ indicqa.mr.json filter=lfs diff=lfs merge=lfs -text
11
+ indicqa.or.json filter=lfs diff=lfs merge=lfs -text
data/indicqa.as.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2bb91906d9a9a0390f02a79e08f67a1e72fcda95335a9e98ec8884e8063286f2
3
+ size 2067724
data/indicqa.bn.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0e65c5b28e90d1912c0ec114eba5fa81aa39cbcf76ec968412c7d77900d666b
3
+ size 2592245
data/indicqa.gu.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0964fbdb056c1d21942a4332da31a2c70eba7387c327ee604bcae8785b32569f
3
+ size 1901951
data/indicqa.hi.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c91d20e7c095956a097e8d2962c0e4bd7029006f2031e86fc4af16f7fef8cb5
3
+ size 2673518
data/indicqa.kn.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7041d848ac33981008454ba49d1ddc023112ad02955e0ab34135012f61cee33c
3
+ size 1571913
data/indicqa.ml.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aebd0ebf2d40ad4625a17194127cefa0e834ba60f85bc01e694a006c51a6f44f
3
+ size 2816110
data/indicqa.mr.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:03c14357ce3e54bb02f9d0b4a0e531ad687c70f68416cc46400216a3376d9d52
3
+ size 2177201
data/indicqa.or.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c55506f5d8d5e4dfac2c2939308f0405a0312d6d077b087688d0d471e01c63cf
3
+ size 1602257
data/indicqa.pa.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:99a3407f0d59401a24193a94d7fa793ea647adaa4476b3ed9261879810c6a695
3
+ size 1857268
data/indicqa.ta.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:247c9e74623f8e73e723f0dabd725c4504b3ca6690c4019c0c6e78f4a7aae77c
3
+ size 2709926
data/indicqa.te.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6e32cd280bc4792c9b0852abe6450984a7ba807cb7d1d004df8c9e6eaf33dc6d
3
+ size 3119401