DawnC commited on
Commit
4b2fee0
1 Parent(s): b6feb5d

Update breed_recommendation.py

Browse files
Files changed (1) hide show
  1. breed_recommendation.py +32 -22
breed_recommendation.py CHANGED
@@ -189,28 +189,38 @@ def create_recommendation_tab(UserPreferences, get_breed_recommendations, format
189
 
190
  # 從描述中提取用戶偏好
191
  user_prefs = UserPreferences(
192
- living_space="apartment" if any(word in description.lower()
193
- for word in ["apartment", "flat", "condo"]) else "house_small",
194
- exercise_time=120 if any(word in description.lower()
195
- for word in ["active", "exercise", "running", "athletic", "high energy"]) else 60,
196
- grooming_commitment="high" if any(word in description.lower()
197
- for word in ["grooming", "brush", "maintain"]) else "medium",
198
- experience_level="experienced" if any(word in description.lower()
199
- for word in ["experienced", "trained", "professional"]) else "intermediate",
200
- has_children=any(word in description.lower()
201
- for word in ["children", "kids", "family", "child"]),
202
- noise_tolerance="low" if any(word in description.lower()
203
- for word in ["quiet", "peaceful", "silent"]) else "medium",
204
- space_for_play=any(word in description.lower()
205
- for word in ["yard", "garden", "outdoor", "space"]),
206
- other_pets=any(word in description.lower()
207
- for word in ["other pets", "cats", "dogs"]),
208
- climate="moderate",
209
- health_sensitivity="high" if any(word in description.lower()
210
- for word in ["health", "medical", "sensitive"]) else "medium",
211
- barking_acceptance="low" if any(word in description.lower()
212
- for word in ["quiet", "no barking"]) else None
213
- )
 
 
 
 
 
 
 
 
 
 
214
 
215
  final_recommendations = []
216
 
 
189
 
190
  # 從描述中提取用戶偏好
191
  user_prefs = UserPreferences(
192
+ living_space="apartment" if any(word in description.lower()
193
+ for word in ["apartment", "flat", "condo"]) else "house_small",
194
+ yard_access="no_yard" if any(word in description.lower()
195
+ for word in ["apartment", "flat", "condo"]) else "private_yard",
196
+ exercise_time=120 if any(word in description.lower()
197
+ for word in ["active", "exercise", "running", "athletic", "high energy"]) else 60,
198
+ exercise_type="active_training" if any(word in description.lower()
199
+ for word in ["training", "running", "jogging", "hiking"]) else "moderate_activity",
200
+ grooming_commitment="high" if any(word in description.lower()
201
+ for word in ["grooming", "brush", "maintain"]) else "medium",
202
+ experience_level="experienced" if any(word in description.lower()
203
+ for word in ["experienced", "trained", "professional"]) else "intermediate",
204
+ time_availability="flexible" if any(word in description.lower()
205
+ for word in ["time", "available", "flexible", "home"]) else "moderate",
206
+ has_children=any(word in description.lower()
207
+ for word in ["children", "kids", "family", "child"]),
208
+ children_age="school_age" if any(word in description.lower()
209
+ for word in ["school", "elementary"]) else "teenager" if any(word in description.lower()
210
+ for word in ["teen", "teenager"]) else "toddler" if any(word in description.lower()
211
+ for word in ["baby", "toddler"]) else None,
212
+ noise_tolerance="low" if any(word in description.lower()
213
+ for word in ["quiet", "peaceful", "silent"]) else "medium",
214
+ space_for_play=any(word in description.lower()
215
+ for word in ["yard", "garden", "outdoor", "space"]),
216
+ other_pets=any(word in description.lower()
217
+ for word in ["other pets", "cats", "dogs"]),
218
+ climate="moderate",
219
+ health_sensitivity="high" if any(word in description.lower()
220
+ for word in ["health", "medical", "sensitive"]) else "medium",
221
+ barking_acceptance="low" if any(word in description.lower()
222
+ for word in ["quiet", "no barking"]) else "medium"
223
+ )
224
 
225
  final_recommendations = []
226