Spaces:
GIZ
/
Running on CPU Upgrade

prashant commited on
Commit
948ca1f
1 Parent(s): 43cd965

search update

Browse files
Files changed (1) hide show
  1. appStore/keyword_search.py +26 -21
appStore/keyword_search.py CHANGED
@@ -47,8 +47,20 @@ def app():
47
  policy document - developed by GIZ Data and the \
48
  Sustainable Development Solution Network.
49
  """)
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
- st.markdown("")
52
 
53
  with st.sidebar:
54
  with open('docStore/sample/keywordexample.json','r') as json_file:
@@ -57,14 +69,6 @@ def app():
57
  genre = st.radio("Select Keyword Category", list(keywordexample.keys()))
58
  if genre:
59
  keywordList = keywordexample[genre]
60
- # elif genre == 'Climate':
61
- # keywordList = keywordexample['Climate']
62
- # elif genre == 'Social':
63
- # keywordList = keywordexample['Social']
64
- # elif genre == 'Nature':
65
- # keywordList = keywordexample['Nature']
66
- # elif genre == 'Implementation':
67
- # keywordList = keywordexample['Implementation']
68
  else:
69
  keywordList = None
70
 
@@ -76,17 +80,18 @@ def app():
76
  st.markdown("---")
77
 
78
  with st.container():
79
- if keywordList is not None:
80
- queryList = st.text_input("You selcted the {} category we \
81
- will look for these keywords in document".format(genre),
82
- value="{}".format(keywordList))
83
- else:
84
- queryList = st.text_input("Please enter here your question and we \
85
- will look for an answer in the document\
86
- OR enter the keyword you are looking \
87
- for and we will we will look for similar\
88
- context in the document.",
89
- placeholder="Enter keyword here")
 
90
  searchtype = st.checkbox("Show only Exact Matches")
91
  if st.button("Find them"):
92
 
@@ -105,7 +110,7 @@ def app():
105
  split_by=lexical_split_by,
106
  split_length=lexical_split_length,
107
  split_overlap=lexical_split_overlap,
108
- removePunc=lexical_remove_punc),
109
  logging.info("performing lexical search")
110
  with st.spinner("Performing Exact matching search \
111
  (Lexical search) for you"):
 
47
  policy document - developed by GIZ Data and the \
48
  Sustainable Development Solution Network.
49
  """)
50
+ st.write(""" The application allows its user to perform a keyword search\
51
+ based on two options: a lexical (TFIDF) search and semantic \
52
+ bi-encoder search. The difference between both approaches is quite \
53
+ straightforward; while the lexical search only displays paragraphs \
54
+ in the document with exact matching results, the semantic search \
55
+ shows paragraphs with meaningful connections (e.g., synonyms) based\
56
+ on the context as well. The semantic search allows for a personalized\
57
+ experience in using the application. Both methods employ a \
58
+ probabilistic retrieval framework in its identification of relevant \
59
+ paragraphs. By defualt the search is perfomred using 'Semantic Search'
60
+ , to find 'Exact/Lexical Matches' checkbox is provided, which will \
61
+ by pass semantic search.. Furthermore, the application allows the \
62
+ user to search for pre-defined keywords from different thematic buckets""")
63
 
 
64
 
65
  with st.sidebar:
66
  with open('docStore/sample/keywordexample.json','r') as json_file:
 
69
  genre = st.radio("Select Keyword Category", list(keywordexample.keys()))
70
  if genre:
71
  keywordList = keywordexample[genre]
 
 
 
 
 
 
 
 
72
  else:
73
  keywordList = None
74
 
 
80
  st.markdown("---")
81
 
82
  with st.container():
83
+ # if keywordList is not None:
84
+ # queryList = st.text_input("You selected the {} category we \
85
+ # will look for these keywords in document".format(genre),
86
+ # value="{}".format(keywordList))
87
+ # else:
88
+ queryList = st.text_input("Please enter here your question and we \
89
+ will look for an answer in the document\
90
+ OR enter the keyword you are looking \
91
+ for and we will we will look for similar\
92
+ context in the document. You can select the \
93
+ presets of keywords from sidebar.",
94
+ placeholder="Enter keyword here")
95
  searchtype = st.checkbox("Show only Exact Matches")
96
  if st.button("Find them"):
97
 
 
110
  split_by=lexical_split_by,
111
  split_length=lexical_split_length,
112
  split_overlap=lexical_split_overlap,
113
+ removePunc=lexical_remove_punc)
114
  logging.info("performing lexical search")
115
  with st.spinner("Performing Exact matching search \
116
  (Lexical search) for you"):