fchoquette-ebay commited on
Commit
4f304c6
1 Parent(s): 6d440d8

feat: improve duplication cleanup

Browse files
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -279,11 +279,19 @@ def extract(description: str):
279
  final_sentences = []
280
 
281
  for query_key, query in answer.items():
282
- is_higher = all(
283
- query > answers[key].get(query_key, float('-inf'))
284
- for key, ans in answers.items()
285
- if isinstance(ans, dict) and key != answer_key
286
- )
 
 
 
 
 
 
 
 
287
 
288
  if is_higher:
289
  final_sentences.append(query_key)
 
279
  final_sentences = []
280
 
281
  for query_key, query in answer.items():
282
+ is_higher = True
283
+ for key, ans in answers.items():
284
+ if key == answer_key:
285
+ continue
286
+
287
+ if isinstance(ans, dict):
288
+ possible_answer = ans.get(query_key, float('-inf'))
289
+ if query <= possible_answer:
290
+ is_higher = False
291
+ break
292
+ elif isinstance(ans, str) and query_key == ans:
293
+ is_higher = False
294
+ break
295
 
296
  if is_higher:
297
  final_sentences.append(query_key)