Danesprite on master
Remove unnecessary install requ… (compare)
Danesprite on major
Remove multiple engine options … Remove the dragonfly.util sub-p… Make dragonfly.accessibility su… (compare)
Danesprite on master
Clarify sections of the documen… (compare)
Danesprite on major
Remove dragonfly.rpc sub-packag… (compare)
Danesprite on master
Update sections of the document… (compare)
Danesprite on master
Remove unused test suite module (compare)
Danesprite on minor
Fix Kaldi marking of whether re… Add Kaldi optional local or onl… Update Kaldi version, to fix er… and 32 more (compare)
Danesprite on major
Remove training mode from the S… Remove built-in sleep/wake mode… (compare)
Danesprite on talon-dev
Danesprite on master
Add missing documentation file … (compare)
Danesprite on 0.35.0
Danesprite on master
Update changelog Update to version 0.35.0 Pleas… (compare)
pip install natlink --upgrade
and using thenatlinkconfig_cli
as needed. Since the user directory was set I didn't have to reset it. It is a heck of a lot easier then utilizing the old way. So it's up to you.
@LexiconCode Formatting is done after observer events. To do it yourself, pass the unformatted words list to Dragonfly's DNS dictation word formatter classes:
from dragonfly.engines.backend_natlink.dictation_format import WordFormatter
words = "\\all-caps\\All-Caps hello world".split()
formatter = WordFormatter()
formatted_output = formatter.format_dictation(words)
print(formatted_output)
There are more examples in the doctests: https://dragonfly2.readthedocs.io/en/latest/test_word_formatting_v11_doctest.html
This is not done for integers. IIRC DNS does not provide this information to client applications. You need to pass the words through Dragonfly's integer content classes for that.
@LexiconCode Formatting is done after observer events. To do it yourself, pass the unformatted words list to Dragonfly's DNS dictation word formatter classes:
from dragonfly.engines.backend_natlink.dictation_format import WordFormatter words = "\\all-caps\\All-Caps hello world".split() formatter = WordFormatter() formatted_output = formatter.format_dictation(words) print(formatted_output)
There are more examples in the doctests: https://dragonfly2.readthedocs.io/en/latest/test_word_formatting_v11_doctest.html
This is not done for integers. IIRC DNS does not provide this information to client applications. You need to pass the words through Dragonfly's integer content classes for that.
This solves formatting the problem of free dictation with DNS and commands are not a problem. However the dictation element remains troublesome. The purpose of displaying things on a HUD would be what you see is what you got for output on the screen. If any formatting has been applied to a dictation element it of course does not show as it's not applied yet. Any thoughts to overcome the issue with dictation elements?
Did you ever try the nsformat module in natlinkcore? This was originally written by Joel Gould, to solve the formatting of the <dgndictation> imported rule
@quintijn That's an interesting thought as I'm already importing DNS the specific code so why not Natlink directly. Thank you.
@LexiconCode : I checked nsformat.py with unittestNsformat.py. One failure, that was in 2010 already a failure. I did only commit to "makeflitinstall". If you want an extra release, I will make it...
When you get a chance it would be good. It's a bit more reliable specifically with the 1st letter in a sentence compared to dragonfly's formater
Hello! I'm new to this chat and first off wanted to thank everyone who has contributed to the dragonfly toolbox or shared their command modules – I'm a researcher and after a bad case of RSI would have been pretty screwed without some way to code by voice. Seriously, thank you! I've recently been trying to find/develop more command modules (right now I'm mostly using _vim and _multiedit) but I'm not a developer and am running into a few issues.
For example, I can't get _bringme to pull up a specific folder (https://github.com/simianhacker/code-by-voice/blob/master/macros/_bringme.py). It works fine for websites and for opening documents but not for opening folders. I'm also on the hunt for a command module to use with slack (for whatever reason my set up fails miserably in this app) – if anyone has a lead it would be much appreciated.
Not sure if this is the best place to post these questions – if there is another forum geared towards more basic questions please let me know!
Hello Rebecca and welcome! Sorry to hear about the RSI. It can be very painful and frustrating. Glad you've found your way here.
For opening folders using the _bringme.py module, I have managed to get it working. As the module's documentation specifies, you need to add folder entries to the configuration. However, the author is slightly wrong about the use of the r in front of the open-quote. This doesn't work for strings ending with backslashes, e.g. "C:\"
.
Try the following targets.mapping
entries in your configuration:
"my local folder": folder(r"C:"), # Without a backslash.
"program files": folder(r"C:\Program Files"),
"macro system": folder(r"C:\Natlink\Natlink\MacroSystem"),
the commands in that grammer do not really look like slack to me
I have a slack grammar but I am using caster rather than dragonfly so if I shared the whole file it would not work for you. And I'm not familiar with setting up dragonfly only files
I replaced the commands in that file with my own, which should work but I have not tested it
control slash in Slack brings up the list of shortcuts so you can map any commands you want
from dragonfly import (Grammar, AppContext, MappingRule, Integer, Key, Text, Dictation, Repeat)
from supporting import utils
class SlackMapping(MappingRule):
mapping = {
"next [message]": Key("as-down"),
"prior [message]": Key("as-up"),
"open channel": Key("c-k"),
"next channel [<n>]": Key("a-down/15") Repeat(extra="n"),
"prior channel [<n>]": Key("a-up/15") Repeat(extra="n"),
"keyboard": Key("c-slash"),
"info": Key("cs-i"),
"jump": Key("c-j"),
"attach file": Key("c-u"),
"edit last [message]": Key("c-up"),
"code block": Key("cas-c"),
"quit slack": Key("c-q"),
}
extras=[
Integer("n", 1, 50),
Integer("number", 1, 9999),
Dictation("text"),
]
defaults = {
"n": 1,
}
context = AppContext(executable="slack")
slack_grammar = Grammar("Slack Grammar", context=context)
slack_grammar.add_rule(SlackMapping())
slack_grammar.load()
def unload():
global slack_grammar
slack_grammar= utils.unloadHelper(slack_grammar, name)
I also think I figured out which of my other grammars was screwing things up – it seems like the "release" function in multiedit somehow selects the menu in the upper left corner. No idea why. Not sure how to get around this. I tried just getting rid of the "release +" part preceding Key() but it seems "release" is maybe built into the grammar (i.e. line 268 here: https://github.com/t4ngo/dragonfly-modules/blob/master/command-modules/_multiedit.py).
There are some comments in the code that you might experiment with related to releasing the keys https://github.com/dictation-toolbox/dragonfly/blob/0a0eae5668baa0f5953972d5c9b5692f6c246309/dragonfly/actions/action_key.py. One thing I would recommend experimenting with is adding a pause before In and see it makes any difference sometimes there's timing issues. Rather than releasing X modifier you could really release all modifier keys without issues. Key("shift:up, ctrl:up, alt:up, win:up").execute()
makes it a bit simpler instead of keeping track for every key that's been pressed.
anyone have a good idea of how to have "1" be the default optional value in continous combined commands but have it be non-optional and required for single action commands?
I would also be curious in this as well as I hope to migrate the Caster repository leveraging Kim's method Utter Command's Human-Machine Grammar. However I don't think it's possible to do that dynamically.
python -m dragonfly load _*.py --engine kaldi --engine-options " \ auto_add_to_user_lexicon=False"
usage: python -m dragonfly load [-h] [-e ENGINE] [-o ENGINE_OPTIONS]
[--language LANGUAGE] [-n]
[--no-recobs-messages]
[-l {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [-q]
[file [file ...]]
python -m dragonfly load: error: argument -o/--engine-options: invalid _engine_options_string value: ' \\ auto_add_to_user_lexicon=False'
Does not work either --engine-options "auto_add_to_user_lexicon=False"
Im trying to write a dragonfly command using a function with the clipboard toolkit but Im having some trouble. I want to 1) backup whatever is already on the clipboard 2) copy a new line of text that my cursor is in to the clipboard to read and manipulate it (print for now) 3) then return original backed up content to system clipboard. I tried to use the examples in the docs, but these wont work:
original = Clipboard(from_system=True)
print(original.get_system_text())
Key("home, s-down, c-c").execute() # fails override system clipboard
clipboard = Clipboard(from_system=True) # Retrieve from system clipboard.
current_line = clipboard.get_system_text()
print(current_line)
original.copy_to_system()
Weirdly enough, this seems to work every other time, it fails, works, then fails again. Or so it seems to me:
original = Clipboard(from_system=True)
print(original.get_system_text())
clipboard = Clipboard() # Create empty instance.
Key("home, s-down, c-c").execute() # mostly fails to override system clipboard
clipboard.copy_from_system() # Retrieve from system clipboard.
current_line = clipboard.get_system_text()
print(current_line)
original.copy_to_system()
prior_content = Clipboard.get_system_text()
) instead of the specific instance cb with from_system=True (cb = Clipboard(from_system=True)
) created earlier? Also should I always set the system_text to an empty string (Clipboard.set_system_text("")
) before trying to overwrite clipboard contents? What does that do? Thanks for the help!