![]() |
KnowBrainer Speech Recognition | ![]() |
Topic Title: Parenthesize that? Topic Summary: Created On: 03/04/2021 06:17 PM Status: Post and Reply |
|
![]() |
![]() |
- SJones12 | - 03/04/2021 06:17 PM |
![]() |
![]() |
- Lunis Orcutt | - 03/04/2021 06:55 PM |
![]() |
![]() |
- Matt_Chambers | - 03/04/2021 07:12 PM |
![]() |
![]() |
- Matt_Chambers | - 03/05/2021 11:30 AM |
![]() |
![]() |
- Edgar | - 03/05/2021 04:41 PM |
![]() |
![]() |
- Ag | - 03/11/2021 07:20 PM |
![]() |
![]() |
- Alan Cantor | - 03/05/2021 08:24 PM |
![]() |
![]() |
- wristofdoom | - 03/06/2021 02:28 PM |
![]() |
![]() |
- monkey8 | - 03/06/2021 03:13 PM |
![]() |
![]() |
- Edgar | - 03/06/2021 04:54 PM |
![]() |
![]() |
- Alan Cantor | - 03/06/2021 07:12 PM |
![]() |
![]() |
- R. Wilke | - 03/06/2021 07:20 PM |
![]() |
![]() |
- dilligence | - 03/06/2021 10:13 PM |
![]() |
![]() |
- ax | - 03/06/2021 11:11 PM |
![]() |
![]() |
- Alan Cantor | - 03/06/2021 11:55 PM |
![]() |
![]() |
- monkey8 | - 03/07/2021 05:28 AM |
![]() |
![]() |
- R. Wilke | - 03/07/2021 06:11 AM |
![]() |
![]() |
- monkey8 | - 03/07/2021 06:31 AM |
![]() |
![]() |
- R. Wilke | - 03/07/2021 06:33 AM |
![]() |
![]() |
- dinotalking | - 03/08/2021 04:00 PM |
![]() |
![]() |
- Nelson | - 03/11/2021 04:54 PM |
![]() |
![]() |
- Edgar | - 03/12/2021 10:56 AM |
![]() |
![]() |
- Ag | - 03/11/2021 07:31 PM |
![]() |
![]() |
- Lunis Orcutt | - 03/12/2021 01:54 PM |
![]() |
![]() |
- kkkwj | - 03/12/2021 06:55 PM |
![]() |
![]() |
- wristofdoom | - 03/18/2021 12:43 PM |
![]() |
![]() |
- newbiecoder | - 03/27/2021 12:43 PM |
![]() |
|
I'm a law student who often desires (and needs) to put phrases in parenthesis. That said, I find the "open paren" > "close paren" thing a bit cumbersome given the frequency with which I need to use it. Does anyone know how to create a "parenthesize (or "paren) that" command that closes the last utterance in parenthesis? (Much like italicize, bold, capitalize that etc.)
|
|
|
|
![]() |
|
Welcome (See Mission Statement) You might find it easier to use Dragon's built-in italicize <dictation>, bold <dictation> and capitalize <dictation> commands. For example, you can say “the brown fox jumped over the fence”. You can then say bold <brown fox> to apply bold formatting to “brown fox” without having to select text in Dragon friendly environments like Microsoft Word.
------------------------- Forum Mission Statement |
|
|
|
![]() |
|
I have a command that puts a word or term in parenthesis and quotation marks (I used to be a lawyer). It's a DVC command, but could easily be an Advanced Scripting command. It's named "defined term
SendKeys "(" & "{Shift+'}" SendKeys _arg1 SendKeys "{Shift+'})" |
|
|
|
![]() |
|
here's a Advanced Scripting command to do what you asked for. I call it "paren
Sub Main SendKeys "{(}",1 SendKeys ListVar1,1 SendKeys "{)}" End Sub |
|
|
|
![]() |
|
The previous solutions offered don't meet your requirement to "parenthesize that". To do that you would need to have access to the last utterance you made (or have some text selected). Neither Dragon® nor KnowBrainer make accessing your last utterance easy. I've been assured that it's possible but no one has been willing to share the exact steps. Sub Main Dim recognized As String Clipboard ("")' clear the clipboard SendKeys "^c", 1 Wait 0.4 recognized = Clipboard Wait 0.4 If recognized = "" Then Dim EngineControl As New DgnEngineControl EngineControl.DlgShow(dgndlgRecognitionHistory,0,,0) Wait 0.5 'Copy the the second to last uttered item in the recognition history box to the clipboard SendKeys "{Up}{Tab}", 1 SendKeys "^c", 1 Wait 0.4 'Close the recognition history window SendKeys "{Esc}" recognized = Trim(Clipboard$()) 'Recognition history window adds one space to the end of everything recognized = "XXXFromRecognitionHistoryXXX " & recognized Wait 0.4 End If ' ShellExecute "D:\CorrectThat\CorrectThat\bin\Release\CorrectThat.exe " & recognized ShellExecute "Z:\CoryJ\CorrectThat.exe " & recognized End Sub ------------------------- -Edgar |
|
|
|
![]() |
|
As usual, Edgar, I love your posts. I've been meaning to borrow your code to do this since I first saw you mention it, although back then either you did not have as much detail, or I was not as comfortable using DgnEngineControl via AHK.
It occurs to me that something like DragonCapture could provide much of this functionality. At least for non-speech friendly apps where most of my voice input goes through DragonCapture.
Further, I believe in at least some cases Dragon's SendKeys are intercepted by AutoHotKey. (Is it fully layered, or am I just misremembering? ... yes, it works, it was one of the first ways I used to provide persistent state...) It is scarily easy to create a keylogger in AutoHotKey, and then you might be able to grab all of speech utterances, strings injected by speech commands, as well as typing.
after you can actually capture the history, the next challenge is deciding how far back "that" goes. or better providing an incremental: "no, further back, one more word..."
when dealing with a nonspeech friendly app, DragonCapture or PHP scripts that I hope one day to have written, might have to insert back spaces to delete what was just inserted. Obviously they would have to detect things like mouse motion that would break such backspacing.
------------------------- DPG15.6 (also DPI 15.3) + KB, Sennheiser MB Pro 1 UC ML, BTD 800 dongle, Windows 10 Pro, MS Surface Book 3, Intel Core i7-1065G7 CPU @ 1.3/1.5GHz (4 cores, 8 logical, GPU=NVIDIA Quadro RTX 3000 with Max-Q Design. |
|
|
|
![]() |
|
This "quick and dirty" solution may not be reliable in every context, but hopefully it's good enough.
I find these kinds of scripts tend to misfire in unusual, hard to anticipate ways, so use this script at your own risk! Sub Main ' Wrap the last utterance in parentheses Dim x As String HeardWord "select", "that" ' Wait .2 ' A short delay may be needed here SendDragonKeys "{Ctrl+c}" Let x = Clipboard ' Wait .2 ' A short delay may be needed here Let x = Trim(x) If Len(x) < Len(Clipboard) Then SendDragonKeys " " SendDragonKeys "(" & x & ") " End Sub |
|
|
|
![]() |
|
This doesn't address the original concern, but this is something supplementary you can do. ------------------------- Dragon Professional Individual v15.6. Windows 10. Knowbrainer 2017. |
|
|
|
![]() |
|
------------------------- |
|
|
|
![]() |
|
"Bracket that" surrounds the phrase in square brackets. I would hope that "parenthesize that" would do the right thing but that big word starting with P baffles Dragon.
------------------------- -Edgar |
|
|
|
![]() |
|
Lindsay,
That's brilliant. I don't think I was aware of that command. If I was, I'd forgotten about it. Edgar, For me, "bracket that" wraps the previous utterance in parentheses, not square brackets. |
|
|
|
![]() |
|
It does that in a UK English profile. I haven't tested with a US English profile. -------------------------
|
|
|
|
![]() |
|
|
|
![]() |
|
I know OP asked for a Dragon solution, which I don't have, at least not by itself. FWIW, I am using "monkey" dragon - not to be confused with monkey8's dragon. The former was made for primates. The latter was curated for Homo superioris.
Here "^q" (Ctrl-q) gives you quotes as afterthoughts, while "^r" (Ctrl-r) delivers parentheses as afterthoughts.
P.S., why the bits of unsightly "regular expressions" when some programming greats long ago said of those who use them ... "now they have two problems" ... Well in knuckleland when I use mouse to select phrases, it is very easy to drag in the space before or after. You can probably use "LTrim" or "RTrim" in AHK and then add trimmed space back. But then I got three problems ...
Anyway, I use those two above almost every other day. Very reliable everywhere. |
|
|
|
![]() |
|
I have, and it sends brackets instead of parens :-( Could it be that the UK English Profile outputs parentheses for "bracket that," while the US English Profile outputs square brackets? Using a Canadian English profile, I get parentheses. If you're in the USA and absolutely need "bracket that" to output parentheses, maybe try creating a Canadian English profile. Canadian spellings are a hybrid of British and American, so the differences may or may not affect you. (Like my southern neighbours, I spell "organize" with a "z" instead of with an "s," but "color" without a "u" looks wrong!) |
|
|
|
![]() |
|
Well having just loaded an American profile I can confirm that "Brackets That" will do square brackets with US profile and round brackets (parentheses) with a UK profile so the moral of the story is change your nationality to Canadian, British or German using a UK profile when speaking English.
However looking at the American profile vocabulary the dictation commands include "open paren" and "close paren" as well as "open parenthesis" and "close parenthesis". So because these are dictation commands they can be used in continuous speech(yes I appreciate that the original poster may already be aware of this). So if I dictate the following:
"I will continue dictating open paren hopefully anyway close paren and we will see what is going to happen open paren theoretically close paren full stop" (
I get:
I will continue dictating (hopefully anyway) and we will see what is going to happen (theoretically).
So it seems to be much quicker to do that anyway than using commands like "bracket that" as an afterthought. Furthermore you can shorten the dictation commands further if so required.
If I were going to write a dragon command I would base it on the fact that "select that" will always select the last utterance, similar to what Alan has done above. Or an autohotkey script similar to ax above. You could also use the SDK to check the last utterance/last result (with a DgnDictCustom or DgnDictEdit), instead of using heardword, as RW has done (along with many other things) in his test bench application if I remember correctly. Maybe not so simple with an advanced script however without spending time looking at it. ------------------------- |
|
|
|
![]() |
|
All languages include "commands" like these, and then there are a lot more, such as: open/close square bracket open/close angle bracket open/close curly bracket To name just a few, and then they all come in some variations. Just open the vocabulary editor, and type "{" (without the quotes) in the written form field, and you will get the idea. However, they are not "dictation commands", they are just plain vocabulary, for symbols as written forms, and with particular properties controlling the spacing before and after the symbol. Just as with punctuation marks, and so on.
There is a lot more magic behind the keyword "that" when used from within built-in commands, which no amount of scripting, even more ambitiously, could easily replicate, on-the-fly, so better just leave it alone. The keyword "that" does the following: If text is selected (if the length of the selection is greater than 0), act on the current selection. If no text is selected (if the length of the selection is 0), no matter where the cursor is, act on the utterance, as a whole, where the cursor is. Coincidentally, or not, when saying "correct that", "select that", "bold that", etc., immediately after the last utterance, it will act on the last utterance, as one particular case of the rules above. It goes without saying that all the above only applies for Select-and-Say editors, of course.
Yes, sort of. The bench application, the echo application, and the "Capture" application all act on a recognition result trigger, doing this in various ways, and with the SDK, early on, or without it, later on. -------------------------
|
|
|
|
![]() |
|
I think you know I am aware of that but I still call them "dictation commands" out of habit because that's what they are to me and have of course the magic property of being able to be used in continuous dictation as with any vocabulary entry.
------------------------- |
|
|
|
![]() |
|
Yes, only for the sake of being pedantic, and considering the children reading this at home; by definition, a "dictation commands", or "inline-commands" (because they can be spoken inline), are the ones with empty written forms in the vocabulary.
-------------------------
|
|
|
|
![]() |
|
As wristofdoom mentions, you could shorten the voice command using a different spoken form for the punctuation -- for example, to open and close quotations, I say OQ and CQ, respectively. That's for double quotation marks ". For single, I say OSQ and CSQ. For parenthesis, I have Open P and Close P, but probably OP and CP would work, too.
------------------------- DPI 15.61.200.010, Sennheiser ME3 Microphone, Lenovo Legion V laptop with 16GB RAM, AMD Ryzen 7 Mobile 4800H Processor (2.9Ghz-4.2Ghz), Realtek (R) Audio 6.0.9003.1. Windows 10 Home 64-bit, Office 2013 Pro. |
|
|
|
![]() |
|
I have the opposite problem when trying to use square brackets in a Canadian vocabulary. I can dictate "empty closed brackets" [ ] but I cannot get the square brackets to surround text as one command. I mainly use this to surround case citations. Any suggestions on being able to surround text with square brackets would be appreciated.
------------------------- DPI 15.3, Knowbrainer, VoiceComputer, Lenovo Thinkpad P50, Lenovo Thinkpad X1 Carbon, Sennheiser MD 431 II, Microtech Gefell MD 300, Sound Devices USBpre 2 and Sound Devices MixPre 3 - II. |
|
|
|
![]() |
|
The solution breaks down into more than one situation. Do you want to speak an utterance and then say "bracket that" (to bracket the most recent utterance)? Do you want to select some already existing text (and if so, how) and put brackets around that by saying "bracket that"? While the general solution for both is fairly simple the devil is in the details. In the simplest case (some text is already selected and you want to put brackets around it): Sub Main Dim utterance As String SendKeys "^c", 1 Wait 0.4 utterance = Clipboard Wait 0.4 SendKeys "{[}" & utterance & "{]}", 1 End Sub
the two "Wait 0.4" statements might be unnecessary, excessive or need to be longer depending on your system. ------------------------- -Edgar |
|
|
|
![]() |
|
bracket that may do the right thing in a speech aware act, but since I use non-speech aware apps like OneNote quite a lot, I would really like to have that functionality via DragonCapture, or via Edgar's technique.
------------------------- DPG15.6 (also DPI 15.3) + KB, Sennheiser MB Pro 1 UC ML, BTD 800 dongle, Windows 10 Pro, MS Surface Book 3, Intel Core i7-1065G7 CPU @ 1.3/1.5GHz (4 cores, 8 logical, GPU=NVIDIA Quadro RTX 3000 with Max-Q Design. |
|
|
|
![]() |
|
AG,
This capability used to be included in KnowBrainer but we removed it because we couldn't guarantee proper spacing in all environments. That's why we changed the commands to Paren <dictation>, Bracket <dictation> etc. It's not what you want but it's probably your only bulletproof option other than adding parentheses etc. as you dictate. ------------------------- Forum Mission Statement |
|
|
|
![]() |
|
Wow, it always amazes me to see so many responses and suggestions and different ways of doing things over "simple" problems like this. I have the parens issue as well and have basically given up and accepted the dictation stream style of "blah blah open parens blah blah close parens" to get the job done. It seems to take less cognitive effort overall and works in all the situations that I experience. Having said that, I love the OP CP method to save syllables. I'll have to try that.
@wristofdoom: I just implemented the CP / NP (end P) method you suggested! Wow, it works great! Very smooth inline, easy to speak, and very reliable. I couldn't remember that you used CLO P, so I used "end P" (NP) instead (end parens, end bracket, end square, end angle, etc). Thank you for posting your excellent idea! ------------------------- 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 |
|
|
|
![]() |
|
I'm glad that helped! ------------------------- Dragon Professional Individual v15.6. Windows 10. Knowbrainer 2017. |
|
|
|
![]() |
|
My way around this was to define in the vocabulary ( as the spoken term "lefty" and you guessed it, "righty" for ) pretty sure I deleted lefty and righty from the vocabulary immediately thereafter to avoid confusion. In the vocabulary editor you should go into the properties of the term and no spece after ( and no space before ) |
|
|
FuseTalk Standard Edition v4.0 - © 1999-2021 FuseTalk™ Inc. All rights reserved.