KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Macros to simulate the spell dialogue
Topic Summary: An example of dimensioning a string array
Created On: 03/16/2021 11:05 AM
Status: Post and Reply
Linear : Threading : Single : Branch
 Macros to simulate the spell dialogue   - Edgar - 03/16/2021 11:05 AM  
 Macros to simulate the spell dialogue   - dilligence - 03/16/2021 06:50 PM  
 Macros to simulate the spell dialogue   - kkkwj - 03/16/2021 10:19 PM  
 Macros to simulate the spell dialogue   - Edgar - 03/17/2021 11:16 AM  
 Macros to simulate the spell dialogue   - kkkwj - 03/17/2021 12:28 PM  
 Macros to simulate the spell dialogue   - Edgar - 03/17/2021 07:54 PM  
 Macros to simulate the spell dialogue   - kkkwj - 03/17/2021 08:20 PM  
 Macros to simulate the spell dialogue   - Edgar - 03/18/2021 10:47 AM  
 Macros to simulate the spell dialogue   - drrunev - 03/24/2021 08:18 AM  
 Macros to simulate the spell dialogue   - Edgar - 05/04/2021 12:53 PM  
 Macros to simulate the spell dialogue   - TomDonovan - 05/04/2021 03:04 PM  
 Macros to simulate the spell dialogue   - Edgar - 05/05/2021 10:38 AM  
 Macros to simulate the spell dialogue   - kkkwj - 10/18/2021 11:02 PM  
 Macros to simulate the spell dialogue   - Edgar - 10/19/2021 11:31 AM  
 Macros to simulate the spell dialogue   - kkkwj - 10/19/2021 01:35 PM  
 Macros to simulate the spell dialogue   - Edgar - 10/19/2021 01:58 PM  
Keyword
 03/16/2021 11:05 AM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 1187
Joined: 04/03/2009

Here are a couple of macros. The first, "L <dictation>" (short for lowercase letters) turns any utterance into a string of lowercase letters representing just the first letter of each word:

L <dictation>

Sub Main

Dim words() As String' dimension a string array

Dim k As Integer

Dim result As String

 

result = ""

words = Split(ListVar1," ")

For k = 0 To UBound(words)

result = result & LCase(Left(words(k), 1))

Next

SendKeys result

End Sub

Try uttering "el the quick brown fox" - on my machine the resulting output of letters is virtually instantaneous running as a KnowBrainer command (I could find no documentation for the Split command and Dragon®).

 

Try uttering "el the quick numeral 1 brown fox": tq1bf

 

Try uttering "el the quick cap brown fox": tqBf

 

Try uttering "el the quick caps on brown fox jumped": tqBFJ

 

The second, "Ack <dictation>" (short for acronym) turns any utterance into an acronym (all capital letters) presenting the first letter of each word:

Ack <dictation>

Sub Main

Dim words() As String' dimension a string array

Dim k As Integer

Dim result As String

 

result = ""

words = Split(ListVar1," ")

For k = 0 To UBound(words)

result = result & UCase(Left(words(k), 1))

Next

SendKeys result

End Sub



-------------------------

-Edgar
DPI 15.3, 64-bit Windows 10 Pro, OpenOffice & Office 365, Norton Security, Shure X2U XLR to USB mic adapter with Audio Technica DB135 vocal mic, Asus X299-Deluxe Prime, Intel Core i9-7940X (14 core, 4.3 GHz overclocked to 4.9 GHz), G.SKILL TridentZ Series 64GB (4 x 16GB) DDR4 3333 (PC4 26600) F4-3333C16Q-64GTZ, NVIDIA GIGABYTE GeForce GTX 1060 GV-N1060G1 GAMING-6GD REV 2.0 6GB graphics card with 3 1920x1080 monitors

 03/16/2021 06:50 PM
User is offline View Users Profile Print this message

Author Icon
dilligence
Top-Tier Member

Posts: 1407
Joined: 08/16/2010

With SP 6 Standard you can now use the Dragon® Spelling Window in speech unfriendly applications as well. You can deploy the very same "spell" command to bring up the Spelling Window, do your spelling, and send it to the speech unfriendly target. 

 

Here is the video demonstration:

 



-------------------------


Auto Box© Demo now available



 03/16/2021 10:19 PM
User is offline View Users Profile Print this message

Author Icon
kkkwj
Top-Tier Member

Posts: 802
Joined: 11/05/2015

