Sha256: a141c4c2e00d6f9472e5da6da98314a1fbbc01d3b865f277143cbab4e7eb620d

Contents?: true

Size: 1.91 KB

Versions: 1

Compression:

Stored size: 1.91 KB

Contents

# frozen_string_literal: true

module TailwindDsl
  module Etl
    module ComponentModels
      # Extract component models by reading the cleansed component HTML and then using GPT3 to infer both the data/model structure.
      class Extractor
        attr_reader :components
        attr_reader :target_root_path
        attr_reader :batch_size
        attr_reader :use_prompt

        def initialize(components, target_root_path, batch_size: 1, use_prompt: false, filter_design_system: nil)
          @components = components
          @target_root_path = target_root_path
          @batch_size = batch_size
          @batch_left = batch_size
          @use_prompt = use_prompt
        end

        # Goal:       Extract the next (batch_size) component models using GPT3 and save them to target_root_path
        #             Create a data file at: design_system.name -> group-hierarchy -> component-name.data.json
        #             Create a model file at: design_system.name -> group-hierarchy -> component-name.model.rb

        # Process:    Collect all components and optionally filter them by design system name.
        #             Look for the next component to be processed, if it does not exist in the target folder then process it.
        #             decrement the batch_left counter and continue until batch_left is 0.
        #             if :use_prompt is true then display the input/output files and ask if you wish to process the component or skip.
        #             process the component by calling the GPT3 API and save the results to the target folder.

        def extract; end

        # def components
        #   @components ||= components.design_systems.map do |design_system|
        #     design_system.components.map do |component|
        #       Component.new(design_system, component, source_root_path, target_root_path)
        #     end
        #   end.flatten
        # end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tailwind_dsl-0.0.15 lib/tailwind_dsl/etl/component_models/extractor.rb