mannnon commited on
Commit
65e18cc
·
verified ·
1 Parent(s): f11be2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -413,9 +413,16 @@ def parse_zebris_pdf(uploaded_pdf):
413
 
414
  def match_pdf_to_athlete(pdfs_data, athlete_name):
415
  target = normalize_name(athlete_name)
 
 
416
  for pdf in pdfs_data:
417
- if normalize_name(pdf.get("athlete_name")) == target:
 
 
 
 
418
  return pdf
 
419
  return None
420
 
421
  # =========================================================
 
413
 
414
  def match_pdf_to_athlete(pdfs_data, athlete_name):
415
  target = normalize_name(athlete_name)
416
+ target_parts = set(target.split())
417
+
418
  for pdf in pdfs_data:
419
+ pdf_name = normalize_name(pdf.get("athlete_name"))
420
+ pdf_parts = set(pdf_name.split())
421
+
422
+ # match si au moins 2 mots en commun
423
+ if len(target_parts.intersection(pdf_parts)) >= 2:
424
  return pdf
425
+
426
  return None
427
 
428
  # =========================================================