<commit_before>module WaveFile
  module ChunkReaders
    # Internal
    class SampleChunkReader < BaseChunkReader    # :nodoc:
      def initialize(io, chunk_size)
        @io = io
        @chunk_size = chunk_size
      end

      def read
        raw_bytes = @io.sysread(@chunk_size)

        fields = {}
        fields[:manufacturer_id],
        fields[:product_id],
        fields[:sample_duration],
        fields[:midi_note],
        fields[:pitch_fraction],
        fields[:smpte_format],
        fields[:smpte_offset_hours],
        fields[:smpte_offset_minutes],
        fields[:smpte_offset_seconds],
        fields[:smpte_offset_frame_count],
        fields[:loop_count],
        fields[:sampler_data_size] = raw_bytes.slice!(0...CORE_BYTE_COUNT).unpack("VVVVVVcCCCVV")
        fields[:pitch_fraction] = (fields[:pitch_fraction] / 4_294_967_296.0) * 100

        fields[:loops] = []
        fields[:loop_count].times do
          loop_fields = {}
          loop_fields[:id],
          loop_fields[:type],
          loop_fields[:start_sample_frame],
          loop_fields[:end_sample_frame],
          loop_fields[:fraction],
          loop_fields[:play_count] = raw_bytes.slice!(0...LOOP_BYTE_COUNT).unpack("VVVVVV")
          loop_fields[:type] = loop_type(loop_fields[:type])
          loop_fields[:fraction] /= 4_294_967_296.0

          fields[:loops] << Loop.new(loop_fields)
        end

        fields[:sampler_specific_data] = raw_bytes.slice!(0...fields[:sampler_data_size])

        SampleChunk.new(fields)<commit_msg>Reducing scope of fields<commit_after>module WaveFile
  module ChunkReaders
    # Internal
    class SampleChunkReader < BaseChunkReader    # :nodoc:
      def initialize(io, chunk_size)
        @io = io
        @chunk_size = chunk_size
      end

      def read
        raw_bytes = @io.sysread(@chunk_size)

        fields = {}
        fields[:manufacturer_id],
        fields[:product_id],
        fields[:sample_duration],
        fields[:midi_note],
        fields[:pitch_fraction],
        fields[:smpte_format],
        fields[:smpte_offset_hours],
        fields[:smpte_offset_minutes],
        fields[:smpte_offset_seconds],
        fields[:smpte_offset_frame_count],
        loop_count,
        sampler_data_size = raw_bytes.slice!(0...CORE_BYTE_COUNT).unpack("VVVVVVcCCCVV")
        fields[:pitch_fraction] = (fields[:pitch_fraction] / 4_294_967_296.0) * 100

        fields[:loops] = []
        loop_count.times do
          loop_fields = {}
          loop_fields[:id],
          loop_fields[:type],
          loop_fields[:start_sample_frame],
          loop_fields[:end_sample_frame],
          loop_fields[:fraction],
          loop_fields[:play_count] = raw_bytes.slice!(0...LOOP_BYTE_COUNT).unpack("VVVVVV")
          loop_fields[:type] = loop_type(loop_fields[:type])
          loop_fields[:fraction] /= 4_294_967_296.0

          fields[:loops] << Loop.new(loop_fields)
        end

        fields[:sampler_specific_data] = raw_bytes.slice!(0...sampler_data_size)

        SampleChunk.new(fields)
{'fraction_non_alphanumeric': 0.11733857751556867, 'fraction_numerical': 0.018354637823664373, 'mean_word_length': 2.65947242206235, 'pattern_counts': {'":': 0, '<': 9, '<?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': '6001', 'n_tokens_mistral': 1023, 'n_tokens_neox': 926, 'n_words': 122}