The intern() method is never applied to variable "word", which is passed directly into the suggestSimilar(...) method from user code. So in this case, it appears that my fix is necessary.

Michael H

Dave Kor wrote:
I am not sure about that particular piece of code, but Lucene always
use interned strings, which makes string compares a straightforward
and very fast "==" object reference comparison operation rather than
the use the slow equals() character by character compare function.

If spellchecker's strings all use intern() strings, then using
equals() will simply slow the spell checker's performance without
fixing any bugs.  (Of course, I could be totally wrong too)

On 1/29/06, Michael Harhen <[EMAIL PROTECTED]> wrote:
While debugging a Lucene application using the Sandbox SpellChecker, I
have identified a problem with SpellChecker's suggestSimilar(...) method.

Lines 175-177 are currently:
            if (sugword.string==word) {
                continue; // don't suggest a word for itself, that would
be silly
            }

I believe that "==" should be replaced by equals(), so the code should read:
            if (sugword.string.equals(word)) {
                continue; // don't suggest a word for itself, that would
be silly
            }

I cannot think of any case where using "==" would give the expected
result. Also, making the change eliminated my bug!

What is the procedure to get this fix incorporated in the Sandbox?

Regards
Michael H



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Dave Kor, Research Assistant
Center for Information Mining and Extraction
School of Computing
National University of Singapore.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to