File size: 566 Bytes
9d5b280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
def convert_choice(choice):
    return choice[0].lower() + choice[1:]


def doc_to_text(doc):
    # Drop the period
    connector = {
        "cause": "because",
        "effect": "therefore",
    }[doc["question"]]
    return doc["premise"].strip()[:-1] + f" {connector}"


def doc_to_target(doc):
    correct_choice = doc["choice1"] if doc["label"] == 0 else doc["choice2"]
    # Connect the sentences
    return " " + convert_choice(correct_choice)


def doc_to_choice(doc):
    return [" " + convert_choice(doc["choice1"]), " " + convert_choice(doc["choice2"])]