<commit_before>
local BlockSet = {}
local BlockSet_mt = {}
local bs_mt = {}

BlockSet_mt.__index = BlockSet_mt
bs_mt.__index = bs_mt

local is_prepangenome = function(seq2fragments)
    for seq, fragments in pairs(seq2fragments) do
        local lengths_sum = 0
        local prev
        for _, fragment in ipairs(fragments) do
            lengths_sum = lengths_sum + fragment:length()
            if prev and prev:common(fragment) > 0 then
                return false
            end
            prev = fragment
        end
        if lengths_sum ~= seq:length() then
            return false
        end
    end
    return true
end

local parent_or_fragment = function(self, f)
    local parent = self._parent_of_parts[f]
    return parent or f
end

BlockSet_mt.__call = function(self, sequences, blocks)
    local name2seq = {}
    local seq2fragments = {}
    for _, sequence in ipairs(sequences) do
        assert(sequence:type() == 'Sequence')
        assert(not name2seq[sequence:name()])
        name2seq[sequence:name()] = sequence
        seq2fragments[sequence] = {}
    end
    local parent_of_parts = {}
    local block_by_fragment = {}
    for _, block in ipairs(blocks) do<commit_msg>add error message to assert<commit_after>
local BlockSet = {}
local BlockSet_mt = {}
local bs_mt = {}

BlockSet_mt.__index = BlockSet_mt
bs_mt.__index = bs_mt

local is_prepangenome = function(seq2fragments)
    for seq, fragments in pairs(seq2fragments) do
        local lengths_sum = 0
        local prev
        for _, fragment in ipairs(fragments) do
            lengths_sum = lengths_sum + fragment:length()
            if prev and prev:common(fragment) > 0 then
                return false
            end
            prev = fragment
        end
        if lengths_sum ~= seq:length() then
            return false
        end
    end
    return true
end

local parent_or_fragment = function(self, f)
    local parent = self._parent_of_parts[f]
    return parent or f
end

BlockSet_mt.__call = function(self, sequences, blocks)
    local name2seq = {}
    local seq2fragments = {}
    for _, sequence in ipairs(sequences) do
        assert(sequence:type() == 'Sequence')
        assert(not name2seq[sequence:name()],
            'Repeated sequence name: ' .. sequence:name())
        name2seq[sequence:name()] = sequence
        seq2fragments[sequence] = {}
    end
    local parent_of_parts = {}
    local block_by_fragment = {}
    for _, block in ipairs(blocks) do
{'fraction_non_alphanumeric': 0.08444444444444445, 'fraction_numerical': 0.007272727272727273, 'mean_word_length': 2.4922425952045133, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5909389', 'n_tokens_mistral': 727, 'n_tokens_neox': 720, 'n_words': 203}