Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to read numbers as individual digits #4273

Open
nvaccessAuto opened this issue Jul 12, 2014 · 78 comments
Open

option to read numbers as individual digits #4273

nvaccessAuto opened this issue Jul 12, 2014 · 78 comments

Comments

@nvaccessAuto
Copy link

Reported by blindbhavya on 2014-07-12 11:50
Lets take a big number for example 20000.
I want the number to be read as 2 0 0 0 0.
A user may want an option to read a number as an individual digit due to several reasons. Like a sighted person converts the visible numbers into thousands and millions a blind person may also want to test himself. Also, telephone numbers by no reason should be pronounced as one number.
So there should be an option somewhere that would allow the user to do this.
Blocking #178, #4779, #4872

@nvaccessAuto
Copy link
Author

Comment 1 by jteh on 2014-07-13 01:30
A couple of notes:

  1. For now, this can already be done using speech dictionary rules, though you have to have a reasonable knowledge of regular expressions to manage this.
  2. We used to have a rule to do this automatically for telephone numbers. Unfortunately, telephone numbers aren't formatted consistently, so it was taking effect for numbers where it shouldn't. Consequently, it was removed.

@nvaccessAuto
Copy link
Author

Comment 2 by driemer.riemer@... on 2014-07-13 05:12
What would need done to implement this? I could do it, as I have a good knowledge of regular expressions. I wouldn't mind adding a checkbox that does this to the document formatting or voice page. This could maybe edit the speech dictionarries to achieve this?

@nvaccessAuto
Copy link
Author

Comment 3 by blindbhavya on 2014-07-13 06:05
Hi.
I think most people who encounter telephone numbers would not know about regular expressions. just a simple check box in Speech Dictionaries or Document Formtting or Punctuation Symbol Pronunciation dialog.

@nvaccessAuto
Copy link
Author

Comment 4 by jteh on 2014-07-13 09:24
My first note was just pointing out that it can be done already if you need it. The request is still valid. (Otherwise, I would have closed the ticket.)

As to telephone numbers, as I explained in my second note, they aren't formatted consistently, so there's no reliable way to do this. It's either speaking all numbers as separate digits or all numbers as full numbers.

@nvaccessAuto
Copy link
Author

Comment 5 by blindbhavya on 2014-07-13 10:11
Hi.
Yes, so maybe there could be a combo box to choose whether to read numbers as individual digits or to read as whole numbers.
Could you implement this?
It could be put in the Punctuation Symbol Pronunciation dialog box?

@nvaccessAuto
Copy link
Author

Comment 6 by driemer.riemer@... on 2014-07-13 19:10
I am going to try to first implement this in an addon, and then if it works take steps to incorperate it into core code. I will start this as soon as I finish my work on audacity support.

@nvaccessAuto
Copy link
Author

Comment 7 by blindbhavya on 2014-07-14 11:56
Hi.
Thanks for taking this responsibility.
If possible, do send me a private e-mail when the add-on is ready for testing.
I am on the NVDA add-ons list though.

@nvaccessAuto
Copy link
Author

Attachment dev.nvda-addon added by driemer.riemer@... on 2014-07-25 21:23
Description:
Prototype addon giving this support.

@nvaccessAuto
Copy link
Author

Comment 8 by driemer.riemer@... on 2014-07-25 21:23
This gives initial support of this functionality.

@nvaccessAuto
Copy link
Author

Comment 9 by blindbhavya on 2014-07-26 04:48
Hi.
Thanks for this.
However, I feel that this addon should be incorporated into NVDA itself.

@nvaccessAuto
Copy link
Author

Comment 10 by driemer.riemer@... on 2014-07-26 12:34
There are a few technical things I have questions about before I incorperate it into core. Mainly, is it safe to use the temp dict or should I use builtin, and a few other things. I would like it to be more transparent than having a new temperary dictionary created. I will work on that next week.

@nvaccessAuto
Copy link
Author

Comment 11 by blindbhavya on 2014-07-26 13:41
Ok.

@nvaccessAuto
Copy link
Author

