Spaces:
Running
on
Zero
Running
on
Zero
Update smart_breed_matcher.py
Browse files- smart_breed_matcher.py +0 -31
smart_breed_matcher.py
CHANGED
@@ -245,37 +245,6 @@ class SmartBreedMatcher:
|
|
245 |
|
246 |
return similarity
|
247 |
|
248 |
-
# def _general_matching(self, description: str, top_n: int = 10) -> List[Dict]:
|
249 |
-
# """基本的品種匹配邏輯"""
|
250 |
-
# matches = []
|
251 |
-
# for breed in self.dog_data:
|
252 |
-
# breed_name = breed[1]
|
253 |
-
# breed_description = breed[9]
|
254 |
-
# temperament = breed[4]
|
255 |
-
|
256 |
-
# # 計算相似度
|
257 |
-
# desc_embedding = self.model.encode(description)
|
258 |
-
# breed_desc_embedding = self.model.encode(breed_description)
|
259 |
-
# breed_temp_embedding = self.model.encode(temperament)
|
260 |
-
|
261 |
-
# # 計算描述和性格的相似度
|
262 |
-
# desc_similarity = float(util.pytorch_cos_sim(desc_embedding, breed_desc_embedding))
|
263 |
-
# temp_similarity = float(util.pytorch_cos_sim(desc_embedding, breed_temp_embedding))
|
264 |
-
|
265 |
-
# # 結合分數
|
266 |
-
# final_score = (desc_similarity * 0.6 + temp_similarity * 0.4)
|
267 |
-
|
268 |
-
# matches.append({
|
269 |
-
# 'breed': breed_name,
|
270 |
-
# 'score': final_score,
|
271 |
-
# 'is_preferred': False,
|
272 |
-
# 'similarity': final_score,
|
273 |
-
# 'reason': "Matched based on general description and temperament"
|
274 |
-
# })
|
275 |
-
|
276 |
-
# # 排序並返回前 N 個匹配結果
|
277 |
-
# return sorted(matches, key=lambda x: -x['score'])[:top_n]
|
278 |
-
|
279 |
def _general_matching(self, description: str, top_n: int = 10) -> List[Dict]:
|
280 |
"""基本的品種匹配邏輯,考慮描述、性格、噪音和健康因素"""
|
281 |
matches = []
|
|
|
245 |
|
246 |
return similarity
|
247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
def _general_matching(self, description: str, top_n: int = 10) -> List[Dict]:
|
249 |
"""基本的品種匹配邏輯,考慮描述、性格、噪音和健康因素"""
|
250 |
matches = []
|