Libraryless. Click here for Pure Java version (3101L/19K).
// patterns = e.g. "Zitat, Anfrage, Preis, Kosten, Preise, Geld, wieviel, wie + viel" // potentially slow (not using levenLimited) static Int mmo_levenWithSwapsScore(S patterns, S s) { Int min = null; if (startsWith(s, "#")) null; patLoop: for (S pat : tok_splitAtComma(patterns)) { if (startsWith(pat, "#")) continue; // ignore special commands int score = 0; for (S phrase : tok_splitAtPlus(pat)) { if (endsWith(phrase, "!")) { if (!find3(phrase, s)) continue patLoop; } else { Int score2 = find3_levenWithSwapsDistance(phrase, s); if (score2 == null) continue patLoop; score += score2; } } min = min_withNull(min, score); } ret min; }
Began life as a copy of #1026018
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1026037 |
Snippet name: | mmo_levenWithSwapsScore - like mmo_match, but return leven difference |
Eternal ID of this version: | #1026037/6 |
Text MD5: | a42efe94dded7324a61b86e683427cb3 |
Transpilation MD5: | 203d1adea6d7898307b97034d4179ef3 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-01-05 04:15:38 |
Source code size: | 737 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 226 / 362 |
Version history: | 5 change(s) |
Referenced in: | [show references] |