words / double-metaphone

Fast Double Metaphone algorithm

Home Page:https://words.github.io/double-metaphone/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong codes being generated

andreialecu opened this issue · comments

I've been troubleshooting some issues with text matching in something I'm working on and realized that this library generates wrong codes.

For example alexander should encode to ALKS but this library encodes it as ALNTR. Also aleksander encodes to ALKSNTR. Matching is pretty much impaired by this.

Is this expected with this implementation?

commented

For example alexander should encode to ALKS but this library encodes it as ALNTR. Also aleksander encodes to ALKSNTR. Matching is pretty much impaired by this.

Do you have a source for this?

@wooorm Sorry, didn't see this.

The source is pretty much every other double-metaphone implementation that I have come across.

Also, I think that strings like alexander and aleksander should generate the same codes, otherwise phonetic matching would be pointless.

Here's what natural generates: https://runkit.com/58136f736c8dfa00144f2065/581b19b0bf25ea001464b5fc

The two match.

And here's what this package outputs:
https://runkit.com/58136f736c8dfa00144f2065/581b1a8b5f41420013e08436