From f297313ca72da38fc97c2c52e73a844cb26f3b98 Mon Sep 17 00:00:00 2001 From: Howard Wilson Date: Wed, 18 Mar 2015 12:16:24 +0100 Subject: [PATCH] Add test for undesirable decoding behavior on first hypothesis (see #10) --- spec/integration/decoder_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/integration/decoder_spec.rb b/spec/integration/decoder_spec.rb index 694eafd..f8d6be1 100644 --- a/spec/integration/decoder_spec.rb +++ b/spec/integration/decoder_spec.rb @@ -21,6 +21,17 @@ expect(subject.hypothesis).to eq("go forward ten meters") end + # FIXME: This test illustrates a current issue discussed in: + # https://github.com/watsonbox/pocketsphinx-ruby/issues/10 + it 'incorrectly decodes the speech in hello.wav on first attempt' do + hypotheses = (1..2).map do + subject.decode File.open('spec/assets/audio/hello.wav', 'rb') + subject.hypothesis + end + + expect(hypotheses).to eq(['oh', 'hello']) + end + it 'accepts a file path as well as a stream' do subject.decode 'spec/assets/audio/goforward.raw' expect(subject.hypothesis).to eq("go forward ten meters")