Comment 13 by jteh on 2014-07-28 06:42
I've marked #178 as a duplicate, but note that #178 suggests an option to read as double or triple digits as well as single digits.

I think the builtin dictionary is most appropriate, but we need to make sure that the entry can be removed easily when the configuration option is disabled.

@nvaccessAuto
Copy link
Author

Comment 14 by driemer.riemer@... on 2014-07-28 16:51
working with builtin should be the same. This works by mapping the dictionary name to a list of SpeechDictEntry instances. The only problem is where to put this in the code, and/or if it would be better managed as a speech api function. I need to do more research about how I could implement this efficiently, such that nvda wouldn't start to get bloated with random features that get requested over the years. Any ideas on ways to implement this or if simply putting my addon somewhere in the code and changing to builtin would suffice?

@nvaccessAuto
Copy link
Author

Comment 15 by jteh on 2014-08-05 10:24
On further thought, for a core implementation, I don't think we should bother putting this in a dictionary at all. Instead, I think it makes sense to just check the configuration option in speechDictHandler.processText and do the replacement (using a constant regular expression) if the option is enabled. This is a lot simpler to manage.

@nvaccessAuto
Copy link
Author

Comment 16 by blindbhavya on 2014-08-05 12:01
Hi.
Thank you to both of you for getting the implementation of this feature under process.
Thank you for this! Hope it will be in 2014.3!!!

@nvaccessAuto
Copy link
Author

Comment 17 by driemer.riemer@... on 2014-08-10 03:08
Hey, I got the numbers to work right.
Try this build and tell me if it was what you were looking for. Also, is it okay to submit a pull request, or would you guys rather have a patch?
click here to download the try build for t4273.

@nvaccessAuto
Copy link
Author

Comment 18 by driemer.riemer@... on 2014-08-10 03:11
remember to uninstall the digits or numbers addon, as it won't be necessary with this build. That was my first implementation.

@nvaccessAuto
Copy link
Author

Comment 19 by beqa on 2014-08-10 03:16
yes, it works without problems

@nvaccessAuto
Copy link
Author

Comment 20 by driemer.riemer@... on 2014-08-10 03:20
Cool! I was hoping so. So now, do I or does nvaccess usually put in the whats new entry?

@nvaccessAuto
Copy link
Author

