diff --git a/services/marketplace_product_matcher.py b/services/marketplace_product_matcher.py index 32fb612..49b33b0 100644 --- a/services/marketplace_product_matcher.py +++ b/services/marketplace_product_matcher.py @@ -55,6 +55,13 @@ NOISE_PHRASES = ( "贈送薰衣草精油", "超聲波大噴霧", "天然陶瓷", + "女大電視節目推薦", + "醫師好辣推薦", + "嬰兒界萬用霜", + "48h抑味爽身", + "10度c順降", + "vit b5", + "vitb5", "任選", "即期品", "福利品", @@ -175,6 +182,13 @@ SEARCH_NOISE_PHRASES = ( "贈送薰衣草精油", "超聲波大噴霧", "天然陶瓷", + "女大電視節目推薦", + "醫師好辣推薦", + "嬰兒界萬用霜", + "48h抑味爽身", + "10度c順降", + "vit b5", + "vitb5", "母親節", "父親節", "情人節", @@ -241,6 +255,18 @@ SEARCH_IDENTITY_ANCHORS = ( "男性私密激淨凝露", "私密抑菌噴霧", "天然陶瓷精油香薰機", + "裸光幻閃亮采餅", + "絕對持久定妝噴霧", + "兒童防曬氣墊粉餅", + "提提亮膚打亮液", + "甜甜嫩頰腮紅液", + "自動武士刀眉筆", + "超進化光感輕潤遮瑕棒", + "4合1微臻全能氣墊粉餅", + "唯我玫瑰裸光潤唇膏", + "晨曦冷香儀", + "舒恬良修護霜", + "頂級濃潤柔霜潤唇膏", "絕對完美永生玫瑰逆齡乳霜", "永生玫瑰逆齡乳霜", "永生玫瑰霜", @@ -1320,10 +1346,10 @@ def score_marketplace_match( and brand_score >= 0.95 and not hard_veto and price_penalty == 0 - and type_score >= 0.95 + and type_score >= 0.55 and spec_score >= 0.45 and token_score >= 0.56 - and sequence_score >= 0.62 + and sequence_score >= 0.60 and not variant_descriptor_conflict ): score += 0.02 @@ -1342,6 +1368,19 @@ def score_marketplace_match( ): score += 0.03 reasons.append("shared_identity_anchor_marketing_variant") + if ( + shared_anchor + and len(shared_anchor.replace(" ", "")) >= 6 + and brand_score >= 0.95 + and not hard_veto + and price_penalty == 0 + and type_score >= 0.55 + and spec_score >= 0.45 + and token_score >= 0.88 + and not variant_descriptor_conflict + ): + score += 0.02 + reasons.append("shared_identity_anchor_core_line") if ( brand_score >= 0.95 and not hard_veto diff --git a/tests/test_marketplace_product_matcher.py b/tests/test_marketplace_product_matcher.py index 5894648..3e95f3c 100644 --- a/tests/test_marketplace_product_matcher.py +++ b/tests/test_marketplace_product_matcher.py @@ -323,6 +323,46 @@ def test_marketplace_matcher_promotes_besthot_aroma_machine_marketing_variant(): assert diagnostics.hard_veto is False +def test_marketplace_matcher_promotes_precise_cosmetics_and_skincare_lines(): + from services.marketplace_product_matcher import score_marketplace_match + + samples = [ + ( + "【NARS】官方直營 裸光幻閃亮采餅", + "NARS 裸光幻閃亮采餅 2g #Heavenly", + ), + ( + "【PONY EFFECT】絕對持久定妝噴霧 100ml(持久定妝/控油特霧)", + "【PONY EFFECT】絕對持久定妝噴霧(控油特霧版)", + ), + ( + "【植村秀】官方直營 自動武士刀眉筆(Shu uemura/眉筆)", + "《Shu Uemura 植村秀》自動武士刀眉筆 0.3g", + ), + ( + "【SHISEIDO 資生堂國際櫃】超進化光感輕潤遮瑕棒(遮瑕/修容/打亮/新品)", + "【資生堂國際櫃】超進化光感輕潤遮瑕棒2.7g", + ), + ( + "【LANCOME 蘭蔻】唯我玫瑰裸光潤唇膏(多款任選 國際航空版 送禮)", + "LANCOME 唯我玫瑰裸光潤唇膏 3g", + ), + ( + "【Les nez 香鼻子】晨曦冷香儀贈複方擴香精油 30ml(無水擴香 智能霧化)", + "les nez 晨曦冷香儀(無水擴香、智能霧化)", + ), + ( + "【Mustela 慕之恬廊】舒恬良 修護霜 40ml(Vit.B5 嬰兒界萬用霜 醫師好辣推薦)", + "Mustela 慕之恬廊舒恬良修護霜40ml", + ), + ] + + for left, right in samples: + diagnostics = score_marketplace_match(left, right, momo_price=399, competitor_price=399) + assert diagnostics.score >= 0.76 + assert diagnostics.hard_veto is False + + def test_marketplace_matcher_rejects_same_count_different_unit_family(): from services.marketplace_product_matcher import score_marketplace_match