fix(canonical-lexicon): MB katalog-kodu regex'ini çıplak-koda sabitle
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled

^[cd]\d{3,} fazla genişti — "D765300(22H), LS 7 F, MB SERVO DİREKSİYON" gibi
parça bilgisi taşıyan düğümleri yapısal yapıp Direksiyon eşleşmesini bozuyordu
(Mercedes ham kapsama %79→%49). $ ile sabitle → sadece çıplak kod (C442,
C105011). Açıklamalı düğümler keyword'le eşleşmeye devam eder. 19/19 test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-05 11:08:47 +03:00
parent 25cf0fa670
commit f1f36d8cf1
2 changed files with 8 additions and 7 deletions

View File

@@ -14,13 +14,13 @@ describe("classifyNode", () => {
expect(classifyNode("astra-h 2004 - 2014")).toBe("structural");
});
it("flags Mercedes catalog codes structural and index pages junk", () => {
expect(classifyNode("c371211 - 1817 k/4x2/36 mbt")).toBe("structural");
it("flags bare Mercedes catalog codes structural and index pages junk", () => {
expect(classifyNode("c442")).toBe("structural");
expect(classifyNode("d308802(811), 308, cowl")).toBe("structural");
expect(classifyNode("c105011")).toBe("structural");
expect(classifyNode("sa listesi")).toBe("junk");
expect(classifyNode("ilk on resim aciklama sayfasi")).toBe("junk");
// regression: real parts starting with c/d stay part (no digits after)
// descriptor codes that carry a part word must stay part (map via keyword)
expect(classifyNode("d765300(22h), ls 7 f, mb servo direksiyon")).toBe("part");
expect(classifyNode("conta takimi")).toBe("part");
expect(classifyNode("debriyaj balatasi")).toBe("part");
});

View File

@@ -204,9 +204,10 @@ const YEAR_RANGE_ONLY = /^\D*(19|20)\d{2}\s*-\s*(19|20)\d{2}\D*$/;
const YEAR_RANGE_ANY = /\b(19|20)\d{2}\s*-\s*(19|20)\d{2}\b/;
// Bare engine/order code like "z16dt", "z16dt[lfu]" — a single token with digits.
const CODE_TOKEN = /^[a-z]{1,3}\d{1,3}[a-z]{0,4}(\[[a-z]+\])?$/;
// Mercedes catalog/variant descriptors: "C371211 - 1817 K/4X2…", "C442",
// "D308802(811), 308, COWL" — model/vehicle selectors, not part categories.
const MB_CATALOG_CODE = /^[cd]\d{3,}/;
// Mercedes BARE catalog codes only ("C442", "C105011"). Anchored so descriptor
// nodes that also carry a part name ("D765300(22H), LS 7 F, MB SERVO DİREKSİYON"
// → direksiyon) still map via keyword instead of being wrongly dropped.
const MB_CATALOG_CODE = /^[cd]\d{3,}$/;
const DOC_JUNK = new Set(["teknik literatur talimatlar", "aletler", "kargo tahditi", "kriko alet"]);
// Catalog index/meta pages (Mercedes "SA LİSTESİ", "…resim açıklama sayfası").
const DOC_PAGE = /resim aciklama|^sa listesi$/;