Libraryless. Click here for Pure Java version (2368L/15K).
1 | sclass LevenList {
|
2 | //Set<S> set = ciSet(); |
3 | LS list; |
4 | |
5 | *() {}
|
6 | *(LS *list) {}
|
7 | |
8 | // returns pair(word, distance) |
9 | // or null when search step was not successful |
10 | Iterator<Pair<S, Int>> findClosestWordIterator(S word) {
|
11 | if (empty(list)) ret emptyIterator(); |
12 | ret iff(new O {
|
13 | int limit = Integer.MAX_VALUE-1; |
14 | int idx; |
15 | |
16 | O get() {
|
17 | if (idx >= l(list)) ret endMarker(); |
18 | S s = list.get(idx++); |
19 | int dist = leven_limitedIC(word, s, limit); |
20 | if (dist < limit) { limit = dist; ret s; }
|
21 | null; |
22 | } |
23 | }); |
24 | } |
25 | } |
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: | 377 / 499 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |