Somewhat fancy voice command recognition software
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

pluginbase.py 1.0KB

12345678910111213141516171819202122232425262728293031323334
  1. # This is part of Kaylee
  2. # -- this code is licensed GPLv3
  3. # Copyright 2015-2016 Clayton G. Hobbs
  4. # Portions Copyright 2013 Jezra
  5. from abc import ABCMeta, abstractmethod
  6. class PluginBase(metaclass=ABCMeta):
  7. """Base class for Kaylee plugins
  8. Each Kaylee plugin module must define a subclass of this class, named
  9. ``Plugin``.
  10. """
  11. def __init__(self, config):
  12. """Initialize the plugin
  13. All strings to be included in the corpus should be elements of
  14. ``corpus_strings`` by the end of __init__'s execution. Note however
  15. that the words required for number support are automatically included,
  16. so they need not be listed explicitly on a per-plugin basis.
  17. """
  18. self.config = config
  19. self.corpus_strings = set()
  20. @abstractmethod
  21. def recognizer_finished(self, recognizer, text):
  22. """Process a recognized voice command
  23. This method must return True if the command was handled by the plugin,
  24. and False otherwise.
  25. """
  26. pass