← back to Rentv 2026
pr/normalize: Cody gate — anchor the N.A.-suffix strip to END-OF-STRING ($), not \\b. The \\b form fired at position 0 / after a hyphen too, wrongly collapsing PREFIX/MID uses ('N.A. Williams'→'williams', 'Corp N.A. Trust'→'trust') into false AUTO-merges (data loss — worse than the dedup miss). Now only a trailing N.A. is stripped: 4 suffix forms dedup, 3 prefix/mid cases stay distinct
ecc4c6ce9b1feefd4f9a1f4b4718b0129804da81 · 2026-08-05 19:30:17 -0700 · Steve
Files touched
M src/pr/lib/normalize.js
Diff
commit ecc4c6ce9b1feefd4f9a1f4b4718b0129804da81
Author: Steve <steve@designerwallcoverings.com>
Date: Wed Aug 5 19:30:17 2026 -0700
pr/normalize: Cody gate — anchor the N.A.-suffix strip to END-OF-STRING ($), not \\b. The \\b form fired at position 0 / after a hyphen too, wrongly collapsing PREFIX/MID uses ('N.A. Williams'→'williams', 'Corp N.A. Trust'→'trust') into false AUTO-merges (data loss — worse than the dedup miss). Now only a trailing N.A. is stripped: 4 suffix forms dedup, 3 prefix/mid cases stay distinct
---
src/pr/lib/normalize.js | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/pr/lib/normalize.js b/src/pr/lib/normalize.js
index 4e565cd4..d755dc9f 100644
--- a/src/pr/lib/normalize.js
+++ b/src/pr/lib/normalize.js
@@ -11,11 +11,13 @@ 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 ')
+ // "N.A." (National Association) is a bank charter suffix that ALWAYS trails the name; once
+ // punctuation is stripped it tokenizes to stray "n a", defeating the 'na' stopword, so
+ // "First National Bank, N.A." failed to dedup against "First National Bank". Strip the dotted
+ // suffix at END-OF-STRING only. Anchoring to $ (not \b) is essential: \b also fires at
+ // position 0 / after a hyphen, which would wrongly collapse PREFIX/MID uses ("N.A. Williams"
+ // → "williams", "CBRE-N.A." → "cbre") and cause false AUTO-merges (Cody gate).
+ .replace(/,?\s*\bn\.\s?a\.?\s*$/gi, '')
.replace(/&/g, ' and ')
.replace(/[^a-z0-9\s]/g, ' ')
.split(/\s+/)
← 6c77b91a pr/normalize: fix dedup miss on dotted bank 'N.A.' suffix —
·
back to Rentv 2026
·
auto-save: 2026-08-05T19:45:13 (7 files) — data/deals-regist bbcd07e6 →