mlynatom commited on
Commit
177571c
1 Parent(s): 1846858

revised working version

Browse files
Files changed (1) hide show
  1. csfever_v2.py +62 -27
csfever_v2.py CHANGED
@@ -50,7 +50,8 @@ _URLS = {
50
  "test": "./precision/test.jsonl"},
51
  "07": {"train": "./07/train.jsonl",
52
  "dev" : "./07/dev.jsonl",
53
- "test": "./07/test.jsonl"}
 
54
  }
55
 
56
  _ORIGINAL_DESCRIPTION = ""
@@ -95,6 +96,11 @@ class CsFEVERv2(datasets.GeneratorBasedBuilder):
95
  version=VERSION,
96
  description=_ORIGINAL_DESCRIPTION
97
  ),
 
 
 
 
 
98
  ]
99
 
100
  DEFAULT_CONFIG_NAME = "original" # It's not mandatory to have a default configuration. Just use one if it make sense.
@@ -113,6 +119,17 @@ class CsFEVERv2(datasets.GeneratorBasedBuilder):
113
  # These are the features of your dataset like images, labels ...
114
  }
115
  )
 
 
 
 
 
 
 
 
 
 
 
116
  else: # This is an example to show how to have different features for "first_domain" and "second_domain"
117
  features = datasets.Features(
118
  {
@@ -148,32 +165,42 @@ class CsFEVERv2(datasets.GeneratorBasedBuilder):
148
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
149
  urls = _URLS[self.config.name]
150
  data_dir = dl_manager.download_and_extract(urls)
151
- return [
152
- datasets.SplitGenerator(
153
- name=datasets.Split.TRAIN,
154
- # These kwargs will be passed to _generate_examples
155
- gen_kwargs={
156
- "filepath": data_dir["train"],
157
- "split": "train",
158
- },
159
- ),
160
- datasets.SplitGenerator(
161
- name=datasets.Split.VALIDATION,
162
- # These kwargs will be passed to _generate_examples
163
- gen_kwargs={
164
- "filepath": data_dir["dev"],
165
- "split": "dev",
166
- },
167
- ),
168
- datasets.SplitGenerator(
169
- name=datasets.Split.TEST,
170
- # These kwargs will be passed to _generate_examples
171
- gen_kwargs={
172
- "filepath": data_dir["test"],
173
- "split": "test"
174
- },
175
- ),
176
- ]
 
 
 
 
 
 
 
 
 
 
177
 
178
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
179
  def _generate_examples(self, filepath, split):
@@ -192,6 +219,14 @@ class CsFEVERv2(datasets.GeneratorBasedBuilder):
192
  "claim": data_point["claim"],
193
  "evidence": data_point["evidence"],
194
  }
 
 
 
 
 
 
 
 
195
  else:
196
  yield key, {
197
  "id": data_point["id"],
 
50
  "test": "./precision/test.jsonl"},
51
  "07": {"train": "./07/train.jsonl",
52
  "dev" : "./07/dev.jsonl",
53
+ "test": "./07/test.jsonl"},
54
+ "wiki": "./wiki_pages/wiki_pages.jsonl"
55
  }
56
 
57
  _ORIGINAL_DESCRIPTION = ""
 
96
  version=VERSION,
97
  description=_ORIGINAL_DESCRIPTION
98
  ),
99
+ datasets.BuilderConfig(
100
+ name="wiki_pages",
101
+ version=VERSION,
102
+ description=_ORIGINAL_DESCRIPTION
103
+ ),
104
  ]
105
 
106
  DEFAULT_CONFIG_NAME = "original" # It's not mandatory to have a default configuration. Just use one if it make sense.
 
119
  # These are the features of your dataset like images, labels ...
120
  }
121
  )
122
+ elif self.config.name == "wiki_pages":
123
+ features = datasets.Features(
124
+ {
125
+ "id": datasets.Value("int32"),
126
+ "revid": datasets.Value("int32"),
127
+ "url": datasets.Value("string"),
128
+ "title": datasets.Value("string"),
129
+ "text": datasets.Value("string"),
130
+ # These are the features of your dataset like images, labels ...
131
+ }
132
+ )
133
  else: # This is an example to show how to have different features for "first_domain" and "second_domain"
134
  features = datasets.Features(
135
  {
 
165
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
166
  urls = _URLS[self.config.name]
167
  data_dir = dl_manager.download_and_extract(urls)
168
+ if self.config.name == "wiki_pages":
169
+ return datasets.SplitGenerator(
170
+ name="wiki_pages",
171
+ # These kwargs will be passed to _generate_examples
172
+ gen_kwargs={
173
+ "filepath": data_dir,
174
+ "split": "wiki_pages",
175
+ },
176
+ )
177
+ else:
178
+ return [
179
+ datasets.SplitGenerator(
180
+ name=datasets.Split.TRAIN,
181
+ # These kwargs will be passed to _generate_examples
182
+ gen_kwargs={
183
+ "filepath": data_dir["train"],
184
+ "split": "train",
185
+ },
186
+ ),
187
+ datasets.SplitGenerator(
188
+ name=datasets.Split.VALIDATION,
189
+ # These kwargs will be passed to _generate_examples
190
+ gen_kwargs={
191
+ "filepath": data_dir["dev"],
192
+ "split": "dev",
193
+ },
194
+ ),
195
+ datasets.SplitGenerator(
196
+ name=datasets.Split.TEST,
197
+ # These kwargs will be passed to _generate_examples
198
+ gen_kwargs={
199
+ "filepath": data_dir["test"],
200
+ "split": "test"
201
+ },
202
+ ),
203
+ ]
204
 
205
  # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
206
  def _generate_examples(self, filepath, split):
 
219
  "claim": data_point["claim"],
220
  "evidence": data_point["evidence"],
221
  }
222
+ elif self.config.name == "wiki_pages":
223
+ yield key, {
224
+ "id": data_point["id"],
225
+ "revid": data_point["revid"],
226
+ "url": data_point["url"],
227
+ "title": data_point["title"],
228
+ "text": data_point["text"],
229
+ }
230
  else:
231
  yield key, {
232
  "id": data_point["id"],