utils.py 178 Bytes
Newer Older
haileyschoelkopf's avatar
haileyschoelkopf committed
1
2
3
import re


lintangsutawika's avatar
lintangsutawika committed
4
def doc_to_choice(doc):
haileyschoelkopf's avatar
haileyschoelkopf committed
5
6
7
8
9
    choices = [
        c[4:].rstrip(" ,")
        for c in re.findall(r"[abcd] \) .*?, |e \) .*?$", doc["options"])
    ]
    return choices