Dennis Sweeney
80a2a4ed7d
bpo-38530: Refactor and improve AttributeError suggestions (GH-25776)
- Make case-swaps half the cost of any other edit
- Refactor Levenshtein code to not use memory allocator, and to bail early on no match.
- Add comments to Levenshtein distance code
- Add test cases for Levenshtein distance behind a debug macro
- Set threshold to `(name_size + item_size + 3) * MOVE_COST / 6`.
- Reasoning: similar to `difflib.SequenceMatcher.ratio()` >= 2/3:
```
"Multiset Jaccard similarity" >= 2/3
matching letters / total letters >= 2/3
(name_size - distance + item_size - distance) / (name_size + item_size) >= 2/3
1 - (2*distance) / (name_size + item_size) >= 2/3
1/3 >= (2*distance) / (name_size + item_size)
(name_size + item_size) / 6 >= distance
With rounding:
(name_size + item_size + 3) // 6 >= distance
```
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2021-05-03 16:47:27 +01:00
..
2021-03-24 02:23:01 +01:00
2021-04-28 22:58:44 -07:00
2021-04-28 22:58:44 -07:00
2020-12-23 03:41:08 +01:00
2020-12-23 03:41:08 +01:00
2020-11-13 15:38:17 +01:00
2021-04-27 23:58:54 -07:00
2021-03-08 22:56:37 +01:00
2020-10-20 06:22:44 +01:00
2021-04-25 13:38:00 +03:00
2021-02-19 15:10:45 +01:00
2021-03-22 11:58:59 +01:00
2021-04-30 15:21:42 +02:00
2020-12-03 12:46:16 +02:00
2021-02-19 15:10:45 +01:00
2021-01-12 15:43:32 +01:00
2021-03-29 12:28:14 +09:00
2021-04-30 09:50:28 +01:00
2021-04-02 15:28:13 +02:00
2021-04-22 00:52:52 +02:00
2021-04-11 23:57:09 +02:00
2021-03-24 01:29:09 +01:00
2021-03-24 02:23:01 +01:00
2021-05-03 16:47:27 +01:00
2021-04-02 15:28:13 +02:00
2021-02-19 13:33:31 +01:00
2021-01-12 10:29:45 +01:00
2021-05-03 15:50:24 +01:00
2021-05-03 10:43:00 +03:00
2021-01-19 23:35:27 +01:00
2020-10-27 04:36:22 +01:00
2020-11-08 20:00:13 -08:00
2021-02-19 15:10:45 +01:00