Libraryless. Click here for Pure Java version (2368L/15K).
sclass LevenList { //Set<S> set = ciSet(); LS list; *() {} *(LS *list) {} // returns pair(word, distance) // or null when search step was not successful Iterator<Pair<S, Int>> findClosestWordIterator(S word) { if (empty(list)) ret emptyIterator(); ret iff(new O { int limit = Integer.MAX_VALUE-1; int idx; O get() { if (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: | #1025880 |
| Snippet name: | LevenList |
| Eternal ID of this version: | #1025880/2 |
| Text MD5: | ad17a00ac1477c110815e71b540dab70 |
| Transpilation MD5: | 6514de2bab6366bb8c7460cbe76e67cf |
| 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:33:32 |
| Source code size: | 607 bytes / 25 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 375 / 496 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |