preprocess_medqa.py 323 Bytes
Newer Older
Tanishq Abraham's avatar
Tanishq Abraham committed
1
2
3
4
5
6
7
8
def doc_to_text(doc) -> str:
    option_choices = {'A': doc["ending0"], 'B': doc["ending1"], 'C': doc["ending2"], 'D': doc["ending3"]}
    answers = "".join((f"{k}. {v}\n") for k, v in option_choices.items())
    return f"Question: {doc['sent1']}\n{answers}Answer:"


def doc_to_target(doc) -> int:
    return doc["label"]