Esempio n. 1
0
     for s in sent_list:
         score = Rules.whoRule(q,helper.remove_puncts(s))
         list1.append((s,score))
 elif question_type=="what":
     for s in sent_list:
         score = Rules.whatRule(q,helper.remove_puncts(s))
         list1.append((s,score))
 elif question_type=="when":
     dateline_score = Rules.datelineRule(q)
     for s in sent_list:
         score = Rules.whenRule(q,helper.remove_puncts(s))
         list1.append((s,score))
 elif question_type=="where":
     dateline_score = Rules.datelineRule(q)
     for s in sent_list:
         score = Rules.whereRule(q,helper.remove_puncts(s))
         list1.append((s,score))
 elif question_type=="hownum":
     for s in sent_list:
         score = Rules.howRule(q,helper.remove_puncts(s))
         list1.append((s,score))
 elif question_type=="why":
     list1 = Rules.whyMainRule(q,sent_list)
 else:
     for s in sent_list:
         s_nopunct = helper.remove_puncts(s)
         score = Rules.WordMatch(q,s_nopunct)
         list1.append((s,score))
 max_s = max(list1, key=lambda x:x[1])
 s = ""
 for x in list1: