Oleg Somov commited on
Commit
b687218
1 Parent(s): a06694a

update pauq script

Browse files
Files changed (1) hide show
  1. pauq.py +50 -16
pauq.py CHANGED
@@ -14,16 +14,13 @@
14
  # limitations under the License.
15
  """PAUQ: Text-to-SQL in Russian"""
16
 
17
-
18
  import json
19
  import os
20
 
21
  import datasets
22
 
23
-
24
  logger = datasets.logging.get_logger(__name__)
25
 
26
-
27
  _CITATION = """\
28
  @inproceedings{bakshandaeva-etal-2022-pauq,
29
  title = "{PAUQ}: Text-to-{SQL} in {R}ussian",
@@ -51,6 +48,12 @@ _HOMEPAGE = "https://github.com/ai-spiderweb/pauq"
51
 
52
  _URL = "https://huggingface.co/datasets/composite/pauq/resolve/main/formatted_pauq.zip"
53
 
 
 
 
 
 
 
54
 
55
  class Pauq(datasets.GeneratorBasedBuilder):
56
  VERSION = datasets.Version("1.0.0")
@@ -59,22 +62,22 @@ class Pauq(datasets.GeneratorBasedBuilder):
59
  datasets.BuilderConfig(
60
  name="ru_pauq_tl",
61
  version=VERSION,
62
- description=_DESCRIPTION,
63
  ),
64
  datasets.BuilderConfig(
65
  name="en_pauq_tl",
66
  version=VERSION,
67
- description=_DESCRIPTION,
68
  ),
69
  datasets.BuilderConfig(
70
  name="ru_pauq_iid",
71
  version=VERSION,
72
- description=_DESCRIPTION,
73
  ),
74
  datasets.BuilderConfig(
75
  name="en_pauq_iid",
76
  version=VERSION,
77
- description=_DESCRIPTION,
78
  ),
79
  ]
80
 
@@ -94,14 +97,45 @@ class Pauq(datasets.GeneratorBasedBuilder):
94
  "masked_query": datasets.Value("string")
95
  }
96
  )
97
- return datasets.DatasetInfo(
98
- description=_DESCRIPTION,
99
- features=features,
100
- supervised_keys=None,
101
- homepage=_HOMEPAGE,
102
- license=_LICENSE,
103
- citation=_CITATION,
104
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
  def _split_generators(self, dl_manager):
107
  downloaded_filepath = dl_manager.download_and_extract(_URL)
@@ -128,7 +162,7 @@ class Pauq(datasets.GeneratorBasedBuilder):
128
  datasets.SplitGenerator(
129
  name=datasets.Split.TEST,
130
  gen_kwargs={
131
- "data_filepath": os.path.join(downloaded_filepath, "splits/ru_tl_est.json"),
132
  },
133
  ),
134
  datasets.SplitGenerator(
 
14
  # limitations under the License.
15
  """PAUQ: Text-to-SQL in Russian"""
16
 
 
17
  import json
18
  import os
19
 
20
  import datasets
21
 
 
22
  logger = datasets.logging.get_logger(__name__)
23
 
 
24
  _CITATION = """\
25
  @inproceedings{bakshandaeva-etal-2022-pauq,
26
  title = "{PAUQ}: Text-to-{SQL} in {R}ussian",
 
48
 
49
  _URL = "https://huggingface.co/datasets/composite/pauq/resolve/main/formatted_pauq.zip"
50
 
51
+ RUSSIAN_PAUQ_TL_DESCRIPTION = "Russian PAUQ train/test split based on target length of SQL query. Long queries in train, short queries in test."
52
+ ENGLISH_PAUQ_TL_DESCRIPTION = "English PAUQ train/test split based on target length of SQL query. Long queries in train, short queries in test."
53
+
54
+ RUSSIAN_PAUQ_IID_DESCRIPTION = "Independent and identical Russian PAUQ train/test split. Сorresponds to original Spider splitting."
55
+ ENGLISH_PAUQ_IID_DESCRIPTION = "Independent and identical English PAUQ train/test split. Сorresponds to original Spider splitting."
56
+
57
 
58
  class Pauq(datasets.GeneratorBasedBuilder):
59
  VERSION = datasets.Version("1.0.0")
 
62
  datasets.BuilderConfig(
63
  name="ru_pauq_tl",
64
  version=VERSION,
65
+ description=RUSSIAN_PAUQ_TL_DESCRIPTION,
66
  ),
67
  datasets.BuilderConfig(
68
  name="en_pauq_tl",
69
  version=VERSION,
70
+ description=ENGLISH_PAUQ_TL_DESCRIPTION,
71
  ),
72
  datasets.BuilderConfig(
73
  name="ru_pauq_iid",
74
  version=VERSION,
75
+ description=RUSSIAN_PAUQ_IID_DESCRIPTION,
76
  ),
77
  datasets.BuilderConfig(
78
  name="en_pauq_iid",
79
  version=VERSION,
80
+ description=ENGLISH_PAUQ_IID_DESCRIPTION,
81
  ),
82
  ]
83
 
 
97
  "masked_query": datasets.Value("string")
98
  }
99
  )
100
+ dataset_info = None
101
+ if self.config.name == 'ru_pauq_tl':
102
+ dataset_info = datasets.DatasetInfo(
103
+ description=RUSSIAN_PAUQ_TL_DESCRIPTION,
104
+ features=features,
105
+ supervised_keys=None,
106
+ homepage=_HOMEPAGE,
107
+ license=_LICENSE,
108
+ citation=_CITATION,
109
+ config_name="ru_pauq_tl")
110
+ elif self.config.name == "en_pauq_tl":
111
+ dataset_info = datasets.DatasetInfo(
112
+ description=ENGLISH_PAUQ_TL_DESCRIPTION,
113
+ features=features,
114
+ supervised_keys=None,
115
+ homepage=_HOMEPAGE,
116
+ license=_LICENSE,
117
+ citation=_CITATION,
118
+ config_name="en_pauq_tl")
119
+ elif self.config.name == 'ru_pauq_iid':
120
+ dataset_info = datasets.DatasetInfo(
121
+ description=RUSSIAN_PAUQ_IID_DESCRIPTION,
122
+ features=features,
123
+ supervised_keys=None,
124
+ homepage=_HOMEPAGE,
125
+ license=_LICENSE,
126
+ citation=_CITATION,
127
+ config_name="ru_pauq_iid")
128
+ elif self.config.name == 'en_pauq_iid':
129
+ dataset_info = datasets.DatasetInfo(
130
+ description=ENGLISH_PAUQ_IID_DESCRIPTION,
131
+ features=features,
132
+ supervised_keys=None,
133
+ homepage=_HOMEPAGE,
134
+ license=_LICENSE,
135
+ citation=_CITATION,
136
+ config_name="en_pauq_iid")
137
+
138
+ return dataset_info
139
 
140
  def _split_generators(self, dl_manager):
141
  downloaded_filepath = dl_manager.download_and_extract(_URL)
 
162
  datasets.SplitGenerator(
163
  name=datasets.Split.TEST,
164
  gen_kwargs={
165
+ "data_filepath": os.path.join(downloaded_filepath, "splits/ru_tl_test.json"),
166
  },
167
  ),
168
  datasets.SplitGenerator(