who_list,what_list,when_list,why_list,where_list,how_list=[],[],[],[],[],[]

    for i in range(0, len(cleansedqList)):
        result = ""
        qWords = cleansedqList[i].split()
        print qIDList[i]
        q_flag = 0
        question_list.append(qIDList[i])
        for j in range(0, len(qWords)):
            if qWords[j].lower() == 'who' or qWords[j].lower(
            ) == 'whom' or qWords[j].lower() == 'whose':
                q_flag = 1
                result = who.answering_who(
                    cleansedqList[i], stopwords_free_questions_list[i],
                    sentences_list, stopwords_free_sentences_list,
                    master_person_list,
                    master_prof_list)  #stopwords_free_sentences_list
                break
            elif qWords[j].lower() == 'what':
                q_flag = 1
                result = what.answering_what(
                    cleansedqList[i], stopwords_free_questions_list[i],
                    sentences_list, stopwords_free_sentences_list,
                    master_time_list,
                    master_person_list)  #stopwords_free_sentences_list
                break
            elif qWords[j].lower() == 'when':
                q_flag = 1
                result = when.answering_when(
                    cleansedqList[i], stopwords_free_questions_list[i],
    ################### CATEGORIZING THE QUESTION AS WH0, WHAT, WHEN , WHY , WHERE OR HOW  ########################

    who_list,what_list,when_list,why_list,where_list,how_list=[],[],[],[],[],[]


    for i in range(0, len(cleansedqList)):
        result=""
        qWords= cleansedqList[i].split()
        print qIDList[i]
        q_flag=0
        question_list.append(qIDList[i])
        for j in range(0, len(qWords)):
            if qWords[j].lower()=='who' or qWords[j].lower()=='whom' or qWords[j].lower()=='whose'  :
                q_flag=1
                result=who.answering_who(cleansedqList[i],stopwords_free_questions_list[i],sentences_list,stopwords_free_sentences_list,master_person_list,master_prof_list) #stopwords_free_sentences_list
                break
            elif qWords[j].lower()=='what':
                q_flag=1
                result=what.answering_what(cleansedqList[i],stopwords_free_questions_list[i],sentences_list,stopwords_free_sentences_list,master_time_list,master_person_list) #stopwords_free_sentences_list
                break
            elif qWords[j].lower()=='when':
                q_flag=1
                result=when.answering_when(cleansedqList[i],stopwords_free_questions_list[i],sentences_list,stopwords_free_sentences_list,hline_date,master_month_list,master_time_list) #stopwords_free_sentences_list

                break
            elif qWords[j].lower()=='where':
                q_flag=1
                result=where.answering_where(cleansedqList[i],stopwords_free_questions_list[i],sentences_list,stopwords_free_sentences_list,hline_date,master_loc_list) #stopwords_free_sentences_list

                break
Exemplo n.º 3
0
    ################### CATEGORIZING THE QUESTION AS WH0, WHAT, WHEN , WHY , WHERE OR HOW  ########################

    who_list,what_list,when_list,why_list,where_list,how_list=[],[],[],[],[],[]

    for i in range(0, len(cleansedqList)):
        qWords = cleansedqList[i].split()
        print qIDList[i]
        q_flag = 0
        question_list.append(qIDList[i])
        for j in range(0, len(qWords)):
            if qWords[j].lower() == 'who':
                #print 'Who question',cleansedqList[i]
                q_flag = 1
                answer_list.append(
                    who.answering_who(cleansedqList[i],
                                      stopwords_free_questions_list[i],
                                      stopwords_free_sentences_list)
                )  #stopwords_free_sentences_list
                #result=who.answering_who(cleansedqList[i],stopwords_free_questions_list[i],stopwords_free_sentences_list) #stopwords_free_sentences_list
                break
            elif qWords[j].lower() == 'what':
                #what_list.append(cleansedqList[i])
                q_flag = 1
                answer_list.append(
                    what.answering_what(
                        cleansedqList[i], stopwords_free_questions_list[i],
                        sentences_list, stopwords_free_sentences_list,
                        hline_date))  #stopwords_free_sentences_list
                #result=what.answering_what(cleansedqList[i],stopwords_free_questions_list[i],sentences_list,stopwords_free_sentences_list,hline_date) #stopwords_free_sentences_list

                break
    ################### CATEGORIZING THE QUESTION AS WH0, WHAT, WHEN , WHY , WHERE OR HOW  ########################

    who_list,what_list,when_list,why_list,where_list,how_list=[],[],[],[],[],[]


    for i in range(0, len(cleansedqList)):
        qWords= cleansedqList[i].split()
        print qIDList[i]
        q_flag=0
        question_list.append(qIDList[i])
        for j in range(0, len(qWords)):
            if qWords[j].lower()=='who':
                #print 'Who question',cleansedqList[i]
                q_flag=1
                answer_list.append(who.answering_who(cleansedqList[i],stopwords_free_questions_list[i],stopwords_free_sentences_list)) #stopwords_free_sentences_list
                #result=who.answering_who(cleansedqList[i],stopwords_free_questions_list[i],stopwords_free_sentences_list) #stopwords_free_sentences_list
                break
            elif qWords[j].lower()=='what':
                #what_list.append(cleansedqList[i])
                q_flag=1
                answer_list.append(what.answering_what(cleansedqList[i],stopwords_free_questions_list[i],sentences_list,stopwords_free_sentences_list,hline_date)) #stopwords_free_sentences_list
                #result=what.answering_what(cleansedqList[i],stopwords_free_questions_list[i],sentences_list,stopwords_free_sentences_list,hline_date) #stopwords_free_sentences_list

                break
            elif qWords[j].lower()=='when':
                #who_list.append(cleansedqList[i])
                q_flag=1
                answer_list.append(when.answering_when(cleansedqList[i],stopwords_free_questions_list[i],stopwords_free_sentences_list,hline_date)) #stopwords_free_sentences_list
                #result=when.answering_when(cleansedqList[i],stopwords_free_questions_list[i],stopwords_free_sentences_list,hline_date) #stopwords_free_sentences_list