Engines sub-package

Dragonfly supports multiple speech recognition engines as its backend. The engines sub-package implements the interface code for each supported engine.

EngineBase class

The dragonfly.engines.engine_base.EngineBase class forms the base class for this specific speech recognition engine classes. It defines the stubs required and performs some of the logic necessary for Dragonfly to be able to interact with a speech recognition engine.

class EngineBase[source]

Base class for engine-specific back-ends.


Connect to back-end SR engine.


Context manager for a connection to the back-end SR engine.


Disconnect from back-end SR engine.


Current user language of the SR engine.


Mimic a recognition of the given words.


The human-readable name of this engine.


Speak the given text using text-to-speech.

Dictation container classes

Dictation container base class

This class is used to store the recognized results of dictation elements within voice-commands. It offers access to both the raw spoken-form words and be formatted written-form text.

The formatted text can be retrieved using format() or simply by calling str(...) on a dictation container object. A tuple of the raw spoken words can be retrieved using words.

class DictationContainerBase(words)[source]

Container class for dictated words as recognized by the Dictation element.

This base class implements the general functionality of dictation container classes. Each supported engine should have a derived dictation container class which performs the actual engine- specific formatting of dictated text.

A dictation container is created by passing it a sequence of words as recognized by the backend SR engine. Each word must be a Unicode string.

Parameters:words (sequence-of-unicode) – A sequence of Unicode strings.

Format and return this dictation as a Unicode object.


Sequence of the words forming this dictation.