Dragonfly command API
Project description
Breathe
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 theget_engine
function in your loader file.
Project details
Release history Release notifications | RSS feed
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.3.tar.gz
(7.5 kB
view hashes)
Built Distributions
Close
Hashes for dfly_breathe-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e21228eda7bc3ee4525d57a6a4a5078781899bf28bab0d7b253f7fbf793a909e |
|
MD5 | e1c1c108cbdd7d884fc77536fb8eabe1 |
|
BLAKE2b-256 | 48690b5c1d70125cc91f835d6fb04f29b5740f5104904441895604ed9098abff |
Close
Hashes for dfly_breathe-0.1.3-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6b5a3406390c3689d4784ce015fefdff60f09667f0a8b627db693361e9d161b |
|
MD5 | e074f2ba1c9b74bb4771b1513f1d31d3 |
|
BLAKE2b-256 | 0b726f9d762b3edec3e3e88ef6db07d26154d6d17dc5173cad6761fdaf572c45 |