示例#1
0
    def create_wake_word_recognizer(self):
        # Create a local recognizer to hear the wakeup word, e.g. 'Hey Mycroft'
        LOG.info("creating wake word engine")
        word = self.config.get("wake_word", "hey mycroft")
        # TODO remove this, only for server settings compatibility
        phonemes = self.config.get("phonemes")
        thresh = self.config.get("threshold")

        # Since we're editing it for server backwards compatibility
        # use a copy so we don't alter the hash of the config and
        # trigger a reload.
        config = deepcopy(self.config_core.get("hotwords", {word: {}}))

        if word not in config:
            config[word] = {'module': 'precise'}
        if phonemes:
            config[word]["phonemes"] = phonemes
        if thresh:
            config[word]["threshold"] = thresh
        if phonemes is None or thresh is None:
            config = None
        return HotWordFactory.create_hotword(word,
                                             config,
                                             self.lang,
                                             loop=self)
示例#2
0
 def testInvalid(self):
     config = {
         'hey Zeds': {
             'module': 'pocketsphinx',
             'phonemes': 'ZZZZZZZZZ',
             'threshold': 1e-90
         }
     }
     p = HotWordFactory.create_hotword('hey Zeds', config)
     self.assertEqual(p.phonemes, 'HH EY . M AY K R AO F T')
     self.assertEqual(p.key_phrase, 'hey mycroft')
 def testInvalid(self):
     config = {
         'hey Zeds': {
             'module': 'pocketsphinx',
             'phonemes': 'ZZZZZZZZZ',
             'threshold': 1e-90
         }
     }
     p = HotWordFactory.create_hotword('hey Zeds', config)
     self.assertEquals(p.phonemes, 'HH EY . M AY K R AO F T')
     self.assertEquals(p.key_phrase, 'hey mycroft')
示例#4
0
 def testVictoria(self):
     config = {
         'hey victoria': {
             'module': 'pocketsphinx',
             'phonemes': 'HH EY . V IH K T AO R IY AH',
             'threshold': 1e-90
         }
     }
     p = HotWordFactory.create_hotword('hey victoria', config)
     config = config['hey victoria']
     self.assertEqual(config['phonemes'], p.phonemes)
     self.assertEqual(p.key_phrase, 'hey victoria')
示例#5
0
 def testDefault(self):
     config = {
         'hey mycroft': {
             'module': 'pocketsphinx',
             'phonemes': 'HH EY . M AY K R AO F T',
             'threshold': 1e-90
         }
     }
     p = HotWordFactory.create_hotword('hey mycroft', config)
     config = config['hey mycroft']
     self.assertEqual(config['phonemes'], p.phonemes)
     self.assertEqual(config['threshold'], p.threshold)
 def testVictoria(self):
     config = {
         'hey victoria': {
             'module': 'pocketsphinx',
             'phonemes': 'HH EY . V IH K T AO R IY AH',
             'threshold': 1e-90
         }
     }
     p = HotWordFactory.create_hotword('hey victoria', config)
     config = config['hey victoria']
     self.assertEquals(config['phonemes'], p.phonemes)
     self.assertEquals(p.key_phrase, 'hey victoria')
 def testDefault(self):
     config = {
         'hey mycroft': {
             'module': 'pocketsphinx',
             'phonemes': 'HH EY . M AY K R AO F T',
             'threshold': 1e-90
         }
     }
     p = HotWordFactory.create_hotword('hey mycroft', config)
     config = config['hey mycroft']
     self.assertEquals(config['phonemes'], p.phonemes)
     self.assertEquals(config['threshold'], p.threshold)
示例#8
0
    def create_wake_word_recognizer(self):
        """Create a local recognizer to hear the wakeup word

        For example 'Hey Mycroft'.

        The method uses the hotword entry for the selected wakeword, if
        one is missing it will fall back to the old phoneme and threshold in
        the listener entry in the config.

        If the hotword entry doesn't include phoneme and threshold values these
        will be patched in using the defaults from the config listnere entry.
        """
        LOG.info('Creating wake word engine')
        word = self.config.get('wake_word', 'hey mycroft')

        # TODO remove this, only for server settings compatibility
        phonemes = self.config.get('phonemes')
        thresh = self.config.get('threshold')

        # Since we're editing it for server backwards compatibility
        # use a copy so we don't alter the hash of the config and
        # trigger a reload.
        config = deepcopy(self.config_core.get('hotwords', {}))
        if word not in config:
            # Fallback to using config from "listener" block
            LOG.warning('Wakeword doesn\'t have an entry falling back'
                        'to old listener config')
            config[word] = {'module': 'precise'}
            if phonemes:
                config[word]['phonemes'] = phonemes
            if thresh:
                config[word]['threshold'] = thresh
            if phonemes is None or thresh is None:
                config = None
        else:
            LOG.info('Using hotword entry for {}'.format(word))
            if 'phonemes' not in config[word]:
                LOG.warning('Phonemes are missing falling back to listeners '
                            'configuration')
                config[word]['phonemes'] = phonemes
            if 'threshold' not in config[word]:
                LOG.warning('Threshold is missing falling back to listeners '
                            'configuration')
                config[word]['threshold'] = thresh

        return HotWordFactory.create_hotword(word,
                                             config,
                                             self.lang,
                                             loop=self)
示例#9
0
 def create_wake_word_recognizer(self):
     # Create a local recognizer to hear the wakeup word, e.g. 'Hey Mycroft'
     LOG.info("creating wake word engine")
     word = self.config.get("wake_word", "hey mycroft")
     # TODO remove this, only for server settings compatibility
     phonemes = self.config.get("phonemes")
     thresh = self.config.get("threshold")
     config = self.config_core.get("hotwords", {word: {}})
     if phonemes:
         config[word]["phonemes"] = phonemes
     if thresh:
         config[word]["threshold"] = thresh
     if phonemes is None or thresh is None:
         config = None
     return HotWordFactory.create_hotword(word, config, self.lang)
示例#10
0
 def create_wake_word_recognizer(self):
     # Create a local recognizer to hear the wakeup word, e.g. 'Hey Mycroft'
     LOG.info("creating wake word engine")
     word = self.config.get("wake_word", "hey mycroft")
     # TODO remove this, only for server settings compatibility
     phonemes = self.config.get("phonemes")
     thresh = self.config.get("threshold")
     config = self.config_core.get("hotwords", {word: {}})
     if word not in config:
         config[word] = {}
     if phonemes:
         config[word]["phonemes"] = phonemes
     if thresh:
         config[word]["threshold"] = thresh
     if phonemes is None or thresh is None:
         config = None
     return HotWordFactory.create_hotword(word, config, self.lang)
示例#11
0
 def create_wakeup_recognizer(self):
     LOG.info("creating stand up word engine")
     word = self.config.get("stand_up_word", "wake up")
     return HotWordFactory.create_hotword(word, lang=self.lang)
示例#12
0
 def create_wakeup_recognizer(self):
     LOG.info("creating stand up word engine")
     word = self.config.get("stand_up_word", "wake up")
     return HotWordFactory.create_hotword(word, lang=self.lang)