preprocess_winogrande.py 374 Bytes
Newer Older
1
2
def doc_to_text(doc):
    idx = doc["sentence"].index("_")
lintangsutawika's avatar
lintangsutawika committed
3
4
5
    options = [doc["option1"], doc["option2"]]
    return [doc["sentence"][:idx] + opt for opt in options]

6
7
8
9
10

def doc_to_target(doc):
    idx = doc["sentence"].index("_") + 1
    return doc["sentence"][idx:].strip()

Benjamin Fattori's avatar
Benjamin Fattori committed
11
12
13

def gold_alias(doc):
    answer_to_num = {"1": 0, "2": 1}
lintangsutawika's avatar
lintangsutawika committed
14
    return answer_to_num[doc["answer"]]