KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: formatting time duration
Topic Summary: autoformat or the like to get 3h24m instead of 3 hours and 24 minutes
Created On: 07/15/2021 05:48 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 formatting time duration   - Ag - 07/15/2021 05:48 PM  
 formatting time duration   - Lunis Orcutt - 07/15/2021 06:48 PM  
 formatting time duration   - Alan Cantor - 07/15/2021 08:40 PM  
 formatting time duration   - Alan Cantor - 07/15/2021 08:50 PM  
 formatting time duration   - kkkwj - 07/15/2021 10:10 PM  
 formatting time duration   - Ag - 07/16/2021 01:54 PM  
 formatting time duration   - Ag - 07/20/2021 09:50 AM  
 formatting time duration   - PG LTU - 07/20/2021 05:06 PM  
 formatting time duration   - PG LTU - 07/20/2021 04:57 PM  
 formatting time duration   - kkkwj - 07/20/2021 06:35 PM  
 formatting time duration   - Ag - 07/20/2021 06:36 PM  
 formatting time duration   - PG LTU - 07/20/2021 07:01 PM  
 formatting time duration   - Ag - 07/20/2021 07:35 PM  
Keyword
 07/15/2021 05:48 PM
User is offline View Users Profile Print this message

Author Icon
Ag
Top-Tier Member

Posts: 644
Joined: 07/08/2019

I often use durations when entering stuff on the computer. Both for work (performance analysis of computers), but also logging and analyzing personal productivity.

 

When I enter durations in human friendly units, I prefer to have them look like 3h23m - rather than the verbose 3 hours and 23 minutes

 

Q: is there any way to do this via a standard autoformat?

 

Of course I already have speech commands that do this for the current time (e.g. for use in filenames, making sortable by date) , and it won't be hard to create speech commands that do this.

 

But I really prefer to say "3 hours 23 minutes" rather than "duration 3 hours 23 minutes"

 

i.e. most speech commands have a prefix. That's not how I speak most of the time. (I think the Vocola guy agrees with me)

 

I suppose that I could write speech commands of the form

 

<0_to_100> hours <0_to_59> minutes

 

<0_to_365> days <0_to_23> hours <0_to_59> minutes

 

But I have grown shy of the combinatoric explosion implied by such lists.

 

Being me, I might do it via speech commands

<0_to_100> hours

<0_to_7> days

Executing AutoHotKey commands that do the full thing - much less common torque explosion

 

 

But if there is a standard way to do this in AutoHotKey, e.g. using autoformat, I'd like to know about it. I haven't found it in the Dragon manuals.

 

---

 

I hope that dragonfly grammars can distinguish suffix and infix as well as prefix commands. I really need to spend more time with dragonfly.



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

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.



 07/15/2021 06:48 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 39257
Joined: 10/01/2006

We can't think of a native way to do this but it looks like you already have the answer. This is why Dragon includes this capability, via Advanced-Scripting commands. You might consider naming it something like Duration <0to100> hours and <0to59> minutes. Of course you can shorten the name to something like Time <0to100> and <0to59>We appreciate that this is not what you're looking for but it's the only option we can think of.



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

Change "No" to "Know" w/KnowBrainer 2020
Trial Downloads
Dragon/Sales@KnowBrainer.com 
(615) 884-4558 ex 1

 07/15/2021 08:40 PM
User is offline View Users Profile Print this message


Alan Cantor
Top-Tier Member

Posts: 4155
Joined: 12/08/2007

One of the surest way to make a custom Dragon command nonfunctional is to name the command something that closely mirrors Dragon's rules for formatting a time, a date, a phone number, a dollar value, a postal code, etc.

So I'm guessing the best way to accomplish what you're trying to do is to ensure that the spoken form of your command is different than the way you would normally say times. Starting with the word "duration" (or some other word) might help; but you may discover the extra syllables do their magic best when they are BETWEEN the hours and minutes, instead of in front. Or maybe at the end.

In other words, the command you write will probably not roll off your tongue naturally!

I wouldn't be overly concerned about the "combinatoric explosion" of these list commands. (What a great term!) I've written commands like these, and in most versions of Dragon -- although definitely not all -- a command with tens of thousands of possible outputs has worked fine.
 07/15/2021 08:50 PM
User is offline View Users Profile Print this message


Alan Cantor
Top-Tier Member

Posts: 4155
Joined: 12/08/2007

Maybe something like this... And it's not hard to say...

Command name:

<hours> and <minutes>

<hours> consists of

1
2
3
...
100

<minutes> consists of

0
1
2
3
...
59


Sub Main
Dim Hours, Minutes As String
Let Hours = ListVar1
Let Minutes = ListVar2
SendKeys Hours & "h" & Minutes & "m"
End Sub



 07/15/2021 10:10 PM
User is offline View Users Profile Print this message

Author Icon
kkkwj
Top-Tier Member

Posts: 802
Joined: 11/05/2015

