<commit_before>class GatherInputController < Adhearsion::CallController
  def run
    logger.debug "Listening for input"
    recording = record(start_beep: true, initial_timeout: 4.seconds, final_timeout: 1.seconds, format: 'wav', direction: :send).complete_event.recording

    logger.debug "Input received. Checking interpretation from AT&T..."
    listener = Celluloid::Actor[:att_speech].future.speech_to_text File.read(recording.uri.sub('file://', ''))

    play recording.uri.sub('file://', '')

    interpretation = listener.value
    logger.debug "Interpretation from AT&T: #{interpretation.inspect}"
    if interpretation.recognition.status == 'OK' && interpretation.recognition.n_best.confidence >= 0.4
      message = interpretation.recognition.n_best.result_text
      App.publish_message message, call.id
    else
      say "Sorry, I didn't catch that."
      pass self.class
    end
  end
end<commit_msg>More human-like feedback to cover audio processing time<commit_after>class GatherInputController < Adhearsion::CallController
  def run
    logger.debug "Listening for input"
    recording = record(start_beep: true, initial_timeout: 4.seconds, final_timeout: 1.seconds, format: 'wav', direction: :send).complete_event.recording

    logger.debug "Input received. Checking interpretation from AT&T..."
    listener = Celluloid::Actor[:att_speech].future.speech_to_text File.read(recording.uri.sub('file://', ''))

    say ["Just a second while I check on that", "One moment please", "Hmmmm, checking", "Yes, ok, let me check", "Ok, let me look", "Right, let me check my sources"].sample

    interpretation = listener.value
    logger.debug "Interpretation from AT&T: #{interpretation.inspect}"
    if interpretation.recognition.status == 'OK' && interpretation.recognition.n_best.confidence >= 0.4
      message = interpretation.recognition.n_best.result_text
      App.publish_message message, call.id
    else
      say "Sorry, I didn't catch that."
      pass self.class
    end
  end
end
{'fraction_non_alphanumeric': 0.11548033847685416, 'fraction_numerical': 0.003982080637132902, 'mean_word_length': 4.180412371134021, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4535681', 'n_tokens_mistral': 592, 'n_tokens_neox': 574, 'n_words': 155}