INNER CODE UNIT · Python
generate_questions_from_inputs
AMontgomerie/question_generator · questiongenerator.py:127
def generate_questions_from_inputs(self, qg_inputs: List) -> List[str]:
"""Given a list of concatenated answers and contexts, with the form:
"answer_token <answer text> context_token <context text>", generates a list of
questions.
"""
generated_questions = []
for qg_input in qg_inputs:
question = self._generate_question(qg_input)
generated_questions.append(question)
return generated_questions
def _split_text(self, text: str) -> List[str]:
"""Splits the text into sentences, and attempts to split or truncate long sentences."""
MAX_SENTENCE_LEN = 128
sentences = re.findall(".*?[.!\?]", text)
cut_sentences = []