<commit_before>def find(pattern, text):
    # Compute fail function
    p = [0] * len(pattern)
    j = 0
    for i in range(1, len(pattern)):
        while j > 0 and pattern[i] != pattern[j]:
            j = p[j - 1]
        if pattern[i] == pattern[j]:
            j += 1
            p[i] = j
    print(list(zip(pattern, p)))
    # find
    results = []
    j = 0
    for i in range(0, len(text)):
        while j > 0 and text[i] != pattern[j]:
            j = p[j - 1]
            print(i, j)
        if text[i] == pattern[j]:
            if j == len(pattern) - 1:
                results.append(i - j)
                j = p[j - 1]<commit_msg>kmp fixes<commit_after>def find(pattern, text):
    # Compute fail function
    p = [0] * len(pattern)
    j = 0
    for i in range(1, len(pattern)):
        while j > 0 and pattern[i] != pattern[j]:
            j = p[j - 1]
        if pattern[i] == pattern[j]:
            j += 1
            p[i] = j
    # find
    results = []
    j = 0
    for i in range(0, len(text)):
        while j > 0 and text[i] != pattern[j]:
            j = p[j - 1]
        if text[i] == pattern[j]:
            if j == len(pattern) - 1:
                results.append(i - j)
                j = p[j - 1]
{'fraction_non_alphanumeric': 0.1529698942229455, 'fraction_numerical': 0.01952807160292921, 'mean_word_length': 1.3745173745173744, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6404593', 'n_tokens_mistral': 445, 'n_tokens_neox': 419, 'n_words': 128}