orionweller commited on
Commit
2992a41
1 Parent(s): 02405e8

add options to turn features off

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -180,6 +180,10 @@ with st.sidebar:
180
  # add a checkbox to turn off word suggestions
181
  st.header("Word Suggestions Off")
182
  word_suggestions_off = st.checkbox("Turn off word suggestions", key="word_suggestions_off")
 
 
 
 
183
 
184
  ## make sure all qids in qrels are in queries and write out a warning if not
185
  if queries is not None and qrels is not None:
@@ -193,6 +197,13 @@ with st.sidebar:
193
  if qid in queries:
194
  del queries[qid]
195
 
 
 
 
 
 
 
 
196
 
197
  data = []
198
  for key, value in qrels.items():
 
180
  # add a checkbox to turn off word suggestions
181
  st.header("Word Suggestions Off")
182
  word_suggestions_off = st.checkbox("Turn off word suggestions", key="word_suggestions_off")
183
+ # use only Qrels with relevance 2
184
+ st.header("Use only Qrels with relevance 2")
185
+ use_only_relevance_2 = st.checkbox("Use only Qrels with relevance 2", key="use_only_relevance_2")
186
+
187
 
188
  ## make sure all qids in qrels are in queries and write out a warning if not
189
  if queries is not None and qrels is not None:
 
197
  if qid in queries:
198
  del queries[qid]
199
 
200
+ if use_only_relevance_2:
201
+ # remove all qrels that are not relevance 2
202
+ for qid, doc_rels in qrels.items():
203
+ qrels[qid] = {docid: rel for docid, rel in doc_rels.items() if rel == "2"}
204
+ # remove all queries that have no qrels
205
+ queries = {qid: text for qid, text in queries.items() if qid in qrels}
206
+
207
 
208
  data = []
209
  for key, value in qrels.items():