Datasets:

Modalities:
Text
ArXiv:
Libraries:
Datasets
License:
lhoestq HF Staff commited on
Commit
2b2b025
·
verified ·
1 Parent(s): 830df75

Delete loading script auxiliary file

Browse files
Files changed (1) hide show
  1. raw_data/convert_tsv.py +0 -33
raw_data/convert_tsv.py DELETED
@@ -1,33 +0,0 @@
1
- import json
2
- import random
3
-
4
- def winogrande_format(row):
5
- array = row["pronoun"]
6
- position_idx = json.loads(array)[1][0]
7
- # Turn unicode into proper chinese characters
8
- sent = str(u"{}".format(row["sent"]))
9
- start_idx = 0
10
- for i, tok in enumerate(json.loads(row["toks"])):
11
- tok = str(u"{}".format(tok))
12
- cur_start_idx = sent.find(tok)
13
- if i == position_idx:
14
- break
15
- sent = sent[cur_start_idx + len(tok):]
16
- start_idx += cur_start_idx + len(tok)
17
- # +1 to give room for an optional space
18
- row["sentence"] = row["sent"][:start_idx] + row["sent"][start_idx:start_idx+len(tok)+1].replace(tok, "_") + row["sent"][start_idx+len(tok)+1:]
19
-
20
- sol = json.loads(row["solution"])
21
-
22
- cor_answer_idx = random.choice([1, 2])
23
- incor_answer_idx = 2 if cor_answer_idx == 1 else 1
24
-
25
- cor_answer = str(u"{}".format(sol[0][0])) if sol[0][-1] == True else str(u"{}".format(sol[1][0]))
26
- incor_answer = str(u"{}".format(sol[0][0])) if sol[0][-1] == False else str(u"{}".format(sol[1][0]))
27
-
28
- row[f"option{cor_answer_idx}"] = cor_answer
29
- row[f"option{incor_answer_idx}"] = incor_answer
30
- row["answer"] = cor_answer_idx
31
- return row
32
-
33
- # ds = ds.apply(winogrande_format, axis=1)