def __init__(self, channels=int(speech_config.get('channels')), sample_rate=int(speech_config.get('sample_rate')), device_index=None, lang=core_config.get('lang')): pyee.EventEmitter.__init__(self) self.microphone = MutableMicrophone(sample_rate=sample_rate, device_index=device_index) # FIXME - channels are not been used self.microphone.CHANNELS = channels self.mycroft_recognizer = LocalRecognizer(sample_rate, lang) # TODO - localization self.wakeup_recognizer = LocalRecognizer(sample_rate, lang, "wake up") self.remote_recognizer = Recognizer() self.state = RecognizerLoopState()
class LocalRecognizerTest(unittest.TestCase): def setUp(self): self.recognizer = LocalRecognizer() def testRecognizerWrapper(self): source = WavFile(os.path.join(DATA_DIR, "hey_mycroft.wav")) with source as audio: hyp = self.recognizer.transcribe(audio.stream.read()) assert "mycroft" in hyp.hypstr.lower() source = WavFile(os.path.join(DATA_DIR, "mycroft.wav")) with source as audio: hyp = self.recognizer.transcribe(audio.stream.read()) assert "mycroft" in hyp.hypstr.lower() def testRecognitionInLongerUtterance(self): source = WavFile(os.path.join(DATA_DIR, "weather_mycroft.wav")) with source as audio: hyp = self.recognizer.transcribe(audio.stream.read()) assert "mycroft" in hyp.hypstr.lower()
def setUp(self): self.loop = RecognizerLoop() self.queue = Queue() self.recognizer = MockRecognizer() self.consumer = AudioConsumer( self.loop.state, self.queue, self.loop, MycroftSTT(), LocalRecognizer(self.loop.wakeup_recognizer.key_phrase, self.loop.wakeup_recognizer.phonemes, "1e-16"), self.loop.mycroft_recognizer)
def setUp(self): self.loop = RecognizerLoop() self.queue = Queue() self.recognizer = MockRecognizer() self.consumer = AudioConsumer( self.loop.state, self.queue, self.loop, LocalRecognizer(self.loop.wakeup_recognizer.key_phrase, self.loop.wakeup_recognizer.phonemes, "1e-16"), self.loop.mycroft_recognizer, RemoteRecognizerWrapperFactory.wrap_recognizer( self.recognizer, 'google'))
def __init__(self, samp_rate): self.ww_recognizer = LocalRecognizer(samp_rate, 'en-us') self.listener = ResponsiveRecognizer(self.ww_recognizer) speech_logger.setLevel(100) # Disables logging to clean output
def create_wakeup_recognizer(rate, lang): return LocalRecognizer("wake up", "W EY K . AH P", 1e-10, rate, lang)
def create_mycroft_recognizer(self, rate, lang): wake_word = self.config.get('wake_word') LOG.debug("Using wake word %s" % wake_word) phonemes = self.config.get('phonemes') threshold = self.config.get('threshold') return LocalRecognizer(wake_word, phonemes, threshold, rate, lang)
def create_wakeup_recognizer(self, rate, lang): wake_word = self.config.get('standup_word', "wake up") phonemes = self.config.get('standup_phonemes', "W EY K . AH P") threshold = self.config.get('standup_threshold', 1e-10) return LocalRecognizer(wake_word, phonemes, threshold, rate, lang)
def create_mycroft_recognizer(self, rate, lang): # Create a local recognizer to hear the wakeup word, e.g. 'Hey Mycroft' wake_word = self.config.get('wake_word') phonemes = self.config.get('phonemes') threshold = self.config.get('threshold') return LocalRecognizer(wake_word, phonemes, threshold, rate, lang)
def create_mycroft_recognizer(rate, lang): wake_word = listener_config.get('wake_word') phonemes = listener_config.get('phonemes') threshold = listener_config.get('threshold') return LocalRecognizer(wake_word, phonemes, threshold, rate, lang)
def setUp(self): self.recognizer = LocalRecognizer()
def create_wakeup_recognizer(rate, lang): return LocalRecognizer("wake up", "1e-10", rate, lang)
def create_mycroft_recognizer(rate, lang): return LocalRecognizer("hey mycroft", "1e-90", rate, lang)