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

16
LINES

< > BotCompany Repo | #1027951 // levenSimilarityIntIC_multi - return score for most similar pair (0 to 100)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2819L/18K).

static int levenSimilarityIntIC_multi(S a, Cl<S> b) {
  if (empty(b)) ret 0;
  new Lowest<S> bestRelDiff; // 0 to 1
  for (S key : b) {
    int n = max(l(a), l(key));
    if (!bestRelDiff.has())
      bestRelDiff.put(key, doubleRatio(levenIC(a, key), n));
    else {
      int limit = iceil(bestRelDiff.score*n);
      int diff = leven_limitedIC(a, key, limit);
      double percentDiff = doubleRatio(diff*100, n);
      bestRelDiff.put(key, doubleRatio(diff, n));
    }
  }
  ret iround((1-bestRelDiff.score)*100);
}

Author comment

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: 207 / 291
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)