Closed den1k closed 1 year ago
I would think it make sense to return nil
, since Clojure people are used to do nil-punning, so get-x
return nil
when x
doesn't exist. Return something else would be surprising?
Okay, should and empty string ""
then also return nil
?
I think so?
the issue is that the code tries to call
.getSuggestion
onnil
https://github.com/juji-io/symspell-clj/blob/main/src/symspell_clj/core.clj#L126-L129
https://github.com/juji-io/symspell-clj/blob/main/src/symspell_clj/core.clj#L108-L110
I was working on a fix but then realized I'm not sure what the API should be. When no suggestion could be found, should
get-suggestion
return the original input ornil
or""
? If it should return nil, then an""
should probably as well. Currently:(sp/get-suggestion checker "") => ""
Here's a tweak of spell-check that returns the original input: