Somewhat fancy voice command recognition software
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pluginbase.py 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  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``. These obviously must provide concrete implementations of all
  10. abstract methods defined here.
  11. """
  12. def __init__(self, config):
  13. """Initialize the plugin
  14. All strings to be included in the corpus should be elements of
  15. ``corpus_strings`` by the end of __init__'s execution. Note however
  16. that the words required for number support are automatically included,
  17. so they need not be listed explicitly on a per-plugin basis.
  18. """
  19. self.config = config
  20. self.corpus_strings = set()
  21. @abstractmethod
  22. def recognizer_finished(self, recognizer, text):
  23. """Process a recognized voice command
  24. This method must return True if the command was handled by the plugin,
  25. and False otherwise.
  26. """
  27. pass