Hi Edgar, it took me a couple of minutes staring at your code wondering why in the world anyone would find such a script useful because I couldn't see any reasons in the post body. I re-read the title and realized you were talking about replacing the Dragon spell dialog, and I wondered why hashing an utterance into first letters (some of them capitalized) would be useful. Is he trying to dictate weird variable names like "tqBf" in code or something? How does "tqBf" make sense in code?

Finally, I thought maybe you were using the fast script to properly spell readable variable names, although none were shown in the post. Is that how and where you use the script?

-------------------------

Win10/x64, AMD Ryzen 7 3700X, 64GB RAM, Dragon 15.3, SP 6 PRO, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse

 03/17/2021 11:16 AM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 1187
Joined: 04/03/2009

Originally posted by: kkkwj I wondered why hashing an utterance into first letters (some of them capitalized) would be useful. Is he trying to dictate weird variable names like "tqBf" in code or something? How does "tqBf" make sense in code? Finally, I thought maybe you were using the fast script to properly spell readable variable names, although none were shown in the post. Is that how and where you use the script?

Originally this was in response to a poster who wanted to say the NATO alphabet words and have the appropriate letters magically appear in dictation (say: "Charlie alpha tango" to get:  cat). In the original example I allowed for capitalizing but quickly realized that phonetic alphabet words like Charlie in this example would yield "Cat" ("Juliet alpha Mike" –> "JaM") - not so useful for me.

And your guess is correct - primarily I use the script for dictating non-dictatable variable names. Sometimes, no matter how hard I try, Dragon simply refuses to dictate a word - this helps in those situations. The second script (acronyms) works really well for dictating stock ticker symbols (especially mutual funds which consist of five letters (generally meaningless and usually unpronounceable: BHBRX etc.). FYI, I typically use the NATO alphabet words with the scripts.



-------------------------

-Edgar
DPI 15.3, 64-bit Windows 10 Pro, OpenOffice & Office 365, Norton Security, Shure X2U XLR to USB mic adapter with Audio Technica DB135 vocal mic, Asus X299-Deluxe Prime, Intel Core i9-7940X (14 core, 4.3 GHz overclocked to 4.9 GHz), G.SKILL TridentZ Series 64GB (4 x 16GB) DDR4 3333 (PC4 26600) F4-3333C16Q-64GTZ, NVIDIA GIGABYTE GeForce GTX 1060 GV-N1060G1 GAMING-6GD REV 2.0 6GB graphics card with 3 1920x1080 monitors

 03/17/2021 12:28 PM
User is offline View Users Profile Print this message

Author Icon
kkkwj
Top-Tier Member

Posts: 802
Joined: 11/05/2015

Thanks Edgar. I'm thinking of dictating tricky programming sequences. We now have OP, OQ, OC, OB etc for parentheses, quotes, curly brackets, and brackets from wristofdoom, the camel/pascal scripts from you, and now this script for tricky character sequences. And don't forget your puff C# command for dictating a wide variety of programming keywords and constructs. Are there any other special characters that haven't been covered by this set of tools? It seems fairly complete to me; I just spent a few minutes trying to think of dictation cases that weren't covered, but I could not identify any.

I always ended up imagining larger snippets that required variable substitution, which is a different thing than the straight dictation/translation that the list of tools above addresses. One day I should spend some time and write down an analysis of it all. But it seems that the tools above do a pretty good job of covering all the main use cases.

-------------------------

Win10/x64, AMD Ryzen 7 3700X, 64GB RAM, Dragon 15.3, SP 6 PRO, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse

 03/17/2021 07:54 PM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 1187
Joined: 04/03/2009

Originally posted by: kkkwj  I always ended up imagining larger snippets that required variable substitution, which is a different thing than the straight dictation/translation that the list of tools above addresses.

My StatementConstructor (puff <dictation>) can do some fairly complex snippets with variable substitution now. Flow-control (if..., do..., for... etc.) all have at least rudimentary "use the content of the clipboard to fill in the condition" ability. foreach... accepts a "type" (all the reserved variable types, strng etc.) and builds the construct with a reasonable guess of a "what" name (foreach (type what in which)). Enumeration now accepts a "variable type". VS likes to leave the "suggestion" context menu open even when you have typed the most logical item in the context list - I am going through the methods and adding {ESC} to the SendKey statement where needed.



-------------------------

-Edgar
DPI 15.3, 64-bit Windows 10 Pro, OpenOffice & Office 365, Norton Security, Shure X2U XLR to USB mic adapter with Audio Technica DB135 vocal mic, Asus X299-Deluxe Prime, Intel Core i9-7940X (14 core, 4.3 GHz overclocked to 4.9 GHz), G.SKILL TridentZ Series 64GB (4 x 16GB) DDR4 3333 (PC4 26600) F4-3333C16Q-64GTZ, NVIDIA GIGABYTE GeForce GTX 1060 GV-N1060G1 GAMING-6GD REV 2.0 6GB graphics card with 3 1920x1080 monitors

 03/17/2021 08:20 PM
User is offline View Users Profile Print this message

Author Icon
kkkwj
Top-Tier Member

Posts: 802
Joined: 11/05/2015

It sounds like your constructor is getting smarter every day! When the code stabilizes, I hope that you will post it again so that we can pick up the additional features. Oh yes, and in your spare time maybe you could whip up another expert video showing all the latest features? :-) (Man, those videos are challenging. Rob's videos (*many* of them) and RW's video were flawless. I'll work on my video technique sometime in the future...


-------------------------

Win10/x64, AMD Ryzen 7 3700X, 64GB RAM, Dragon 15.3, SP 6 PRO, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse

 03/18/2021 10:47 AM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 1187
Joined: 04/03/2009

Originally posted by: kkkwj When the code stabilizes […] I'll work on my video technique sometime in the future...

"stabilizes" ha ha! At this point I am adding a few new features every day - I was trying to keep track of the changes (change log) but I know I have missed quite a few.

The first few videos I did were "off-the-cuff" (extemporaneous). The last one I posted was scripted and rehearsed. In one sense of the word I'm totally new at this (the first video I posted, a few weeks ago, is the first video I've ever created with me as the narrator - I shot and produced one music video many years ago as a lark for a 10-year-old neighbor). I have spent a LOT of time on stage so I am comfortable with the process if not the techniques. I now have 4 new scripts which are ready for production.



