2023-06-23 13:25:42+00:00

When aggregating catalog data from multiple suppliers, data inconsistency is a major challenge. Different distributors write manufacturer names differently. For instance, Hirose Electric is written as HRS, Hirose, HIROSE ELECTRIC, or Hirose (HRS). If not normalized, your storefront facets will show 5 different filters for the same manufacturer.

To clean up this data, we build a Manufacturer Normalization Engine using mapping tables and string similarity algorithms.


1. Creating the Canonical Mapping Table

We define a dictionary mapping common spelling variations to a single, canonical manufacturer name:

MANUFACTURER_MAP = {
    "hrs": "Hirose",
    "hirose": "Hirose",
    "hirose electric": "Hirose",
    "hirose(hrs)": "Hirose",
    "ti": "Texas Instruments",
    "texas inst": "Texas Instruments",
    "stmicro": "STMicroelectronics",
    "st microelectronics": "STMicroelectronics"
}

def normalize_manufacturer(name: str) -> str:
    if not name:
        return "Unknown"
    clean_name = name.strip().lower()
    return MANUFACTURER_MAP.get(clean_name, name.title())

2. Fuzzy String Fallback

If a new variation is encountered that is not in our dictionary, we can fall back to fuzzy string matching (using libraries like rapidfuzz or Python's built-in difflib). If a spelling is a 90%+ match to an existing canonical name, we map it automatically, flag it for manual review, and log the change.

Applying this normalization during the ingestion phase ensures search index cleanliness and consistent navigation filters.

Canonical Alias Lookup Tables + Trigram Similarity Thresholds

Pair a deterministic alias lookup dictionary (mapping HRS → Hirose Electric) with PostgreSQL pg_trgm similarity scoring for previously unseen vendor abbreviations.


About the Author — Hire Freelance Programmer Aldian Fazrihady

Aldian Fazrihady is a Top-Rated Senior Freelance Programmer, Freelance Full Stack Developer, and AI Application Engineer with 15+ years of production software engineering experience and Google Cloud Professional Cloud Architect & Data Engineer certifications. He specializes in building custom LLM & autonomous AI agents, RAG pipelines, Next.js/React PWAs, Python (Django/FastAPI), Go microservices, and serverless cloud infrastructure on Google Cloud Run and AWS.

Hire Aldian Fazrihady on Upwork | Book 1-Day Programming Service ($100 USD via Polar) | View Live AI Portfolio | Portfolio Directory | Send a Direct Message

Related Engineering Articles

Freelance Programmer Specializations & Category Hubs