Skip to content

TreeSpellChecker: cases where it doesn't work as expected? #166

Description

@pudiva

I've just started playing with TreeSpellChecker and found a couple of cases where it doesn't give me the corrections I would expect.

If I run this script in ruby-3.0.3:

#!/usr/bin/env ruby
require 'set'

paths = [
  "dir/typo",
  "typo",
]
sc = DidYouMean::TreeSpellChecker.new(dictionary: paths)
puts "*** none slashed:"
puts sc.correct("tyop")

paths = [
  "dir/typo",
  "typo",
]
sc = DidYouMean::TreeSpellChecker.new(dictionary: paths)
puts "*** query slashed:"
puts sc.correct("/tyop")

paths = [
  "dir/typo",
  "/typo",
]
sc = DidYouMean::TreeSpellChecker.new(dictionary: paths)
puts "*** dict slashed:"
puts sc.correct("tyop")

paths = [
  "dir/typo",
  "/typo",
]
sc = DidYouMean::TreeSpellChecker.new(dictionary: paths)
puts "*** both slashed:"
puts sc.correct("/tyop")

I get this output:

*** none slashed:
*** query slashed:
dir/typo
*** dict slashed:
*** both slashed:
/typo

And I think in all the cases, the second path on the list (either typo or /typo) should be suggested.

What do you think? ✨✨✨
cc @yuki24

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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