New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use `did_you_mean` spell checker for option suggestions #32289

Merged
merged 1 commit into from Mar 29, 2018

Conversation

Projects
None yet
5 participants
@gsamokovarov
Contributor

gsamokovarov commented Mar 19, 2018

Now that we require Ruby over 2.3, we can replace the current
suggestion methods we have with tooling from the did_you_mean gem.

There is a small user-visible change and this is that we now offer a
single suggestion for misspelled options. We are suggesting fixes during
generator invocation and in a mistyped rails server rack handler. In
both cases, if we don't make a proper prediction on the first match, we
won't do so in the second or third one, so in my mind, this is okay.

@rails-bot

This comment has been minimized.

rails-bot commented Mar 19, 2018

r? @kamipo

(@rails-bot has picked a reviewer for you, use r? to override)

Use `did_you_mean` spell checker for option suggestions
Now that we require Ruby over `2.3`, we can replace the current
suggestion methods we have with tooling from the `did_you_mean` gem.

There is a small user visible change and this is that we now offer a
single suggestion for misspelled options. We are suggesting fixes during
generator invocation and during a mistyped rails server rack handler. In
both cases, if we don't make a proper prediction on the first match, we
won't do so in the second or third one, so in my mind, this is okay.

@gsamokovarov gsamokovarov changed the title from Use DidYouMean::Levenshtein.distance in our own Spellchecker to Use `did_you_mean` spell checker for option suggestions Mar 23, 2018

@gsamokovarov

This comment has been minimized.

Contributor

gsamokovarov commented Mar 23, 2018

r? @kaspth

@rails-bot rails-bot assigned kaspth and unassigned kamipo Mar 23, 2018

@guilleiguaran guilleiguaran merged commit 480595e into rails:master Mar 29, 2018

2 checks passed

codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@gsamokovarov gsamokovarov deleted the gsamokovarov:did-you-mean-suggestions branch Mar 29, 2018

utilum added a commit to utilum/rails that referenced this pull request May 1, 2018

Partly revert rails#32289 to provide Rails' custom fallback in case
`DidYouMean::SpellChecker` is not defined.
`did_you_mean` is bundled in Ruby but can be uninstalled, and is not always
available, sometimes even on our CI:

https://travis-ci.org/rails/rails/jobs/372638523#L2405
https://travis-ci.org/rails/rails/jobs/372638523#L2416
https://travis-ci.org/rails/rails/jobs/372638523#L2427
...

rafaelfranca added a commit that referenced this pull request May 1, 2018

Merge pull request #32781 from utilum/retry_did_you_mean
Partly revert #32289 to provide Rails' custom fallback in case did_you_mean is not available

y-yagi added a commit that referenced this pull request Jun 3, 2018

Remove unnecessary test
Since #32289, `Spellchecker.suggest` returns only one value, multiple
suggestions not output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment