AM_Document_analysis / helpers /questions_helper.py
MikaJLeh
Pushed all files to Hugging Face, replacing old content
f2ec360
raw
history blame contribute delete
718 Bytes
getAnsweredQuestions = lambda questions: [
q for q in questions if q["status"] == "answered"
]
getUnansweredQuestions = lambda questions: [
q for q in questions if q["status"] == "unanswered"
]
getSubQuestions = lambda questions: [q for q in questions if q["type"] == "subquestion"]
getHopQuestions = lambda questions: [q for q in questions if q["type"] == "hop"]
getLastQuestionId = lambda questions: max([q["id"] for q in questions])
def markAnswered(questions, id: int):
for q in questions:
if q["id"] == id:
q["status"] = "answered"
def getQuestionById(questions, id: int):
q = [q for q in questions if q["id"] == id]
if len(q) == 0:
return None
return q[0]