// patterns = e.g. "Zitat, Anfrage, Preis, Kosten, Preise, Geld, wieviel, wie + viel" static Int mmo_levenWithSwapsScore(S patterns, S s) { Int min = null; patLoop: for (S pat : tok_splitAtComma(patterns)) { if (startsWith(pat, "#")) continue; // ignore special commands int score = 0; for (S phrase : tok_splitAtPlus(pat)) { Int score2 = find3_levenWithSwapsDistance(p, s); if (score2 == null) continue patLoop; score += score2; } min = min_withNull(min, score); } ret min; }