-------------------------

-Edgar
DPI 15.3, 64-bit Windows 10 Pro, OpenOffice & Office 365, Norton Security, Shure X2U XLR to USB mic adapter with Audio Technica DB135 vocal mic, Asus X299-Deluxe Prime, Intel Core i9-7940X (14 core, 4.3 GHz overclocked to 4.9 GHz), G.SKILL TridentZ Series 64GB (4 x 16GB) DDR4 3333 (PC4 26600) F4-3333C16Q-64GTZ, NVIDIA GIGABYTE GeForce GTX 1060 GV-N1060G1 GAMING-6GD REV 2.0 6GB graphics card with 3 1920x1080 monitors

 03/24/2021 08:18 AM
User is offline View Users Profile Print this message

Author Icon
drrunev
Junior Member

Posts: 39
Joined: 01/23/2015

I have made a similar script in DVC script.
You can say one word or several words and it will take the first letters in each . I use it sometimes when a need big letters, e.g. can be more intuitive to say "as in Rome Washington" in order to write RW instead of saying "press cap romeo press cap whiskey"

The script:
' <><><><><><><><><><><>
'command name: as in <dictation>


x=_arg1
do until Instr(x," ") < 1
w = Mid$(x,0,Instr(x," ")-1)
x = Mid$(x,Instr(x," "))

key$ = Mid$ (w, 0, 1)
SendKeys key$

loop

'< Get the character from the last word

key$ = Mid$ (x, 0, 1)
SendKeys key$
' <><><><><><><><><><><>



-------------------------

Rune Vabø



 05/04/2021 12:53 PM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 1187
Joined: 04/03/2009

I've made some slight improvements to Letters <dictation>

Sub Main

   Dim words() As String' dimension a string array 
   Dim k As Integer
   Dim result As String
   
   result = ""
   words = Split(ListVar1," ")
   For k = 0 To UBound(words)
      words(k) = LCase(words(k))
   Next
   For k = 0 To UBound(words)
      If words(k) = "space" Then words(k) = " "
      If words(k) = "." Or words(k) = "period" Then words(k) = "."
      If words(k) = "zero" Then words(k) = "0"
      If words(k) = "one" Or words(k) = "won" Then words(k) = "1"
      If words(k) = "to" Or words(k) = "two" Or words(k) = "too" Then words(k) = "2"
      If words(k) = "three" Then words(k) = "3"
      If words(k) = "for" Or words(k) = "four" Or words(k) = "fore" Then words(k) = "4"
      If words(k) = "five" Then words(k) = "5"
      If words(k) = "six" Or words(k) = "sex" Then words(k) = "6"
      If words(k) = "seven" Then words(k) = "7"
      If words(k) = "eight" Or words(k) = "ate" Then words(k) = "8"
      If words(k) = "nine" Then words(k) = "9"
   Next
   For k = 0 To UBound(words)
      result = result & LCase(Left(words(k), 1))
   Next
   SendKeys result
