<commit_before>module DependencyGrapher
  require 'set'
  class Analyzer
    def initialize(dependencies, *filters)
      @original_dependencies = dependencies
      @calculated_dependencies = @original_dependencies

      # Crawl folders for class names 
      @known_classes = get_classes
      #@known_classes.each do |klass|
        #p klass
      #end
      @original_dependencies.each do |dep|
        p dep.caller.defined_class.to_s.split("::").first
        p dep.receiver.defined_class.to_s.split("::").first
      end

      # Add default filters
      if filters.empty?
        @filters = Set.new [:interclass, :rails]
        # Otherwise, add provided filters
      else
        add_filters(filters)
      end

      #Apply filters
      apply_filters
    end

    def add_filters(*filters)
      @filters.merge filters
    end
<commit_msg>Super class setups<commit_after>module DependencyGrapher
  require 'set'
  class Analyzer
    def initialize(dependencies, *filters)
      @original_dependencies = dependencies
      @calculated_dependencies = Set.new

      # Crawl folders for class names 
      @known_classes = get_classes
      #@known_classes.each do |klass|
        #p klass
      #end

      p @original_dependencies.size
      @original_dependencies.each do |dep|
        caller_root =  dep.caller.defined_class.to_s.split("::").first
        receiver_root =  dep.receiver.defined_class.to_s.split("::").first
        p caller_root.class
        @calculated_dependencies << dep if (@known_classes.include?(caller_root) || @known_classes.include?(receiver_root))
      end

      p "cacl dep size: #{@calculated_dependencies.size}"
      @calculated_dependencies.each do |calc_dep|
        p calc_dep
      end

      # Add default filters
      if filters.empty?
        @filters = Set.new [:interclass, :rails]
        # Otherwise, add provided filters
      else
        add_filters(filters)
      end

      #Apply filters
      apply_filters
    end

    def add_filters(*filters)
      @filters.merge filters
    end

{'fraction_non_alphanumeric': 0.08589555880917521, 'fraction_numerical': 0.0, 'mean_word_length': 2.5714285714285716, 'pattern_counts': {'":': 4, '<': 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': '108471', 'n_tokens_mistral': 617, 'n_tokens_neox': 590, 'n_words': 140}