Skip to content
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
This repository was archived by the owner on Nov 19, 2020. It is now read-only.

Bug Found in Accord.Math.Distance.Levenshtein #232

@LSGOMYP

Description

@LSGOMYP

I found a bug in Accord.Math.Distance.Levenshtein

the if statement

        public static double Levenshtein(string x, string y)
        {
            if (x == null || x.Length == 0)
            {
                if (y == null || y.Length != 0)
                    return 0;
                return y.Length;
            }
            else
            {
                if (y == null || y.Length == 0)
                    return x.Length;
            }

in my opinion that the if statement may be like the fowllowing statement

       public static double Levenshtein(string x, string y)
        {
            if (x == null || x.Length == 0)
            {
                if (y == null || y.Length == 0)
                    return 0;
                return y.Length;
            }
            else
            {
                if (y == null || y.Length == 0)
                    return x.Length;
            }

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