some help with a script for vscode?

31 views
Skip to first unread message

Sam

unread,
May 30, 2019, 3:24:11 PM5/30/19
to Dragonfly Speech Recognition
I'm making a grammar file for vscode and need some help to get over a roadblock

Code is in this paste https://pastebin.com/1F4r9mRH

If you check line 98, it works the first time around but when I say 'jump to 127' again it just types out 'jump to 127', is there any way I can avoid this and have dragon accept this as a command only?

Thanks, Sam

dwk

unread,
May 30, 2019, 3:40:21 PM5/30/19
to dragonf...@googlegroups.com
You could try setting Dragon to command-only mode instead of command+dictation mode. Not sure about your setup, but aenea also has a little client that can capture typed text and reinterpret it as a command. Otherwise, try using a different sequence of words. Sorry to be of such little help.

David

--
You received this message because you are subscribed to the Google Groups "Dragonfly Speech Recognition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dragonflyspee...@googlegroups.com.
To post to this group, send email to dragonf...@googlegroups.com.
Visit this group at https://groups.google.com/group/dragonflyspeech.
To view this discussion on the web visit https://groups.google.com/d/msgid/dragonflyspeech/39d34078-cf17-4f4f-b5c8-24d8b1230377%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

.

unread,
May 30, 2019, 3:43:52 PM5/30/19
to dragonf...@googlegroups.com
Well as far as you can see, it's done correctly, I'm just running into a naming issue somewhere?
Thanks.

Hawkeye Parker

unread,
May 31, 2019, 1:34:07 PM5/31/19
to Dragonfly Speech Recognition
Here's how I do it:


You have to say the numbers one by one, so: 'show line one two five' to get to line 125. I remember having a little trouble getting this to work.


On Thursday, May 30, 2019 at 12:43:52 PM UTC-7, . wrote:
Well as far as you can see, it's done correctly, I'm just running into a naming issue somewhere?
Thanks.

On Thu, May 30, 2019 at 2:40 PM dwk <dwk...@gmail.com> wrote:
You could try setting Dragon to command-only mode instead of command+dictation mode. Not sure about your setup, but aenea also has a little client that can capture typed text and reinterpret it as a command. Otherwise, try using a different sequence of words. Sorry to be of such little help.

David

On Thu, May 30, 2019, 3:24 PM Sam <syf...@gmail.com> wrote:
I'm making a grammar file for vscode and need some help to get over a roadblock

Code is in this paste https://pastebin.com/1F4r9mRH

If you check line 98, it works the first time around but when I say 'jump to 127' again it just types out 'jump to 127', is there any way I can avoid this and have dragon accept this as a command only?

Thanks, Sam

--
You received this message because you are subscribed to the Google Groups "Dragonfly Speech Recognition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dragonf...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Dragonfly Speech Recognition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dragonf...@googlegroups.com.

.

unread,
May 31, 2019, 2:46:13 PM5/31/19
to dragonf...@googlegroups.com
Thanks for that, I read something in the docs that makes it easier to say numbers in the way we're expecting, if you reply/respond a bit later i'll look it up and hopefully figure it out, sorry i'm at work right now.

To unsubscribe from this group and stop receiving emails from it, send an email to dragonflyspee...@googlegroups.com.

To post to this group, send email to dragonf...@googlegroups.com.
Visit this group at https://groups.google.com/group/dragonflyspeech.

Sam

unread,
May 31, 2019, 3:13:19 PM5/31/19
to Dragonfly Speech Recognition
found it (shortintegerref) nevermind the others unless they're useful to you


navigation = MappingRule(
    name="navigation",
    mapping={
             "jump to <num>":       Key("c-g") + Text("%(num)d") + Key("enter"),
             #"go to <text>":      Key("c-p/200") + Text("%(text)s") + Key("enter"),
             "show problems":      Key("cs-m"),
             "show next error":    Key("f8"),
             "show previous error":Key("s-f8"),
             "cursor back":        Key("a-right"),
             "cursor forward":     Key("a-left"),
            },
    extras=[
            IntegerRef("n", 1, 9999),
            Dictation("text"),
            ShortIntegerRef("num", 0, 1000),
           ]
    )

Caspar

unread,
Jun 6, 2019, 12:52:25 AM6/6/19
to Dragonfly Speech Recognition
Bit late here but just wanted to add a couple things:

1. It's definitely easier to always develop your first prototypes of grammars in command-only mode. Say "switch to command mode" and "stop command mode" to toggle on/off.

2. If you try using ShortIntegerRef, make sure you're using Dragonfly2, i.e. dragonfly2 package on pypi, which comes from https://github.com/dictation-toolbox/dragonfly . The old dragonfly package has been unmaintained for a couple years and ShortIntegerRef was added just 2 months ago.

3. Make sure you give your elements unique names - in your sample of https://pastebin.com/1F4r9mRH , you have both an Integer and an IntegerRef element which are both named "n" - only one of them will actually be used (I'd guess the last one, but haven't checked).

4. If in doubt about whether you're saying a long number like 141 correctly (e.g. "is it one four one or one hundred forty one or hundred forty one?"), you can generally figure out the answer by looking at Dragonfly's code - there's nothing special about these elements, as they're just composed of "mini mapping rules" themselves: https://github.com/dictation-toolbox/dragonfly/blob/c8ebb79198fdbba719790236cb830e29701ec4a7/dragonfly/language/en/short_number.py (of course for ShortIntegerRef there is also explicit docs: https://dragonfly2.readthedocs.io/en/latest/language.html#shortintegerref ).

If you're still struggling with this, drop by the gitter channel and someone should be able to help you out: https://gitter.im/dictation-toolbox/dragonfly

.

unread,
Jun 6, 2019, 1:21:54 AM6/6/19
to dragonf...@googlegroups.com
It seems to be working as expected now, I appreciate the response, I'll be sure to look out for the duplicate names as well, thanks.

--
You received this message because you are subscribed to the Google Groups "Dragonfly Speech Recognition" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dragonflyspee...@googlegroups.com.
To post to this group, send email to dragonf...@googlegroups.com.
Visit this group at https://groups.google.com/group/dragonflyspeech.
Reply all
Reply to author
Forward
0 new messages