Comment 21 by nvdakor on 2014-08-10 07:17
Hi,
Do you have a public Git repository, based your work from master and did your modifications in a separate branch? If so, let us know the URL for your repo and the branch name so Mick and Jamie can incorporate your branch. Alternatively, someone can commit your changes as part of a new branch called t4273 which will be stored on NV Access's server and tag it for code review for you.
Once your patch is accepted, it'll be incubated for two weeks to see if there are bug reports on it. Once there are no commits in two weeks, then Mick and/or Jamie will incorporate it into master, at which point changes entry will be written.
One more thing: in additoin to code changes, did you write an entry in the user guide explaining what your new option is? This is needed so users will know what to do (as for milestones and keywords, let's wait until Mick and adds them).
Thanks.

@nvaccessAuto
Copy link
Author

Comment 22 by driemer.riemer@... (in reply to comment 21) on 2014-08-11 02:29
Okay. I submitted a pull request, but my computer was screwing with me, so I think that I might have accidentally submitted a patch for another ticket that I did no work on. Let me know if a t4273 branch was created if you except the patch. My git repo is derek's git repo overview page. I am also happy to generate a .patch file if need be. You might want to mark this so you know it still needs a whats new entry.
Replying to nvdakor:

Hi,

Do you have a public Git repository, based your work from master and did your modifications in a separate branch? If so, let us know the URL for your repo and the branch name so Mick and Jamie can incorporate your branch. Alternatively, someone can commit your changes as part of a new branch called t4273 which will be stored on NV Access's server and tag it for code review for you.

Once your patch is accepted, it'll be incubated for two weeks to see if there are bug reports on it. Once there are no commits in two weeks, then Mick and/or Jamie will incorporate it into master, at which point changes entry will be written.

One more thing: in additoin to code changes, did you write an entry in the user guide explaining what your new option is? This is needed so users will know what to do (as for milestones and keywords, let's wait until Mick and adds them).

Thanks.

@nvaccessAuto
Copy link
Author

Comment 23 by jutzi1 on 2014-08-27 17:16
As suggested, here are the steps Emailed to me for modifying the default speech dictionary to pronounce numbers as digits. I back up my dictionary so I don't need to do this whenever I reinstall Windows and NVDA.

following strings will be in quotes but when putting it in they should be
without quotes.
Pattern: "(\d)(?=\d)"
Replacement: "\1 " (note the trailing space at the end; this is very
important)
Comment: "Numbers as single digits"
Check the Regular expression checkbox.

@nvaccessAuto
Copy link
Author

Comment 24 by jteh on 2014-08-28 03:23
I'm assuming the correct URL is https://bitbucket.org/derek_riemer/nvda? I don't see a t4273 branch in that repo.

@nvaccessAuto
Copy link
Author

Comment 25 by beqa on 2014-08-28 04:34
hi.

no, the correct url is https://bitbucket.org/derek_riemer_/nvda

@nvaccessAuto
Copy link
Author

Comment 26 by driemer.riemer@... on 2014-08-28 05:27
That is correct. The derek_riemer_ one. The other one is my other eamil account's bitbucket.

@nvaccessAuto
Copy link
Author

Comment 27 by blindbhavya on 2014-08-28 09:51
Hello.
One of the primary situations in which this feature would be very useful is while reading telephone numbers. These could pop up any time, so I think a shortcut should be there to quickly toggle between reading individual digits or numbers.
I am not sure what keystroke that would be though. What about NVDA Ctrl N? n is the initial letter of numbers so would be easy to remember.

@nvaccessAuto
Copy link
Author

Comment 28 by jteh on 2014-08-29 06:27
This looks pretty good. Nice work.

A few comments:

Some people have requested the ability to speak numbers as small groups of digits (e.g. 123456 could be 12 34 56 or 123 456) as well as single digits. Is this something people think could actually be useful? If so, we should incorporate it into this feature now, rather than having to introduce a new setting later.

+++ b/source/speechDictHandler.py
@@ -90,6 +90,8 @@ def processText(text):
...
      text=dictionaries[+ if config.conf["speech"](type].sub(text)
)["speakDigits"]:

I wonder whether this should happen before we process other dictionaries instead of after, since it's built in. However, you could argue it's better to do it after so that users can override this in specific cases. Thoughts?

+     text=re.sub(r"(\d)(?=\d)", r"\1 ", text)

This should be compiled and placed in a constant outside of (probably just above) the function, as this avoids the need to recompile it every time it is used, which is much more efficient. For example:

RE_NUMBERS_DIGITS = re.compile(r"(\d)(?=\d)")
...
        text=RE_NUMBERS_DIGITS.sub(r"\1 ",text)
+++ b/user_docs/en/userGuide.t2t
@@ -698,6 +698,9 @@ Usually, NVDA raises the pitch slightly for any capital letter, but some synthes
...
+This checkbox allows you to toggle whether nvda will speak numbers as words, or digits. For example, if this is checked nvda will speak the number "2482" as "2 4 8 2". 

nit: These two sentences should be on separate lines. (We do one sentence per line in the User Guide to make life easier for translators.) Also, remove the comma before the "or".

+++ b/source/config/__init__.py
@@ -73,6 +73,7 @@ confspec = ConfigObj(StringIO(
...
+ speakDigits=boolean(default=false)

nit: There should be a space on either side of the equals sign after speakDigits, just as there is for the other options. I know the NVDA code is pretty inconsistent as far as spaces around operators go, but it's best to be consistent with the area you're working in.

@nvaccessAuto
Copy link
Author

Comment 29 by jteh on 2014-08-29 06:30
Btw, Derek, in case you didn't know, you can associate multiple email addresses (and ssh keys) with the same Bitbucket account, rather than needing separate accounts.

@nvaccessAuto
Copy link
Author

Comment 30 by k_kolev1985 (in reply to comment 28) on 2014-08-29 06:43
Replying to jteh:

Some people have requested the ability to speak numbers as small groups of digits (e.g. 123456 could be 12 34 56 or 123 456) as well as single digits. Is this something people think could actually be useful? If so, we should incorporate it into this feature now, rather than having to introduce a new setting later.

Yes, I for one would prefer to have a more flexible option about how the digits are read: one by one, in pairs, in triplets.

@derekriemer
Copy link
Collaborator

I have screwed up my code for this so I will have to redo it. It might
happen this summer. In the mean time, please use the regexp.

On 4/14/2016 2:34 AM, thegogz wrote:

@nvaccessAuto https://github.com/nvaccessAuto what is the status of
this, my Dad a long time JAWS user has adopted NVDA recently and this
is his biggest bugbear to the point that he's now considering forking
out for a JAWS licence renewal (which he really can't afford). He
deals a lot with phone numbers and he really struggles with them being
read out in the millions. I'm going to try adding the regex via the
dictionary for this in the meantime.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#4273 (comment)


Derek Riemer
  • Department of computer science, third year undergraduate student.
  • Proud user of the NVDA screen reader.
  • Open source enthusiast.
  • Member of Bridge Cu
  • Avid skiier.

Websites:
Honors portfolio http://derekriemer.com
Awesome little hand built weather app!
http://django.derekriemer.com/weather/

email me at derek.riemer@colorado.edu mailto:derek.riemer@colorado.edu
Phone: (303) 906-2194

@Brian1Gaff
Copy link

Strangely, when I put this sort of thing in by default, of course somebody
comes along and wants it the other way around. Yes of course they do!

Maybe this is a decision for a permanent item toggle on the main code
branch.
Brian

bglists@blueyonder.co.uk
Sent via blueyonder.
Please address personal email to:-
briang1@blueyonder.co.uk, putting 'Brian Gaff'
in the display name field.
----- Original Message -----
From: "derekriemer" notifications@github.com
To: "nvaccess/nvda" nvda@noreply.github.com
Sent: Thursday, April 14, 2016 9:41 AM
Subject: Re: [nvaccess/nvda] option to read numbers as individual digits
(#4273)

I have screwed up my code for this so I will have to redo it. It might
happen this summer. In the mean time, please use the regexp.

On 4/14/2016 2:34 AM, thegogz wrote:

@nvaccessAuto https://github.com/nvaccessAuto what is the status of
this, my Dad a long time JAWS user has adopted NVDA recently and this
is his biggest bugbear to the point that he's now considering forking
out for a JAWS licence renewal (which he really can't afford). He
deals a lot with phone numbers and he really struggles with them being
read out in the millions. I'm going to try adding the regex via the
dictionary for this in the meantime.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#4273 (comment)


Derek Riemer
  • Department of computer science, third year undergraduate student.
  • Proud user of the NVDA screen reader.
  • Open source enthusiast.
  • Member of Bridge Cu
  • Avid skiier.

Websites:
Honors portfolio http://derekriemer.com
Awesome little hand built weather app!
http://django.derekriemer.com/weather/

email me at derek.riemer@colorado.edu mailto:derek.riemer@colorado.edu
Phone: (303) 906-2194


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#4273 (comment)

@derekriemer
Copy link
Collaborator

If you read the comments on this ticket that is exactly what we have planned except for I keep being an idiot and breaking my code. It will happen someday.

Sent from my heavily encrypted iPhone.
Please disregard errors as this is a smaller device.

On Apr 14, 2016, at 09:11, Brian1Gaff notifications@github.com wrote:

Strangely, when I put this sort of thing in by default, of course somebody
comes along and wants it the other way around. Yes of course they do!

Maybe this is a decision for a permanent item toggle on the main code
branch.
Brian

bglists@blueyonder.co.uk
Sent via blueyonder.
Please address personal email to:-
briang1@blueyonder.co.uk, putting 'Brian Gaff'
in the display name field.
----- Original Message -----
From: "derekriemer" notifications@github.com
To: "nvaccess/nvda" nvda@noreply.github.com
Sent: Thursday, April 14, 2016 9:41 AM
Subject: Re: [nvaccess/nvda] option to read numbers as individual digits
(#4273)

I have screwed up my code for this so I will have to redo it. It might
happen this summer. In the mean time, please use the regexp.

On 4/14/2016 2:34 AM, thegogz wrote:

@nvaccessAuto https://github.com/nvaccessAuto what is the status of
this, my Dad a long time JAWS user has adopted NVDA recently and this
is his biggest bugbear to the point that he's now considering forking
out for a JAWS licence renewal (which he really can't afford). He
deals a lot with phone numbers and he really struggles with them being
read out in the millions. I'm going to try adding the regex via the
dictionary for this in the meantime.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#4273 (comment)


Derek Riemer

  • Department of computer science, third year undergraduate student.
  • Proud user of the NVDA screen reader.
  • Open source enthusiast.
  • Member of Bridge Cu
  • Avid skiier.

Websites:
Honors portfolio http://derekriemer.com
Awesome little hand built weather app!
http://django.derekriemer.com/weather/

email me at derek.riemer@colorado.edu mailto:derek.riemer@colorado.edu
Phone: (303) 906-2194


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#4273 (comment)


You are receiving this because you commented.
Reply to this email directly or view it on GitHub

@derekriemer
Copy link
Collaborator

Referencing this: I can't compose a reply in github like I could in track.

nvaccessAuto commented on Aug 31, 2014
(\D|\b)
@jcsteh Do you remember why we had "(\D|\b) at the end of the regexp? It seems to me like it's not necessary.

@derekriemer
Copy link
Collaborator

Also, config/init.py doesn't have a header. I'm going to add one, unless there's a good reason for me not to.

@derekriemer
Copy link
Collaborator

If I add a header to config, I probably should label it 2006. I don't know if this is the right way to do this, but I think this gave me that config.py was created then.
$ git log --reverse -v source/config/init.py
the first result is this.
commit 6b4eb90
Author: jamie <>
Date: Mon Aug 14 02:33:42 2006 +0000

 Move all files into trunk to allow for branching, tagging, etc. in the futur

e.

@jcsteh
Copy link
Contributor

jcsteh commented May 3, 2016

Referencing this: I can't compose a reply in github like I could in track.

The GitHub Comment Enhancer Greasemonkey script used to allow this, but it seems to be broken at the moment. :(

@jcsteh Do you remember why we had "(\D|\b) at the end of the regexp? It seems to me like it's not necessary.

It ensures the groups of numbers are followed by a non-digit or a word boundary (which might be end of text). Without this, I'm guessing (but am not sure) that things would get weird if you had, say, a sequence of numbers with a length not divisible by 3 (e.g. 5 or 7 numbers).

Also, config/init.py doesn't have a header. I'm going to add one, unless there's a good reason for me not to.

Please do.

If I add a header to config, I probably should label it 2006. I don't know if this is the right way to do this, but I think this gave me that config.py was created then.

Correct. It should be 2006-2016.

@derekriemer
Copy link
Collaborator

derekriemer commented May 4, 2016

It ensures the groups of numbers are followed by a non-digit or a word boundary (which might be end of text). Without this, I'm guessing (but am not sure) that things would get weird if you had, say,

The regexp accounts for this by doing (\d{1,n})(?=blablabla
I'm leaving it, because I'm the one who came up with it and I must have done it for a reason.
I thought about adding 1 through N chars version to this, what do you think? This way, if the user selects more than 3 numbers, they could actually select to read by groups of four. We'd have to initialize the expression in two places, but that's fine.

@derekriemer
Copy link
Collaborator

@thegogz mind trying this feature and telling me if you think the thousands separator should be ignored or not??

@Brian1Gaff
Copy link

I don't get the question, I think in most cases reading numbers as digits is
preferable. Reading as two or more is probably quite a rare need.

Brian

bglists@blueyonder.co.uk
Sent via blueyonder.
Please address personal email to:-
briang1@blueyonder.co.uk, putting 'Brian Gaff'
in the display name field.
----- Original Message -----
From: "derekriemer" notifications@github.com
To: "nvaccess/nvda" nvda@noreply.github.com
Cc: "Brian1Gaff" bglists@blueyonder.co.uk; "Comment"
comment@noreply.github.com
Sent: Monday, October 17, 2016 7:12 AM
Subject: Re: [nvaccess/nvda] option to read numbers as individual digits
(#4273)

@thegogz mind trying this feature and telling me if you think the
thousands separator should be ignored or not??

You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#4273 (comment)

@Qchristensen
Copy link
Member

Did anything get resolved with this issue? It's come up in the user group, as it does from time to time, so thought I'd ask.

@derekriemer
Copy link
Collaborator

derekriemer commented Jun 25, 2017 via email

jcsteh added a commit that referenced this issue Sep 4, 2017
…e digits, or words (issue #4273).

I'm backing this out of next, as there are outstanding issues/questions, there hasn't been progress for quite some time, there are merge conflicts, and this was originally reviewed/incubated by me but I won't be around to see it through.
This reverts merges 584e8b4, 94898a7 and fba17fa.
@Adriani90
Copy link
Collaborator

@jcsteh, @derekriemer what is the current Status on this issue? Has been any further work on it during last 1,5 years??

@LeonarddeR
Copy link
Collaborator

LeonarddeR commented Feb 22, 2019

As @derekriemer asked for adopters of this issue, I will do it :) I have an idea of how to fix this reliably with not too much effort.

  1. Move the number processing from speechDictHandler to character Processing.
  2. Provide a thousand separator regex in the English symbol dictionary, and keep a compiled version of the thousands separator rregex on the SpeechSymbolProcessor
  3. Run every string through the sub method on the thousands separator regex, providing a replacement of two spaces. This ensures that single digits ignore the separator, and double digits respect the separator (i.e. 3,333 is spoken as 3 3 33, not as 33 33). Triple digits already behave like there's a separator.
  4. Run every result of 3 through the sub method on the appropriate regex, either single, double or triple.

@jcsteh: Do you think this will work?

@LeonarddeR
Copy link
Collaborator

After carefully reading #5930 and testing things, I updated my comment above. It turns out I was wrong with regard to the decimal separator. As @derekriemer pointed out somewhere, the decimal separator is not touched by the single, double and triple regexes at all and thus is properly handled when processing symbols. It should be enough to handle the thousands separator per language.

@wafiqtaher
Copy link

اين الملف def.nvda-addon

@ABuffEr
Copy link
Contributor

ABuffEr commented Dec 14, 2019

Hi all,
I read all comments, even if I'm not sure to understand the thousands separator question.
Anyway, if it can help to unlock this feature, I created recently an add-on to speak number digit by digit (no pairs or triplets for the moment). It's here.

@Qchristensen
Copy link
Member

This is still requested.

Also, @ABuffEr is your add-on compatible with current (ie 2019.3 and newer) NVDA? It looks like it was originally released before then, but possibly updated more recently?

@ABuffEr
Copy link
Contributor

ABuffEr commented Jan 14, 2021

Hi @Qchristensen ,
I did a quick test just now (I not use that add-on usually), and everything still works (it was surely developed in a 2019.3 alpha); I just updated add-on template and compatibility flag (also in downlodable package).

@Qchristensen
Copy link
Member

Has anyone looked at this issue recently? We do still get asked about it.

@cary-rowen
Copy link
Contributor

@Qchristensen
In the NVDA Chinese community we are often asked this question, NumberProcessing add-on is a must to install, so I think this feature should really appear in the NVDA core

@Qchristensen
Copy link
Member

@ABuffEr, has that add-on been updated for NVDA 2023.1? (Just reading the GitHub page for it I think it has?) And have you considered submitting it to https://addons.nvda-project.org/index.en.html

@ABuffEr
Copy link
Contributor

ABuffEr commented Jul 24, 2023

Hi, it's updated, maybe I forgot the documentation. I must publish all my addons on the new store.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.