Skip to main content

Dragonfly command API

Project description

Breathe Build Status

A convenient API for creating dragonfly grammars with automatic CCR (continuous command recognition).

  • Very quick start-up
  • Command activity can be controlled either using dragonfly contexts or using "enable" and "disable" commands.
  • All commands which match the current context may be chained together in any order in the same utterance.

Installation

pip install dfly-breathe

Example

from dragonfly import *
from breathe import Breathe, CommandContext

Breathe.add_commands(
    # Commands will be active either when we are editing a python file
    # or after we say "enable python". pass None for the commands to be global.
    context = AppContext(title=".py") | CommandContext("python"),
    mapping = {
        "for each"              : Text("for  in :") + Key("left:5"),
        "for loop"              : Text("for i in range():") + Key("left:2"),
        "from import"           : Text("from  import ") + Key("home, right:5"),
        "function"              : Text("def ():") + Key("left:3"),
        "(iffae | iffy)"        : Text("if :") + Key("left"),
        "iffae not"             : Text("if not :") + Key("left"),
        "import"                : Text("import "),
        "lambda"                : Text("lambda :") + Key("left"),
        "while loop"            : Text("while :") + Key("left"),
        "shell iffae"           : Text("elif :") + Key("left"),
        "shells"                : Text("else:"),
        "return"                : Text("return "),
        # ------------------------------------------------
        "method <snaketext>"    : Text("def %(snaketext)s(self):") + Key("left:2"),
        "function [<snaketext>]": Text("def %(snaketext)s():") + Key("left:2"),
        "selfie [<snaketext>]"  : Text("self.%(snaketext)s"),
        "pointer [<snaketext>]" : Text(".%(snaketext)s"),
        "classy [<classtext>]"  : Text("class %(classtext)s:") + Key("left"),
    },
    extras = [
        Dictation("snaketext", default="").lower().replace(" ", "_"),
        Dictation("classtext", default="").title().replace(" ", ""),
    ]
)

For full details of the available contexts, actions and extras you can use, see the dragonfly documentation.

Notes

  • If you are using the kaldi backend, you will need to set lazy_compilation=False in the get_engine function in your loader file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dfly-breathe-0.1.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distributions

dfly_breathe-0.1.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

dfly_breathe-0.1.1-py2-none-any.whl (5.6 kB view details)

Uploaded Python 2

File details

Details for the file dfly-breathe-0.1.1.tar.gz.

File metadata

  • Download URL: dfly-breathe-0.1.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for dfly-breathe-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f55b09a06d72608628f21ae49c12158773512ab61b716cbe538de2558a25cb54
MD5 ca75ff0d49c2a2c787a56faa01899076
BLAKE2b-256 7d21391b66f1143df48e8f482c7f2cf7e3b28077df23e9215b7396cb2fdaf6be

See more details on using hashes here.

File details

Details for the file dfly_breathe-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dfly_breathe-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for dfly_breathe-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 476c81b8cf3c6e697c3f90cd9c09feebdb3d33c4792a8cf33246049064f924ad
MD5 12eedb28791483c536a9cc8969157422
BLAKE2b-256 9f67681facf1024a96631b515c7fd2254c0bebcb97356a2b45500dc624b3d1fb

See more details on using hashes here.

File details

Details for the file dfly_breathe-0.1.1-py2-none-any.whl.

File metadata

  • Download URL: dfly_breathe-0.1.1-py2-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for dfly_breathe-0.1.1-py2-none-any.whl
Algorithm Hash digest
SHA256 6dde5f379f8f62508fef53cb59aea4254cf10bfe7c080f12f1b6f61c5d70b6ca
MD5 9f3630241af5d4f435b4db3b75b37e9a
BLAKE2b-256 550164532899748c0f9126c3013245e455475abfb64ae7cab7c5affdada8441b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page