MCPcopy Create free account
hub / github.com/DataArcTech/ToG / prepare_dataset

Function prepare_dataset

ToG/utils.py:192–232  ·  view source on GitHub ↗
(dataset_name)

Source from the content-addressed store, hash-verified

190
191
192def prepare_dataset(dataset_name):
193 if dataset_name == 'cwq':
194 with open('../data/cwq.json',encoding='utf-8') as f:
195 datas = json.load(f)
196 question_string = 'question'
197 elif dataset_name == 'webqsp':
198 with open('../data/WebQSP.json',encoding='utf-8') as f:
199 datas = json.load(f)
200 question_string = 'RawQuestion'
201 elif dataset_name == 'grailqa':
202 with open('../data/grailqa.json',encoding='utf-8') as f:
203 datas = json.load(f)
204 question_string = 'question'
205 elif dataset_name == 'simpleqa':
206 with open('../data/SimpleQA.json',encoding='utf-8') as f:
207 datas = json.load(f)
208 question_string = 'question'
209 elif dataset_name == 'qald':
210 with open('../data/qald_10-en.json',encoding='utf-8') as f:
211 datas = json.load(f)
212 question_string = 'question'
213 elif dataset_name == 'webquestions':
214 with open('../data/WebQuestions.json',encoding='utf-8') as f:
215 datas = json.load(f)
216 question_string = 'question'
217 elif dataset_name == 'trex':
218 with open('../data/T-REX.json',encoding='utf-8') as f:
219 datas = json.load(f)
220 question_string = 'input'
221 elif dataset_name == 'zeroshotre':
222 with open('../data/Zero_Shot_RE.json',encoding='utf-8') as f:
223 datas = json.load(f)
224 question_string = 'input'
225 elif dataset_name == 'creak':
226 with open('../data/creak.json',encoding='utf-8') as f:
227 datas = json.load(f)
228 question_string = 'sentence'
229 else:
230 print("dataset not found, you should pick from {cwq, webqsp, grailqa, simpleqa, qald, webquestions, trex, zeroshotre, creak}.")
231 exit(-1)
232 return datas, question_string

Callers 2

main_freebase.pyFile · 0.70
main_wiki.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected