<commit_before># -*- coding: gbk -*-

import numpy as np

class LSH(object):
    @staticmethod
    def get_keys(bit_arr, dist):
        bits_list = [bit_arr]
        if dist == 0:
            return bits_list
        for i in range(bit_arr.len):
            tmp_bits = bit_arr
            tmp_bits[i] = not tmp_bits[i]
            bits_list.append(tmp_bits)
        return bits_list

    @staticmethod
    def hamming_dist(bit_arr1, bit_arr2):
        return (bit_arr1^bit_arr2).count(True)

    @staticmethod
    def get_keys_str(bits_str, dist):
        bits_list = [bits_str]
        if dist == 0:
            return bits_list
        for i in range(len(bits_str)):
            tmp_list = list(bits_str)
            if bits_str[i] == '0':
                tmp_list[i] = '1'
                bits_str = ''.join(tmp_list)
            else:
                tmp_list[i] = '0'
                bits_str = ''.join(tmp_list)
            bits_list.append(bits_str)
        return bits_list

    @staticmethod
    def hamming_dist_str(bits_str1, bits_str2):<commit_msg>fix get key str bug,一个大bug。。<commit_after># -*- coding: gbk -*-

import numpy as np

class LSH(object):
    @staticmethod
    def get_keys(bit_arr, dist):
        bits_list = [bit_arr]
        if dist == 0:
            return bits_list
        for i in range(bit_arr.len):
            tmp_bits = bit_arr
            tmp_bits[i] = not tmp_bits[i]
            bits_list.append(tmp_bits)
        return bits_list

    @staticmethod
    def hamming_dist(bit_arr1, bit_arr2):
        return (bit_arr1^bit_arr2).count(True)

    @staticmethod
    def get_keys_str(bits_str, dist):
        bits_list = [bits_str]
        if dist == 0:
            return bits_list
        for i in range(len(bits_str)):
            tmp_list = list(bits_str)
            if bits_str[i] == '0':
                tmp_list[i] = '1'
            else:
                tmp_list[i] = '0'
            bits_list.append(''.join(tmp_list))
        return bits_list

    @staticmethod
    def hamming_dist_str(bits_str1, bits_str2):
{'fraction_non_alphanumeric': 0.10126582278481013, 'fraction_numerical': 0.010710808179162609, 'mean_word_length': 1.8462603878116344, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5942597', 'n_tokens_mistral': 702, 'n_tokens_neox': 683, 'n_words': 147}