commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <>
Subject [jira] Commented: (CODEC-57) Metaphone.metaphone(String) returns an empty string when passed the word "why".
Date Mon, 10 Mar 2008 01:29:46 GMT


Henri Yandell commented on CODEC-57:

It's a bug in the algorithm.

The problem with both fixes is in the other words they affect.

So PHP makes WHY->H and affects things like WHAT being HT and not WT.
My suggestion makes WHY->Y, and changes WHYTE from T to WT. 

PHP change all 'WH' from W to H. Mine only affects WH?Y and the result is to make the W more
sticky. I think mine's going to affect a lot less words (so better for backwards compat) and
also more correct as it creates better looking tokens, but I'm hardly an expert at any of
this.  It's entirely possible that an empty String is intended to be an acceptable Soundex.

Or the best solution might be to, if the metaphone is an empty String; simply return the first
character of the input. 

> Metaphone.metaphone(String) returns an empty string when passed the word "why".
> -------------------------------------------------------------------------------
>                 Key: CODEC-57
>                 URL:
>             Project: Commons Codec
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: Commons-codec built from source using jdk 1.4.2.
> OS: Windows XP
> Java Build: 1.4.2
>            Reporter: Adam Wilmore
>             Fix For: 1.4
> An empty string is returned from the Metaphone.metaphone(String) method when passed the
value "why". Variations on the value, such as "wwwhy" and "wwhhhy" also return empty strings.
> This appears to be an issue since other implementations of the metaphone algorithm, namely
the PHP version, returns "H" when passed the value "why".

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message