Wow, Alan made that solution look smooth and simple in a six-line script, didn't he? Nice work!

I confess that I do my commands in the style Lunis suggested. If I add a prefix word, I have total control over the parsing without combinatorial explosion.

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

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

 07/16/2021 01:54 PM
User is offline View Users Profile Print this message

Author Icon
Ag
Top-Tier Member

Posts: 644
Joined: 07/08/2019

Originally posted by: kkkwj  I confess that I do my commands in the style Lunis suggested. If I add a prefix word, I have total control over the parsing without combinatorial explosion.

me too.

ironically [*] it was  Alan Cantor whose  post clued me into the problems of combinatoric expansion related to lists

which was one of the big reasons that I  switched to AutoHotKey. No combinatoric expansion problems with regular expressions  At least when dynamically run. When saved, stupid implementations have combinatoric expansion problems, but friends of mine have  eliminated those.

 

 

 



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

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.



 07/20/2021 09:50 AM
User is offline View Users Profile Print this message

Author Icon
Ag
Top-Tier Member

Posts: 644
Joined: 07/08/2019

WHERE I AM NOW:

I already had a command "Duration <...>"

I am rejecting " ..." because I'm trying to minimize the number of commands I have in Dragon.

for my own usage I am using a notation that is easy to dictate

3.5 H = 3.5 hours = 3 hours 30 minutes = 3.30 HM

i.e. I am using H four hours, with decimal fractions, and 3.30 HM, with the decimal point separating hours and minutes. actually, I suppose I should call that a sexagesimal point :-)

I might have preferred 3'30h, three apostrophe 30 h, but I find that a pain to say repeatedly.

I am using H and HM just because that's easier to get by Dragon. If I could write my own autoformat rules I would lowercase them. But then again if I could write my own autoformat rules it would be 3h30m



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

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.

 07/20/2021 05:06 PM
User is offline View Users Profile Print this message

Author Icon
PG LTU
Top-Tier Member

Posts: 2167
Joined: 03/21/2007

Originally posted by: Ag I might have preferred 3'30h

...

But then again if I could write my own autoformat rules it would be 3h30m

 

Wait, if the latter is preferred, use "h" instead of "'" in "hour" and "m" instead of "h" in "minute" in my instruction . . . To make a formatting change, you have to first reset to default, and then you can change it:

 

Just reading back my earlier Recogniton History:

12h15m, 1h7m, 17h58m, or say it all as a string: the duration was 3h45m time total.

 



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




PG





Remember folks, my comments and this forum are for entertainment value only, please, no wagering or other reliance on the contents herein.  I permit no commercial use of my ideas (whether expressions or embodiments) without my written consent.



 07/20/2021 04:57 PM
User is offline View Users Profile Print this message

Author Icon
PG LTU
Top-Tier Member

Posts: 2167
Joined: 03/21/2007

With everything you've been able to do, this is where you say you can't? Of course you should have it how you want. Let me help . . .

Format your word "hour" and "minute" appropriately and you can say for instance 3'30h by just saying like it looks in my recognition history:

format your word open quote power close quote and open quote minute close quote appropriately and you can say
for instance three hour thirty minute by just saying like it looks in my recognition history colon
correct power
choose two
open recognition history

So "hour" has an alternative written form of "'" for "between numbers" with "0" spaces before and after, and numbers preceding and following "as numerals."

And "minute" has an alternative written form of "h" for "after numbers" with "0" spaces before and "1" space after, and numbers preceding "as numerals" while numbers following are treated "normally."

And you say the hour number normally, followed by "hour" and the minute number normally followed by "minute" all as vocabulary:
12'15h, 1'7h, 17'58h, or say it all as a string: the duration was 3'45h time total.

Recognition History:
twelve hour fifteen minute
comma one hour seven minute
comma
seventeen hour fifty eight minute comma
or say it all as a string colon
the duration was three hour forty five minute time total
period
view recognition history

Hth,

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




PG





Remember folks, my comments and this forum are for entertainment value only, please, no wagering or other reliance on the contents herein.  I permit no commercial use of my ideas (whether expressions or embodiments) without my written consent.

 07/20/2021 06:35 PM
User is offline View Users Profile Print this message

Author Icon
kkkwj
Top-Tier Member

Posts: 802
Joined: 11/05/2015

If it were me, I would dictate something like 3.5.10 and have the software strip off the trailing 10 and use it for minutes, giving 3.5 hours 10 minutes (however you wanted to format the output string).

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

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

 07/20/2021 06:36 PM
User is offline View Users Profile Print this message

Author Icon
Ag
Top-Tier Member

Posts: 644
Joined: 07/08/2019

Doh! I slap my forehead for my stupidity while genuflecting in your direction PG_LTU. I simply did not think about using the custom word properties.


