V10.584 強化 PChome Nick 比對窄門
All checks were successful
CD Pipeline / deploy (push) Successful in 1m6s

This commit is contained in:
OoO
2026-06-04 14:33:26 +08:00
parent 133232e2f4
commit a1e56a2c6b
8 changed files with 156 additions and 6 deletions

View File

@@ -1425,6 +1425,62 @@ def test_marketplace_matcher_keeps_expiry_or_variant_pack_in_manual_review():
assert "safe_multi_component_exact_total_price" not in diagnostics.reasons
def test_marketplace_matcher_promotes_nivea_creme_100ml_type_alignment():
from services.marketplace_product_matcher import score_marketplace_match
diagnostics = score_marketplace_match(
"【NIVEA 妮維雅】妮維雅霜100ml 隨身版(小藍罐 身體乳霜 臉部身體適用)",
"NIVEA 妮維雅 妮維雅霜100ml 隨身版(小藍罐/身體乳霜/臉部身體適用)",
)
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 "nivea_creme_100ml_type_alignment" in diagnostics.reasons
assert "focused_exact_identity_nivea_creme_100ml" in diagnostics.reasons
def test_marketplace_matcher_promotes_recent_stale_recovery_single_spec_lines():
from services.marketplace_product_matcher import score_marketplace_match
cases = [
(
"【LAURA MERCIER 蘿拉蜜思】煥顏透明蜜粉29g超殺組(冠軍蜜粉/定妝散粉)",
"【Laura Mercier 蘿拉蜜思】煥顏透明蜜粉 29g 專櫃公司貨 Translucent Loose Setting Powder",
),
(
"【TS6 護一生】沁涼潔淨慕斯100g(私密清潔)",
"TS6護一生 沁涼潔淨慕斯100g",
),
(
"【Schick 舒適牌】舒綺仕女 除毛刀片 刀片3入(敏感肌)",
"【Schick 舒適牌】舒綺仕女除毛刀片(敏感肌用)3入",
),
]
for momo_name, competitor_name in cases:
diagnostics = score_marketplace_match(momo_name, competitor_name)
assert diagnostics.hard_veto is False
assert diagnostics.match_type == "exact"
assert diagnostics.price_basis == "total_price"
assert diagnostics.alert_tier == "price_alert_exact"
def test_marketplace_matcher_keeps_baby_shampoo_bath_gap_in_identity_review():
from services.marketplace_product_matcher import score_marketplace_match
diagnostics = score_marketplace_match(
"【IBL 依必朗】依必朗 Angel Baby 嬰兒 沐浴精 洗髮精 600ml",
"依必朗Angel Baby嬰兒洗髮精600ml",
)
assert diagnostics.hard_veto is False
assert diagnostics.match_type == "comparable"
assert diagnostics.price_basis == "manual_review"
assert diagnostics.alert_tier == "identity_review"
def test_marketplace_matcher_promotes_focused_lip_care_exact_lines_to_total_price():
from services.marketplace_product_matcher import score_marketplace_match

View File

@@ -137,6 +137,32 @@ def test_pchome_match_name_combines_non_duplicate_nick():
)
def test_pchome_match_name_deduplicates_normalized_nick_prefix():
from services.pchome_crawler import _build_match_name
match_name = _build_match_name(
"【Laura Mercier 蘿拉蜜思】 煥顏透明蜜粉 29g",
"【Laura Mercier 蘿拉蜜思】煥顏透明蜜粉 29g 專櫃公司貨",
)
assert match_name == "【Laura Mercier 蘿拉蜜思】煥顏透明蜜粉 29g 專櫃公司貨"
assert match_name.count("29g") == 1
def test_pchome_match_name_strips_html_marketing_noise():
from services.pchome_crawler import _build_match_name
match_name = _build_match_name(
"TS6護一生沁涼潔淨慕斯100g",
'<font color="#FF0066">★降溫限定。92%滿意★</font><br>TS6護一生 沁涼潔淨慕斯100g',
)
assert "<font" not in match_name
assert "降溫限定" not in match_name
assert match_name == "TS6護一生 沁涼潔淨慕斯100g"
assert match_name.count("100g") == 1
def test_feeder_search_cleanup_preserves_bracket_brand_and_specs():
from services.competitor_price_feeder import _clean_search_text