diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-26 16:58:07 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2014-09-26 16:58:07 +0200 |
| commit | cb0eb4742347c7d8c692342bc4c0e37a95ffaa51 (patch) | |
| tree | aef2f60d1f446f4ebd296f7c6597a2dca06747fb /client/brain.py | |
| parent | ba7df0c17b633e28502db384743856f050d934c0 (diff) | |
| parent | dd133d3738162e184f206d112ea4a39ba43f0781 (diff) | |
| download | jasper-client-cb0eb4742347c7d8c692342bc4c0e37a95ffaa51.tar.gz jasper-client-cb0eb4742347c7d8c692342bc4c0e37a95ffaa51.zip | |
Merge pull request #148 from alexsiri7/multiple_queries
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 1ed6db5..007b7fe 100644 --- a/client/brain.py +++ b/client/brain.py @@ -51,7 +51,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. @@ -60,13 +60,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 |
