Divyanshu commited on
Commit
77da6f3
1 Parent(s): 533c910
.history/IE_SemParse_20230708001749.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+
56
+
57
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
58
+
59
+
60
+ class IE_SemParseConfig(datasets.BuilderConfig):
61
+ """BuilderConfig for IE-SemParse."""
62
+
63
+ def __init__(self, dataset: str, language: str, **kwargs):
64
+ """BuilderConfig for IE-SemParse.
65
+
66
+ Args:
67
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
68
+ **kwargs: keyword arguments forwarded to super.
69
+ """
70
+ super(IE_SemParseConfig, self).__init__(**kwargs)
71
+
72
+ self.dataset = dataset
73
+ self.language = language
74
+ self.languages = _LANGUAGES
75
+ self.datasets = _DATASETS
76
+
77
+ self._URLS = [os.path.join(
78
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
79
+
80
+
81
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
82
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
83
+
84
+ VERSION = datasets.Version("1.0.0", "")
85
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
86
+ BUILDER_CONFIGS = [
87
+ IE_SemParseConfig(
88
+ name=f"{dataset}_{language}",
89
+ language=language,
90
+ dataset=dataset,
91
+ version=datasets.Version("1.0.0", ""),
92
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
93
+ )
94
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
95
+ ]
96
+
97
+ def _info(self):
98
+ dl_manager = datasets.DownloadManager()
99
+
100
+ urls_to_download = self.config._URLS
101
+
102
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
103
+
104
+ with open(filepath, "r") as f:
105
+ data = json.load(f)
106
+
107
+ features = datasets.Features(
108
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
109
+ )
110
+
111
+ return datasets.DatasetInfo(
112
+ description=_DESCRIPTION,
113
+ features=features,
114
+ # No default supervised_keys (as we have to pass both premise
115
+ # and hypothesis as input).
116
+ supervised_keys=None,
117
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
118
+ citation=_CITATION,
119
+ )
120
+
121
+ def _split_generators(self, dl_manager):
122
+ urls_to_download = self.config._URLS
123
+
124
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
125
+
126
+ return [
127
+ datasets.SplitGenerator(
128
+ name=datasets.Split.TRAIN,
129
+ gen_kwargs={
130
+ "split_key": "train",
131
+ "filepath": downloaded_file,
132
+ "data_format": "IE-SemParse"
133
+ },
134
+ ),
135
+ datasets.SplitGenerator(
136
+ name=datasets.Split.TEST,
137
+ gen_kwargs={
138
+ "split_key": "test",
139
+ "filepath": downloaded_file,
140
+ "data_format": "IE-SemParse"
141
+ },
142
+ ),
143
+ datasets.SplitGenerator(
144
+ name=datasets.Split.VALIDATION,
145
+ gen_kwargs={
146
+ "split_key": "val",
147
+ "filepath": downloaded_file,
148
+ "data_format": "IE-SemParse"
149
+ },
150
+ ),
151
+ ]
152
+
153
+ def _generate_examples(self, data_format, split_key, filepath):
154
+ """This function returns the examples in the raw (text) form."""
155
+
156
+ with open(filepath, "r") as f:
157
+ data = json.load(f)
158
+ data = data[split_key]
159
+
160
+ for idx, row in enumerate(data):
161
+ yield idx, {
162
+ k: v for k, v in row.items()
163
+ }
.history/IE_SemParse_20230708001751.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping
56
+
57
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
58
+
59
+
60
+ class IE_SemParseConfig(datasets.BuilderConfig):
61
+ """BuilderConfig for IE-SemParse."""
62
+
63
+ def __init__(self, dataset: str, language: str, **kwargs):
64
+ """BuilderConfig for IE-SemParse.
65
+
66
+ Args:
67
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
68
+ **kwargs: keyword arguments forwarded to super.
69
+ """
70
+ super(IE_SemParseConfig, self).__init__(**kwargs)
71
+
72
+ self.dataset = dataset
73
+ self.language = language
74
+ self.languages = _LANGUAGES
75
+ self.datasets = _DATASETS
76
+
77
+ self._URLS = [os.path.join(
78
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
79
+
80
+
81
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
82
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
83
+
84
+ VERSION = datasets.Version("1.0.0", "")
85
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
86
+ BUILDER_CONFIGS = [
87
+ IE_SemParseConfig(
88
+ name=f"{dataset}_{language}",
89
+ language=language,
90
+ dataset=dataset,
91
+ version=datasets.Version("1.0.0", ""),
92
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
93
+ )
94
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
95
+ ]
96
+
97
+ def _info(self):
98
+ dl_manager = datasets.DownloadManager()
99
+
100
+ urls_to_download = self.config._URLS
101
+
102
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
103
+
104
+ with open(filepath, "r") as f:
105
+ data = json.load(f)
106
+
107
+ features = datasets.Features(
108
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
109
+ )
110
+
111
+ return datasets.DatasetInfo(
112
+ description=_DESCRIPTION,
113
+ features=features,
114
+ # No default supervised_keys (as we have to pass both premise
115
+ # and hypothesis as input).
116
+ supervised_keys=None,
117
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
118
+ citation=_CITATION,
119
+ )
120
+
121
+ def _split_generators(self, dl_manager):
122
+ urls_to_download = self.config._URLS
123
+
124
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
125
+
126
+ return [
127
+ datasets.SplitGenerator(
128
+ name=datasets.Split.TRAIN,
129
+ gen_kwargs={
130
+ "split_key": "train",
131
+ "filepath": downloaded_file,
132
+ "data_format": "IE-SemParse"
133
+ },
134
+ ),
135
+ datasets.SplitGenerator(
136
+ name=datasets.Split.TEST,
137
+ gen_kwargs={
138
+ "split_key": "test",
139
+ "filepath": downloaded_file,
140
+ "data_format": "IE-SemParse"
141
+ },
142
+ ),
143
+ datasets.SplitGenerator(
144
+ name=datasets.Split.VALIDATION,
145
+ gen_kwargs={
146
+ "split_key": "val",
147
+ "filepath": downloaded_file,
148
+ "data_format": "IE-SemParse"
149
+ },
150
+ ),
151
+ ]
152
+
153
+ def _generate_examples(self, data_format, split_key, filepath):
154
+ """This function returns the examples in the raw (text) form."""
155
+
156
+ with open(filepath, "r") as f:
157
+ data = json.load(f)
158
+ data = data[split_key]
159
+
160
+ for idx, row in enumerate(data):
161
+ yield idx, {
162
+ k: v for k, v in row.items()
163
+ }
.history/IE_SemParse_20230708001755.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {""}
56
+
57
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
58
+
59
+
60
+ class IE_SemParseConfig(datasets.BuilderConfig):
61
+ """BuilderConfig for IE-SemParse."""
62
+
63
+ def __init__(self, dataset: str, language: str, **kwargs):
64
+ """BuilderConfig for IE-SemParse.
65
+
66
+ Args:
67
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
68
+ **kwargs: keyword arguments forwarded to super.
69
+ """
70
+ super(IE_SemParseConfig, self).__init__(**kwargs)
71
+
72
+ self.dataset = dataset
73
+ self.language = language
74
+ self.languages = _LANGUAGES
75
+ self.datasets = _DATASETS
76
+
77
+ self._URLS = [os.path.join(
78
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
79
+
80
+
81
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
82
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
83
+
84
+ VERSION = datasets.Version("1.0.0", "")
85
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
86
+ BUILDER_CONFIGS = [
87
+ IE_SemParseConfig(
88
+ name=f"{dataset}_{language}",
89
+ language=language,
90
+ dataset=dataset,
91
+ version=datasets.Version("1.0.0", ""),
92
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
93
+ )
94
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
95
+ ]
96
+
97
+ def _info(self):
98
+ dl_manager = datasets.DownloadManager()
99
+
100
+ urls_to_download = self.config._URLS
101
+
102
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
103
+
104
+ with open(filepath, "r") as f:
105
+ data = json.load(f)
106
+
107
+ features = datasets.Features(
108
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
109
+ )
110
+
111
+ return datasets.DatasetInfo(
112
+ description=_DESCRIPTION,
113
+ features=features,
114
+ # No default supervised_keys (as we have to pass both premise
115
+ # and hypothesis as input).
116
+ supervised_keys=None,
117
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
118
+ citation=_CITATION,
119
+ )
120
+
121
+ def _split_generators(self, dl_manager):
122
+ urls_to_download = self.config._URLS
123
+
124
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
125
+
126
+ return [
127
+ datasets.SplitGenerator(
128
+ name=datasets.Split.TRAIN,
129
+ gen_kwargs={
130
+ "split_key": "train",
131
+ "filepath": downloaded_file,
132
+ "data_format": "IE-SemParse"
133
+ },
134
+ ),
135
+ datasets.SplitGenerator(
136
+ name=datasets.Split.TEST,
137
+ gen_kwargs={
138
+ "split_key": "test",
139
+ "filepath": downloaded_file,
140
+ "data_format": "IE-SemParse"
141
+ },
142
+ ),
143
+ datasets.SplitGenerator(
144
+ name=datasets.Split.VALIDATION,
145
+ gen_kwargs={
146
+ "split_key": "val",
147
+ "filepath": downloaded_file,
148
+ "data_format": "IE-SemParse"
149
+ },
150
+ ),
151
+ ]
152
+
153
+ def _generate_examples(self, data_format, split_key, filepath):
154
+ """This function returns the examples in the raw (text) form."""
155
+
156
+ with open(filepath, "r") as f:
157
+ data = json.load(f)
158
+ data = data[split_key]
159
+
160
+ for idx, row in enumerate(data):
161
+ yield idx, {
162
+ k: v for k, v in row.items()
163
+ }
.history/IE_SemParse_20230708001759.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {"itop": IE-}
56
+
57
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
58
+
59
+
60
+ class IE_SemParseConfig(datasets.BuilderConfig):
61
+ """BuilderConfig for IE-SemParse."""
62
+
63
+ def __init__(self, dataset: str, language: str, **kwargs):
64
+ """BuilderConfig for IE-SemParse.
65
+
66
+ Args:
67
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
68
+ **kwargs: keyword arguments forwarded to super.
69
+ """
70
+ super(IE_SemParseConfig, self).__init__(**kwargs)
71
+
72
+ self.dataset = dataset
73
+ self.language = language
74
+ self.languages = _LANGUAGES
75
+ self.datasets = _DATASETS
76
+
77
+ self._URLS = [os.path.join(
78
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
79
+
80
+
81
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
82
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
83
+
84
+ VERSION = datasets.Version("1.0.0", "")
85
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
86
+ BUILDER_CONFIGS = [
87
+ IE_SemParseConfig(
88
+ name=f"{dataset}_{language}",
89
+ language=language,
90
+ dataset=dataset,
91
+ version=datasets.Version("1.0.0", ""),
92
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
93
+ )
94
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
95
+ ]
96
+
97
+ def _info(self):
98
+ dl_manager = datasets.DownloadManager()
99
+
100
+ urls_to_download = self.config._URLS
101
+
102
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
103
+
104
+ with open(filepath, "r") as f:
105
+ data = json.load(f)
106
+
107
+ features = datasets.Features(
108
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
109
+ )
110
+
111
+ return datasets.DatasetInfo(
112
+ description=_DESCRIPTION,
113
+ features=features,
114
+ # No default supervised_keys (as we have to pass both premise
115
+ # and hypothesis as input).
116
+ supervised_keys=None,
117
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
118
+ citation=_CITATION,
119
+ )
120
+
121
+ def _split_generators(self, dl_manager):
122
+ urls_to_download = self.config._URLS
123
+
124
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
125
+
126
+ return [
127
+ datasets.SplitGenerator(
128
+ name=datasets.Split.TRAIN,
129
+ gen_kwargs={
130
+ "split_key": "train",
131
+ "filepath": downloaded_file,
132
+ "data_format": "IE-SemParse"
133
+ },
134
+ ),
135
+ datasets.SplitGenerator(
136
+ name=datasets.Split.TEST,
137
+ gen_kwargs={
138
+ "split_key": "test",
139
+ "filepath": downloaded_file,
140
+ "data_format": "IE-SemParse"
141
+ },
142
+ ),
143
+ datasets.SplitGenerator(
144
+ name=datasets.Split.VALIDATION,
145
+ gen_kwargs={
146
+ "split_key": "val",
147
+ "filepath": downloaded_file,
148
+ "data_format": "IE-SemParse"
149
+ },
150
+ ),
151
+ ]
152
+
153
+ def _generate_examples(self, data_format, split_key, filepath):
154
+ """This function returns the examples in the raw (text) form."""
155
+
156
+ with open(filepath, "r") as f:
157
+ data = json.load(f)
158
+ data = data[split_key]
159
+
160
+ for idx, row in enumerate(data):
161
+ yield idx, {
162
+ k: v for k, v in row.items()
163
+ }
.history/IE_SemParse_20230708001809.py ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {"itop": "IE-mTOP",
56
+ "indic-atis": }
57
+
58
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
59
+
60
+
61
+ class IE_SemParseConfig(datasets.BuilderConfig):
62
+ """BuilderConfig for IE-SemParse."""
63
+
64
+ def __init__(self, dataset: str, language: str, **kwargs):
65
+ """BuilderConfig for IE-SemParse.
66
+
67
+ Args:
68
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
69
+ **kwargs: keyword arguments forwarded to super.
70
+ """
71
+ super(IE_SemParseConfig, self).__init__(**kwargs)
72
+
73
+ self.dataset = dataset
74
+ self.language = language
75
+ self.languages = _LANGUAGES
76
+ self.datasets = _DATASETS
77
+
78
+ self._URLS = [os.path.join(
79
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
80
+
81
+
82
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
83
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
84
+
85
+ VERSION = datasets.Version("1.0.0", "")
86
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
87
+ BUILDER_CONFIGS = [
88
+ IE_SemParseConfig(
89
+ name=f"{dataset}_{language}",
90
+ language=language,
91
+ dataset=dataset,
92
+ version=datasets.Version("1.0.0", ""),
93
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
94
+ )
95
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
96
+ ]
97
+
98
+ def _info(self):
99
+ dl_manager = datasets.DownloadManager()
100
+
101
+ urls_to_download = self.config._URLS
102
+
103
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
104
+
105
+ with open(filepath, "r") as f:
106
+ data = json.load(f)
107
+
108
+ features = datasets.Features(
109
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
110
+ )
111
+
112
+ return datasets.DatasetInfo(
113
+ description=_DESCRIPTION,
114
+ features=features,
115
+ # No default supervised_keys (as we have to pass both premise
116
+ # and hypothesis as input).
117
+ supervised_keys=None,
118
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
119
+ citation=_CITATION,
120
+ )
121
+
122
+ def _split_generators(self, dl_manager):
123
+ urls_to_download = self.config._URLS
124
+
125
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
126
+
127
+ return [
128
+ datasets.SplitGenerator(
129
+ name=datasets.Split.TRAIN,
130
+ gen_kwargs={
131
+ "split_key": "train",
132
+ "filepath": downloaded_file,
133
+ "data_format": "IE-SemParse"
134
+ },
135
+ ),
136
+ datasets.SplitGenerator(
137
+ name=datasets.Split.TEST,
138
+ gen_kwargs={
139
+ "split_key": "test",
140
+ "filepath": downloaded_file,
141
+ "data_format": "IE-SemParse"
142
+ },
143
+ ),
144
+ datasets.SplitGenerator(
145
+ name=datasets.Split.VALIDATION,
146
+ gen_kwargs={
147
+ "split_key": "val",
148
+ "filepath": downloaded_file,
149
+ "data_format": "IE-SemParse"
150
+ },
151
+ ),
152
+ ]
153
+
154
+ def _generate_examples(self, data_format, split_key, filepath):
155
+ """This function returns the examples in the raw (text) form."""
156
+
157
+ with open(filepath, "r") as f:
158
+ data = json.load(f)
159
+ data = data[split_key]
160
+
161
+ for idx, row in enumerate(data):
162
+ yield idx, {
163
+ k: v for k, v in row.items()
164
+ }
.history/IE_SemParse_20230708001812.py ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {"itop": "IE-mTOP",
56
+ "indic-atis": "IE-ATIS"}
57
+
58
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
59
+
60
+
61
+ class IE_SemParseConfig(datasets.BuilderConfig):
62
+ """BuilderConfig for IE-SemParse."""
63
+
64
+ def __init__(self, dataset: str, language: str, **kwargs):
65
+ """BuilderConfig for IE-SemParse.
66
+
67
+ Args:
68
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
69
+ **kwargs: keyword arguments forwarded to super.
70
+ """
71
+ super(IE_SemParseConfig, self).__init__(**kwargs)
72
+
73
+ self.dataset = dataset
74
+ self.language = language
75
+ self.languages = _LANGUAGES
76
+ self.datasets = _DATASETS
77
+
78
+ self._URLS = [os.path.join(
79
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
80
+
81
+
82
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
83
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
84
+
85
+ VERSION = datasets.Version("1.0.0", "")
86
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
87
+ BUILDER_CONFIGS = [
88
+ IE_SemParseConfig(
89
+ name=f"{dataset}_{language}",
90
+ language=language,
91
+ dataset=dataset,
92
+ version=datasets.Version("1.0.0", ""),
93
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
94
+ )
95
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
96
+ ]
97
+
98
+ def _info(self):
99
+ dl_manager = datasets.DownloadManager()
100
+
101
+ urls_to_download = self.config._URLS
102
+
103
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
104
+
105
+ with open(filepath, "r") as f:
106
+ data = json.load(f)
107
+
108
+ features = datasets.Features(
109
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
110
+ )
111
+
112
+ return datasets.DatasetInfo(
113
+ description=_DESCRIPTION,
114
+ features=features,
115
+ # No default supervised_keys (as we have to pass both premise
116
+ # and hypothesis as input).
117
+ supervised_keys=None,
118
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
119
+ citation=_CITATION,
120
+ )
121
+
122
+ def _split_generators(self, dl_manager):
123
+ urls_to_download = self.config._URLS
124
+
125
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
126
+
127
+ return [
128
+ datasets.SplitGenerator(
129
+ name=datasets.Split.TRAIN,
130
+ gen_kwargs={
131
+ "split_key": "train",
132
+ "filepath": downloaded_file,
133
+ "data_format": "IE-SemParse"
134
+ },
135
+ ),
136
+ datasets.SplitGenerator(
137
+ name=datasets.Split.TEST,
138
+ gen_kwargs={
139
+ "split_key": "test",
140
+ "filepath": downloaded_file,
141
+ "data_format": "IE-SemParse"
142
+ },
143
+ ),
144
+ datasets.SplitGenerator(
145
+ name=datasets.Split.VALIDATION,
146
+ gen_kwargs={
147
+ "split_key": "val",
148
+ "filepath": downloaded_file,
149
+ "data_format": "IE-SemParse"
150
+ },
151
+ ),
152
+ ]
153
+
154
+ def _generate_examples(self, data_format, split_key, filepath):
155
+ """This function returns the examples in the raw (text) form."""
156
+
157
+ with open(filepath, "r") as f:
158
+ data = json.load(f)
159
+ data = data[split_key]
160
+
161
+ for idx, row in enumerate(data):
162
+ yield idx, {
163
+ k: v for k, v in row.items()
164
+ }
.history/IE_SemParse_20230708001814.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {"itop": "IE-mTOP",
56
+ "indic-atis": "IE-ATIS",
57
+ ""}
58
+
59
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
60
+
61
+
62
+ class IE_SemParseConfig(datasets.BuilderConfig):
63
+ """BuilderConfig for IE-SemParse."""
64
+
65
+ def __init__(self, dataset: str, language: str, **kwargs):
66
+ """BuilderConfig for IE-SemParse.
67
+
68
+ Args:
69
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
70
+ **kwargs: keyword arguments forwarded to super.
71
+ """
72
+ super(IE_SemParseConfig, self).__init__(**kwargs)
73
+
74
+ self.dataset = dataset
75
+ self.language = language
76
+ self.languages = _LANGUAGES
77
+ self.datasets = _DATASETS
78
+
79
+ self._URLS = [os.path.join(
80
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
81
+
82
+
83
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
84
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
85
+
86
+ VERSION = datasets.Version("1.0.0", "")
87
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
88
+ BUILDER_CONFIGS = [
89
+ IE_SemParseConfig(
90
+ name=f"{dataset}_{language}",
91
+ language=language,
92
+ dataset=dataset,
93
+ version=datasets.Version("1.0.0", ""),
94
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
95
+ )
96
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
97
+ ]
98
+
99
+ def _info(self):
100
+ dl_manager = datasets.DownloadManager()
101
+
102
+ urls_to_download = self.config._URLS
103
+
104
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
105
+
106
+ with open(filepath, "r") as f:
107
+ data = json.load(f)
108
+
109
+ features = datasets.Features(
110
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
111
+ )
112
+
113
+ return datasets.DatasetInfo(
114
+ description=_DESCRIPTION,
115
+ features=features,
116
+ # No default supervised_keys (as we have to pass both premise
117
+ # and hypothesis as input).
118
+ supervised_keys=None,
119
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
120
+ citation=_CITATION,
121
+ )
122
+
123
+ def _split_generators(self, dl_manager):
124
+ urls_to_download = self.config._URLS
125
+
126
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
127
+
128
+ return [
129
+ datasets.SplitGenerator(
130
+ name=datasets.Split.TRAIN,
131
+ gen_kwargs={
132
+ "split_key": "train",
133
+ "filepath": downloaded_file,
134
+ "data_format": "IE-SemParse"
135
+ },
136
+ ),
137
+ datasets.SplitGenerator(
138
+ name=datasets.Split.TEST,
139
+ gen_kwargs={
140
+ "split_key": "test",
141
+ "filepath": downloaded_file,
142
+ "data_format": "IE-SemParse"
143
+ },
144
+ ),
145
+ datasets.SplitGenerator(
146
+ name=datasets.Split.VALIDATION,
147
+ gen_kwargs={
148
+ "split_key": "val",
149
+ "filepath": downloaded_file,
150
+ "data_format": "IE-SemParse"
151
+ },
152
+ ),
153
+ ]
154
+
155
+ def _generate_examples(self, data_format, split_key, filepath):
156
+ """This function returns the examples in the raw (text) form."""
157
+
158
+ with open(filepath, "r") as f:
159
+ data = json.load(f)
160
+ data = data[split_key]
161
+
162
+ for idx, row in enumerate(data):
163
+ yield idx, {
164
+ k: v for k, v in row.items()
165
+ }
.history/IE_SemParse_20230708001819.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {"itop": "IE-mTOP",
56
+ "indic-atis": "IE-ATIS",
57
+ "indic-TOP": }
58
+
59
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
60
+
61
+
62
+ class IE_SemParseConfig(datasets.BuilderConfig):
63
+ """BuilderConfig for IE-SemParse."""
64
+
65
+ def __init__(self, dataset: str, language: str, **kwargs):
66
+ """BuilderConfig for IE-SemParse.
67
+
68
+ Args:
69
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
70
+ **kwargs: keyword arguments forwarded to super.
71
+ """
72
+ super(IE_SemParseConfig, self).__init__(**kwargs)
73
+
74
+ self.dataset = dataset
75
+ self.language = language
76
+ self.languages = _LANGUAGES
77
+ self.datasets = _DATASETS
78
+
79
+ self._URLS = [os.path.join(
80
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
81
+
82
+
83
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
84
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
85
+
86
+ VERSION = datasets.Version("1.0.0", "")
87
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
88
+ BUILDER_CONFIGS = [
89
+ IE_SemParseConfig(
90
+ name=f"{dataset}_{language}",
91
+ language=language,
92
+ dataset=dataset,
93
+ version=datasets.Version("1.0.0", ""),
94
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
95
+ )
96
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
97
+ ]
98
+
99
+ def _info(self):
100
+ dl_manager = datasets.DownloadManager()
101
+
102
+ urls_to_download = self.config._URLS
103
+
104
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
105
+
106
+ with open(filepath, "r") as f:
107
+ data = json.load(f)
108
+
109
+ features = datasets.Features(
110
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
111
+ )
112
+
113
+ return datasets.DatasetInfo(
114
+ description=_DESCRIPTION,
115
+ features=features,
116
+ # No default supervised_keys (as we have to pass both premise
117
+ # and hypothesis as input).
118
+ supervised_keys=None,
119
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
120
+ citation=_CITATION,
121
+ )
122
+
123
+ def _split_generators(self, dl_manager):
124
+ urls_to_download = self.config._URLS
125
+
126
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
127
+
128
+ return [
129
+ datasets.SplitGenerator(
130
+ name=datasets.Split.TRAIN,
131
+ gen_kwargs={
132
+ "split_key": "train",
133
+ "filepath": downloaded_file,
134
+ "data_format": "IE-SemParse"
135
+ },
136
+ ),
137
+ datasets.SplitGenerator(
138
+ name=datasets.Split.TEST,
139
+ gen_kwargs={
140
+ "split_key": "test",
141
+ "filepath": downloaded_file,
142
+ "data_format": "IE-SemParse"
143
+ },
144
+ ),
145
+ datasets.SplitGenerator(
146
+ name=datasets.Split.VALIDATION,
147
+ gen_kwargs={
148
+ "split_key": "val",
149
+ "filepath": downloaded_file,
150
+ "data_format": "IE-SemParse"
151
+ },
152
+ ),
153
+ ]
154
+
155
+ def _generate_examples(self, data_format, split_key, filepath):
156
+ """This function returns the examples in the raw (text) form."""
157
+
158
+ with open(filepath, "r") as f:
159
+ data = json.load(f)
160
+ data = data[split_key]
161
+
162
+ for idx, row in enumerate(data):
163
+ yield idx, {
164
+ k: v for k, v in row.items()
165
+ }
.history/IE_SemParse_20230708001821.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {"itop": "IE-mTOP",
56
+ "indic-atis": "IE-ATIS",
57
+ "indic-TOP": ""}
58
+
59
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
60
+
61
+
62
+ class IE_SemParseConfig(datasets.BuilderConfig):
63
+ """BuilderConfig for IE-SemParse."""
64
+
65
+ def __init__(self, dataset: str, language: str, **kwargs):
66
+ """BuilderConfig for IE-SemParse.
67
+
68
+ Args:
69
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
70
+ **kwargs: keyword arguments forwarded to super.
71
+ """
72
+ super(IE_SemParseConfig, self).__init__(**kwargs)
73
+
74
+ self.dataset = dataset
75
+ self.language = language
76
+ self.languages = _LANGUAGES
77
+ self.datasets = _DATASETS
78
+
79
+ self._URLS = [os.path.join(
80
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
81
+
82
+
83
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
84
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
85
+
86
+ VERSION = datasets.Version("1.0.0", "")
87
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
88
+ BUILDER_CONFIGS = [
89
+ IE_SemParseConfig(
90
+ name=f"{dataset}_{language}",
91
+ language=language,
92
+ dataset=dataset,
93
+ version=datasets.Version("1.0.0", ""),
94
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
95
+ )
96
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
97
+ ]
98
+
99
+ def _info(self):
100
+ dl_manager = datasets.DownloadManager()
101
+
102
+ urls_to_download = self.config._URLS
103
+
104
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
105
+
106
+ with open(filepath, "r") as f:
107
+ data = json.load(f)
108
+
109
+ features = datasets.Features(
110
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
111
+ )
112
+
113
+ return datasets.DatasetInfo(
114
+ description=_DESCRIPTION,
115
+ features=features,
116
+ # No default supervised_keys (as we have to pass both premise
117
+ # and hypothesis as input).
118
+ supervised_keys=None,
119
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
120
+ citation=_CITATION,
121
+ )
122
+
123
+ def _split_generators(self, dl_manager):
124
+ urls_to_download = self.config._URLS
125
+
126
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
127
+
128
+ return [
129
+ datasets.SplitGenerator(
130
+ name=datasets.Split.TRAIN,
131
+ gen_kwargs={
132
+ "split_key": "train",
133
+ "filepath": downloaded_file,
134
+ "data_format": "IE-SemParse"
135
+ },
136
+ ),
137
+ datasets.SplitGenerator(
138
+ name=datasets.Split.TEST,
139
+ gen_kwargs={
140
+ "split_key": "test",
141
+ "filepath": downloaded_file,
142
+ "data_format": "IE-SemParse"
143
+ },
144
+ ),
145
+ datasets.SplitGenerator(
146
+ name=datasets.Split.VALIDATION,
147
+ gen_kwargs={
148
+ "split_key": "val",
149
+ "filepath": downloaded_file,
150
+ "data_format": "IE-SemParse"
151
+ },
152
+ ),
153
+ ]
154
+
155
+ def _generate_examples(self, data_format, split_key, filepath):
156
+ """This function returns the examples in the raw (text) form."""
157
+
158
+ with open(filepath, "r") as f:
159
+ data = json.load(f)
160
+ data = data[split_key]
161
+
162
+ for idx, row in enumerate(data):
163
+ yield idx, {
164
+ k: v for k, v in row.items()
165
+ }
.history/IE_SemParse_20230708001824.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {"itop": "IE-mTOP",
56
+ "indic-atis": "IE-ATIS",
57
+ "indic-TOP": "IE-"}
58
+
59
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
60
+
61
+
62
+ class IE_SemParseConfig(datasets.BuilderConfig):
63
+ """BuilderConfig for IE-SemParse."""
64
+
65
+ def __init__(self, dataset: str, language: str, **kwargs):
66
+ """BuilderConfig for IE-SemParse.
67
+
68
+ Args:
69
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
70
+ **kwargs: keyword arguments forwarded to super.
71
+ """
72
+ super(IE_SemParseConfig, self).__init__(**kwargs)
73
+
74
+ self.dataset = dataset
75
+ self.language = language
76
+ self.languages = _LANGUAGES
77
+ self.datasets = _DATASETS
78
+
79
+ self._URLS = [os.path.join(
80
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
81
+
82
+
83
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
84
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
85
+
86
+ VERSION = datasets.Version("1.0.0", "")
87
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
88
+ BUILDER_CONFIGS = [
89
+ IE_SemParseConfig(
90
+ name=f"{dataset}_{language}",
91
+ language=language,
92
+ dataset=dataset,
93
+ version=datasets.Version("1.0.0", ""),
94
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
95
+ )
96
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
97
+ ]
98
+
99
+ def _info(self):
100
+ dl_manager = datasets.DownloadManager()
101
+
102
+ urls_to_download = self.config._URLS
103
+
104
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
105
+
106
+ with open(filepath, "r") as f:
107
+ data = json.load(f)
108
+
109
+ features = datasets.Features(
110
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
111
+ )
112
+
113
+ return datasets.DatasetInfo(
114
+ description=_DESCRIPTION,
115
+ features=features,
116
+ # No default supervised_keys (as we have to pass both premise
117
+ # and hypothesis as input).
118
+ supervised_keys=None,
119
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
120
+ citation=_CITATION,
121
+ )
122
+
123
+ def _split_generators(self, dl_manager):
124
+ urls_to_download = self.config._URLS
125
+
126
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
127
+
128
+ return [
129
+ datasets.SplitGenerator(
130
+ name=datasets.Split.TRAIN,
131
+ gen_kwargs={
132
+ "split_key": "train",
133
+ "filepath": downloaded_file,
134
+ "data_format": "IE-SemParse"
135
+ },
136
+ ),
137
+ datasets.SplitGenerator(
138
+ name=datasets.Split.TEST,
139
+ gen_kwargs={
140
+ "split_key": "test",
141
+ "filepath": downloaded_file,
142
+ "data_format": "IE-SemParse"
143
+ },
144
+ ),
145
+ datasets.SplitGenerator(
146
+ name=datasets.Split.VALIDATION,
147
+ gen_kwargs={
148
+ "split_key": "val",
149
+ "filepath": downloaded_file,
150
+ "data_format": "IE-SemParse"
151
+ },
152
+ ),
153
+ ]
154
+
155
+ def _generate_examples(self, data_format, split_key, filepath):
156
+ """This function returns the examples in the raw (text) form."""
157
+
158
+ with open(filepath, "r") as f:
159
+ data = json.load(f)
160
+ data = data[split_key]
161
+
162
+ for idx, row in enumerate(data):
163
+ yield idx, {
164
+ k: v for k, v in row.items()
165
+ }
.history/IE_SemParse_20230708001826.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {"itop": "IE-mTOP",
56
+ "indic-atis": "IE-ATIS",
57
+ "indic-TOP": "IE-"}
58
+
59
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
60
+
61
+
62
+ class IE_SemParseConfig(datasets.BuilderConfig):
63
+ """BuilderConfig for IE-SemParse."""
64
+
65
+ def __init__(self, dataset: str, language: str, **kwargs):
66
+ """BuilderConfig for IE-SemParse.
67
+
68
+ Args:
69
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
70
+ **kwargs: keyword arguments forwarded to super.
71
+ """
72
+ super(IE_SemParseConfig, self).__init__(**kwargs)
73
+
74
+ self.dataset = dataset
75
+ self.language = language
76
+ self.languages = _LANGUAGES
77
+ self.datasets = _DATASETS
78
+
79
+ self._URLS = [os.path.join(
80
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
81
+
82
+
83
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
84
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
85
+
86
+ VERSION = datasets.Version("1.0.0", "")
87
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
88
+ BUILDER_CONFIGS = [
89
+ IE_SemParseConfig(
90
+ name=f"{dataset}_{language}",
91
+ language=language,
92
+ dataset=dataset,
93
+ version=datasets.Version("1.0.0", ""),
94
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
95
+ )
96
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
97
+ ]
98
+
99
+ def _info(self):
100
+ dl_manager = datasets.DownloadManager()
101
+
102
+ urls_to_download = self.config._URLS
103
+
104
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
105
+
106
+ with open(filepath, "r") as f:
107
+ data = json.load(f)
108
+
109
+ features = datasets.Features(
110
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
111
+ )
112
+
113
+ return datasets.DatasetInfo(
114
+ description=_DESCRIPTION,
115
+ features=features,
116
+ # No default supervised_keys (as we have to pass both premise
117
+ # and hypothesis as input).
118
+ supervised_keys=None,
119
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
120
+ citation=_CITATION,
121
+ )
122
+
123
+ def _split_generators(self, dl_manager):
124
+ urls_to_download = self.config._URLS
125
+
126
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
127
+
128
+ return [
129
+ datasets.SplitGenerator(
130
+ name=datasets.Split.TRAIN,
131
+ gen_kwargs={
132
+ "split_key": "train",
133
+ "filepath": downloaded_file,
134
+ "data_format": "IE-SemParse"
135
+ },
136
+ ),
137
+ datasets.SplitGenerator(
138
+ name=datasets.Split.TEST,
139
+ gen_kwargs={
140
+ "split_key": "test",
141
+ "filepath": downloaded_file,
142
+ "data_format": "IE-SemParse"
143
+ },
144
+ ),
145
+ datasets.SplitGenerator(
146
+ name=datasets.Split.VALIDATION,
147
+ gen_kwargs={
148
+ "split_key": "val",
149
+ "filepath": downloaded_file,
150
+ "data_format": "IE-SemParse"
151
+ },
152
+ ),
153
+ ]
154
+
155
+ def _generate_examples(self, data_format, split_key, filepath):
156
+ """This function returns the examples in the raw (text) form."""
157
+
158
+ with open(filepath, "r") as f:
159
+ data = json.load(f)
160
+ data = data[split_key]
161
+
162
+ for idx, row in enumerate(data):
163
+ yield idx, {
164
+ k: v for k, v in row.items()
165
+ }
.history/IE_SemParse_20230708001833.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {"itop": "IE-mTOP",
56
+ "indic-atis": "IE-ATIS",
57
+ "indic-TOP": "IE-multilingualTOP"}
58
+
59
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
60
+
61
+
62
+ class IE_SemParseConfig(datasets.BuilderConfig):
63
+ """BuilderConfig for IE-SemParse."""
64
+
65
+ def __init__(self, dataset: str, language: str, **kwargs):
66
+ """BuilderConfig for IE-SemParse.
67
+
68
+ Args:
69
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
70
+ **kwargs: keyword arguments forwarded to super.
71
+ """
72
+ super(IE_SemParseConfig, self).__init__(**kwargs)
73
+
74
+ self.dataset = dataset
75
+ self.language = language
76
+ self.languages = _LANGUAGES
77
+ self.datasets = _DATASETS
78
+
79
+ self._URLS = [os.path.join(
80
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
81
+
82
+
83
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
84
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
85
+
86
+ VERSION = datasets.Version("1.0.0", "")
87
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
88
+ BUILDER_CONFIGS = [
89
+ IE_SemParseConfig(
90
+ name=f"{dataset}_{language}",
91
+ language=language,
92
+ dataset=dataset,
93
+ version=datasets.Version("1.0.0", ""),
94
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
95
+ )
96
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
97
+ ]
98
+
99
+ def _info(self):
100
+ dl_manager = datasets.DownloadManager()
101
+
102
+ urls_to_download = self.config._URLS
103
+
104
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
105
+
106
+ with open(filepath, "r") as f:
107
+ data = json.load(f)
108
+
109
+ features = datasets.Features(
110
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
111
+ )
112
+
113
+ return datasets.DatasetInfo(
114
+ description=_DESCRIPTION,
115
+ features=features,
116
+ # No default supervised_keys (as we have to pass both premise
117
+ # and hypothesis as input).
118
+ supervised_keys=None,
119
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
120
+ citation=_CITATION,
121
+ )
122
+
123
+ def _split_generators(self, dl_manager):
124
+ urls_to_download = self.config._URLS
125
+
126
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
127
+
128
+ return [
129
+ datasets.SplitGenerator(
130
+ name=datasets.Split.TRAIN,
131
+ gen_kwargs={
132
+ "split_key": "train",
133
+ "filepath": downloaded_file,
134
+ "data_format": "IE-SemParse"
135
+ },
136
+ ),
137
+ datasets.SplitGenerator(
138
+ name=datasets.Split.TEST,
139
+ gen_kwargs={
140
+ "split_key": "test",
141
+ "filepath": downloaded_file,
142
+ "data_format": "IE-SemParse"
143
+ },
144
+ ),
145
+ datasets.SplitGenerator(
146
+ name=datasets.Split.VALIDATION,
147
+ gen_kwargs={
148
+ "split_key": "val",
149
+ "filepath": downloaded_file,
150
+ "data_format": "IE-SemParse"
151
+ },
152
+ ),
153
+ ]
154
+
155
+ def _generate_examples(self, data_format, split_key, filepath):
156
+ """This function returns the examples in the raw (text) form."""
157
+
158
+ with open(filepath, "r") as f:
159
+ data = json.load(f)
160
+ data = data[split_key]
161
+
162
+ for idx, row in enumerate(data):
163
+ yield idx, {
164
+ k: v for k, v in row.items()
165
+ }
.history/IE_SemParse_20230708001846.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {"itop": "IE-mTOP",
56
+ "indic-atis": "IE-ATIS",
57
+ "indic-TOP": "IE-multilingualTOP"}
58
+
59
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
60
+
61
+
62
+ class IE_SemParseConfig(datasets.BuilderConfig):
63
+ """BuilderConfig for IE-SemParse."""
64
+
65
+ def __init__(self, dataset: str, language: str, **kwargs):
66
+ """BuilderConfig for IE-SemParse.
67
+
68
+ Args:
69
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
70
+ **kwargs: keyword arguments forwarded to super.
71
+ """
72
+ super(IE_SemParseConfig, self).__init__(**kwargs)
73
+
74
+ self.dataset = dataset
75
+ self.language = language
76
+ self.languages = _LANGUAGES
77
+ self.datasets = _DATASETS
78
+
79
+ self._URLS = [os.path.join(
80
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
81
+
82
+
83
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
84
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
85
+
86
+ VERSION = datasets.Version("1.0.0", "")
87
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
88
+ BUILDER_CONFIGS = [
89
+ IE_SemParseConfig(
90
+ name=f"{dataset}_{language}",
91
+ language=language,
92
+ dataset=dataset,
93
+ version=datasets.Version("1.0.0", ""),
94
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
95
+ )
96
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
97
+ ]
98
+
99
+ def _info(self):
100
+ dl_manager = datasets.DownloadManager()
101
+
102
+ urls_to_download = self.config._URLS
103
+
104
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
105
+
106
+ with open(filepath, "r") as f:
107
+ data = json.load(f)
108
+
109
+ features = datasets.Features(
110
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
111
+ )
112
+
113
+ return datasets.DatasetInfo(
114
+ description=_DESCRIPTION,
115
+ features=features,
116
+ # No default supervised_keys (as we have to pass both premise
117
+ # and hypothesis as input).
118
+ supervised_keys=None,
119
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
120
+ citation=_CITATION,
121
+ )
122
+
123
+ def _split_generators(self, dl_manager):
124
+ urls_to_download = self.config._URLS
125
+
126
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
127
+
128
+ return [
129
+ datasets.SplitGenerator(
130
+ name=datasets.Split.TRAIN,
131
+ gen_kwargs={
132
+ "split_key": "train",
133
+ "filepath": downloaded_file,
134
+ "data_format": "IE-SemParse"
135
+ },
136
+ ),
137
+ datasets.SplitGenerator(
138
+ name=datasets.Split.TEST,
139
+ gen_kwargs={
140
+ "split_key": "test",
141
+ "filepath": downloaded_file,
142
+ "data_format": "IE-SemParse"
143
+ },
144
+ ),
145
+ datasets.SplitGenerator(
146
+ name=datasets.Split.VALIDATION,
147
+ gen_kwargs={
148
+ "split_key": "val",
149
+ "filepath": downloaded_file,
150
+ "data_format": "IE-SemParse"
151
+ },
152
+ ),
153
+ ]
154
+
155
+ def _generate_examples(self, data_format, split_key, filepath):
156
+ """This function returns the examples in the raw (text) form."""
157
+
158
+ with open(filepath, "r") as f:
159
+ data = json.load(f)
160
+ data = data[split_key]
161
+
162
+ for idx, row in enumerate(data):
163
+ yield idx, {
164
+ k: v for k, v in row.items()
165
+ }
.history/IE_SemParse_20230708001852.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {"itop": "IE-mTOP",
56
+ "indic-atis": "IE-ATIS",
57
+ "indic-TOP": "IE-multilingualTOP"}
58
+
59
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
60
+
61
+
62
+ class IE_SemParseConfig(datasets.BuilderConfig):
63
+ """BuilderConfig for IE-SemParse."""
64
+
65
+ def __init__(self, dataset: str, language: str, **kwargs):
66
+ """BuilderConfig for IE-SemParse.
67
+
68
+ Args:
69
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
70
+ **kwargs: keyword arguments forwarded to super.
71
+ """
72
+ super(IE_SemParseConfig, self).__init__(**kwargs)
73
+
74
+ self.dataset = dataset
75
+ self.language = language
76
+ self.languages = _LANGUAGES
77
+ self.datasets = _DATASETS
78
+
79
+ self._URLS = [os.path.join(
80
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
81
+
82
+
83
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
84
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
85
+
86
+ VERSION = datasets.Version("1.0.0", "")
87
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
88
+ BUILDER_CONFIGS = [
89
+ IE_SemParseConfig(
90
+ name=f"{madataset}_{language}",
91
+ language=language,
92
+ dataset=dataset,
93
+ version=datasets.Version("1.0.0", ""),
94
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
95
+ )
96
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
97
+ ]
98
+
99
+ def _info(self):
100
+ dl_manager = datasets.DownloadManager()
101
+
102
+ urls_to_download = self.config._URLS
103
+
104
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
105
+
106
+ with open(filepath, "r") as f:
107
+ data = json.load(f)
108
+
109
+ features = datasets.Features(
110
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
111
+ )
112
+
113
+ return datasets.DatasetInfo(
114
+ description=_DESCRIPTION,
115
+ features=features,
116
+ # No default supervised_keys (as we have to pass both premise
117
+ # and hypothesis as input).
118
+ supervised_keys=None,
119
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
120
+ citation=_CITATION,
121
+ )
122
+
123
+ def _split_generators(self, dl_manager):
124
+ urls_to_download = self.config._URLS
125
+
126
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
127
+
128
+ return [
129
+ datasets.SplitGenerator(
130
+ name=datasets.Split.TRAIN,
131
+ gen_kwargs={
132
+ "split_key": "train",
133
+ "filepath": downloaded_file,
134
+ "data_format": "IE-SemParse"
135
+ },
136
+ ),
137
+ datasets.SplitGenerator(
138
+ name=datasets.Split.TEST,
139
+ gen_kwargs={
140
+ "split_key": "test",
141
+ "filepath": downloaded_file,
142
+ "data_format": "IE-SemParse"
143
+ },
144
+ ),
145
+ datasets.SplitGenerator(
146
+ name=datasets.Split.VALIDATION,
147
+ gen_kwargs={
148
+ "split_key": "val",
149
+ "filepath": downloaded_file,
150
+ "data_format": "IE-SemParse"
151
+ },
152
+ ),
153
+ ]
154
+
155
+ def _generate_examples(self, data_format, split_key, filepath):
156
+ """This function returns the examples in the raw (text) form."""
157
+
158
+ with open(filepath, "r") as f:
159
+ data = json.load(f)
160
+ data = data[split_key]
161
+
162
+ for idx, row in enumerate(data):
163
+ yield idx, {
164
+ k: v for k, v in row.items()
165
+ }
.history/IE_SemParse_20230708001854.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {"itop": "IE-mTOP",
56
+ "indic-atis": "IE-ATIS",
57
+ "indic-TOP": "IE-multilingualTOP"}
58
+
59
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
60
+
61
+
62
+ class IE_SemParseConfig(datasets.BuilderConfig):
63
+ """BuilderConfig for IE-SemParse."""
64
+
65
+ def __init__(self, dataset: str, language: str, **kwargs):
66
+ """BuilderConfig for IE-SemParse.
67
+
68
+ Args:
69
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
70
+ **kwargs: keyword arguments forwarded to super.
71
+ """
72
+ super(IE_SemParseConfig, self).__init__(**kwargs)
73
+
74
+ self.dataset = dataset
75
+ self.language = language
76
+ self.languages = _LANGUAGES
77
+ self.datasets = _DATASETS
78
+
79
+ self._URLS = [os.path.join(
80
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
81
+
82
+
83
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
84
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
85
+
86
+ VERSION = datasets.Version("1.0.0", "")
87
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
88
+ BUILDER_CONFIGS = [
89
+ IE_SemParseConfig(
90
+ name=f"{mapping[dataset}_{language}",
91
+ language=language,
92
+ dataset=dataset,
93
+ version=datasets.Version("1.0.0", ""),
94
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
95
+ )
96
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
97
+ ]
98
+
99
+ def _info(self):
100
+ dl_manager = datasets.DownloadManager()
101
+
102
+ urls_to_download = self.config._URLS
103
+
104
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
105
+
106
+ with open(filepath, "r") as f:
107
+ data = json.load(f)
108
+
109
+ features = datasets.Features(
110
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
111
+ )
112
+
113
+ return datasets.DatasetInfo(
114
+ description=_DESCRIPTION,
115
+ features=features,
116
+ # No default supervised_keys (as we have to pass both premise
117
+ # and hypothesis as input).
118
+ supervised_keys=None,
119
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
120
+ citation=_CITATION,
121
+ )
122
+
123
+ def _split_generators(self, dl_manager):
124
+ urls_to_download = self.config._URLS
125
+
126
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
127
+
128
+ return [
129
+ datasets.SplitGenerator(
130
+ name=datasets.Split.TRAIN,
131
+ gen_kwargs={
132
+ "split_key": "train",
133
+ "filepath": downloaded_file,
134
+ "data_format": "IE-SemParse"
135
+ },
136
+ ),
137
+ datasets.SplitGenerator(
138
+ name=datasets.Split.TEST,
139
+ gen_kwargs={
140
+ "split_key": "test",
141
+ "filepath": downloaded_file,
142
+ "data_format": "IE-SemParse"
143
+ },
144
+ ),
145
+ datasets.SplitGenerator(
146
+ name=datasets.Split.VALIDATION,
147
+ gen_kwargs={
148
+ "split_key": "val",
149
+ "filepath": downloaded_file,
150
+ "data_format": "IE-SemParse"
151
+ },
152
+ ),
153
+ ]
154
+
155
+ def _generate_examples(self, data_format, split_key, filepath):
156
+ """This function returns the examples in the raw (text) form."""
157
+
158
+ with open(filepath, "r") as f:
159
+ data = json.load(f)
160
+ data = data[split_key]
161
+
162
+ for idx, row in enumerate(data):
163
+ yield idx, {
164
+ k: v for k, v in row.items()
165
+ }
.history/IE_SemParse_20230708001856.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+
3
+
4
+ # Lint as: python3
5
+ """IndicXNLI: The Cross-Lingual NLI Corpus for Indic Languages."""
6
+
7
+
8
+ import os
9
+ import json
10
+
11
+ import pandas as pd
12
+
13
+ import datasets
14
+
15
+ from datasets import DownloadManager
16
+
17
+
18
+ _CITATION = """\
19
+ @misc{aggarwal2023evaluating,
20
+ title={Evaluating Inter-Bilingual Semantic Parsing for Indian Languages},
21
+ author={Divyanshu Aggarwal and Vivek Gupta and Anoop Kunchukuttan},
22
+ year={2023},
23
+ eprint={2304.13005},
24
+ archivePrefix={arXiv},
25
+ primaryClass={cs.CL}
26
+ }
27
+ """
28
+
29
+ _DESCRIPTION = """\
30
+ IE-SemParse is an Inter-bilingual Seq2seq Semantic parsing dataset for 11 distinct Indian languages
31
+ """
32
+
33
+ _LANGUAGES = (
34
+ 'hi',
35
+ 'bn',
36
+ 'mr',
37
+ 'as',
38
+ 'ta',
39
+ 'te',
40
+ 'or',
41
+ 'ml',
42
+ 'pa',
43
+ 'gu',
44
+ 'kn'
45
+ )
46
+
47
+
48
+ _DATASETS = (
49
+ 'itop',
50
+ 'indic-atis',
51
+ 'indic-TOP'
52
+ )
53
+
54
+
55
+ mapping = {"itop": "IE-mTOP",
56
+ "indic-atis": "IE-ATIS",
57
+ "indic-TOP": "IE-multilingualTOP"}
58
+
59
+ _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
60
+
61
+
62
+ class IE_SemParseConfig(datasets.BuilderConfig):
63
+ """BuilderConfig for IE-SemParse."""
64
+
65
+ def __init__(self, dataset: str, language: str, **kwargs):
66
+ """BuilderConfig for IE-SemParse.
67
+
68
+ Args:
69
+ language: One of hi, bn, mr, as, ta, te, or, ml, pa, gu, kn
70
+ **kwargs: keyword arguments forwarded to super.
71
+ """
72
+ super(IE_SemParseConfig, self).__init__(**kwargs)
73
+
74
+ self.dataset = dataset
75
+ self.language = language
76
+ self.languages = _LANGUAGES
77
+ self.datasets = _DATASETS
78
+
79
+ self._URLS = [os.path.join(
80
+ _URL, "unfiltered_data", dataset, f"{language}.json")]
81
+
82
+
83
+ class IE_SemParse(datasets.GeneratorBasedBuilder):
84
+ """IE-SemParse: Inter-Bilingual Semantic Parsing Dataset for Indic Languages. Version 1.0."""
85
+
86
+ VERSION = datasets.Version("1.0.0", "")
87
+ BUILDER_CONFIG_CLASS = IE_SemParseConfig
88
+ BUILDER_CONFIGS = [
89
+ IE_SemParseConfig(
90
+ name=f"{mapping[dataset]}_{language}",
91
+ language=language,
92
+ dataset=dataset,
93
+ version=datasets.Version("1.0.0", ""),
94
+ description=f"Plain text import of IE-SemParse for the {language} language for {dataset} dataset",
95
+ )
96
+ for language, dataset in zip(_LANGUAGES, _DATASETS)
97
+ ]
98
+
99
+ def _info(self):
100
+ dl_manager = datasets.DownloadManager()
101
+
102
+ urls_to_download = self.config._URLS
103
+
104
+ filepath = dl_manager.download_and_extract(urls_to_download)[0]
105
+
106
+ with open(filepath, "r") as f:
107
+ data = json.load(f)
108
+
109
+ features = datasets.Features(
110
+ {k: datasets.Value("string") for k in data['train'][0].keys()}
111
+ )
112
+
113
+ return datasets.DatasetInfo(
114
+ description=_DESCRIPTION,
115
+ features=features,
116
+ # No default supervised_keys (as we have to pass both premise
117
+ # and hypothesis as input).
118
+ supervised_keys=None,
119
+ homepage="https://github.com/divyanshuaggarwal/IE-SemParse",
120
+ citation=_CITATION,
121
+ )
122
+
123
+ def _split_generators(self, dl_manager):
124
+ urls_to_download = self.config._URLS
125
+
126
+ downloaded_file = dl_manager.download_and_extract(urls_to_download)[0]
127
+
128
+ return [
129
+ datasets.SplitGenerator(
130
+ name=datasets.Split.TRAIN,
131
+ gen_kwargs={
132
+ "split_key": "train",
133
+ "filepath": downloaded_file,
134
+ "data_format": "IE-SemParse"
135
+ },
136
+ ),
137
+ datasets.SplitGenerator(
138
+ name=datasets.Split.TEST,
139
+ gen_kwargs={
140
+ "split_key": "test",
141
+ "filepath": downloaded_file,
142
+ "data_format": "IE-SemParse"
143
+ },
144
+ ),
145
+ datasets.SplitGenerator(
146
+ name=datasets.Split.VALIDATION,
147
+ gen_kwargs={
148
+ "split_key": "val",
149
+ "filepath": downloaded_file,
150
+ "data_format": "IE-SemParse"
151
+ },
152
+ ),
153
+ ]
154
+
155
+ def _generate_examples(self, data_format, split_key, filepath):
156
+ """This function returns the examples in the raw (text) form."""
157
+
158
+ with open(filepath, "r") as f:
159
+ data = json.load(f)
160
+ data = data[split_key]
161
+
162
+ for idx, row in enumerate(data):
163
+ yield idx, {
164
+ k: v for k, v in row.items()
165
+ }
IE_SemParse.py CHANGED
@@ -52,6 +52,10 @@ _DATASETS = (
52
  )
53
 
54
 
 
 
 
 
55
  _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
56
 
57
 
@@ -83,7 +87,7 @@ class IE_SemParse(datasets.GeneratorBasedBuilder):
83
  BUILDER_CONFIG_CLASS = IE_SemParseConfig
84
  BUILDER_CONFIGS = [
85
  IE_SemParseConfig(
86
- name=f"{dataset}_{language}",
87
  language=language,
88
  dataset=dataset,
89
  version=datasets.Version("1.0.0", ""),
 
52
  )
53
 
54
 
55
+ mapping = {"itop": "IE-mTOP",
56
+ "indic-atis": "IE-ATIS",
57
+ "indic-TOP": "IE-multilingualTOP"}
58
+
59
  _URL = "https://huggingface.co/datasets/Divyanshu/IE_SemParse/resolve/main/"
60
 
61
 
 
87
  BUILDER_CONFIG_CLASS = IE_SemParseConfig
88
  BUILDER_CONFIGS = [
89
  IE_SemParseConfig(
90
+ name=f"{mapping[dataset]}_{language}",
91
  language=language,
92
  dataset=dataset,
93
  version=datasets.Version("1.0.0", ""),