did_you_mean icon indicating copy to clipboard operation
did_you_mean copied to clipboard

Suggestion not provided if the word to check ends up with a number

Open coorasse opened this issue 5 years ago • 1 comments

sc = DidYouMean::SpellChecker.new(dictionary: [:emailaddress3])

sc.correct('emailAddress')
=> [:emailaddress3]

sc.correct('emailAddresseswe')
=> [:emailaddress3]

sc.correct('emailAddress3')
=> []

I'd expect did_you_mean to be able to suggest emailaddress3 for emailAddress3

coorasse avatar Oct 20 '20 14:10 coorasse

I think it's not about the number at the end. It seems that a suggestion is not provided if you try to correct a correct word (i.e. one that is in the dictionary). Take a look:

sc = DidYouMean::SpellChecker.new(dictionary: [:emailaddress])
# => #<DidYouMean::SpellChecker:0x000055eafbd4cb00 @dictionary=[:emailaddress]>
sc.correct('emailAddress')
# => []
sc.correct('emailAddres')
# => [:emailaddress]

mrzasa avatar Aug 12 '22 12:08 mrzasa

Apologies for way overdue reply here. @mrzasa is right, the exact match is intentionally excluded and this is working as expected. Please let me know if you think suggesting the exact match would he helpful.

yuki24 avatar Jan 01 '23 10:01 yuki24