Spaces:
Running
on
Zero
Running
on
Zero
Update scoring_calculation_system.py
Browse files- scoring_calculation_system.py +12 -12
scoring_calculation_system.py
CHANGED
@@ -486,7 +486,7 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
|
|
486 |
},
|
487 |
"Medium": {
|
488 |
"apartment": {
|
489 |
-
"no_yard": 0.35,
|
490 |
"shared_yard": 0.45,
|
491 |
"private_yard": 0.55
|
492 |
},
|
@@ -503,9 +503,9 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
|
|
503 |
},
|
504 |
"Large": {
|
505 |
"apartment": {
|
506 |
-
"no_yard": 0.
|
507 |
-
"shared_yard": 0.
|
508 |
-
"private_yard": 0.
|
509 |
},
|
510 |
"house_small": {
|
511 |
"no_yard": 0.55,
|
@@ -520,9 +520,9 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
|
|
520 |
},
|
521 |
"Giant": {
|
522 |
"apartment": {
|
523 |
-
"no_yard": 0.
|
524 |
-
"shared_yard": 0.
|
525 |
-
"private_yard": 0.
|
526 |
},
|
527 |
"house_small": {
|
528 |
"no_yard": 0.40,
|
@@ -605,10 +605,10 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
|
|
605 |
def apply_extreme_case_adjustments(score):
|
606 |
# 處理極端情況
|
607 |
if size == "Giant" and living_space == "apartment":
|
608 |
-
return score * 0.
|
609 |
|
610 |
if size == "Large" and living_space == "apartment" and exercise_needs == "Very High":
|
611 |
-
return score * 0.85
|
612 |
|
613 |
if size == "Small" and living_space == "house_large" and exercise_needs == "Low":
|
614 |
return score * 0.9 # 低運動需求的小型犬在大房子可能過於寬敞
|
@@ -727,9 +727,9 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
|
|
727 |
def calculate_time_score():
|
728 |
if exercise_time >= breed_level['ideal']:
|
729 |
if exercise_time > breed_level['max']:
|
730 |
-
|
731 |
-
|
732 |
-
return
|
733 |
return 1.0 # 理想範圍內給予滿分
|
734 |
elif exercise_time >= breed_level['min']:
|
735 |
# 在最小值和理想值之間使用更陡峭的曲線
|
|
|
486 |
},
|
487 |
"Medium": {
|
488 |
"apartment": {
|
489 |
+
"no_yard": 0.35,
|
490 |
"shared_yard": 0.45,
|
491 |
"private_yard": 0.55
|
492 |
},
|
|
|
503 |
},
|
504 |
"Large": {
|
505 |
"apartment": {
|
506 |
+
"no_yard": 0.45,
|
507 |
+
"shared_yard": 0.55,
|
508 |
+
"private_yard": 0.65
|
509 |
},
|
510 |
"house_small": {
|
511 |
"no_yard": 0.55,
|
|
|
520 |
},
|
521 |
"Giant": {
|
522 |
"apartment": {
|
523 |
+
"no_yard": 0.40,
|
524 |
+
"shared_yard": 0.50,
|
525 |
+
"private_yard": 0.60
|
526 |
},
|
527 |
"house_small": {
|
528 |
"no_yard": 0.40,
|
|
|
605 |
def apply_extreme_case_adjustments(score):
|
606 |
# 處理極端情況
|
607 |
if size == "Giant" and living_space == "apartment":
|
608 |
+
return score * 0.85
|
609 |
|
610 |
if size == "Large" and living_space == "apartment" and exercise_needs == "Very High":
|
611 |
+
return score * 0.85
|
612 |
|
613 |
if size == "Small" and living_space == "house_large" and exercise_needs == "Low":
|
614 |
return score * 0.9 # 低運動需求的小型犬在大房子可能過於寬敞
|
|
|
727 |
def calculate_time_score():
|
728 |
if exercise_time >= breed_level['ideal']:
|
729 |
if exercise_time > breed_level['max']:
|
730 |
+
excess = (exercise_time - breed_level['max']) / breed_level['max']
|
731 |
+
bonus = min(0.15, excess * 0.3)
|
732 |
+
return min(1.0, 1.0 + bonus)
|
733 |
return 1.0 # 理想範圍內給予滿分
|
734 |
elif exercise_time >= breed_level['min']:
|
735 |
# 在最小值和理想值之間使用更陡峭的曲線
|