def analyze(): query = request.form['query'] a, b, c = query_module.query_structure(query) clean_query_root = a query_synonym_root = b query_suggestion_root = c query_analyse = query result_tm = ranking_text_mining.ranking(a, b, c) result_nlp, ngram_considered = ranking_nlp.rank_ngram(query) result, result_score = combined_ranking.ranking(result_tm, result_nlp) result_analyse = result result_score_analyse = result_score score=[] for key, value in result_score.items(): score.append(value) return render_template("analysis.html", query=query_analyse, query_root=clean_query_root, synonym=query_synonym_root, suggestion=query_suggestion_root, result_title=result_analyse, result_score=result_score_analyse, score=score, ngram=ngram_considered)
def index(): query = request.form['query'] a, b, c=query_module.query_structure(query) result_tm=ranking_text_mining.ranking(a, b, c) result_nlp, ngram_considered=ranking_nlp.rank_ngram(query) result, result_score=combined_ranking.ranking(result_tm,result_nlp) return render_template("result.html",result=result)
list_final_query = [] for i in range(10): temp = [] temp.append(list_combined_query_str[i]) temp.append(list_random_gram2[i]) temp.append(list_random_gram3[i]) temp = ' '.join(temp) list_final_query.append(temp) #print(list_final_query) #print(list_random_url_50) count = 0 for iter, temp_query in enumerate(list_final_query): query = temp_query a, b, c = query_module.query_structure(query) result_tm = ranking_text_mining.ranking(a, b, c) result_nlp, ngram_considered = ranking_nlp.rank_ngram(query) result, result_score = combined_ranking.ranking(result_tm, result_nlp) #result=result[:3] print(result) print(list_random_url_50[iter]) if list_random_url_50[iter] in result: count = count + 1 print("Count=", count) print("Count=", count)