Grammar Crashes Dragon NaturallySpeaking
Submitted by wigsta on Mon, 03/03/2008 - 15:23.
Any help / advice / comments will be great.
Many thanks
Hi all
I am using a grammar that "listens for" spoken numbers. It works fine for single utterances however when I export the grammar using a "+" (repeated) for multiple utterances Dragon completely crashes (to the point where I have use the task list to kill it!). I often use the + for other grammars, which works fine. I dont understand why it crashes.
The following is the grammar I am using:
gramSpec="""
<expr> exported = (<number>)+
<1to99> = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 |
40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |
50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |
70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 |
80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 |
90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99;
<1to999> = <1to99> |
( 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19) hundred [ [and] <1to99> ];
<number> = 0 | <1to999> [
thousand [ [and] <1to999> ] |
million [ [and] <1to999> [ thousand [ [and] <1to999> ] ] ]
];
"""Any help / advice / comments will be great.
Many thanks



Hello,
Hello,
I elaborated on the _number.py grammar, after the example of Joel Gould, quite a while ago. See _number.py, it is in unimacro. So, please study this grammar of unimacro. Sorry there is a lot of Dutch in the source file, it is years ago I worked on it.
Remarks:
1. The repetition (+ sign) is tricky, recognition of 21 through 99 is also.
2. The numbers grammar trick is used in firefox browsing grammar all the time:
numbers rules in firefox browsing
3. The rule I used for repetition was:
So you say: number 23 number 35 number 57
Quintijn
Hi Quintijn Thank you for
Hi Quintijn
Thank you for your reply.
I tried using the rule you gave:
<numbers> exported = (number <number>)+;and it works perfectly. I am still confused as to why it crashes without the "number" in front. If I put <1to99>+ or <1to999>+ it doesnt crash.
I am quite interested in looking at the _number.py file. I only have NatLink and Vocola installed so I will install unimacro too.
Thanks again
Angela
I think >number<+ will get
I think <number>+ will get conflicts with built-in grammars, like the numbers module which NatSpeak has always on (numbers are also recognised when dictating text, remember?).
In general for specific tasks having a fixed "trigger" word, like "number" here seems to be quite convenient, both for NatSpeak as for yourself (for remembering the commands).
Quintijn