Skip to content

Domain Packs

bsevern edited this page Apr 6, 2026 · 1 revision

Domain Packs

GoldenMatch includes 7 built-in YAML rulebooks that extract structured fields from unstructured product descriptions and other domain-specific text.

Using domain packs

Auto-detection

import goldenmatch as gm

rulebooks = gm.discover_rulebooks()  # Returns all 7 packs
print(list(rulebooks.keys()))
# ['electronics', 'software', 'healthcare', 'financial', 'real_estate', 'people', 'retail']

Extract fields

import goldenmatch as gm

rulebooks = gm.discover_rulebooks()
enhanced_df, low_confidence = gm.extract_with_rulebook(df, "title", rulebooks["electronics"])

# enhanced_df has new columns: __brand__, __model__, __sku__, etc.
# low_confidence contains records where extraction confidence was low

Auto-detect domain

domain = gm.match_domain(df, "description")
# Returns "electronics", "software", etc., or None

Electronics pack

Extracts brand, model number, SKU, color, and technical specs from product titles.

"Samsung Galaxy S24 Ultra 256GB Titanium Black SM-S928B"
  -> brand: Samsung
  -> model: Galaxy S24 Ultra
  -> sku: SM-S928B
  -> color: Titanium Black
  -> specs: 256GB

Model normalization strips hyphens, region suffixes, and color suffixes for better matching.

Healthcare pack

Extracts medical identifiers with contextual prefix requirements (e.g., NPI:, CPT:) to avoid false positives on generic numbers.

"Provider NPI:1234567890, CPT:99213 Office Visit"
  -> npi: 1234567890
  -> cpt_code: 99213

Custom domain packs

Create your own YAML rulebook and place it in one of the search paths:

Path Scope
.goldenmatch/domains/ Project-local
~/.goldenmatch/domains/ Global (user)
goldenmatch/domains/ Built-in (read-only)

Rulebook YAML format

# .goldenmatch/domains/my_domain.yaml
name: my_domain
description: Custom domain for matching widgets
signals:
  - pattern: "widget"
    weight: 1.0
  - pattern: "part_?number"
    weight: 0.8
extractors:
  - name: part_number
    pattern: "PN[:-]?\\s*(\\w{6,12})"
    group: 1
  - name: manufacturer
    pattern: "(Acme|Globex|Initech)"
    group: 1
normalizers:
  part_number:
    strip_chars: "-"
    uppercase: true

Create via Python

import goldenmatch as gm

gm.save_rulebook("my_domain", rulebook)
loaded = gm.load_rulebook("my_domain")

Create via MCP

The MCP server provides tools for domain management:

Tool Description
list_domains List all available domain packs
create_domain Create a new custom domain pack
test_domain Test a domain pack against sample data

Benchmarks

Domain extraction significantly improves product matching:

Dataset Without Domain With Domain Improvement
Abt-Buy (electronics) 44.5% F1 72.2% F1 +27.7pp
Amazon-Google (software) 45.3% F1 42.1% F1 -3.2pp

Domain extraction helps datasets with structured identifiers (brand, model, SKU) but can hurt datasets with unstructured descriptions. For software matching, clean embedding + ANN pipelines perform better.

GoldenMatch

PyPI npm

🟡 Golden Suite (Monorepo)

Suite Packages

Getting Started

Core Concepts

AI Integration

Advanced

Reference


pip install goldenmatch
npm install goldenmatch

Clone this wiki locally