-
Notifications
You must be signed in to change notification settings - Fork 4
/
CustomGUI.py
60 lines (50 loc) · 2.82 KB
/
CustomGUI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Mirko Mantovani
import easygui as eg
def ask_query():
msg = "Enter your query"
title = "Query"
# field_names = ["Query"]
# fieldValues = [] # we start with blanks for the values
# fieldValues = eg.multenterbox(msg, title, field_names)
response = eg.enterbox(msg, title)
return response
def display_query_results(docs_list, url_from_code, query_tokens):
# url_from_code = Crawler.get_url_from_code()
msg = "Preprocessed query: "+str(query_tokens)+"\nThese are the results of your query, you can double click" \
" or select and press ok on a" \
" result to open the web page in a new tab of your default browser" \
" or you can choose to Show more results. Press cancel to go back" \
" to the main menu."
title = "Query results"
# print(url_from_code)
url_list = [str(url_from_code[code[0]])+' '+str(code[1]) for code in docs_list]
url_list.append("Show more results")
url_list.append("Auto expand query")
choice = eg.choicebox(msg, title, url_list)
return choice
def display_query_results_expanded(docs_list, url_from_code, query_tokens, query_expansion_tokens):
msg = "Preprocessed query: " + str(query_tokens) + "\nExpanded query tokens : " + str(query_expansion_tokens) +\
"\nThese are the results of your query, you can double click" \
" or select and press ok on a" \
" result to open the web page in a new tab of your default browser" \
" or you can choose to Show more results. Press cancel to go back" \
" to the main menu."
title = "Expanded query results"
# print(url_from_code)
url_list = [str(url_from_code[code[0]]) + ' ' + str(code[1]) for code in docs_list]
url_list.append("Show more results")
choice = eg.choicebox(msg, title, url_list)
return choice
def display_main_menu(use_page_rank, use_pseudo_relevance_feedback):
# image = "python_and_check_logo.gif"
msg = "Settings \nUse page rank: " + str(use_page_rank) + "\nUse Context pseudo relevance feedback: "\
+ str(use_pseudo_relevance_feedback) + "\n\nChoose your action"
title = "Main menu UIC web search engine"
choices = ["Setup search options", "New query", "Exit UIC web search engine"]
choice = eg.buttonbox(msg, title, choices=choices)
return choice
def ask_preference(use_feature_text):
msg = "Do you want to "+use_feature_text+" feature in your future searches?"
title = "Setup Preference"
choice = eg.ynbox(msg, title)
return choice