End Sub

 



-------------------------

-Edgar
DPI 15.3, 64-bit Windows 10 Pro, OpenOffice & Office 365, Norton Security, Shure X2U XLR to USB mic adapter with Audio Technica DB135 vocal mic, Asus X299-Deluxe Prime, Intel Core i9-7940X (14 core, 4.3 GHz overclocked to 4.9 GHz), G.SKILL TridentZ Series 64GB (4 x 16GB) DDR4 3333 (PC4 26600) F4-3333C16Q-64GTZ, NVIDIA GIGABYTE GeForce GTX 1060 GV-N1060G1 GAMING-6GD REV 2.0 6GB graphics card with 3 1920x1080 monitors

 05/04/2021 03:04 PM
User is online View Users Profile Print this message

Author Icon
TomDonovan
Junior Member

Posts: 26
Joined: 08/22/2020

Thank you for sharing. Very helpful and in effect so simple and yet forgiving of my nato alphabet skills (lack thereof)

-------------------------

Tom

 05/05/2021 10:38 AM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 1187
Joined: 04/03/2009

You are very welcome!

-------------------------

-Edgar
DPI 15.3, 64-bit Windows 10 Pro, OpenOffice & Office 365, Norton Security, Shure X2U XLR to USB mic adapter with Audio Technica DB135 vocal mic, Asus X299-Deluxe Prime, Intel Core i9-7940X (14 core, 4.3 GHz overclocked to 4.9 GHz), G.SKILL TridentZ Series 64GB (4 x 16GB) DDR4 3333 (PC4 26600) F4-3333C16Q-64GTZ, NVIDIA GIGABYTE GeForce GTX 1060 GV-N1060G1 GAMING-6GD REV 2.0 6GB graphics card with 3 1920x1080 monitors

 10/18/2021 11:02 PM
User is offline View Users Profile Print this message

Author Icon
kkkwj
Top-Tier Member

Posts: 802
Joined: 11/05/2015

