Skip to content

incorrect if logic in Speller.replaceRunOnWords()? #96

@danielnaber

Description

@danielnaber

This looks wrong, it uses getOutputConversionPairs() if it's empty, shouldn't it be the other way round?

if (!dictionaryMetadata.getOutputConversionPairs().isEmpty()) {
candidates.add(firstCh + " " + original.subSequence(i, original.length()));
} else {
candidates.add(DictionaryLookup.applyReplacements(firstCh + " " + original.subSequence(i, original.length()),
dictionaryMetadata.getOutputConversionPairs()).toString());
}

I'm not sure if applyReplacements() makes sense at all. We've just checked that both parts are in the dictionary, should replacements still be applied? The if isn't tested, remove it and testRunonWords() still works.

Ping @milekpl, seems this was originally your code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions