karen.Skill

Class for inheriting to generate new skills. Includes basic functionality for generic skills.

__init__(self) special

Skill Initialization

ask(self, in_text, in_callback, timeout=0)

Encapsulates the frequently used function of "ask" in order to make it easier for new skill development. Makes self.ask() method available.

Parameters:
  • in_text (str) – The text to speak to start the question/answer phase.

  • in_callback (function) – The function to call when the subject responds.

  • timeout (int) – The length of time to wait for a response before giving up. A value of zero will wait forever.

Returns:
  • (bool) – True on success and False on failure.

getContentsFromVocabFile(self, filename)

Retrieves all text in the specified file beneath the vocab/locale folder.

Parameters:
  • filename (str) – Filename for the skill from which to read data.

Returns:
  • (str) – Full text of the specified file.

getMessageFromDialog(self, dialog_file, **args)

Retrieves a randomized line from the specified dialog file beneath the vocab/locale folder.

Parameters:
  • dialog_file (str) – Filename of the dialog for the skill from which to pull a response.

Returns:
  • (str) – Randomized string response from the specified dialog file.

initialize(self)

Function to be overridden in child classes. This function is where intents can be registered for the padatious runtime.

Returns:
  • (bool) – True on success or False on failure.

register_intent_file(self, filename, callback)

Registers an intent file with the Padatious neural network engine.

Parameters:
  • filename (str) – The file in the vocab/local folder whose contents should be registered.

  • callback (function) – The function to call when the determined intent matches this data set.

Returns:
  • (bool) – True on success and False on failure.

say(self, in_text)

Encapsulates the frequently used function of "say" in order to make it easier for new skill development. Makes self.say() method available.

Parameters:
  • in_text (str) – The text to speak to start the question/answer phase.

Returns:
  • (bool) – True on success and False on failure.

stop(self)

Method to stop any daemons created during startup/initialization for this skill.

Returns:
  • (bool) – True on success and False on failure