Skip to content

fix: ignore H and W between SoundEx consonants - #807

Open
xiaoyao-666-coder wants to merge 1 commit into
NaturalNode:masterfrom
xiaoyao-666-coder:fix/soundex-hw-separators
Open

xiaoyao-666-coder wants to merge 1 commit into
NaturalNode:masterfrom
xiaoyao-666-coder:fix/soundex-hw-separators

Conversation

@xiaoyao-666-coder

@xiaoyao-666-coder xiaoyao-666-coder commented Nov 13, 2026 •

Copy link
Copy Markdown

new SoundEx().process('Ashcraft') currently returns A226 instead of A261. H and W incorrectly separate consonants with the same code, so the S and C are both encoded. The National Archives Soundex rules explicitly use Ashcraft to illustrate this case.

Remove H and W from the input after its first character before collapsing repeated codes. This also handles duplicate initial consonant sounds across H/W. Vowels still separate consonants, and an initial H or W is preserved.

Add 10 Jasmine specs covering Ashcraft/Ashcroft, all six consonant groups, repeated H/W, vowels, initial H/W, comparisons, and extended codes. The new suite had 8 failures against the unmodified source and passes after the fix.

Validation on Node 24.22.1:

  • npm run build:tests
  • Focused SoundEx suite: 30 specs, 0 failures
  • npm test: 908 specs, 0 failures
  • npm run lint
  • Standard JS and focused jscpd check for soundex.js
  • npm run build:esm and npm run smoke:esm
  • git diff --check

The database-backed I/O suite was not run. Companion documentation is submitted separately against gh-pages in #808, as requested by CONTRIBUTING.md.

Prepared with Codex assistance.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant