Yomguithereal / talisman

Straightforward fuzzy matching, information retrieval and NLP building blocks for JavaScript.
https://yomguithereal.github.io/talisman/
MIT License
704 stars 47 forks source link

bug in nysiis modified/refined algorithm #180

Closed vilchesalves closed 3 years ago

vilchesalves commented 3 years ago

Hello, everyone.

I've found a bug with the modified/refined NYSIIS algorithm. Sorry I couldn't find any guidelines for bug report, but I'll try my best to give you something useful.

Following the definition here: http://www.dropby.com/NYSIIS.html

Specifically this: image

The use case my tester found was the following: input ANANND expected ANAD actual ANAND

This can also be confirmed in talisman full docs: image

Test case:

it('converts repeated letter correctly', () => {
  const input = 'ANANND';
  const expected = 'ANAD';
  const nysiisConverted = toNysiis(input);

  expect(nysiisConverted).toBe(expected);
});

Cheers!

Yomguithereal commented 3 years ago

Hello @vilchesalves, thanks for noticing this bug, it seems I missed the "repeat this last step as necessary" bit. This should be fixed now on v1.1.4.

vilchesalves commented 3 years ago

Hello @vilchesalves, thanks for noticing this bug, it seems I missed the "repeat this last step as necessary" bit. This should be fixed now on v1.1.4.

Beautiful! Such quick action! Thank you very much. <3