preprocess_pubmedqa.py 397 Bytes
Newer Older
Ethan Smith's avatar
Ethan Smith committed
1
def doc_to_text(doc) -> str:
2
3
4
5
6
    ctxs = "\n".join(doc["context"]["contexts"])
    return "Abstract: {}\nQuestion: {}\nAnswer:".format(
        ctxs, doc["question"], doc["final_decision"]
    )

lintangsutawika's avatar
lintangsutawika committed
7

Ethan Smith's avatar
Ethan Smith committed
8
def doc_to_target(doc) -> str:
9
10
    return " {}".format(doc["final_decision"])

lintangsutawika's avatar
lintangsutawika committed
11

12
def gold_alias(doc):
lintangsutawika's avatar
lintangsutawika committed
13
14
    dict_to_label = {"yes": 0, "no": 1, "maybe": 2}
    return dict_to_label[doc["final_decision"]]