HelloWorld0204 commited on
Commit
6aec122
·
verified ·
1 Parent(s): 1477761

Upload 9 files

Browse files
Files changed (1) hide show
  1. scoring.py +18 -3
scoring.py CHANGED
@@ -215,11 +215,16 @@ def _occasion_score(occasion: str, top: dict[str, Any], bottom: dict[str, Any])
215
  b_occ = _STYLE_TO_OCCASIONS.get(extract_style(bottom), set())
216
  top_fits = occ in t_occ
217
  bottom_fits = occ in b_occ
 
 
 
 
218
  if top_fits and bottom_fits:
219
  return 90
220
  if top_fits or bottom_fits:
221
- return 70
222
- return 35
 
223
 
224
 
225
  # ---------------------------------------------------------------------------
@@ -334,12 +339,19 @@ def build_reason(
334
 
335
  o = breakdown["occasion"]
336
  if occasion:
 
 
337
  if o >= 88:
338
  lines.append(f"Both pieces suit {occasion}.")
339
  elif o >= 68:
340
  lines.append(f"One piece suits {occasion}, the other is borderline.")
 
 
 
 
 
341
  else:
342
- lines.append(f"Neither piece is suited to {occasion}.")
343
 
344
  f = breakdown["fit"]
345
  f1, f2 = extract_fit(top), extract_fit(bottom)
@@ -449,6 +461,9 @@ def compute_score(
449
  final = min(final, 68)
450
  if raw_scores["style"] <= 48:
451
  final = min(final, 58)
 
 
 
452
  if raw_scores["pattern"] == 55 and raw_scores["color"] <= 80:
453
  final = min(final, 72)
454
 
 
215
  b_occ = _STYLE_TO_OCCASIONS.get(extract_style(bottom), set())
216
  top_fits = occ in t_occ
217
  bottom_fits = occ in b_occ
218
+
219
+ # Formal occasions have stricter requirements
220
+ is_formal = occ in {"formal", "work", "interview", "business", "office", "wedding", "meeting"}
221
+
222
  if top_fits and bottom_fits:
223
  return 90
224
  if top_fits or bottom_fits:
225
+ # Partial match: lower score for formal occasions
226
+ return 60 if is_formal else 70
227
+ return 25 if is_formal else 35
228
 
229
 
230
  # ---------------------------------------------------------------------------
 
339
 
340
  o = breakdown["occasion"]
341
  if occasion:
342
+ occ_lower = occasion.lower()
343
+ is_formal = occ_lower in {"formal", "work", "interview", "business", "office", "wedding", "meeting"}
344
  if o >= 88:
345
  lines.append(f"Both pieces suit {occasion}.")
346
  elif o >= 68:
347
  lines.append(f"One piece suits {occasion}, the other is borderline.")
348
+ elif o >= 50:
349
+ if is_formal:
350
+ lines.append(f"Pieces are casual — not ideal for formal {occasion}.")
351
+ else:
352
+ lines.append(f"Neither piece is well-suited to {occasion}.")
353
  else:
354
+ lines.append(f"Pieces are incompatible with {occasion} dress code.")
355
 
356
  f = breakdown["fit"]
357
  f1, f2 = extract_fit(top), extract_fit(bottom)
 
461
  final = min(final, 68)
462
  if raw_scores["style"] <= 48:
463
  final = min(final, 58)
464
+ if raw_scores["occasion"] <= 40:
465
+ # Neither piece suited to the occasion — cap final score
466
+ final = min(final, 52)
467
  if raw_scores["pattern"] == 55 and raw_scores["color"] <= 80:
468
  final = min(final, 72)
469