Topics

NVDA and Fractions

 

Hello All,

         On the JFW group a thread has started entitled, How to insert a 1-digit fraction into a 2013 word document

          I started playing with NVDA and Window-Eyes to see how they'd handle three-character fraction designations versus single vulgar fraction characters for vulgar fractions other than one fourth, one half, and three quarters.  With NVDA I've run into an interesting issue that I cannot seem to fix in the context of writing something incredibly common:  a recipe.   Virtually any recipe you name might contain a fraction of a cup of something.  When I use one slash three for one third, or two slash three for two thirds, the word cup that follows it is consistently announced as Cuban Pesos, not cup.  This is not true when I use a vulgar fraction character ahead of the word cup, and NVDA does what I consider the more natural thing and doesn't announce "vulgar" or "vulgar fraction" followed by one third or two thirds, but just says the fractional amount and the word cup gets said as cup.

          I have tried tweaking the default and voice dictionaries, but must be doing something wrong.  The pattern I'm using is the word cup, and the replacement is the word cup, and I make sure that it's set for whole word only.  Even after doing this I still get "Cuban pesos" after the three-character version of a vulgar fraction.  I have exited NVDA and restarted it and it makes no difference.

          I either don't have the format down correctly for what I need to put in for the dictionary, have the wrong dictionary, or there's some sort of bug here as I can't imagine "Cuban pesos" to be something you'd want said for "cup" except in the very rarest of circumstances.

          Can anyone help me out here?
--
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall

    


John Sanfilippo
 

Hi,

I have no solution, but do also experience this and similar odd "super
interpretations" which are annoying.

I'm not sure if the problem is with NVDA or with the chosen speech
synth. For instance, I'm using Microsoft's SAPI5, David.

O, and when my Mac boots in win10 the logon voice is e-speak. It says
"one ratio 48" instead of "thirteen 48" or "one 48 PM".

John S

On 10/17/16 13:30, Brian Vogel wrote:
Hello All,

On the JFW group a thread has started entitled, How to insert a
1-digit fraction into a 2013 word document
<https://jfw.groups.io/g/main/topic/how_to_insert_a_1_digit/2911704?p=,,,100,0,0,0::RecentPostDate%2FSticky,,,100,2,0,2911704>

I started playing with NVDA and Window-Eyes to see how they'd
handle three-character fraction designations versus single vulgar
fraction characters for vulgar fractions other than one fourth, one
half, and three quarters. With NVDA I've run into an interesting issue
that I cannot seem to fix in the context of writing something incredibly
common: a recipe. Virtually any recipe you name might contain a
fraction of a cup of something. When I use one slash three for one
third, or two slash three for two thirds, the word cup that follows it
is consistently announced as Cuban Pesos, not cup. This is not true
when I use a vulgar fraction character ahead of the word cup, and NVDA
does what I consider the more natural thing and doesn't announce
"vulgar" or "vulgar fraction" followed by one third or two thirds, but
just says the fractional amount and the word cup gets said as cup.

I have tried tweaking the default and voice dictionaries, but
must be doing something wrong. The pattern I'm using is the word cup,
and the replacement is the word cup, and I make sure that it's set for
whole word only. Even after doing this I still get "Cuban pesos" after
the three-character version of a vulgar fraction. I have exited NVDA
and restarted it and it makes no difference.

I either don't have the format down correctly for what I need
to put in for the dictionary, have the wrong dictionary, or there's some
sort of bug here as I can't imagine "Cuban pesos" to be something you'd
want said for "cup" except in the very rarest of circumstances.

