
Normalizing 20,000 Components for SMT Assembly
A 10kΩ resistor has at least eight names in the wild, so a regex-driven normalization engine maps all of them to one canonical format.
- Published
- March 9, 2026
- Author
- Hrushiekesh Reddy Kanjula
- Read time
- ~4 min
- Category
- engineering

Ask five customers for a 10kΩ resistor and you get five strings: "10k Res", "Resistor 10 kilohm", "RES 10K 1%", "10000 Ohm SMD 0402", "R 10K/0.1". All five describe the same part. The machine has to place exactly one of them.
The assembly hub holds a component library of over 20,000 unique entries. This post covers the engine that normalizes them: an 18-family taxonomy, a 7-token canonical format and a four-stage pipeline. The hardest bug was idempotency.
The 18-family taxonomy
Before normalizing anything, I needed a taxonomy. I split all components into 18 family profiles: resistors, capacitors, inductors, diodes, MOSFETs, BJTs, ICs, connectors, crystals and so on. Each family has its own attributes that matter for assembly.
| Family | Attributes |
|---|---|
| Resistor | Value, Tolerance, Wattage, Package |
| Capacitor | Value, Voltage Rating, Dielectric Type, Package |
| Connector | Pin Count, Pitch, Gender |

Everything downstream depends on this. The engine's first job on any string is to classify the family. Regex patterns match known family indicators before any attribute extraction starts.
The 7-token canonical format
Every component normalizes to the same 7 tokens, whatever its family:
Type | Value | Tolerance | Wattage | Package | Voltage | Extra
Tokens that don't apply to a family get a standard null marker, not an empty string. Queries, joins and reports then work against one schema.
For a 10kΩ 1% 0.1W 0402 resistor, the canonical output is:
RES | 10K | 1% | 0.1W | 0402 | - | -
For a 100nF 10V X7R 0402 capacitor:
CAP | 100N | 10% | - | 0402 | 10V | X7R
Because of this, production reporting code never needs to know the family. It reads token[4] and gets the package size.

The four-stage pipeline
Input strings pass through four stages in order.
Stage 1: Unit standardization. Raw values arrive as 10k, 10K, 10 kilohm, 10000 or 0.01M. This layer converts resistance to a canonical SI-prefix form (10K), capacitance to picofarads for comparison, and voltage to the same scale. Idempotency failures hide here. A naive 10K → 10KOHM rule applied twice gives 10KOHMOHM. So every substitution rule uses a regex that matches only the un-normalized form. That makes repeated passes safe.
Stage 2: Family classification. Next, the string is matched against family-specific regex batteries. Resistor indicators (RES, RESISTOR, Ω, OHM) trigger the resistor extraction pipeline. Capacitor indicators trigger a different one. Unknown strings fall through to a fuzzy classification layer.
Stage 3: Attribute extraction. Within a family, targeted regex patterns pull out the attributes. Value, package, tolerance and wattage each have a dedicated extractor, with fallback patterns for unusual formats.
Stage 4: Mouser API enrichment. Some components survive extraction with incomplete attributes. This is common for custom or specialty parts. For those, the pipeline queries the Mouser Electronics API, using the manufacturer part number as the lookup key. That also adds market data: pricing, availability and lead times.

The idempotency problem
An idempotency failure is a transformation that gives wrong output when applied twice to the same string. In production, BOMs get re-imported and components get re-normalized when the library updates. If the pipeline isn't idempotent, the second run corrupts data the first run got right.
Here is a real example from the build. A rule converted "OHM" to "OHMS" for a consistent plural. On "10K OHM" it correctly gave "10K OHMS". On the second pass it gave "10K OHMSOHMS". The fix was a regex that only matches strings that don't already end in "OHMS":
# Broken — not idempotent
value = value.replace("OHM", "OHMS")
# Fixed — idempotent
import re
value = re.sub(r'OHM(?!S)', 'OHMS', value)Every substitution rule in the engine follows this pattern. The test suite runs every input through the pipeline twice and asserts identical output.
The long tail
Across 20,000 components and 18 families, the engine handles the 90% case well. The long tail is different. It includes legacy parts, custom assemblies and non-standard naming from specific manufacturers.
The engine gives components it can't classify confidently a confidence score and flags them. Flagged components go to a UI review queue, where an engineer confirms or corrects the classification. Those corrections feed back into the normalization rules, so coverage grows over time. I didn't have to list every possible input format up front.

Why it was worth building
The engine took weeks to build, and nobody sees it. Users see a clean component library and accurate production reports. But the features downstream depend on it:
- Cross-referencing AOI defect data against component specs needs normalized part numbers.
- Predicting hardware degradation needs normalized package sizes.
- Generating machine-ready CPL files needs normalized rotation data.
Bad data at the foundation corrupts every query that touches it. The 20,000-component canonical library is what the rest of the assembly hub stands on.