補強 PChome 精準同款 total price 通道

This commit is contained in:
OoO
2026-05-25 12:01:57 +08:00
parent 7e29c00eb8
commit 5c0ff7f8cf
7 changed files with 191 additions and 6 deletions

View File

@@ -527,6 +527,68 @@ def test_marketplace_matcher_promotes_ludeya_line_with_platform_name_drift():
assert "shared_identity_anchor" in diagnostics.reasons or "shared_identity_anchor_no_spec" in diagnostics.reasons
def test_marketplace_matcher_promotes_focused_exact_pack_rows_to_total_price():
from services.marketplace_product_matcher import score_marketplace_match
cases = [
(
"【3W CLINIC】膠原蛋白粉底液50mlX2入(膠原 保濕 清透 服貼 長效持久)",
"【韓國 3W CLINIC】膠原蛋白粉底液50mlx2入",
"focused_exact_identity_3w_clinic_collagen_foundation_50ml_2pack",
),
(
"【花美水】Moisture保濕修護精華凝膠-原黃金(1.7g x 3支/盒)",
"【花美水】Moisture 保濕修護 精華凝膠(原黃金)(1.7g*3支入)/盒",
"focused_exact_identity_hanamisui_moisture_original_gel_1_7g_3pack",
),
(
"【花美水】Inclear 櫻克麗兒一次性私密淨化凝膠(1.7g x 3支/盒)",
"【花美水】Inclear櫻克麗兒私密淨化凝膠(1.7g*3支)/盒",
"focused_exact_identity_hanamisui_inclear_private_gel_1_7g_3pack",
),
(
"【The Ordinary】Caffeine Solution 咖啡因 + EGCG兒茶眼部配方30ml",
"The Ordinary 5%咖啡因 + EGCG兒茶眼部配方 (30ml)",
"focused_exact_identity_the_ordinary_caffeine_egcg_30ml",
),
(
"【KUSSEN 葵森】寶寶益菌屁屁膏 50ml 3入(易敏肌 屁屁霜 紅屁屁 尿布膏 尿布區照護)",
"【KUSSEN 葵森】寶寶益菌屁屁膏 50ml 3入",
"focused_exact_identity_kussen_baby_butt_cream_50ml_3pack",
),
(
"【Bone 蹦克】擴香禮盒三入組 原木麋鹿+搖搖貓頭鷹+薰衣草精油(交換禮物 香氛 擴香木 )",
"Bone / 擴香禮盒三入組 - 原木麋鹿+搖搖貓頭鷹+薰衣草精油",
"focused_exact_identity_bone_diffuser_gift_3pack",
),
(
"【1990選物】現代簡約半圓罩融燭燈 香氛蠟燭暖燈-白色款( 送禮) 生日禮物 香氛蠟燭燈)",
"【1990選物】現代簡約半圓罩融燭燈 香氛蠟燭暖燈-白色款",
"focused_exact_identity_selection1990_half_dome_wax_lamp_white",
),
(
"【1990選物】歐式可彎融燭燈 香氛蠟燭暖燈-白色款( 送禮) 生日禮物 香氛蠟燭燈)",
"【1990選物】歐式可彎融燭燈 香氛蠟燭暖燈-白色款",
"focused_exact_identity_selection1990_bendable_wax_lamp_white",
),
(
"【CANMAKE】淚袋專用盤(淚袋眼影盤)",
"台隆手創館 CANMAKE淚袋專用盤(淚袋眼影盤)",
"focused_exact_identity_canmake_tear_bag_palette",
),
]
for momo_name, competitor_name, expected_reason in cases:
diagnostics = score_marketplace_match(momo_name, competitor_name, momo_price=1000, competitor_price=900)
assert diagnostics.score >= 0.76, (momo_name, diagnostics)
assert diagnostics.hard_veto is False
assert diagnostics.match_type == "exact"
assert diagnostics.price_basis == "total_price"
assert diagnostics.alert_tier == "price_alert_exact"
assert expected_reason in diagnostics.reasons
assert "focused_exact_total_price_safe" in diagnostics.reasons
def test_marketplace_matcher_promotes_recipe_box_marketing_line_drift():
from services.marketplace_product_matcher import score_marketplace_match