<commit_before># coding: utf-8

require          'io/console'
require_relative 'other/map'
require_relative 'other/set_posn'

#* raw_term/other.rb - Support for raw terminal access in non-windows systems.
module MiniReadline

  #The detected platform is not windows.
  PLATFORM = :other

  #The class used to manipulate console i/o on a low level.
  class RawTerm

    #Carriage return
    CARRIAGE_RETURN = "\x0D"

    #Bell
    BELL            = "\x07"

    #Output a string
    def put_string(str)
      scan_string(str)
      print(str)
    end

    #Home the cursor and start at a known state.
    def initialize_parms
      put_string CARRIAGE_RETURN
      STDIN.raw!
    end

    #Conclude the terminal state.
    def conclude
      STDIN.cooked!
      print("\n")
    end

    #Sound a beep
    def beep
      print BELL
    end

    #Get a uncooked character keystroke.
    #<br>Notes
    #* This needs to be tested under Linux, Cygwin, and Apple.
    #<br>Endemic Code Smells
    #* :reek:UtilityFunction -- For now, the way things are.
    def get_raw_char
      STDIN.getch
    end

    #Determine the affect of a string on the cursor.
    def scan_string(str)
      str.chars.each do |char|
        if char == CARRIAGE_RETURN
          @cursor_posn = 0
        else
          @cursor_posn += 1
        end
      end
    end
  end<commit_msg>Updated beep routine for other.<commit_after># coding: utf-8

require          'io/console'
require_relative 'other/map'
require_relative 'other/set_posn'

#* raw_term/other.rb - Support for raw terminal access in non-windows systems.
module MiniReadline

  #The detected platform is not windows.
  PLATFORM = :other

  #The class used to manipulate console i/o on a low level.
  class RawTerm

    #Carriage return
    CARRIAGE_RETURN = "\x0D"

    #Bell
    BELL = "\x07"

    #Output a string
    def put_string(str)
      scan_string(str)
      print(str)
    end

    #Home the cursor and start at a known state.
    def initialize_parms
      put_string CARRIAGE_RETURN
      STDIN.raw!
    end

    #Conclude the terminal state.
    def conclude
      STDIN.cooked!
      print("\n")
    end

    #Sound a beep
    def beep
      $stderr.write(BELL)
      $stderr.flush
    end

    #Get a uncooked character keystroke.
    #<br>Notes
    #* This needs to be tested under Linux, Cygwin, and Apple.
    #<br>Endemic Code Smells
    #* :reek:UtilityFunction -- For now, the way things are.
    def get_raw_char
      STDIN.getch
    end

    #Determine the affect of a string on the cursor.
    def scan_string(str)
      str.chars.each do |char|
        if char == CARRIAGE_RETURN
          @cursor_posn = 0
        else
          @cursor_posn += 1
        end
      end
    end
  end
{'fraction_non_alphanumeric': 0.07325072886297376, 'fraction_numerical': 0.004373177842565598, 'mean_word_length': 2.1660899653979238, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2958853', 'n_tokens_mistral': 920, 'n_tokens_neox': 873, 'n_words': 291}