Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1025879 // levenWithSwapsClosestIC [dev., needs levenWithSwaps_limitedIC] - get Levenshtein-with-swaps-closest key in map or element in list (ignoring case)

JavaX fragment (include)

1  
static <A> S levenWithSwapsClosestIC(Map<S, A> map, S s) {
2  
  ret levenWithSwapsClosestIC(keys(map), s);
3  
}
4  
5  
sS levenWithSwapsClosestIC(Collection<S> l, S s) {
6  
  int limit = Integer.MAX_VALUE-1;
7  
  new Lowest<S> best;
8  
  for (S key : unnull(l)) {
9  
    limit = levenWithSwaps_limitedIC(s, key, limit);
10  
    best.put(key, limit);
11  
  }
12  
  ret best!;
13  
}
14  
15  
static <A> S levenWithSwapsClosestIC(S s, Map<S, A> map) {
16  
  ret levenWithSwapsClosestIC(map, s);
17  
}
18  
19  
sS levenWithSwapsClosestIC(S s, Collection<S> l) {
20  
  ret levenWithSwapsClosestIC(l, s);
21  
}

Author comment

Began life as a copy of #1008052

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: #1025879
Snippet name: levenWithSwapsClosestIC [dev., needs levenWithSwaps_limitedIC] - get Levenshtein-with-swaps-closest key in map or element in list (ignoring case)
Eternal ID of this version: #1025879/2
Text MD5: 17d3102262eaebe684c5ef1b42d3d5b6
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:27:09
Source code size: 552 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 205 / 236
Version history: 1 change(s)
Referenced in: [show references]