Git Product home page Git Product logo

Comments (6)

dylan-chong avatar dylan-chong commented on July 17, 2024

OK oops part of the problem was caused by the grammar is not getting reloaded for some reason. There goes several hours of my day!

But anyway, the problem is still there. but i have been able to replicate it with a different piece of code.

So this is the new code that reproduces the bug.

So when I say this should not get typed, some stuff should be printed to the nat link console and that's it. This behaves as expected.

But when I say should not get typed, my host os types out wtf this should not get typed. Why does this happen? The grammar spec says that I have to have first the word this before saying should not get typed. Where does the Text even get executed?

import aenea.config
import aenea.configuration

from aenea.proxy_contexts import ProxyAppContext

from dragonfly import (
    AppContext,
    CompoundRule,
    Grammar,
    MappingRule,
    RuleRef,
)

from aenea import (
    Text,
)


def load():
    global git_grammar
    context = aenea.wrappers.AeneaContext(
        ProxyAppContext(
            match='regex',
            app_id='(?i)(?:(?:DOS|CMD).*)|(?:.*(?:TERM|SHELL).*)',
        ),
        AppContext(title='git'),
    )
    git_grammar = Grammar('git', context=context)

    git_grammar.add_rule(GitRule())
    git_grammar.load()


def unload():
    global git_grammar
    if git_grammar:
        git_grammar.unload()
    git_grammar = None



class GitRule(CompoundRule):
    def __init__(self):
        super(GitRule, self).__init__(
            spec='this [<command_with_options>]',
            extras=[
                RuleRef(
                    name='command_with_options',
                    rule=MappingRule(
                        name='command',
                        mapping={
                            'should not get typed':
                            Text('wtf this should not get typed')
                        }
                    ),
                )
            ],
        )

    def _process_recognition(self, node, extras):
        print('_process_recognition', extras)


load()

from aenea.

calmofthestorm avatar calmofthestorm commented on July 17, 2024

I have a theory of what may be going on here, though I'm not confident in it.

As far as I can tell, based only on my experience rather than concrete cited resources, Dragon takes the grammar structure into account when determining what words you sad. That is to say, rather than first processing the audio into words (analogous to lexing), and then in a separate pass parsing those words according to the grammars in effect, Dragon uses information from the grammar to assist with the lexing.

So for example, suppose you were in command mode, with only a single grammar active. This grammar consisted of two rules: one is you saying "red" and the other "blue". In my experience, Dragon will try very, very hard to match pretty much everything you say to either "red" or "blue".

This is less pronounced when in Normal mode, since Dragon always has the "alternate" hypothesis that you were dictating normal words.

So what I think may be going on here, is that you have few rules active, are in command mode, and say "should not get typed" without "this". Dragon tries to match that to something, and the best guess it has is that it simply didn't hear the "this".

Just some thoughts, I could be way off base. Issues like this seem unlikely to be a bug in Aenea (or even Dragonfly), but I'm fine with making this issue tracker available for their discussion.

from aenea.

dylan-chong avatar dylan-chong commented on July 17, 2024

from aenea.

dylan-chong avatar dylan-chong commented on July 17, 2024

from aenea.

dylan-chong avatar dylan-chong commented on July 17, 2024

I'll report back with what happens over at the dragonfly repo

from aenea.

dylan-chong avatar dylan-chong commented on July 17, 2024

Moved issue to here t4ngo/dragonfly#71

from aenea.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.