import staticRanking as sR

queries = [
    "johnny manziel", "quidditch game today", "kyle field", "cse",
    "TAMU libraries", "Holi", "dance", "career center", "century tree",
    "TAMU dining", "Big event", "graduate students", "OGAPS", "intern",
    "soccer", "AgLibLove", "Aggie Ring", "Agricultural Economics",
    "yell leader", "career fair", "Mays Business School", "TAMU REC",
    "Penberthy", "Emerging Technology Building", "Blocker OAL", "Parents week",
    "Battalion", "TAMU admissions", "Aggie Athletics"
]

for query in queries:
    sR.staticRanking(query)
import staticRanking as sR

queries  = ["johnny manziel", "quidditch game today", "kyle field", "cse", "TAMU libraries", "Holi", "dance", "career center","century tree","TAMU dining","Big event", "graduate students", "OGAPS", "intern", "soccer", "AgLibLove", "Aggie Ring", "Agricultural Economics","yell leader", "career fair", "Mays Business School","TAMU REC", "Penberthy","Emerging Technology Building", "Blocker OAL", "Parents week","Battalion","TAMU admissions","Aggie Athletics"]

for query in queries :
    sR.staticRanking(query)

Example #3
0
def helloCallBack(string,text):
   temp = sR.staticRanking(string)		
   list = []
   text.delete(1.0,END)   
   if(len(temp) == 0 ) :
	text.insert(INSERT,"No, results found for the query")
	return 	
   if(len(temp) == 1 and temp[0] == -1) :
	text.insert(INSERT,"No, results found for the query")
	return	
   for item in temp :
	tempList = re.split('_',item[0]);
       	list.append(tempList[1])
   con = mdb.connect('localhost', 'root', 'javar', 'nkj255-db1');
   with con: 
           #cur = con.cursor()      
           cur = con.cursor(mdb.cursors.DictCursor)
           j = 0	
           AUTHOR_URL=[]
           for postid in list:
               if j<50:
                  cur.execute("SELECT * FROM PostInfo WHERE postID=%s ORDER BY date ASC",(postid))
                  row = cur.fetchone()                  
                  if not row :
			continue	
                  cur.execute("SELECT pageName FROM PageInfo WHERE pageID=%s",(row['pageID']))
                  row2=cur.fetchone()
                  AUTHOR_URL.append('www.facebook.com/'+row['pageID'])
                  if int(row['isPage'])==1:
                     POST_URL='www.facebook.com/'+row['pageID']+'/posts'+row['postID']
                     PAGE_URL='www.facebook.com/'+row['pageID']                     
                     if row2:
                       AUTHOR_NAME=row2['pageName']
                     else:
                       AUTHOR_NAME='John David'
                  else:
                     POST_URL='www.facebook.com/groups/'+row['pageID']+'/permalink'+row['postID']
                     PAGE_URL='www.facebook.com/groups/'+row['pageID']                     
                     auth=row['author'].split('_')
                     if auth:
                       AUTHOR_NAME=auth[1]
                     else:
                       AUTHOR_NAME=' '
                  hyperlink = tkHyperlinkManager.HyperlinkManager(text)
                  Font = tkFont.Font(size=14,weight='bold')
                  text.tag_configure("Normal",font=Font)
                  text.tag_add("Normal",1.0,END)
                  text.insert(INSERT,str(j+1))
                  text.insert(INSERT,".      ")
                  """text.insert(INSERT,row['postID']+" ")
                  text.insert(INSERT,row['pageID']+" ")
                  text.insert(INSERT,row['likes'])
                  text.insert(INSERT," ")
                  text.insert(INSERT,row['shares'])
                  text.insert(INSERT," ")
                  text.insert(INSERT,row['date'])
                  text.insert(INSERT," ")
                  text.insert(INSERT,row['objectID'])
                  text.insert(INSERT," ")"""
                  text.insert(INSERT,row['post'])
                  text.insert(INSERT," ")
                  text.insert(INSERT,"\n")
                  text.insert(INSERT,'Dated  ')
                  text.insert(INSERT,row['date'])
                  text.insert(INSERT,'            ')
                  Font1 = tkFont.Font(size=14,weight='bold')
                  text.tag_configure("datefont",foreground="dark green",underline=False,font=Font1)
                  highlighttext(text,'Dated',"datefont")
                  highlighttext(text,row['date'],"datefont")
                  text.insert(INSERT, AUTHOR_NAME, hyperlink.add(lambda:callback(AUTHOR_URL[j-1])))
                  text.insert(INSERT,"\n\n\n")
                  Font = tkFont.Font(family='Helvetica',size=19, weight='bold')
                  text.tag_configure("highlightfont",foreground="red",underline=False,font=Font)
                  highlighttext(text,string,"highlightfont")
                  j=j+1
                  text.pack()