<commit_before># encoding: utf-8
module Ekylibre

  module Parts

    autoload :Node, 'ekylibre/parts/node'
    autoload :Page, 'ekylibre/parts/page'
    autoload :Tree, 'ekylibre/parts/tree'

    class ReverseImpossible < StandardError
    end

    class DSL

      def self.run!(tree, &block)
        dsl = new(tree)
        dsl.instance_exec(&block)
      end

      def initialize(tree)
        @tree = tree
      end

      def part(name, options = {}, &block)
        unless child = @tree[name]
          child = Node.new(:part, name, options)
          @tree.add_child child
        end
        yield_in_node(child, &block)
      end

      def group(name, options = {}, &block)
        unless node = current_node
          unless node.type == :part
            raise "group must be in a part"
          end
        end
        unless child = node.index[name]
          child = Node.new(:group, name, options)
          node.add_child child
        end
        yield_in_node(child, &block)
      end

      def item(name, options = {}, &block)<commit_msg>Rebuild index after plugin parts add<commit_after># encoding: utf-8
module Ekylibre

  module Parts

    autoload :Node, 'ekylibre/parts/node'
    autoload :Page, 'ekylibre/parts/page'
    autoload :Tree, 'ekylibre/parts/tree'

    class ReverseImpossible < StandardError
    end

    class DSL

      def self.run!(tree, &block)
        dsl = new(tree)
        dsl.instance_exec(&block)
        tree.rebuild_index!
      end

      def initialize(tree)
        @tree = tree
      end

      def part(name, options = {}, &block)
        unless child = @tree[name]
          child = Node.new(:part, name, options)
          @tree.add_child child
        end
        yield_in_node(child, &block)
      end

      def group(name, options = {}, &block)
        unless node = current_node
          unless node.type == :part
            raise "group must be in a part"
          end
        end
        unless child = node.index[name]
          child = Node.new(:group, name, options)
          node.add_child child
        end
        yield_in_node(child, &block)
      end

      def item(name, options = {}, &block)
{'fraction_non_alphanumeric': 0.09839080459770115, 'fraction_numerical': 0.0009195402298850574, 'mean_word_length': 1.9168900804289544, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5663868', 'n_tokens_mistral': 684, 'n_tokens_neox': 658, 'n_words': 179}