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" b
Changes by Russell Ballestrini :
Removed file: http://bugs.python.org/file35022/difflib.py
___
Python tracker
<http://bugs.python.org/issue21344>
___
___
Python-bug
Changes by Russell Ballestrini :
--
keywords: +patch
Added file:
http://bugs.python.org/file35023/difflib-patch-to-save-scores-in-get-close-matches.patch
___
Python tracker
<http://bugs.python.org/issue21
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
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 docs
Changes by Russell Ballestrini :
Removed file:
http://bugs.python.org/file35023/difflib-patch-to-save-scores-in-get-close-matches.patch
___
Python tracker
<http://bugs.python.org/issue21
Changes by Russell Ballestrini :
Removed file:
http://bugs.python.org/file35024/difflib-patch-to-save-scores.patch
___
Python tracker
<http://bugs.python.org/issue21
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
<http://bugs.python.org/issue21
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 co
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
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()` a
12 matches
Mail list logo