[object Object]

← back to Rentv 2026

pr/normalize: fix dedup miss on dotted bank 'N.A.' suffix — the 'na'/'n.a' ORG_STOPWORDS were unreachable (punctuation stripped to spaces before the filter), so 'First National Bank, N.A.' normalized to '...bank n a' and failed to dedup against 'First National Bank'. Fold the dotted N.A. form to a bare 'na' token first (leading \\b avoids matching 'national'/'john.adams'); verified 4 dotted/spaced forms now dedup, Nationwide/Santa Ana/distinct-banks unaffected

6c77b91a0fbbbbc67af33ff48c7c6d2ed4a7e311 · 2026-08-05 19:24:57 -0700 · Steve

Files touched

Diff

commit 6c77b91a0fbbbbc67af33ff48c7c6d2ed4a7e311
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed Aug 5 19:24:57 2026 -0700

    pr/normalize: fix dedup miss on dotted bank 'N.A.' suffix — the 'na'/'n.a' ORG_STOPWORDS were unreachable (punctuation stripped to spaces before the filter), so 'First National Bank, N.A.' normalized to '...bank n a' and failed to dedup against 'First National Bank'. Fold the dotted N.A. form to a bare 'na' token first (leading \\b avoids matching 'national'/'john.adams'); verified 4 dotted/spaced forms now dedup, Nationwide/Santa Ana/distinct-banks unaffected
---
 src/pr/lib/normalize.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/pr/lib/normalize.js b/src/pr/lib/normalize.js
index 31b09a7e..4e565cd4 100644
--- a/src/pr/lib/normalize.js
+++ b/src/pr/lib/normalize.js
@@ -11,6 +11,11 @@ const ORG_STOPWORDS = new Set([
 function normalizeOrgName(name) {
   return String(name || '')
     .toLowerCase()
+    // "N.A." (National Association — a bank charter suffix) tokenizes to stray "n a" once
+    // punctuation is stripped, defeating the 'na' stopword. Fold the DOTTED form to a bare "na"
+    // token first so it dedups: "First National Bank, N.A." === "First National Bank". The leading
+    // \b + required "n." keep it from matching mid-word ("national", "john.adams").
+    .replace(/\bn\.\s?a\.?/gi, ' na ')
     .replace(/&/g, ' and ')
     .replace(/[^a-z0-9\s]/g, ' ')
     .split(/\s+/)

← fd31c4e6 auto-save: 2026-08-05T19:14:58 (7 files) — data/deals-regist  ·  back to Rentv 2026  ·  pr/normalize: Cody gate — anchor the N.A.-suffix strip to EN ecc4c6ce →