Bu yerda Knuth-Morris-Pratt (KMP) algoritmini Pythonda amalga oshirish: def partial_match_table ((pattern): """Boshqa o'xshashlik jadvalini (shuningdek, muvaffaqiyatsizlik funktsiyasi deb ham ataladi) ma'lum bir naqsh uchun hisoblang. """ n = len ((pattern) jadval = [0] * n i = 1 j = 0, i < n: if pattern[i] == pattern[j]: j += 1 table[i] = j i += 1 elif j > 0: table = j[j-1] else: table[i] = 0 i += 1 return def kmp ((match_text, pattern): """ """Knuth-Morris-Pratt algoritmidan foydalanib berilgan match jadvalini qidiring. """ n = len ((text) m = m
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence