def wild(): global words if request.method == "POST": result = request.args words = request.form['text'] if len(words) != 0: w = searchengine.listword(words) return render_template("wild.html",result1 = w,text = words) else: return render_template("index.html")
def rankPositional(): if request.method == "POST": result = request.args words = request.form['text'] re = {} re[""] = "Not Found" if len(words) != 0: if words.count('*') != 0: w = searchengine.listword(words) return render_template("wild.html",result1 = w,text = words) else: pos,c = positional.searchword(words) repo,ttpo = tfpos.searchword(words,pos) return render_template("rankPositional.html",re2 = repo,tt=ttpo,text=words,len=len(repo)) else: return render_template("index.html")
def rankinverted(): global words if request.method == "POST": result = request.args words = request.form['text'] re = {} re[""] = "Not Found" if len(words) != 0: if words.count('*') != 0: w = searchengine.listword(words) return render_template("wild.html",result1 = w,text = words) else: re1,tt = tfidf.searchword(words) return render_template("rankinverted.html",re1 = re1,tt=tt,text=words,len=len(re1)) else: return render_template("index.html")
def result(): global words if request.method == "POST": result = request.args words = request.form['text'] print(words) if len(words) != 0: if words.count('*') != 0: w = searchengine.listword(words) return render_template("wild.html",result1 = w,text = words) else: re1,c1 = testinverted.searchword(words) re2,c2 = test.searchword(words) re3,c3 = testhash.searchword(words) r4,c4 = testtree.searchword(words) return render_template("result.html",result1 = re1,count1 = c1,result2 = re2,count2 = c2,result3=re3,count3 = c3,text=words,result4 = r4,count4 = c4) else: return render_template("index.html")
def wildcard(): if request.method == "POST": result = request.args wilds = request.form['text'] t = clearfileandtoken(words) for i in t: if i.count('*') != 0: wil = words.replace(i,wilds) pos,c = positional.searchword(wil) repo,ttpo = tfpos.searchword(wil,pos) sim,tt = tfidf.searchword(wil) re1,c1 = testinverted.searchword(wil) re2,c2 = test.searchword(wil) re3,c3 = testhash.searchword(wil) r4,c4 = testtree.searchword(wil) if len(words) != 0: w = searchengine.listword(words) return render_template("wildcard.html",re1=sim,re2=repo,result1 = re1,count1 = c1,result2 = re2,count2 = c2,result3=re3,count3 = c3,text=wil,result4 = r4,count4 = c4,re5 =w,tt=tt)