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

9
LINES

< > BotCompany Repo | #1030322 - mmo2_matchWithTypos

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

Libraryless. Click here for Pure Java version (4149L/25K).

sbool mmo2_matchWithTypos(S pattern, S s, int maxTypos default 1) {
  ret mmo2_matchWithTypos(mmo2_parsePattern(pattern), s, maxTypos);
}

sbool mmo2_matchWithTypos(MMOPattern pattern, S s, int maxTypos default 1) {
  if (maxTypos == 0) ret mmo2_match(pattern, s);
  Int score = mmo2_levenWithSwapsScore(pattern, s);
  ret score != null && score <= maxTypos;
}

Author comment

Began life as a copy of #1028074

download  show line numbers  debug dex   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1030322
Snippet name: mmo2_matchWithTypos
Eternal ID of this version: #1030322/1
Text MD5: 4b4b4f78c932dcb62c7eb5ad601774e6
Transpilation MD5: ecd59162a4ca96ad191a38c75e3a48b5
Author: stefan
Category: javax / phrasecache
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-12-02 17:36:55
Source code size: 368 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 10 / 19
Referenced in: [show references]

Formerly at http://tinybrain.de/1030322 & http://1030322.tinybrain.de