<commit_before>class Redimension 
    attr_accessor :debug, :hashkey
    attr_reader :redis, :key, :dim, :prec

    def initialize(redis,key,dim,prec=64)
        @debug = false
        @redis = redis
        @dim = dim
        @key = key
        @prec = prec
        @hashkey = false
        @binary = false # Default is hex encoding
    end

    def check_dim(vars)
        if vars.length != @dim
            raise "Please always use #{@dim} vars with this index."
        end
    end

    # Encode two variables into the interleaved representation.
    def encode(vars)
        comb = false
        vars.each{|v|
            vbin = v.to_s(2).rjust(@prec,'0')
            comb = comb ? comb.zip(vbin.split("")) : vbin.split("")
        }
        comb = comb.flatten.compact.join("")
        comb.to_i.to_s(16).rjust(@prec*@dim/4,'0')
    end

    # Encode an element coordinates and ID as the whole string to add
    # into the sorted set.
    def elestring(vars,id)
        check_dim(vars)
        ele = encode(vars)
        vars.each{|v| ele << ":#{v}"}
        ele << ":#{id}"
    end

    # Add a variable with associated data 'id'
    def index(vars,id)
        ele = elestring(vars,id)<commit_msg>Fix non correct comment claiming 2D operations.<commit_after>class Redimension 
    attr_accessor :debug, :hashkey
    attr_reader :redis, :key, :dim, :prec

    def initialize(redis,key,dim,prec=64)
        @debug = false
        @redis = redis
        @dim = dim
        @key = key
        @prec = prec
        @hashkey = false
        @binary = false # Default is hex encoding
    end

    def check_dim(vars)
        if vars.length != @dim
            raise "Please always use #{@dim} vars with this index."
        end
    end

    # Encode N variables into the bits-interleaved representation.
    def encode(vars)
        comb = false
        vars.each{|v|
            vbin = v.to_s(2).rjust(@prec,'0')
            comb = comb ? comb.zip(vbin.split("")) : vbin.split("")
        }
        comb = comb.flatten.compact.join("")
        comb.to_i.to_s(16).rjust(@prec*@dim/4,'0')
    end

    # Encode an element coordinates and ID as the whole string to add
    # into the sorted set.
    def elestring(vars,id)
        check_dim(vars)
        ele = encode(vars)
        vars.each{|v| ele << ":#{v}"}
        ele << ":#{id}"
    end

    # Add a variable with associated data 'id'
    def index(vars,id)
        ele = elestring(vars,id)
{'fraction_non_alphanumeric': 0.12188139059304703, 'fraction_numerical': 0.006952965235173824, 'mean_word_length': 2.008610086100861, 'pattern_counts': {'":': 4, '<': 11, '<?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': '2795316', 'n_tokens_mistral': 799, 'n_tokens_neox': 775, 'n_words': 219}