Libraryless. Click here for Pure Java version (2819L/18K).
1 | static int levenSimilarityIntIC_multi(S a, Cl<S> b) { |
2 | if (empty(b)) ret 0; |
3 | new Lowest<S> bestRelDiff; // 0 to 1 |
4 | for (S key : b) { |
5 | int n = max(l(a), l(key)); |
6 | if (!bestRelDiff.has()) |
7 | bestRelDiff.put(key, doubleRatio(levenIC(a, key), n)); |
8 | else { |
9 | int limit = iceil(bestRelDiff.score*n); |
10 | int diff = leven_limitedIC(a, key, limit); |
11 | double percentDiff = doubleRatio(diff*100, n); |
12 | bestRelDiff.put(key, doubleRatio(diff, n)); |
13 | } |
14 | } |
15 | ret iround((1-bestRelDiff.score)*100); |
16 | } |
Began life as a copy of #1026703
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027951 |
Snippet name: | levenSimilarityIntIC_multi - return score for most similar pair (0 to 100) |
Eternal ID of this version: | #1027951/4 |
Text MD5: | d226197818448b9380702061d1127678 |
Transpilation MD5: | 188eddf5f50bc59312f9f02a88a32008 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-04-20 19:00:09 |
Source code size: | 532 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 212 / 298 |
Version history: | 3 change(s) |
Referenced in: | [show references] |