t4ngo / dragonfly

ARCHIVED! - Speech recognition framework allowing powerful Python-based scripting and extension of Dragon NaturallySpeaking (DNS) and Windows Speech Recognition (WSR)
GNU Lesser General Public License v3.0
364 stars 82 forks source link

Rules only added by RuleRefs are globally enabled #31

Closed jgarvin closed 9 years ago

jgarvin commented 9 years ago

Using the natlink backend w/ DNSv12, if you add a rule X to a grammar that depends on another rule Y via RuleRef, then Y will be recognized by itself. So for example if X has the phrase "hello " and Y has the phrase "(foo | bar)", saying just "foo" will fire, even though only X was added to the grammar. You can workaround this by disabling Y after loading the grammar containing (now Y by itself won't be recognized but X still will). I don't know if this is intended behavior but I don't consider it intuitive and if it is intended perhaps should be documented.

t4ngo commented 9 years ago

Y is automatically added to the grammar of X because X depends on it. That is intended behavior because otherwise the grammar couldn't be loaded.

Whether in your example Y can be recognized by itself depends on whether Y is "exported" or not. See http://dragonfly.readthedocs.org/en/latest/object_model.html#exported-rules for more info on that.