Can anyone help me out here?
--
*/Brian/*

*/Here is a test to find out whether your mission in life is complete.
If you’re alive, it isn’t./*

/ /~ Lauren Bacall




 

John,

           I'm using Microsoft SAPI5 David as well.  I hadn't thought about changing synthesizers but there had still ought to be a way to force an exception such that anytime the whole word "cup" is seen, which requires a white space character before the C and after the P, it's pronounced as "cup" because that's what I want it to be pronounced as.  I thought that was the whole idea behind the dictionaries.  There are lots of people who work with jargon of various sorts who want to force certain abbreviations to be read as though they're the whole word, and the like.  There has got to be a way to tell NVDA to tell whatever gets passed "cup" that it's always cup, but I'll be darned if I can figure out what!

--
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall

    


Tyler Spivey
 

This is your synth.
If you're using one of the Microsoft voices, try this dictionary entry:
Pattern: cup
Replacement: Cup
Type: Whole Word
We replace cup (lowercase) with Cup (capital C). This is enough to get the synth to not turn it into an abbreviation. However, if it changes the stress of the word cup, you might not want to do it so broadly, and only replace after fractions or digits.

On 10/17/2016 10:50 AM, John Sanfilippo wrote:
Hi,

I have no solution, but do also experience this and similar odd "super
interpretations" which are annoying.

I'm not sure if the problem is with NVDA or with the chosen speech
synth. For instance, I'm using Microsoft's SAPI5, David.

O, and when my Mac boots in win10 the logon voice is e-speak. It says
"one ratio 48" instead of "thirteen 48" or "one 48 PM".

John S




On 10/17/16 13:30, Brian Vogel wrote:
Hello All,

On the JFW group a thread has started entitled, How to insert a
1-digit fraction into a 2013 word document
<https://jfw.groups.io/g/main/topic/how_to_insert_a_1_digit/2911704?p=,,,100,0,0,0::RecentPostDate%2FSticky,,,100,2,0,2911704>

I started playing with NVDA and Window-Eyes to see how they'd
handle three-character fraction designations versus single vulgar
fraction characters for vulgar fractions other than one fourth, one
half, and three quarters. With NVDA I've run into an interesting issue
that I cannot seem to fix in the context of writing something incredibly
common: a recipe. Virtually any recipe you name might contain a
fraction of a cup of something. When I use one slash three for one
third, or two slash three for two thirds, the word cup that follows it
is consistently announced as Cuban Pesos, not cup. This is not true
when I use a vulgar fraction character ahead of the word cup, and NVDA
does what I consider the more natural thing and doesn't announce
"vulgar" or "vulgar fraction" followed by one third or two thirds, but
just says the fractional amount and the word cup gets said as cup.

I have tried tweaking the default and voice dictionaries, but
must be doing something wrong. The pattern I'm using is the word cup,
and the replacement is the word cup, and I make sure that it's set for
whole word only. Even after doing this I still get "Cuban pesos" after
the three-character version of a vulgar fraction. I have exited NVDA
and restarted it and it makes no difference.

I either don't have the format down correctly for what I need
to put in for the dictionary, have the wrong dictionary, or there's some
sort of bug here as I can't imagine "Cuban pesos" to be something you'd
want said for "cup" except in the very rarest of circumstances.

Can anyone help me out here?
--
*/Brian/*

*/Here is a test to find out whether your mission in life is complete.
If you’re alive, it isn’t./*

/ /~ Lauren Bacall




 

Tyler,

          For those not familiar with regular expressions feel free to skip this post.

          I found the way to limit this to something that has some multi character typed fraction ahead of the word "cup" by using a regular expression match for the following regular expression:

([1-9]+/[1-9]+[0-9]*) cup

and replacing it with the regular expression:

\1 Cup

and it works like a charm.  This is entered into the NVDA default dictionary.  Thanks much for the bit about cup with a capital C always being said as "cup."  

I would have thought that Cuban Pesos would have required an all caps abbreviation akin to USD for U.S. dollars or GBP for Great Britain Pounds.

It's also handy to know that the implementation of regular expressions used under NVDA uses the backslash character, and not the dollar sign character, to denote the actual string matched by the numbered parentheses enclosed matching string.

--
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall

    


Gene
 

It sounds like a synthesizer issue.  Cup is read properly by synthesizers I've used.  I would expect the speech dictionary to cause it to be spoken correctly but your message appears to indicate that it isn't.  You might try the synthesizer dictionary instead of the default.  For unknown reasons, I can't change how something is spoken at times with the default dictionary but the change is honored if I use the synthesizer dictionary.
 
Gene

----- Original Message -----
Sent: Monday, October 17, 2016 1:12 PM
Subject: Re: [nvda] NVDA and Fractions

John,

           I'm using Microsoft SAPI5 David as well.  I hadn't thought about changing synthesizers but there had still ought to be a way to force an exception such that anytime the whole word "cup" is seen, which requires a white space character before the C and after the P, it's pronounced as "cup" because that's what I want it to be pronounced as.  I thought that was the whole idea behind the dictionaries.  There are lots of people who work with jargon of various sorts who want to force certain abbreviations to be read as though they're the whole word, and the like.  There has got to be a way to tell NVDA to tell whatever gets passed "cup" that it's always cup, but I'll be darned if I can figure out what!

--
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall

    


Quentin Christensen
 

Looks like Brian sorted out the cup issue, but I can answer the one ratio 48 thing on Windows startup.  Normally a clock would be displayed as 1:48, that is 1 colon 48.  Ratios are written very similarly - I always thought it was the same symbol, so computer monitors are often 16:9 which is for every 16 pixels they are wide, they are 9 high.  It turns out there is a "ratio" symbol, which looks exactly like a colon, only set slightly higher.  For reasons known only to Microsoft, they chose to use that symbol to display the clock on the Windows lock screen.  I've raised it with them, but really the best way to influence change (on this or other issues) is for as many people to be heard as possible and also write to them - either to @msftenable on twitter, the disability answer desk, or accessibility feedback page: https://microsoftaccessibility.uservoice.com/forums/307429-microsoft-accessibility-feedback

Regards

Quentin.

On Tue, Oct 18, 2016 at 4:50 AM, John Sanfilippo <johnsanfilippo@...> wrote:
Hi,

I have no solution, but do also experience this and similar odd "super
interpretations" which are annoying.

I'm not sure if the problem is with NVDA or with the chosen speech
synth. For instance, I'm using Microsoft's SAPI5, David.

O, and when my Mac boots in win10 the logon voice is e-speak. It says
"one ratio 48" instead of "thirteen 48" or "one 48 PM".

John S




On 10/17/16 13:30, Brian Vogel wrote:
> Hello All,
>
>          On the JFW group a thread has started entitled, How to insert a
> 1-digit fraction into a 2013 word document
> <https://jfw.groups.io/g/main/topic/how_to_insert_a_1_digit/2911704?p=,,,100,0,0,0::RecentPostDate%2FSticky,,,100,2,0,2911704>
>
>           I started playing with NVDA and Window-Eyes to see how they'd
> handle three-character fraction designations versus single vulgar
> fraction characters for vulgar fractions other than one fourth, one
> half, and three quarters.  With NVDA I've run into an interesting issue
> that I cannot seem to fix in the context of writing something incredibly
> common:  a recipe.   Virtually any recipe you name might contain a
> fraction of a cup of something.  When I use one slash three for one
> third, or two slash three for two thirds, the word cup that follows it
> is consistently announced as Cuban Pesos, not cup.  This is not true
> when I use a vulgar fraction character ahead of the word cup, and NVDA
> does what I consider the more natural thing and doesn't announce
> "vulgar" or "vulgar fraction" followed by one third or two thirds, but
> just says the fractional amount and the word cup gets said as cup.
>
>           I have tried tweaking the default and voice dictionaries, but
> must be doing something wrong.  The pattern I'm using is the word cup,
> and the replacement is the word cup, and I make sure that it's set for
> whole word only.  Even after doing this I still get "Cuban pesos" after
> the three-character version of a vulgar fraction.  I have exited NVDA
> and restarted it and it makes no difference.
>
>           I either don't have the format down correctly for what I need
> to put in for the dictionary, have the wrong dictionary, or there's some
> sort of bug here as I can't imagine "Cuban pesos" to be something you'd
> want said for "cup" except in the very rarest of circumstances.
>
>           Can anyone help me out here?
> --
> */Brian/*
>
> */Here is a test to find out whether your mission in life is complete.
>  If you’re alive, it isn’t./*
>
> /    /~ Lauren Bacall
>
>
>
>
>






--
Quentin Christensen
Training Material Developer
Basic Training for NVDA & Microsoft Word with NVDA E-Books now available: http://www.nvaccess.org/shop/

Direct: +61 413 904 383
www.nvaccess.org 
Facebook: http://www.facebook.com/NVAccess 
Twitter: @NVAccess 

 

Quentin,

            Are you able to snag the ratio character you refer to and send it to me via e-mail?

            In any case, the following regular expression should catch the time as shown by Microsoft no matter what the character used between the hour and the minute:

                        ([1]*[0-9]+)(.)([0-5]{1}[0-9]{1}) ([a,A,p,P])([m,M])

and use the following replace string to get it pronounced correctly (note, I am going to presume that the backslash is used as the match string notation, if you regular expression interpreter uses the dollar sign substitute it where I have a backslash):

                        \1 \3 \4 \5


this would take the string "6:37 PM" and break it up as "6 37 P M" for the synthesizer.
--
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall

    


Quentin Christensen
 

Hi Brian,

This is the character

Visually, it looks very similar to a regular colon : - to be honest, I don't really understand why there is a character devoted to it when visually 99% of people would never know the difference.  In fact though, used properly, it is the kind of character that could be beneficial to screen reader users - as the synthesizer or screen reader then doesn't need to try and ascertain the context of two dots on top of each other to work out whether it is a colon or a ratio.  As we've seen in the case of the time on the Windows lock screen however, if you give people the option to mess something up....

Here's a page with all the characteristics of the ratio symbol: http://www.fileformat.info/info/unicode/char/2236/index.htm

Regards

Quentin.

On Tue, Oct 18, 2016 at 9:38 AM, Brian Vogel <britechguy@...> wrote:

Quentin,

            Are you able to snag the ratio character you refer to and send it to me via e-mail?

            In any case, the following regular expression should catch the time as shown by Microsoft no matter what the character used between the hour and the minute:

                        ([1]*[0-9]+)(.)([0-5]{1}[0-9]{1}) ([a,A,p,P])([m,M])

and use the following replace string to get it pronounced correctly (note, I am going to presume that the backslash is used as the match string notation, if you regular expression interpreter uses the dollar sign substitute it where I have a backslash):

                        \1 \3 \4 \5


this would take the string "6:37 PM" and break it up as "6 37 P M" for the synthesizer.
--
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall

    





--
Quentin Christensen
Training Material Developer
Basic Training for NVDA & Microsoft Word with NVDA E-Books now available: http://www.nvaccess.org/shop/

Direct: +61 413 904 383
www.nvaccess.org 
Facebook: http://www.facebook.com/NVAccess 
Twitter: @NVAccess 

 

Quentin,

        Thanks.  I agree that it's bizarre that Microsoft decided to use the ratio symbol in time.  It actually looks like a colon set slightly lower than center, but it's not something I would ever have thought of, nor thought it was not a colon, until you mentioned this.

         I also confirmed that my regular expression and replacement make NVDA stop saying "ratio" as part of time (at least when I have it written out in a MS-Word document using the ratio symbol as the separator).  But since AM and PM are read as on would expect one can simplify the regular expression to:

([1]*[0-9]+)(.)([0-5]{1}[0-9]{1}) ([a,A,p,P][m,M])

and the replacement expression to:  \1 \3 \4

since there's no need to separate the A or P from the M to get things announced as one would expect.

It's been some years since I had to use regular expressions with any regularity but they're somewhat like riding a bicycle in that once you've done that you can pick it up again pretty much anytime later on.

 
-- 
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall

    


Quentin Christensen
 

I expect whoever was designing the lock screen, looked at their mock up with the time written in whatever font it's in, came across the ratio character and visually liked the placement of it a little bit better - it never occurred to them that anyone would do anything other than visually look at that screen.  Definitely odd that it was allowed though.

On Tue, Oct 18, 2016 at 10:03 AM, Brian Vogel <britechguy@...> wrote:

Quentin,

        Thanks.  I agree that it's bizarre that Microsoft decided to use the ratio symbol in time.  It actually looks like a colon set slightly lower than center, but it's not something I would ever have thought of, nor thought it was not a colon, until you mentioned this.

         I also confirmed that my regular expression and replacement make NVDA stop saying "ratio" as part of time (at least when I have it written out in a MS-Word document using the ratio symbol as the separator).  But since AM and PM are read as on would expect one can simplify the regular expression to:

([1]*[0-9]+)(.)([0-5]{1}[0-9]{1}) ([a,A,p,P][m,M])

and the replacement expression to:  \1 \3 \4

since there's no need to separate the A or P from the M to get things announced as one would expect.

It's been some years since I had to use regular expressions with any regularity but they're somewhat like riding a bicycle in that once you've done that you can pick it up again pretty much anytime later on.

 
-- 
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall

    





--
Quentin Christensen
Training Material Developer
Basic Training for NVDA & Microsoft Word with NVDA E-Books now available: http://www.nvaccess.org/shop/

Direct: +61 413 904 383
www.nvaccess.org 
Facebook: http://www.facebook.com/NVAccess 
Twitter: @NVAccess 

Cearbhall O'Meadhra
 

Brian and Quentin,

 

I would like to know more about regular expressions and how to use them. Could you point me in the right direction?

 

 

This looks like an important skill particularly with the rise of text to speech delivery of eBooks! BorrowBox have just brought out theirs and it uses the regular API voices. For example the word reach is being pronounced as ree, akt to give you an idea of the mispronunciation.

 

 

All the best,

 

Cearbhall

 

m +353 (0)833323487 Ph: _353 (0)1-2864623 e: cearbhall.omeadhra@...

 

 

 

 

From: nvda@nvda.groups.io [mailto:nvda@nvda.groups.io] On Behalf Of Brian Vogel
Sent: Tuesday, October 18, 2016 12:03 AM
To: nvda@nvda.groups.io
Subject: Re: [nvda] NVDA and Fractions

 

Quentin,

        Thanks.  I agree that it's bizarre that Microsoft decided to use the ratio symbol in time.  It actually looks like a colon set slightly lower than center, but it's not something I would ever have thought of, nor thought it was not a colon, until you mentioned this.

         I also confirmed that my regular expression and replacement make NVDA stop saying "ratio" as part of time (at least when I have it written out in a MS-Word document using the ratio symbol as the separator).  But since AM and PM are read as on would expect one can simplify the regular expression to:

([1]*[0-9]+)(.)([0-5]{1}[0-9]{1}) ([a,A,p,P][m,M])

and the replacement expression to:  \1 \3 \4

since there's no need to separate the A or P from the M to get things announced as one would expect.

It's been some years since I had to use regular expressions with any regularity but they're somewhat like riding a bicycle in that once you've done that you can pick it up again pretty much anytime later on.

 
-- 
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall

    

 

Brian's Mail list account BY <bglists@...>
 

Which synth. Sappi 5 and 4 tends to use abbreviations expanded that one cannot seem to alter, though why it should be dependent on what goes before in such a fashion is very odd indeed.
I know that in a uk post code containing something like 8NY sapi costently says 5 New York.
Brian

bglists@...
Sent via blueyonder.
Please address personal email to:-
briang1@..., putting 'Brian Gaff'
in the display name field.

----- Original Message -----
From: "Brian Vogel" <@britechguy>
To: <nvda@nvda.groups.io>
Sent: Monday, October 17, 2016 6:30 PM
Subject: [nvda] NVDA and Fractions


Hello All,

On the JFW group a thread has started entitled, How to insert a 1-digit fraction into a 2013 word document ( https://jfw.groups.io/g/main/topic/how_to_insert_a_1_digit/2911704?p=,,,100,0,0,0::RecentPostDate%2FSticky,,,100,2,0,2911704 )

I started playing with NVDA and Window-Eyes to see how they'd handle three-character fraction designations versus single vulgar fraction characters for vulgar fractions other than one fourth, one half, and three quarters. With NVDA I've run into an interesting issue that I cannot seem to fix in the context of writing something incredibly common: a recipe. Virtually any recipe you name might contain a fraction of a cup of something. When I use one slash three for one third, or two slash three for two thirds, the word cup that follows it is consistently announced as Cuban Pesos, not cup. This is not true when I use a vulgar fraction character ahead of the word cup, and NVDA does what I consider the more natural thing and doesn't announce "vulgar" or "vulgar fraction" followed by one third or two thirds, but just says the fractional amount and the word cup gets said as cup.

I have tried tweaking the default and voice dictionaries, but must be doing something wrong. The pattern I'm using is the word cup, and the replacement is the word cup, and I make sure that it's set for whole word only. Even after doing this I still get "Cuban pesos" after the three-character version of a vulgar fraction. I have exited NVDA and restarted it and it makes no difference.

I either don't have the format down correctly for what I need to put in for the dictionary, have the wrong dictionary, or there's some sort of bug here as I can't imagine "Cuban pesos" to be something you'd want said for "cup" except in the very rarest of circumstances.

Can anyone help me out here?
--
*Brian*

*Here is a test to find out whether your mission in life is complete. If you’re alive, it isn’t.*

~ Lauren Bacall

Peter Beasley
 

What I do is change the case from upper to lower in the replacement field in the dictionary and that sorts it.

-----Original Message-----
From: Brian's Mail list account
Sent: Tuesday, October 18, 2016 10:07 AM
To: nvda@nvda.groups.io
Subject: Re: [nvda] NVDA and Fractions

Which synth. Sappi 5 and 4 tends to use abbreviations expanded that one
cannot seem to alter, though why it should be dependent on what goes before
in such a fashion is very odd indeed.
I know that in a uk post code containing something like 8NY sapi costently
says 5 New York.
Brian

bglists@...
Sent via blueyonder.
Please address personal email to:-
briang1@..., putting 'Brian Gaff'
in the display name field.
----- Original Message -----
From: "Brian Vogel" <@britechguy>
To: <nvda@nvda.groups.io>
Sent: Monday, October 17, 2016 6:30 PM
Subject: [nvda] NVDA and Fractions


Hello All,

On the JFW group a thread has started entitled, How to insert a 1-digit
fraction into a 2013 word document (
https://jfw.groups.io/g/main/topic/how_to_insert_a_1_digit/2911704?p=,,,100,0,0,0::RecentPostDate%2FSticky,,,100,2,0,2911704 )

I started playing with NVDA and Window-Eyes to see how they'd handle
three-character fraction designations versus single vulgar fraction
characters for vulgar fractions other than one fourth, one half, and three
quarters. With NVDA I've run into an interesting issue that I cannot seem to
fix in the context of writing something incredibly common: a recipe.
Virtually any recipe you name might contain a fraction of a cup of
something. When I use one slash three for one third, or two slash three for
two thirds, the word cup that follows it is consistently announced as Cuban
Pesos, not cup. This is not true when I use a vulgar fraction character
ahead of the word cup, and NVDA does what I consider the more natural thing
and doesn't announce "vulgar" or "vulgar fraction" followed by one third or
two thirds, but just says the fractional amount and the word cup gets said
as cup.

I have tried tweaking the default and voice dictionaries, but must be doing
something wrong. The pattern I'm using is the word cup, and the replacement
is the word cup, and I make sure that it's set for whole word only. Even
after doing this I still get "Cuban pesos" after the three-character version
of a vulgar fraction. I have exited NVDA and restarted it and it makes no
difference.

I either don't have the format down correctly for what I need to put in for
the dictionary, have the wrong dictionary, or there's some sort of bug here
as I can't imagine "Cuban pesos" to be something you'd want said for "cup"
except in the very rarest of circumstances.

Can anyone help me out here?
--
*Brian*

*Here is a test to find out whether your mission in life is complete. If you’re
alive, it isn’t.*

~ Lauren Bacall

Quentin Christensen
 

There are a lot of sites which promise to teach you - some of the rely on colour for various things and I must confess I haven't used any of them lately to know what they are like.  If you do a search for "Regular expression tutorial" you should get heaps of results.  In the meantime, the Wikipedia page goes probably too far into explanation of what it is, but does have some examples: https://en.wikipedia.org/wiki/Regular_expression

Kind regards

Quentin.

On Tue, Oct 18, 2016 at 6:08 PM, Cearbhall O'Meadhra <cearbhall.omeadhra@...> wrote:

Brian and Quentin,

 

I would like to know more about regular expressions and how to use them. Could you point me in the right direction?

 

 

This looks like an important skill particularly with the rise of text to speech delivery of eBooks! BorrowBox have just brought out theirs and it uses the regular API voices. For example the word reach is being pronounced as ree, akt to give you an idea of the mispronunciation.

 

 

All the best,

 

Cearbhall

 

m +353 (0)833323487 Ph: _353 (0)1-2864623 e: cearbhall.omeadhra@...

 

 

 

 

From: nvda@nvda.groups.io [mailto:nvda@nvda.groups.io] On Behalf Of Brian Vogel
Sent: Tuesday, October 18, 2016 12:03 AM
To: nvda@nvda.groups.io
Subject: Re: [nvda] NVDA and Fractions

 

Quentin,

        Thanks.  I agree that it's bizarre that Microsoft decided to use the ratio symbol in time.  It actually looks like a colon set slightly lower than center, but it's not something I would ever have thought of, nor thought it was not a colon, until you mentioned this.

         I also confirmed that my regular expression and replacement make NVDA stop saying "ratio" as part of time (at least when I have it written out in a MS-Word document using the ratio symbol as the separator).  But since AM and PM are read as on would expect one can simplify the regular expression to:

([1]*[0-9]+)(.)([0-5]{1}[0-9]{1}) ([a,A,p,P][m,M])

and the replacement expression to:  \1 \3 \4

since there's no need to separate the A or P from the M to get things announced as one would expect.

It's been some years since I had to use regular expressions with any regularity but they're somewhat like riding a bicycle in that once you've done that you can pick it up again pretty much anytime later on.

 
-- 
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall

    

 




--
Quentin Christensen
Training Material Developer
Basic Training for NVDA & Microsoft Word with NVDA E-Books now available: http://www.nvaccess.org/shop/

Direct: +61 413 904 383
www.nvaccess.org 
Facebook: http://www.facebook.com/NVAccess 
Twitter: @NVAccess 

 

Cearbhall,

          There are *lots* of online resources for regular expressions, but if you can lay your hands on the O'Reilly [publisher of "all things Unix"] book entitled Mastering Regular Expressions by Jeffrey E. F. Friedl that would not be a bad place to start.  Here are three different cheat sheets that I found helpful when I was trying to refresh my memory about how these things work.  One of the trickiest concepts is that you can have a regular expression match zero or more occurrences of a given character, which seems very odd, but if you think about how time is conventionally written out in many instances, there is no leading zero before 10 AM (or PM) and the one may or may not be there in any given instance of the time, so you need to be able to match zero or more occurrences of the digit 1 at the start.

https://www.cheatography.com/davechild/cheat-sheets/regular-expressions/ 

http://www.rexegg.com/regex-quickstart.html 

http://www.regular-expressions.info/reference.html 

           I have to warn you that it generally takes a bit of time to wrap one's head around regular expression syntax.  The nice thing is that there are websites that allow you to test the regular expression you've put together against a pattern to see if it will match it and even some that will allow you to specify a replace option so that you can see precisely what you'd get as a replacement by piecing together bits of the original string in different order, with different separators, etc.  Here is the site that I preferred for that purpose:

http://www.freeformatter.com/regex-tester.html

--
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall

    


 

A very late PS on that regular expression I posted for capturing the time on Windows to make it pronounce correctly.  In my original I had the literal character space between the last digit and the A or P in AM or PM which does work for Windows system time.  But, if someone formatted time with more than one space, or a tab, or the like between the last digit and the A or P the AM/PM part would not be captured correctly.  The corrected regular expression uses the \s special character with the + quantifier to say any one or more occurrences of any of the "white space" characters.

([1]*[0-9]+)(.)([0-5]{1}[0-9]{1})\s+([a,A,p,P][m,M])

and use the following as the replacement expression:  \1 \3 \4

--
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall

    


 

On Tue, Oct 18, 2016 at 02:07 am, Brian's Mail list account wrote:
though why it should be dependent on what goes before in such a fashion is very odd indeed.

 It's an attempt at natural written language intelligence.  Many abbreviations for currencies are, in and of themselves, unpronounceable in English.  When they occur after a digit, however, the logical way to pronounce them is as the currency they represent.  The same trick is used for AM and PM (regardless of case) when it follows what looks like a time as opposed to elsewhere.  We all know that "AM" would be pronounce as in the sentence, "I am typing this right now."  I don't know how various synthesizers would handle PM absent the time context.
--
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall

    


Andre Fisher
 

A great fix to the 'ratio' issue is to change the level of the ratio
symbol being spoken to the most level.

On 10/18/16, Brian Vogel <@britechguy> wrote:
On Tue, Oct 18, 2016 at 02:07 am, Brian's Mail list account wrote:


though why it should be dependent on what goes before in such a fashion
is
very odd indeed.
 It's an attempt at natural written language intelligence.  Many
abbreviations for currencies are, in and of themselves, unpronounceable in
English.  When they occur after a digit, however, the logical way to
pronounce them is as the currency they represent.  The same trick is used
for AM and PM (regardless of case) when it follows what looks like a time as
opposed to elsewhere.  We all know that "AM" would be pronounce as in the
sentence, "I am typing this right now."  I don't know how various
synthesizers would handle PM absent the time context.
--
*Brian*

*Here is a test to find out whether your mission in life is complete.  If
you’re alive, it isn’t.*

   ~ Lauren Bacall

Cearbhall O'Meadhra
 

Brian,

 

This is really helpful, thanks!

 

I’ll get down to it and see if I can learn a bit about this tool.

 

 

All the best,

 

Cearbhall

 

m +353 (0)833323487 Ph: _353 (0)1-2864623 e: cearbhall.omeadhra@...

 

 

 

I use the free version of Spam Reader to get rid of spam. The Professional version doesn't have this disclaimer in outgoing emails. Try Spam Reader for free now!

 

 

From: nvda@nvda.groups.io [mailto:nvda@nvda.groups.io] On Behalf Of Brian Vogel
Sent: Tuesday, October 18, 2016 2:44 PM
To: nvda@nvda.groups.io
Subject: Re: [nvda] NVDA and Fractions

 

Cearbhall,

          There are *lots* of online resources for regular expressions, but if you can lay your hands on the O'Reilly [publisher of "all things Unix"] book entitled Mastering Regular Expressions by Jeffrey E. F. Friedl that would not be a bad place to start.  Here are three different cheat sheets that I found helpful when I was trying to refresh my memory about how these things work.  One of the trickiest concepts is that you can have a regular expression match zero or more occurrences of a given character, which seems very odd, but if you think about how time is conventionally written out in many instances, there is no leading zero before 10 AM (or PM) and the one may or may not be there in any given instance of the time, so you need to be able to match zero or more occurrences of the digit 1 at the start.

https://www.cheatography.com/davechild/cheat-sheets/regular-expressions/ 

http://www.rexegg.com/regex-quickstart.html 

http://www.regular-expressions.info/reference.html 

           I have to warn you that it generally takes a bit of time to wrap one's head around regular expression syntax.  The nice thing is that there are websites that allow you to test the regular expression you've put together against a pattern to see if it will match it and even some that will allow you to specify a replace option so that you can see precisely what you'd get as a replacement by piecing together bits of the original string in different order, with different separators, etc.  Here is the site that I preferred for that purpose:

http://www.freeformatter.com/regex-tester.html

--
Brian

Here is a test to find out whether your mission in life is complete.  If you’re alive, it isn’t.

    ~ Lauren Bacall