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-05-02 09:47:45 +02:00
2021-05-02 12:40:01 +02:00
2021-04-22 08:34:57 -07:00
2021-04-23 23:00:27 +01:00
2020-12-01 10:37:39 +01:00
2021-05-02 09:47:45 +02:00
2021-05-02 23:10:51 +01:00
2021-05-02 09:47:45 +02:00
2021-03-25 00:47:21 +09:00
2021-04-30 16:04:57 +02:00
2021-04-26 15:01:40 +02:00
2021-05-03 00:38:22 +01:00
2021-04-25 13:40:44 +03:00
2020-10-19 22:04:01 -07:00
2021-04-30 16:32:49 -07:00
2020-10-16 10:34:15 +02:00
2021-04-30 09:50:28 +01:00
2020-11-04 16:33:55 +01:00
2020-12-15 15:14:35 +01:00
2021-04-30 12:46:15 +02:00
2021-05-03 15:50:24 +01:00
2021-01-06 20:47:19 +01:00
2021-04-30 16:04:57 +02:00
2020-07-10 12:40:38 +02:00
2021-04-30 16:04:57 +02:00
2021-04-30 16:04:57 +02:00
2021-05-02 09:47:45 +02:00
2020-06-22 17:39:32 +02:00
2021-02-01 17:26:56 +01:00
2020-12-01 09:56:42 +01:00
2020-11-06 17:04:47 +01:00
2021-04-30 16:32:49 -07:00
2020-09-07 10:48:44 +02:00
2021-04-22 00:52:52 +02:00
2021-04-22 00:52:52 +02:00
2021-04-28 19:09:29 +02:00
2021-04-22 00:52:52 +02:00
2021-04-22 00:52:52 +02:00
2020-09-09 12:28:48 +09:00
2021-04-30 16:04:57 +02:00
2021-04-09 08:02:00 -07:00
2021-04-09 08:02:00 -07:00
2020-04-13 22:11:40 -05:00
2021-05-02 09:47:45 +02:00
2021-04-26 15:01:40 +02:00
2020-05-19 13:22:16 +01:00
2020-04-15 02:35:41 +02:00
2021-04-22 00:52:52 +02:00
2020-12-01 10:37:39 +01:00
2021-04-28 18:12:16 +02:00
2021-05-03 16:47:27 +01:00
2020-11-03 22:27:12 +01:00
2021-04-30 16:04:57 +02:00
2021-04-30 12:46:15 +02:00
2020-10-13 08:46:31 +02:00
2020-05-12 23:32:32 +01:00
2020-04-06 14:07:02 +02:00
2021-04-30 16:04:57 +02:00
2021-04-30 12:46:15 +02:00
2021-03-03 21:53:59 -08:00
2021-04-30 16:04:57 +02:00
2021-02-19 15:10:45 +01:00
2020-03-19 10:11:33 -07:00
2020-03-24 23:26:44 -05:00
2020-09-10 16:09:04 +02:00
2020-05-07 10:17:16 +09:00
2021-02-19 13:21:28 +01:00
2020-10-19 16:30:02 -07:00
2021-04-28 18:12:16 +02:00
2020-11-08 10:05:27 +01:00
2020-11-18 23:47:32 -08:00
2020-12-04 19:45:57 -08:00
2021-01-25 14:51:48 -08:00
2020-11-16 16:16:10 +01:00
2021-03-03 14:59:52 +01:00
2021-05-02 09:47:45 +02:00
2021-04-23 23:00:27 +01:00
2020-06-12 11:26:00 +09:00
2020-12-01 10:37:39 +01:00
2020-12-01 10:37:39 +01:00
2021-04-30 14:06:49 +02:00
2020-12-29 14:58:27 +02:00
2020-11-18 23:47:32 -08:00
2021-04-30 16:04:57 +02:00
2021-02-16 00:28:24 +01:00
2021-02-18 16:26:20 +01:00
2021-04-30 18:19:57 +02:00
2021-04-22 00:52:52 +02:00
2021-05-02 09:47:45 +02:00
2021-05-02 09:47:45 +02:00
2021-05-02 09:47:45 +02:00
2021-04-28 03:02:55 +02:00
2021-04-22 00:18:20 +01:00
2021-01-06 20:43:06 +01:00
2020-11-19 10:54:03 +01:00
2020-12-01 10:37:39 +01:00
2020-04-11 10:48:40 +03:00
2021-05-03 10:43:00 +03:00
2020-05-05 10:49:46 +09:00
2020-10-18 17:54:06 +03:00
2020-11-16 16:08:05 +01:00
2020-03-10 20:41:34 -07:00
2021-04-30 16:04:57 +02:00
2020-03-10 20:41:34 -07:00
2021-04-02 16:48:11 +02:00
2021-04-02 16:48:11 +02:00
2020-12-01 10:37:39 +01:00
2020-04-15 02:35:41 +02:00
2021-04-30 16:32:49 -07:00