diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-08-30 17:44:47 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-25 07:12:55 +0100 |
| commit | dd133d3738162e184f206d112ea4a39ba43f0781 (patch) | |
| tree | e1ac1e02cd601c1908d93bea974e19433297c958 /client/brain.py | |
| parent | ea3026c133755bf3e35ad78fa253786bc9ff7c36 (diff) | |
| download | jasper-client-dd133d3738162e184f206d112ea4a39ba43f0781.tar.gz jasper-client-dd133d3738162e184f206d112ea4a39ba43f0781.zip | |
Handle all Google Speech options
Diffstat (limited to 'client/brain.py')
| -rw-r--r-- | client/brain.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/client/brain.py b/client/brain.py index f2a2efd..f57331c 100644 --- a/client/brain.py +++ b/client/brain.py @@ -42,7 +42,7 @@ class Brain(object): modules.sort(key=lambda mod: mod.PRIORITY if hasattr(mod, 'PRIORITY') else 0, reverse=True) return modules - def query(self, text): + def query(self, texts): """ Passes user input to the appropriate module, testing it against each candidate module's isValid function. @@ -51,13 +51,14 @@ class Brain(object): text -- user input, typically speech, to be parsed by a module """ for module in self.modules: - if module.isValid(text): + for text in texts: - try: - module.handle(text, self.mic, self.profile) - break - except: - self._logger.error('Failed to execute module', exc_info=True) - self.mic.say( - "I'm sorry. I had some trouble with that operation. Please try again later.") - break + if module.isValid(text): + try: + module.handle(text, self.mic, self.profile) + return + except: + self._logger.error('Failed to execute module', exc_info=True) + self.mic.say( + "I'm sorry. I had some trouble with that operation. Please try again later.") + return |
