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()[source]

Connect to back-end SR engine.

connection()[source]

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

disconnect()[source]

Disconnect from back-end SR engine.

language

Current user language of the SR engine.

mimic(words)[source]

Mimic a recognition of the given words.

name

The human-readable name of this engine.

speak(text)[source]

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()[source]

Format and return this dictation as a Unicode object.

words

Sequence of the words forming this dictation.