Exemplo n.º 1
0
    def test_kaldi_stt(self, mock_get, mock_post):
        owo.stt.Recognizer = mock.MagicMock
        config = base_config()
        config.merge({
            'stt': {
                'module': 'kaldi',
                'kaldi': {
                    'uri': 'https://test.com'
                },
            },
            'lang': 'en-US'
        })
        mock_get.return_value = config

        kaldiResponse = mock.MagicMock()
        kaldiResponse.json.return_value = {
            'hypotheses': [{
                'utterance': '     [noise]     text'
            }, {
                'utterance': '     asdf'
            }]
        }
        mock_post.return_value = kaldiResponse
        audio = mock.MagicMock()
        stt = owo.stt.KaldiSTT()
        self.assertEquals(stt.execute(audio), 'text')
Exemplo n.º 2
0
    def test_OwO_stt(self, mock_get):
        owo.stt.STTApi = mock.MagicMock()
        config = base_config()
        config.merge({
            'stt': {
                'module': 'OwO',
                'OwO': {
                    'uri': 'https://test.com'
                }
            },
            'lang': 'en-US'
        })
        mock_get.return_value = config

        stt = owo.stt.OwOSTT()
        audio = mock.MagicMock()
        stt.execute(audio, 'en-us')
        self.assertTrue(owo.stt.STTApi.called)
Exemplo n.º 3
0
    def test_bing_stt(self, mock_get):
        owo.stt.Recognizer = mock.MagicMock
        config = base_config()
        config.merge({
            'stt': {
                'module': 'bing',
                'bing': {
                    'credential': {
                        'token': 'FOOBAR'
                    }
                },
            },
            'lang': 'en-US'
        })
        mock_get.return_value = config

        audio = mock.MagicMock()
        stt = owo.stt.BingSTT()
        stt.execute(audio)
        self.assertTrue(stt.recognizer.recognize_bing.called)
Exemplo n.º 4
0
    def test_google_cloud_stt(self, mock_get):
        owo.stt.Recognizer = mock.MagicMock
        config = base_config()
        config.merge({
            'stt': {
                'module': 'google_cloud',
                'google_cloud': {
                    'credential': {
                        'json': {}
                    }
                },
            },
            'lang': 'en-US'
        })
        mock_get.return_value = config

        audio = mock.MagicMock()
        stt = owo.stt.GoogleCloudSTT()
        stt.execute(audio)
        self.assertTrue(stt.recognizer.recognize_google_cloud.called)
Exemplo n.º 5
0
    def test_houndify_stt(self, mock_get):
        owo.stt.Recognizer = mock.MagicMock
        config = base_config()
        config.merge({
            'stt': {
                'module': 'houndify',
                'houndify': {
                    'credential': {
                        'client_id': 'FOO',
                        'client_key': "BAR"
                    }
                }
            },
            'lang': 'en-US'
        })
        mock_get.return_value = config

        audio = mock.MagicMock()
        stt = owo.stt.HoundifySTT()
        stt.execute(audio)
        self.assertTrue(stt.recognizer.recognize_houndify.called)
Exemplo n.º 6
0
    def test_ibm_stt(self, mock_get):
        owo.stt.Recognizer = mock.MagicMock
        config = base_config()
        config.merge({
            'stt': {
                'module': 'ibm',
                'ibm': {
                    'credential': {
                        'username': '******',
                        'password': '******'
                    }
                },
            },
            'lang': 'en-US'
        })
        mock_get.return_value = config

        audio = mock.MagicMock()
        stt = owo.stt.IBMSTT()
        stt.execute(audio)
        self.assertTrue(stt.recognizer.recognize_ibm.called)