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).

1  
static Int find3_levenWithSwapsDistance(S pat, S input) {
2  
  LS tokPat = parse3_cachedPattern(pat);
3  
  LS tok = parse3_cachedInput(input);
4  
  int end = tok.size()-tokPat.size()+1;
5  
  
6  
  Int min = null;
7  
  for (int idx = 0; idx < end; idx += 2) {
8  
    int score = 0;
9  
    for (int i = 1; i < tokPat.size(); i += 2) {
10  
      S p = tokPat.get(i), t = tok.get(idx+i);
11  
      score += levenWithSwapsIC(p, t);
12  
    }
13  
    min = min_withNull(min, score);
14  
  }
15  
  
16  
  ret min;
17  
}

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: 244 / 332
Version history: 1 change(s)
Referenced in: [show references]