12345678910111213141516171819202122232425262728293031323334 |
- # This is part of Kaylee
- # -- this code is licensed GPLv3
- # Copyright 2015-2016 Clayton G. Hobbs
- # Portions Copyright 2013 Jezra
-
- from abc import ABCMeta, abstractmethod
-
-
- class PluginBase(metaclass=ABCMeta):
- """Base class for Kaylee plugins
-
- Each Kaylee plugin module must define a subclass of this class, named
- ``Plugin``.
- """
-
- def __init__(self, config):
- """Initialize the plugin
-
- All strings to be included in the corpus should be elements of
- ``corpus_strings`` by the end of __init__'s execution. Note however
- that the words required for number support are automatically included,
- so they need not be listed explicitly on a per-plugin basis.
- """
- self.config = config
- self.corpus_strings = set()
-
- @abstractmethod
- def recognizer_finished(self, recognizer, text):
- """Process a recognized voice command
-
- This method must return True if the command was handled by the plugin,
- and False otherwise.
- """
- pass
|