<commit_before>require 'chordutilities'
require 'generatechords'
require 'generatenotespace'
module Main
#-----------------------------
  class Program
    include ChordUtilities

    def initialize( note_space_length)
      @note_space = GenerateNoteSpace::NoteSpace.new( note_space_length)
      @most_significant_bit_value = @note_space.most_significant_bit_value
    end

    def run
#@note_space.necklaces.each {|necklace| print 'necklace.to_s ', necklace.to_s, "\n"}
#p 'in Main::Program#run before GenerateChords::Walker.new'
      @walker_new = GenerateChords::Walker.new( @note_space, GenerateChords::WalkerDecorator)
#p 'in Main::Program#run before GenerateChords::Walker#walk'
      @walker_fixed_dump = @walker_new.fixed
      dump_fixed()
      @fill_chords, @counts_dump = @walker_new.walk
#p 'in Main::Program#run after GenerateChords::Walker#walk'
      add_fill_chords_to_necklaces( @fill_chords)
      dump()
    end #def

    def add_fill_chords_to_necklaces( fill_chords)
#p 'in Main::Program#add_fill_chords_to_necklaces'
      fill_chords.each_with_index do |chord, fill_word|
        next if fill_word.nil?
        word = fill_word | @most_significant_bit_value
        detected = @note_space.necklaces.word_to_necklace( word)
#if detected.nil?
#print ' detected '; p detected
#else
#print ' detected.to_s '; p detected.to_s
#end
        detected.add_rooted_chord( word, chord) unless detected.nil?
      end #each_with_index chord, fill_word
    end #def

    def dump_fixed
      print @walker_fixed_dump
    end

    def dump
      print @counts_dump
      empty_ones = []
      sum = 0
      sum_length = 0

      @fill_chords.each_with_index do |e, i|
        empty_ones.push( i) if e.empty?
        sum += e.length
        thing = e.collect {|a| a.absolutes}
        sum_length += thing.length
        next if thing.empty?
       #print i, ' ', i.to_s( 2), ' '; p thing
        print i, ' ', thing.length, ' ', (@most_significant_bit_value | i).to_s( 2), ":\n"
#       thing.each {|e| print e.inspect, }
        e.each do |chord|
          print chord.absolutes.inspect, '[m9 tr ot j2 j17 4 br]:[', [<commit_msg>Changed 'main.rb'.<commit_after>require 'chordutilities'
#require 'generatedprunedorderedpostordernarytree'
require 'generatechords'
require 'generatenotespace'
module Main
#-----------------------------
  class Program
    include ChordUtilities

    def initialize( note_space_length)
      @note_space = GenerateNoteSpace::NoteSpace.new( note_space_length)
      @most_significant_bit_value = @note_space.most_significant_bit_value
    end

    def run
#@note_space.necklaces.each {|necklace| print 'necklace.to_s ', necklace.to_s, "\n"}
#p 'in Main::Program#run before GenerateChords::Walker.new'
      @walker_decorator = GenerateChords::WalkerDecorator.new( @note_space)
      @walker = GeneratedPrunedOrderedPostOrderNaryTree::Walker.new( @walker_decorator,
          GenerateChords::TreeDecorator.new)
#p 'in Main::Program#run before GenerateChords::Walker#walk'
      dump_fixed()
      @fill_chords, @counts_dump = @walker.walk
#p 'in Main::Program#run after GenerateChords::Walker#walk'
      add_fill_chords_to_necklaces( @fill_chords)
      dump()
    end #def

    def add_fill_chords_to_necklaces( fill_chords)
#p 'in Main::Program#add_fill_chords_to_necklaces'
      fill_chords.each_with_index do |chord, fill_word|
        next if fill_word.nil?
        word = fill_word | @most_significant_bit_value
        detected = @note_space.necklaces.word_to_necklace( word)
#if detected.nil?
#print ' detected '; p detected
#else
#print ' detected.to_s '; p detected.to_s
#end
        detected.add_rooted_chord( word, chord) unless detected.nil?
      end #each_with_index chord, fill_word
    end #def

    def dump_fixed
      print @walker_decorator.fixed
    end

    def dump
      print @counts_dump
      empty_ones = []
      sum = 0
      sum_length = 0

      @fill_chords.each_with_index do |e, i|
        empty_ones.push( i) if e.empty?
        sum += e.length
        thing = e.collect {|a| a.absolutes}
        sum_length += thing.length
        next if thing.empty?
       #print i, ' ', i.to_s( 2), ' '; p thing
        print i, ' ', thing.length, ' ', (@most_significant_bit_value | i).to_s( 2), ":\n"
#       thing.each {|e| print e.inspect, }
        e.each do |chord|
          print chord.absolutes.inspect, '[m9 tr ot j2 j17 4 br]:[', [
{'fraction_non_alphanumeric': 0.12043547289634837, 'fraction_numerical': 0.0040825584032660464, 'mean_word_length': 3.1960038058991436, 'pattern_counts': {'":': 2, '<': 3, '<?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': '990879', 'n_tokens_mistral': 1575, 'n_tokens_neox': 1492, 'n_words': 330}