I wrote a very long reply ... that I accidentally deleted :-( ... explaining why I stopped using custom word properties. it looks like it was an accident of my history. 

 

Looks like I re-created that long reply.   mainly because it leads to a question asking for something I have long thought: a good XML diff.

---


Mainly, the Dragon custom words XML export is UTF-16, which git diff does not handle naturally. But since then I convert the exported Dragon commands XML from UTF-16 to UTF-8, and version control those.

 

(BTW,  one of the big reasons I started using KnowBrainer was that  MyKBCommands.xml is UTF-8,  and that works out-of-the-box with git diff.   that, and the fact that KnowBrainer has a lot of useful commands, and that Lunis and KnowBrainer are making a very big contribution to the community with these forums.)




However, even though diff works on UTF-8 XML, it still doesn't work well. in fact, I am not aware of any really good XML diff. Conventional text or line based diff gets quite confused when things like free transformations, moving subtrees around in the XML file that should not affect logical behavior cause a lot of lines to be reported by diff. whereas in the ASCII.txt custom words file I do diff and then sort -u uniq/deduplication, which I find much more pleasant for things like (a) preventing myself from adding crappy custom word entries with typos in them, (b) detecting crappy custom word entries with typos in them, and (c) restoring custom words added and standard words deleted to restore my vocabulary when I had to step back my user profile because of corruption or at least slowing down.


It should be just a simple matter of programming to create a better XML diff for this special case. it is just fairly linear XML, no very complicated three operations like pivoting subtrees of different levels. Unfortunately, I haven't done so yet. if anyone else has already done it, please share!! and then I will genuflect in your direction just like I am genuflecting in honor of PG_LTU.


I started avoiding special custom word properties that don't fit in the.txt file because my standard workflow uses the.txt file, and I lost a few custom word entries with special properties. If I get this XML diff functionality I should not have this problem.


---


Anyway: PG_LTU and Edgar and other programmers: how do you deal with diffing XML custom words and command files?



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

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.



 07/20/2021 07:01 PM
User is offline View Users Profile Print this message

Author Icon
PG LTU
Top-Tier Member

Posts: 2167
Joined: 03/21/2007

I use the Data Distribution Tool that comes with Group editions (and maybe "I" vers too?). It handles Custom Words and Dragon Commands.

Words and Commands (or rather, project-related groups of Words and Commands) can each be held in their own individual files which I name and archive by Project Description and a Date, and then move things into or out of DDT as necessary. The stuff that is _always_ in my DDT folder I add to with great prudence as to whether I _need_ it or not, and rather, I may put a new Word or Command file in there while I'm working on a project, and then move them out when I'm not.

But, if you are not using Custom Word Properties only because it is hard to "Diff" them, you are throwing out the baby with the bathwater, smacking your nose to spite your face, looking a gift horse in the mouth and pushing rocks uphill like Sisyphus. Custom Word Properties should be one of your best friends in life.

Because so much of the XML files are "boilerplate" couldn't you run a Macro to strip an XML file down to what is essential, save it as .txt and do that from ver to ver? I once started converting my xml files to json (much less fluff, just as much descriptive content) but stopped bothering. Why do you need to keep track of Diffs, anyway?

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




PG





Remember folks, my comments and this forum are for entertainment value only, please, no wagering or other reliance on the contents herein.  I permit no commercial use of my ideas (whether expressions or embodiments) without my written consent.

 07/20/2021 07:35 PM
User is offline View Users Profile Print this message

Author Icon
Ag
Top-Tier Member

Posts: 644
Joined: 07/08/2019

Are you a programmer PG? Or, rather, are you a professional programmer working for a software company or a hardware company, where software is the product?


I cannot imagine a programmer who has worked in industry for more than two years asking why you want to use diff. In fact, I use familiarity with version control tools as a weed out question when I am interviewing people. If they don't know how to use a diff tool, neither I nor any of the companies I have worked with want to employ them.


I also use familiarity with build tools like make as a similar weed out question.


I suppose PC programmers may be a different breed. This is not a good thing. Diff tools are essential to code inspection, and code inspection is still the best way to detect bugs. In particular security bugs. it might go a long way to explaining why PC applications historically had so many security bugs. I know that Microsoft only started producing good secure code after becoming really strict about software development standards. of course, the DEC people who started Windows/NT brought real software development discipline to Microsoft,


--


But anyway, as you have reminded me, the special properties of custom words will provide what I was asking for in XML. I may not get around to good diff tools for the XML soon, but I think that if I develop a workflow where I apply the special property changes to some great great great grandfather XML file, then I can continue to use the lightweight ASCII custom words version control system. Until such time that I solve or find somebody else's solution for XML tree diff. and, heck, I can start by just doing the UTF-16 to UTF-8 conversion for XML custom words that I have already been doing for Dragon commands XML.


BTW, keeping copies of files howsoever you name them is not a version control system. It is a backup system.

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

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.

KnowBrainer Speech Recognition » Dragon Speech Recognition » formatting time duration

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

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