Libraryless. Click here for Pure Java version (2376L/15K).
// returns pair(word, distance) // or null when search step was not successful static ItIt<Pair<S, Int>> levenClosestIC_iteratorWithNulls(LS list, S word) { if (empty(list)) ret emptyItIt(); ret iff(new F0 { int limit = Integer.MAX_VALUE-1; int idx; O get() { if (limit == 0 || idx >= l(list)) ret endMarker(); S s = list.get(idx++); int dist = leven_limitedIC(word, s, limit); if (dist < limit) { limit = dist; ret s; } null; } }); }
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: | 199 / 306 |
Version history: | 6 change(s) |
Referenced in: | [show references] |