Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CODEC-281: Double metaphone encode kc as K #36

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sguill
Copy link

@sguill sguill commented Feb 18, 2020

Double metaphone should handle 'K' for 'kc' entries instead of 'KK'

One example is Kirkcaldy: which is presently encoded as "KRKK".

When omitting 'k' or 'c' letters (for example, Kircaldy or Kirkaldy) it is encoded as "KRKL".

The correction consists to verify when letter 'c' follows 'k', if 'c' is encoded as 'K', it is ignored as for a succession of 'kk' letters. With this correction, Kirkcaldy would be encoded as "KRKL" which is more discriminant and compliant with the phonetic.

@coveralls
Copy link

coveralls commented Feb 18, 2020

Coverage Status

Coverage increased (+0.01%) to 93.853% when pulling eb9ca3d on sguill:CODEC-281-DoubleMetaphoneKC into 126f904 on apache:master.

@Ben-Waters
Copy link

Ben-Waters commented Jun 28, 2023

Having a look, I found what I believe to be the vanilla version of the algorithm from its author.

case 'K':
        if(GetAt(current + 1) == 'K')
                current += 2;
        else
                current += 1;
        MetaphAdd("K");
        break;

It doesn't appear to do the additional check to handle 'c' to me. Is this an improvement outside of the official algorithm or is there a source for this change?

@garydgregory garydgregory changed the title CODEC-281: encode kc as K CODEC-281: Double metaphone encode kc as K Feb 19, 2024
@garydgregory
Copy link
Member

@sguill
Would you please reply to @Ben-Waters's question?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants