Class: Pocketsphinx::AudioFileSpeechRecognizer

Inherits:
SpeechRecognizer show all
Defined in:
lib/pocketsphinx/audio_file_speech_recognizer.rb

Overview

High-level class for live speech recognition from a raw audio file.

Constant Summary

Constants inherited from SpeechRecognizer

SpeechRecognizer::ALGORITHMS

Instance Attribute Summary

Attributes inherited from SpeechRecognizer

#configuration, #decoder, #recordable

Instance Method Summary collapse

Methods inherited from SpeechRecognizer

#algorithm, #in_speech?, #initialize, #pause, #recognizing?, #reconfigure, #start, #stop

Constructor Details

This class inherits a constructor from Pocketsphinx::SpeechRecognizer

Instance Method Details

#recognize(file_path, max_samples = 2048) ⇒ Object


4
5
6
7
8
9
10
# File 'lib/pocketsphinx/audio_file_speech_recognizer.rb', line 4

def recognize(file_path, max_samples = 2048)
  self.recordable = AudioFile.new(file_path)

  super(max_samples) do |speech|
    yield speech if block_given?
  end
end