Ejemplo n.º 1
0
def getAnswer(paragraph, question):
    pq_prepro = prepro(paragraph, question)
    if len(pq_prepro['x'])>1000:
        return "[Error] Sorry, the number of words in paragraph cannot be more than 1000." 
    if len(pq_prepro['q'])>100:
        return "[Error] Sorry, the number of words in question cannot be more than 100."
    return demo.run(pq_prepro)
 def answer_question(self, paragraph, question):
     pq_prepro = prepro(paragraph, question)
     answer = self.model.run(pq_prepro)
     if len(answer) == 0:
         return None
     return answer