in leaderboard/data.py [0:0]
def load_quizbowl(*, limit: Optional[int] = None, train: bool = False, sentences: bool = False):
with open("data/qanta.mapped.2018.04.18.json") as f:
questions = json.load(f)["questions"]
questions = [q for q in questions if q["page"] is not None]
for q in questions[:limit]:
if train:
if "train" in q["fold"]:
if sentences:
for sent in extract_sentences(q):
yield sent
else:
yield q
else:
if sentences:
for sent in extract_sentences(q):
yield sent
else:
yield q