GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [CODEC-249] Fix Incorrect transform of CH digraph according Metaphone basic rules by Shalujha0907 · Pull Request #423 · apache/commons-codec

Conversation

@Shalujha0907

@Shalujha0907 Shalujha0907 commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Incorrect transformation of the CH digraph in the Metaphone algorithm

This PR fixes the above issue.

Previously, we checked whether the character following CH was a vowel; if so, we appended the character "K". I have removed that check so that when "CH" is encountered, the algorithm simply appends "X".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Shalujha0907
[CODEC-249] Fix Incorrect transform of CH digraph according Metaphone…
82af962
… basic rules
@garydgregory

garydgregory commented Feb 12, 2026

Copy link
Copy Markdown
Member

Hello @Shalujha0907

Thank you for the PR!

I see this PR changes the expectation for CHARACTER from KRKT to XRKT, but isn't the correct value XRKTR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jhaShalu

jhaShalu commented Feb 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Hello @Shalujha0907

Thank you for the PR!

I see this PR changes the expectation for CHARACTER from KRKT to XRKT, but isn't the correct value XRKTR?

Hello @garydgregory

Thanks for the review and for calling this out.

XRKTR is the full phonetic sequence, but Metaphone in Commons Codec uses a default maxCodeLen of 4, so the returned value is truncated to XRKT.
That’s why this test expects XRKT (and not XRKTR) unless setMaxCodeLen(...) is increased.

Please let me know if you think we should also add a separate assertion with a higher maxCodeLen to make that behavior explicit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@garydgregory

garydgregory commented Feb 12, 2026

Copy link
Copy Markdown
Member

Hi @Shalujha0907
Ah, yes, you're right 👍
Would you please mind adding a new test for this specific 5 char use case?
Ty!

jhaShalu reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Shalujha0907
[CODEC-249] Add. test for Metaphone CH character translation with max…
a546baa
… code length of 5
@jhaShalu

jhaShalu commented Feb 12, 2026

Copy link
Copy Markdown

5 cha

Hi @Shalujha0907 Ah, yes, you're right 👍 Would you please mind adding a new test for this specific 5 char use case? Ty!

Hi @garydgregory
Pushed the latest change.

Thank you!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@garydgregory
Remove blank lines.
d001404
@garydgregory
garydgregory merged commit e352a9b into apache:master Feb 12, 2026
garydgregory added a commit that referenced this pull request Feb 12, 2026
@garydgregory
[CODEC-249] Fix Incorrect transform of CH digraph according Metaphone
d809fb9
basic rules #423.
@garydgregory

garydgregory commented Feb 12, 2026

Copy link
Copy Markdown
Member

Jira ticket is https://issues.apache.org/jira/browse/CODEC-249

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

garydgregory added a commit that referenced this pull request Feb 12, 2026
@garydgregory
[CODEC-249] Fix Incorrect transform of CH digraph according Metaphone
cb09b7a
basic rules #423.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Shalujha0907 @garydgregory @jhaShalu
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.