I was trying to dictate some key strings like "%fa" (file save as), or "^%{del}" control-alt-delete, hoping that the script would let me easily dictate the "fa" in the first sequence or the "del" in the second sequence. But alas, after an hour of effort I was still lost in the wonderland of sometimes Dragon replacing my words "percent sign" with % (and sometimes leaving it alone as two words), the same for ^ (caret, carrot, care at), the scripts maybe not knowing what to do with % or ^, and SendKeys requiring an escaped "{%}" to print out a % in the output (sigh). I'll come back to the problem of dictating key strings later when I have more time. :-) I post this here to record my lessons and understandings.

 

 I could be wrong, but it seems to me that are dedicated program that received word inputs for keys and outputted the string representation of the keys for SendKeys would be the most productive approach.(Then I could say control alt shift function nine, SendKeys would receive "{^}{%}{+}{{}f9{}}" and print "^%+{f9}".



-------------------------

Win10/x64, AMD Ryzen 7 3700X, 64GB RAM, Dragon 15.3, SP 6 PRO, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse



 10/19/2021 11:31 AM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 1187
Joined: 04/03/2009

Originally posted by: kkkwj I was trying to dictate some key strings like "%fa" (file save as), or "^%{del}" control-alt-delete, hoping that the script would let me easily dictate the "fa" in the first sequence or the "del" in the second sequence. But alas, after an hour of effort I was still lost in the wonderland of sometimes Dragon replacing my words "percent sign" with % (and sometimes leaving it alone as two words), the same for ^ (caret, carrot, care at), the scripts maybe not knowing what to do with % or ^, and SendKeys requiring an escaped "{%}" to print out a % in the output (sigh). I'll come back to the problem of dictating key strings later when I have more time. :-) I post this here to record my lessons and understandings.

 

 

 

 I could be wrong, but it seems to me that are dedicated program that received word inputs for keys and outputted the string representation of the keys for SendKeys would be the most productive approach.(Then I could say control alt shift function nine, SendKeys would receive "{^}{%}{+}{{}f9{}}" and print "^%+{f9}".

 

I started a separate thread for (some of) this (the second paragraph):

https://www.knowbrainer.com/forums/forum/messageview.cfm?catid=12&threadid=36050&enterthread=y

As for the first paragraph, I use a combination of two methods. Aside, when I want to spell out the word for a punctuation mark I use the trigger word "literal":
literal colon; literal period; literal caret etc.. These are actually custom words in my vocabulary. Anyway, if I want to dictate "%fa" I just say "percent sign", pause, "letters fox alpha". (This assumes that "letters" is my trigger for this command.)

I will give some thought to including these special characters in this command (I already have a command which handles them appropriately so it should be no problem to copy the code):

    <Command name="Inject <dictation>" group="" enabled="true">

      <description></description>

      <content type="WinWrap Basic"><![CDATA[

Sub Main

   Dim holdString As String

   holdString = ListVar1

   holdString = Replace (holdString, "open curly brace", "{{}")

   holdString = Replace (holdString, "left curly brace", "{{}")

   holdString = Replace (holdString, "{", "{{}")

   holdString = Replace (holdString, "(", "{(}")

   holdString = Replace (holdString, "open paren", "{(}")

   holdString = Replace (holdString, "left paren", "{(}")

   holdString = Replace (holdString, "[", "{[}")

   holdString = Replace (holdString, "open square bracket", "{[}")

   holdString = Replace (holdString, "left square bracket", "{[}")

   holdString = Replace (holdString, "<", "{<}")

   holdString = Replace (holdString, "open angle bracket", "{<}")

   holdString = Replace (holdString, "left angle bracket", "{<}")

   holdString = Replace (holdString, "\", "{\}")

   holdString = Replace (holdString, "back /", "{\}")

   holdString = Replace (holdString, "back slash", "{\}")

   SendKeys holdString, 1

   Clipboard (holdString)

End Sub

]]></content>

    </Command>

 



-------------------------

-Edgar
DPI 15.3, 64-bit Windows 10 Pro, OpenOffice & Office 365, Norton Security, Shure X2U XLR to USB mic adapter with Audio Technica DB135 vocal mic, Asus X299-Deluxe Prime, Intel Core i9-7940X (14 core, 4.3 GHz overclocked to 4.9 GHz), G.SKILL TridentZ Series 64GB (4 x 16GB) DDR4 3333 (PC4 26600) F4-3333C16Q-64GTZ, NVIDIA GIGABYTE GeForce GTX 1060 GV-N1060G1 GAMING-6GD REV 2.0 6GB graphics card with 3 1920x1080 monitors

 10/19/2021 01:35 PM
User is offline View Users Profile Print this message

Author Icon
kkkwj
Top-Tier Member

Posts: 802
Joined: 11/05/2015

Hi Edgar, for some reason (maybe because I learned from Chuck years ago?) my literal phrases put the literal last, like "comma literal", "colon literal", etc. That way they sort with variations like "two number"=>two, "two w"=>two, etc. On the other hand, I bet that your "literal xxx" phrases are recognized more reliably than my "xxx literal" phrases. Just a guess. I'll think about it some more. Did you try the "xxx literal" syntax before settling on the "literal xxx" syntax? Thank you

-------------------------

Win10/x64, AMD Ryzen 7 3700X, 64GB RAM, Dragon 15.3, SP 6 PRO, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse

 10/19/2021 01:58 PM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 1187
Joined: 04/03/2009

Originally posted by: kkkwj Did you try the "xxx literal" syntax before settling on the "literal xxx" syntax?

No. I dislike the form: "x, y, sum" prefereing the natural language form: "x plus y" thus "literal [...]" over "[...] literal". However, I do understand the sorting benefit and for some things; I try to avoid Reverse Polish Notation languages!



-------------------------

-Edgar
DPI 15.3, 64-bit Windows 10 Pro, OpenOffice & Office 365, Norton Security, Shure X2U XLR to USB mic adapter with Audio Technica DB135 vocal mic, Asus X299-Deluxe Prime, Intel Core i9-7940X (14 core, 4.3 GHz overclocked to 4.9 GHz), G.SKILL TridentZ Series 64GB (4 x 16GB) DDR4 3333 (PC4 26600) F4-3333C16Q-64GTZ, NVIDIA GIGABYTE GeForce GTX 1060 GV-N1060G1 GAMING-6GD REV 2.0 6GB graphics card with 3 1920x1080 monitors

Statistics
32134 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 2 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 471 guests browsing this forum, which makes a total of 473 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2021 FuseTalk™ Inc. All rights reserved.