File size: 400 Bytes
9d5b280
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
def doc_to_target(doc):
    labels = [c["label"] for c in doc["question"]["choices"]]

    try:
        i = labels.index(doc["answerKey"].lstrip())
    except Exception as e:
        print("Failed", e)
        return
    return i


def doc_to_choice(doc):
    texts = [c["text"] for c in doc["question"]["choices"]]
    return texts


def doc_to_text(doc):
    return doc["question"]["stem"].strip()