Libraryless. Click here for Pure Java version (2376L/15K).
1 | // returns pair(word, distance) |
2 | // or null when search step was not successful |
3 | static ItIt<Pair<S, Int>> levenClosestIC_iteratorWithNulls(LS list, S word) { |
4 | if (empty(list)) ret emptyItIt(); |
5 | ret iff(new F0 { |
6 | int limit = Integer.MAX_VALUE-1; |
7 | int idx; |
8 | |
9 | O get() { |
10 | if (limit == 0 || idx >= l(list)) ret endMarker(); |
11 | S s = list.get(idx++); |
12 | int dist = leven_limitedIC(word, s, limit); |
13 | if (dist < limit) { limit = dist; ret s; } |
14 | null; |
15 | } |
16 | }); |
17 | } |
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1025881 |
Snippet name: | levenClosestIC_iteratorWithNulls |
Eternal ID of this version: | #1025881/7 |
Text MD5: | 6bfff6e9321ee8d6170139cf91c53f13 |
Transpilation MD5: | 5bdf2aa70dabfb2968e6d7a225c6c3e9 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-10-28 11:48:12 |
Source code size: | 507 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 200 / 307 |
Version history: | 6 change(s) |
Referenced in: | [show references] |