Spaces:
Running
on
Zero
Running
on
Zero
Update scoring_calculation_system.py
Browse files
scoring_calculation_system.py
CHANGED
@@ -211,7 +211,6 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
|
|
211 |
print(f"Processing breed: {breed_info.get('Breed', 'Unknown')}")
|
212 |
print(f"Breed info keys: {breed_info.keys()}")
|
213 |
|
214 |
-
# 在計算每個分數之前添加檢查
|
215 |
if 'Size' not in breed_info:
|
216 |
print("Missing Size information")
|
217 |
raise KeyError("Size information missing")
|
@@ -249,7 +248,6 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
|
|
249 |
|
250 |
def calculate_exercise_score(breed_needs: str, user_time: int) -> float:
|
251 |
"""運動需求計算"""
|
252 |
-
# 更精確的運動需求定義
|
253 |
exercise_needs = {
|
254 |
'VERY HIGH': {'min': 120, 'ideal': 150, 'max': 180},
|
255 |
'HIGH': {'min': 90, 'ideal': 120, 'max': 150},
|
@@ -293,51 +291,7 @@ def calculate_compatibility_score(breed_info: dict, user_prefs: UserPreferences)
|
|
293 |
base_score = max(0.2, base_score + adjustment)
|
294 |
|
295 |
return base_score
|
296 |
-
|
297 |
-
# def calculate_experience_score(care_level: str, user_experience: str, temperament: str) -> float:
|
298 |
-
# """飼養經驗需求計算"""
|
299 |
-
# # 降低初學者的基礎分數
|
300 |
-
# base_scores = {
|
301 |
-
# "High": {"beginner": 0.15, "intermediate": 0.70, "advanced": 1.0},
|
302 |
-
# "Moderate": {"beginner": 0.40, "intermediate": 0.85, "advanced": 1.0},
|
303 |
-
# "Low": {"beginner": 0.75, "intermediate": 0.95, "advanced": 1.0}
|
304 |
-
# }
|
305 |
-
|
306 |
-
# score = base_scores.get(care_level, base_scores["Moderate"])[user_experience]
|
307 |
-
|
308 |
-
# # 擴展性格特徵評估
|
309 |
-
# temperament_lower = temperament.lower()
|
310 |
-
|
311 |
-
# if user_experience == "beginner":
|
312 |
-
# # 增加更多特徵評估
|
313 |
-
# difficult_traits = {
|
314 |
-
# 'stubborn': -0.12,
|
315 |
-
# 'independent': -0.10,
|
316 |
-
# 'dominant': -0.10,
|
317 |
-
# 'strong-willed': -0.08,
|
318 |
-
# 'protective': -0.06,
|
319 |
-
# 'energetic': -0.05
|
320 |
-
# }
|
321 |
-
|
322 |
-
# easy_traits = {
|
323 |
-
# 'gentle': 0.06,
|
324 |
-
# 'friendly': 0.06,
|
325 |
-
# 'eager to please': 0.06,
|
326 |
-
# 'patient': 0.05,
|
327 |
-
# 'adaptable': 0.05,
|
328 |
-
# 'calm': 0.04
|
329 |
-
# }
|
330 |
-
|
331 |
-
# # 更精確的特徵影響計算
|
332 |
-
# temperament_adjustments = sum(value for trait, value in easy_traits.items() if trait in temperament_lower)
|
333 |
-
# temperament_adjustments += sum(value for trait, value in difficult_traits.items() if trait in temperament_lower)
|
334 |
-
|
335 |
-
# # 品種特定調整
|
336 |
-
# if "terrier" in breed_info['Description'].lower():
|
337 |
-
# temperament_adjustments -= 0.1 # 梗類犬對新手不友善
|
338 |
|
339 |
-
# final_score = max(0.2, min(1.0, score + temperament_adjustments))
|
340 |
-
# return final_score
|
341 |
|
342 |
def calculate_experience_score(care_level: str, user_experience: str, temperament: str) -> float:
|
343 |
"""飼養經驗需求計算"""
|
|
|
211 |
print(f"Processing breed: {breed_info.get('Breed', 'Unknown')}")
|
212 |
print(f"Breed info keys: {breed_info.keys()}")
|
213 |
|
|
|
214 |
if 'Size' not in breed_info:
|
215 |
print("Missing Size information")
|
216 |
raise KeyError("Size information missing")
|
|
|
248 |
|
249 |
def calculate_exercise_score(breed_needs: str, user_time: int) -> float:
|
250 |
"""運動需求計算"""
|
|
|
251 |
exercise_needs = {
|
252 |
'VERY HIGH': {'min': 120, 'ideal': 150, 'max': 180},
|
253 |
'HIGH': {'min': 90, 'ideal': 120, 'max': 150},
|
|
|
291 |
base_score = max(0.2, base_score + adjustment)
|
292 |
|
293 |
return base_score
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
|
|
|
|
|
295 |
|
296 |
def calculate_experience_score(care_level: str, user_experience: str, temperament: str) -> float:
|
297 |
"""飼養經驗需求計算"""
|