Giter Site home page Giter Site logo

Comments (4)

mhuerster avatar mhuerster commented on June 20, 2024 1

Thanks for responding, @Yomguithereal. I think either of those is reasonable. As a user, I'd expect consistency with the other functions exposed in clj-fuzzy.metrics, most (though not all) of which seem to treat nil as the empty string:

(use '[clj-fuzzy.metrics])
(levenshtein nil nil) ; => 0
(levenshtein "" "")   ; => 0

(dice nil nil) ; => 1.0
(dice "" "")   ; => 1.0

(sorensen nil nil) ; => 1.0
(sorensen "" "")   ; => 1.0

(mra-comparison nil nil) ; => NullPointerException
(mra-comparison "" "")   ; => {:minimum 5, :similarity 6, :codex ["" ""], :match true}

(jaccard nil nil) ; => ArithmeticException Divide by zero
(jaccard "" "")   ; => ArithmeticException Divide by zero

(hamming nil nil)  ; => 0
(hamming "" "")    ; => 0

(jaro nil nil) ; => 0
(jaro "" "")   ; => 0

(tversky nil nil) ; => ArithmeticException Divide by zero
(tversky "" "")   ; => ArithmeticException Divide by zero

from clj-fuzzy.

Yomguithereal avatar Yomguithereal commented on June 20, 2024

Hello @mhuerster. I guess it's not. Do you think it should throw or do you think it should return 1? Broadly speaking, should nil be considered as an empty string or should we refuse to take it as a valid argument?

from clj-fuzzy.

Yomguithereal avatar Yomguithereal commented on June 20, 2024

Consistency would be good indeed. I don't have much time right now to dedicate to this issue but I'll gladly accept a pull request.

from clj-fuzzy.

mhuerster avatar mhuerster commented on June 20, 2024

Great, thanks! I'll take a stab at it if I have some free time this/next week.

from clj-fuzzy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.