-
-
Notifications
You must be signed in to change notification settings - Fork 406
Use edit-distance to fix typos in cabal fields #4722
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
base: master
Are you sure you want to change the base?
Use edit-distance to fix typos in cabal fields #4722
Conversation
3c4d9d8
to
53bf792
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for taking care of this!
|
||
library | ||
qqjfault-lang: Haskell2010 | ||
-- Import isn't supported right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outdated comment
@@ -18,6 +18,8 @@ import Prelude hiding (filter) | |||
data Scored a = Scored {score :: !Int, original:: !a} | |||
deriving (Functor, Show) | |||
|
|||
newtype Matcher a = Matcher { runMatcher :: T.Text -> [T.Text] -> [Scored a] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a comment would not hurt for why we have this :)
Perhaps all fuzzy filters should return this interface? As is, this type is only used in the cabal-plugin, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a comment would not hurt for why we have this :)
Will do.
Perhaps all fuzzy filters should return this interface? As is, this type is only used in the cabal-plugin, right?
Interesting thought. It currently is indeed yes. I'll try changing the fuzzy functions to have it and check if it's better, otherwise I'll move it to the cabal-plugin
, as I just added it to not have a bare function type in CompleterData
.
Closes #4357.
This adds a pretty simple function for calculating the edit distance between two strings and uses it to score suggestions in completion lists. Some
Matcher
that's used in scoring texts intoCompleterData
. Couldn't really massage that into theweightedConstantCompleter
that's used for licenses.