Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
asahi417 commited on
Commit
f5e0f2c
1 Parent(s): 806c684

randomize answer

Browse files
dataset/conceptnet_relational_similarity/test.jsonl CHANGED
The diff for this file is too large to render. See raw diff
 
dataset/conceptnet_relational_similarity/valid.jsonl CHANGED
The diff for this file is too large to render. See raw diff
 
dataset/nell_relational_similarity/test.jsonl CHANGED
The diff for this file is too large to render. See raw diff
 
dataset/nell_relational_similarity/valid.jsonl CHANGED
The diff for this file is too large to render. See raw diff
 
dataset/t_rex_relational_similarity/test.jsonl CHANGED
The diff for this file is too large to render. See raw diff
 
dataset/t_rex_relational_similarity/valid.jsonl CHANGED
The diff for this file is too large to render. See raw diff
 
shuffle_candidates.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from glob import glob
3
+ from random import shuffle, seed
4
+
5
+ target = ['nell_relational_similarity', 'conceptnet_relational_similarity', 't_rex_relational_similarity']
6
+
7
+ for t in target:
8
+ for i in glob(f"dataset/{t}/*.jsonl"):
9
+ with open(i) as f:
10
+ tmp = [json.loads(x) for x in f.read().split('\n') if len(x) > 0]
11
+ for n, y in enumerate(tmp):
12
+ answer_original = y['choice'][y['answer']]
13
+ choice = y['choice']
14
+ seed(n)
15
+ shuffle(choice)
16
+ index = list(range(len(y['choice'])))
17
+ seed(n)
18
+ shuffle(index)
19
+ answer = index.index(y['answer'])
20
+ assert answer_original == choice[answer]
21
+ y['choice'] = choice
22
+ y['answer'] = answer
23
+
24
+ with open(i, 'w') as f:
25
+ f.write("\n".join([json.dumps(x) for x in tmp]))