| 32 | return result |
| 33 | |
| 34 | def prepare_dataset(dataset_name): |
| 35 | if dataset_name == 'cwq': |
| 36 | with open('../data/cwq.json',encoding='utf-8') as f: |
| 37 | datas = json.load(f) |
| 38 | question_string = 'question' |
| 39 | elif dataset_name == 'webqsp': |
| 40 | with open('../data/WebQSP.json',encoding='utf-8') as f: |
| 41 | datas = json.load(f) |
| 42 | question_string = 'RawQuestion' |
| 43 | elif dataset_name == 'grailqa': |
| 44 | with open('../data/grailqa.json',encoding='utf-8') as f: |
| 45 | datas = json.load(f) |
| 46 | question_string = 'question' |
| 47 | elif dataset_name == 'simpleqa': |
| 48 | with open('../data/SimpleQA.json',encoding='utf-8') as f: |
| 49 | datas = json.load(f) |
| 50 | question_string = 'question' |
| 51 | elif dataset_name == 'qald': |
| 52 | with open('../data/qald_10-en.json',encoding='utf-8') as f: |
| 53 | datas = json.load(f) |
| 54 | question_string = 'question' |
| 55 | elif dataset_name == 'webquestions': |
| 56 | with open('../data/WebQuestions.json',encoding='utf-8') as f: |
| 57 | datas = json.load(f) |
| 58 | question_string = 'question' |
| 59 | elif dataset_name == 'trex': |
| 60 | with open('../data/T-REX.json',encoding='utf-8') as f: |
| 61 | datas = json.load(f) |
| 62 | question_string = 'input' |
| 63 | elif dataset_name == 'zeroshotre': |
| 64 | with open('../data/Zero_Shot_RE.json',encoding='utf-8') as f: |
| 65 | datas = json.load(f) |
| 66 | question_string = 'input' |
| 67 | elif dataset_name == 'creak': |
| 68 | with open('../data/creak.json',encoding='utf-8') as f: |
| 69 | datas = json.load(f) |
| 70 | question_string = 'sentence' |
| 71 | else: |
| 72 | print("dataset not found") |
| 73 | exit(-1) |
| 74 | return datas, question_string |