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

17
LINES

< > BotCompany Repo | #1026038 // find3_levenWithSwapsDistance

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

Libraryless. Click here for Pure Java version (2405L/15K).

static Int find3_levenWithSwapsDistance(S pat, S input) {
  LS tokPat = parse3_cachedPattern(pat);
  LS tok = parse3_cachedInput(input);
  int end = tok.size()-tokPat.size()+1;
  
  Int min = null;
  for (int idx = 0; idx < end; idx += 2) {
    int score = 0;
    for (int i = 1; i < tokPat.size(); i += 2) {
      S p = tokPat.get(i), t = tok.get(idx+i);
      score += levenWithSwapsIC(p, t);
    }
    min = min_withNull(min, score);
  }
  
  ret min;
}

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: #1026038
Snippet name: find3_levenWithSwapsDistance
Eternal ID of this version: #1026038/2
Text MD5: c5e5be10b6d02475c35cb60d55a669ea
Transpilation MD5: d8a546c63a1a6f9e7efad4de7a98a79a
Author: stefan
Category: javax / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-11-13 13:51:25
Source code size: 472 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 245 / 333
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)