class GlobalRegistry(name, description=None, context=None, engine=None, **kwargs)

Bases: dragonfluid._grammars.RegistryGrammar

The GlobalRegistry is a RegistryGrammar with a single globally shared Registry. It can be used as the Grammar object across many files, allowing the rules to know about each other for chaining.

__init__(name, description=None, context=None, engine=None, **kwargs)
class RegistryGrammar(name, registry=None, **kwargs)

Bases: dragonfly.grammar.grammar_base.Grammar

A RegistryGrammar is like a normal Grammar object, except it registers and unregisters RegisteredRule‘s as they are activated and deactivated, maintaining a registry of those that are currently active.

ContinuingRule‘s that are added to this grammar will automatically use this object’s registry when seeking out commands embedded in utterances.

__init__(name, registry=None, **kwargs)
  • name – Passed to dragonfly Grammar
  • registry (Registry) – The Registry object that serves as the active Registration list. It may be shared across RegistryGrammar instances. If None, a local Registry object is created.
  • **kwargs – Passed safely to dragonfly Grammar
class Registry(literal_tags=['English', 'english', 'literal'], override_tags=False)

A registry maintains information about a set of known active rules and the literal tags that must precede their intros when their commands are meant as free speech dictation.

Working directly with a Registry object is an advanced use case.

A registry exposes services regarding inspection and parsing of utterances as it relates to its literal tags and currently actively registered commands.

__init__(literal_tags=['English', 'english', 'literal'], override_tags=False)
  • literal_tags (string list) – These words will function as literalization markers to indicate that what follows is not a command, but rather free speech dictation.
  • override_tags (bool) – If False, the literal_tags supplied to __init__ will be added to the defaults, otherwise they will replace them.

Returns True if the string supplied is an initial substring of a registered intro, assuming only full words are supplied.

Parameters:command_intro (string) – A command intro to test for registration.
Returns:True if registered, False otherwise
Return type:bool

Adds the rule to a list of known active rules. Not generally called directly by users. For more information see the registration concept section.


Returns True if the iterable of strings begins with the words of a registered command.


Returns a list of words, stripped of literal tags in a semantically meaningful way. Final isolated literal_tag’s are stripped.

When a literal_tag precedes a literal_tag, the second occurrence only is retained.

In a string of all literal_tag’s, exactly the odd indexed ones (in a 0-indexed sense) would be returned.


Removes the rule from the list of known active rules. Not generally called directly by users.