Michael Ohlrogge added the comment:
This is my first time posting here, so apologies if I'm breaking rules.
I'd like to put in a vote in favor of this patch to get the matching scores.
I am a researcher at Stanford University using this tool to match up about
100,000 different names of
Michael Ohlrogge added the comment:
Another way the scores could be useful would be to write an algorithm that
would give you a number of possible answers based on the scores that you get.
In other words, for example, perhaps if one of the possible matches has a score
about .9, then it would
Zachary Ware added the comment:
Absent Tim's satisfaction regarding a use-case, I'm closing the issue.
Russell, if you do package this up for pypi and it does become popular (for
some definition of 'popular' :), feel free to reopen this issue or open a new
one.
--
resolution: -
Russell Ballestrini added the comment:
Adding patch to update tests to use Tim Peters suggestion of assertListEqual
over assertEqual for list compares.
--
Added file:
http://bugs.python.org/file35040/diff-lib-tim-peters-assert-list-equals.patch
___
Tim Peters added the comment:
Russell, I'm still looking for a sufficiently compelling use case here:
something tangible and useful that can be done with the new function that can't
be easily done now.
I plan to write a web API that accepts a word, 'doge' and returns a list of
possible
Russell Ballestrini added the comment:
Tim,
You bring up some great points and insight I was missing.
To me the scores just aren't interesting beyond which words' scores exceed a
cutoff, and the ordering of words based on their similarity scores - but
`get_close_matches()` already captures
New submission from Russell Ballestrini:
The current implementation of difflib's get_close_matches() function computes
computationally complex scores (ratios) but then tosses them out without giving
the end-user the chance to have at them.
This patch adds an optional scores boolean argument
Changes by Russell Ballestrini russell.ballestr...@gmail.com:
Removed file: http://bugs.python.org/file35022/difflib.py
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21344
___
Changes by Russell Ballestrini russell.ballestr...@gmail.com:
--
keywords: +patch
Added file:
http://bugs.python.org/file35023/difflib-patch-to-save-scores-in-get-close-matches.patch
___
Python tracker rep...@bugs.python.org
Claudiu.Popa added the comment:
It would be easier to review your patch if you'll upload it as a proper patch.
Usually for these cases (modifying the return by passing a specific argument)
it's best to provide a new function with this functionality, by having
get_close_matches and
Claudiu.Popa added the comment:
Ah, nevermind my first comment.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21344
___
___
Python-bugs-list
Russell Ballestrini added the comment:
Claudiu.Popa,
Yes, that was my first idea on how to tackle this issue.
I will create another proper patch that prepares two separate functions:
* get_close_matches
* get_scored_close_matches
Where each are basically wrapper / API functions around a
Russell Ballestrini added the comment:
New function in difflib: get_scored_matches()
This function acts just like the existing get_close_matches()
function however instead of returning a list of words, it
returns a list of tuples (score, word) pairs.
This gives the end-user the ability to
Claudiu.Popa added the comment:
Your patch needs tests and documentation update. For examples, you could look
in test_difflib.py and see how get_close_matches is tested.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21344
Russell Ballestrini added the comment:
get_close_matches() doesn't seem to have any tests... I suppose I should write
them considering I'm changing the functionality a bit.
TODO: write tests for
* difflib.get_close_matches()
* difflib.get_scored_matches()
Determine if docstrings are
Changes by Zachary Ware zachary.w...@gmail.com:
--
stage: - patch review
versions: -Python 2.7
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21344
___
Zachary Ware added the comment:
Russell Ballestrini wrote:
Determine if docstrings are enough to document the new function.
No, Doc/library/difflib.rst will need an update.
(Btw, I removed 2.7 from versions because 2.7 is not open to new features, bugs
and security-critical enhancements
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
nosy: +tim.peters
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21344
___
___
Changes by Russell Ballestrini russell.ballestr...@gmail.com:
Removed file:
http://bugs.python.org/file35023/difflib-patch-to-save-scores-in-get-close-matches.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21344
Changes by Russell Ballestrini russell.ballestr...@gmail.com:
Removed file:
http://bugs.python.org/file35024/difflib-patch-to-save-scores.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21344
Russell Ballestrini added the comment:
Ok, this patch is ready for review.
--
Added file:
http://bugs.python.org/file35033/diff-lib-get-scored-matches-tests-and-docs.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21344
Tim Peters added the comment:
I wonder whether this new function would attract any users, given that the user
already has control over the smallest ratio that will be accepted, and over the
maximum number of close matches returned. That's always been sufficient for me.
What useful thing(s)
Russell Ballestrini added the comment:
At some point I plan to write a web API that accepts a word, 'doge' and returns
a list of possible suggestions and scores. Later a did you mean dog style
suggestion could be implemented on top.
We compute the scores, and it is computationally taxing, we
23 matches
Mail list logo