This commit is contained in:
@@ -1371,6 +1371,13 @@ class CompetitorPriceFeeder:
|
||||
"replace_same_identity_better_score="
|
||||
f"{existing_score:.3f}->{match_score:.3f}",
|
||||
)
|
||||
if existing_score >= match_score:
|
||||
return (
|
||||
False,
|
||||
f"existing_match_conflict;stronger_existing;existing_id={existing_id};"
|
||||
f"incoming_id={incoming_id};existing_score={existing_score:.3f};"
|
||||
f"incoming_score={match_score:.3f}",
|
||||
)
|
||||
if match_score >= REPLACE_DIFFERENT_PRODUCT_SCORE:
|
||||
return True, f"replace_high_confidence_score={match_score:.3f}"
|
||||
return (
|
||||
@@ -1937,6 +1944,35 @@ class CompetitorPriceFeeder:
|
||||
attempts_written += 1
|
||||
continue
|
||||
|
||||
attempt_status = _classify_low_score_attempt(score, diagnostics)
|
||||
if (
|
||||
attempt_status == "recoverable_low_score"
|
||||
and _has_variant_selection_gap(momo_name, [(best_product, score, diagnostics)], score)
|
||||
):
|
||||
attempt_status = "true_low_confidence"
|
||||
attempt_terms = search_terms + [term for term in recovery_terms if term not in search_terms]
|
||||
self._record_match_attempt(
|
||||
sku,
|
||||
momo_name,
|
||||
momo_product_id=momo_product_id,
|
||||
momo_price=momo_price,
|
||||
search_terms=attempt_terms,
|
||||
candidate_count=max(1, recovery_candidate_count),
|
||||
attempt_status=attempt_status,
|
||||
best_product=best_product,
|
||||
best_score=score,
|
||||
diagnostics=diagnostics,
|
||||
error_message=(
|
||||
"missing_known_product_id_fresh_search_low_confidence; "
|
||||
f"PChome product_id not returned: {competitor_product_id}; "
|
||||
f"{_format_match_diagnostics(diagnostics)}"
|
||||
),
|
||||
source=source,
|
||||
)
|
||||
skipped_low += 1
|
||||
attempts_written += 1
|
||||
continue
|
||||
|
||||
self._record_match_attempt(
|
||||
sku,
|
||||
momo_name,
|
||||
@@ -1991,17 +2027,20 @@ class CompetitorPriceFeeder:
|
||||
if score < MIN_MATCH_SCORE:
|
||||
recovery_terms: list[str] = []
|
||||
recovery_candidate_count = 0
|
||||
if not getattr(diagnostics, "hard_veto", False):
|
||||
recovered, recovery_terms, recovery_candidate_count = _recover_low_score_with_fresh_search(
|
||||
crawler,
|
||||
momo_name,
|
||||
momo_price=momo_price,
|
||||
existing_product_id=competitor_product_id,
|
||||
)
|
||||
if recovered:
|
||||
recovered_product, recovered_score, recovered_diagnostics = recovered
|
||||
if recovered_score > score:
|
||||
best_product, score, diagnostics = recovered_product, recovered_score, recovered_diagnostics
|
||||
recovered, recovery_terms, recovery_candidate_count = _recover_low_score_with_fresh_search(
|
||||
crawler,
|
||||
momo_name,
|
||||
momo_price=momo_price,
|
||||
existing_product_id=competitor_product_id,
|
||||
)
|
||||
if recovered:
|
||||
recovered_product, recovered_score, recovered_diagnostics = recovered
|
||||
if (
|
||||
recovered_score > score
|
||||
or getattr(diagnostics, "hard_veto", False)
|
||||
and not getattr(recovered_diagnostics, "hard_veto", False)
|
||||
):
|
||||
best_product, score, diagnostics = recovered_product, recovered_score, recovered_diagnostics
|
||||
|
||||
if score >= MIN_MATCH_SCORE:
|
||||
extras = ["refresh_known_identity"]
|
||||
|
||||
@@ -365,6 +365,9 @@ SEARCH_IDENTITY_ANCHORS = (
|
||||
"天然植物香氛精油",
|
||||
"爆水擦澡濕巾",
|
||||
"嬰兒潤膚乳",
|
||||
"可撕式水性兒童指甲油",
|
||||
"aroma lava 解憂放鬆緩緩燈",
|
||||
"經典款香氛蠟燭暖燈",
|
||||
"我愛超磁妝定妝噴霧",
|
||||
"全天候超完美定妝噴霧",
|
||||
"怪獸級持色唇膏",
|
||||
@@ -475,6 +478,7 @@ FOCUSED_IDENTITY_REVIEW_ONLY_REASONS = {
|
||||
"kate_monster_lipstick_catalog",
|
||||
"opi_gel_polish_series_catalog",
|
||||
"romand_juicy_lip_tint_2_catalog",
|
||||
"recipe_box_peelable_child_polish_catalog",
|
||||
"solone_longlasting_eyeliner",
|
||||
"shu_auto_hard_formula_refill_catalog",
|
||||
"summer_eve_full_skin_wash_2pack",
|
||||
@@ -497,6 +501,8 @@ FOCUSED_IDENTITY_TOTAL_PRICE_REASONS = {
|
||||
"selection1990_half_dome_wax_lamp_white",
|
||||
"selection1990_bendable_wax_lamp_white",
|
||||
"canmake_tear_bag_palette",
|
||||
"gdesign_aroma_lava_lamp_2",
|
||||
"hooome_classic_white_wax_lamp_bulbs_giftbox",
|
||||
}
|
||||
|
||||
SEARCH_BROAD_ANCHORS = {
|
||||
@@ -3512,6 +3518,38 @@ def _has_focused_low_score_exact_identity_line(left: ProductIdentity, right: Pro
|
||||
and "淚袋眼影盤" in right_text
|
||||
):
|
||||
return "canmake_tear_bag_palette"
|
||||
if (
|
||||
{"recipe", "box"} <= brand_tokens
|
||||
and "可撕式水性兒童指甲油" in left_text
|
||||
and "可撕式水性兒童指甲油" in right_text
|
||||
):
|
||||
return "recipe_box_peelable_child_polish_catalog"
|
||||
if (
|
||||
"gdesign" in (left.brand_tokens & right.brand_tokens)
|
||||
and "aroma" in left_text
|
||||
and "aroma" in right_text
|
||||
and "lava" in left_text
|
||||
and "lava" in right_text
|
||||
and "解憂放鬆緩緩燈2.0" in left_text
|
||||
and "解憂放鬆緩緩燈2.0" in right_text
|
||||
and "熔岩燈" in left_text
|
||||
and "熔岩燈" in right_text
|
||||
and "精油擴香" in left_text
|
||||
and "精油擴香" in right_text
|
||||
):
|
||||
return "gdesign_aroma_lava_lamp_2"
|
||||
if (
|
||||
"hooome" in (left.brand_tokens & right.brand_tokens)
|
||||
and "白色" in left_text
|
||||
and "白色" in right_text
|
||||
and "香氛蠟燭暖燈" in left_text
|
||||
and "香氛蠟燭暖燈" in right_text
|
||||
and "兩顆燈泡" in left_text
|
||||
and "兩顆燈泡" in right_text
|
||||
and "禮盒" in left_text
|
||||
and "禮盒" in right_text
|
||||
):
|
||||
return "hooome_classic_white_wax_lamp_bulbs_giftbox"
|
||||
return ""
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user