NVDA Dictionary Files


 

. . . can they be backed up and can they be edited manually to allow for the rearrangement of the order of entries?

Over time I have put quite a few regex entries into my default dictionary as various questions have come up.  Since NVDA's dictionary processor does not stop processing once the first dictionary match is made, but does the replacement then chugs merrily along the rest of the dictionary entries, it is entirely possible for a later dictionary entry to interfere with the results of an earlier substitution in ways one might not initially expect.

I would love to be able to strip my dictionary down to a single entry for testing purposes, but not lose all the other stuff I have.  If these are stored in a text-based format, it should be simple to copy them and simple to edit whether it's to rearrange order, strip out entries, etc.

Since the dictionary manager does not have the ability to rearrange order, nor to turn specific items on/off for processing, I'd like to be able to do that myself when the occasion requires.  This is not something the average user would likely be doing often, but I have to believe that there are a number of heavy-duty NVDA testers and NVDA developers (whether core code or add-ons) that read here who have had the same need.

If a manual method exists to back up the dictionary files, and to manually edit these so that large numbers of items can be deleted or moved in one fell swoop, please share.
--

Brian - Windows 10, 64-Bit, Version 21H2, Build 19044  

The difference between a top-flight creative man and the hack is his ability to express powerful meanings indirectly.

         ~ Vance Packard


Giles Turnbull
 

yes, it is possible to edit the dictionary files manually. They are located in AppData/Roaming/NVDA/speechDicts. The default dictionary is default.dic and any voice dictionaries you might have are in folders under the name of the synth.

One issue I found tricky to figure out was the flags to indicate options like for Type: anywhere or whole word only or regular expression, and for case sensitive or not. You can figure this out by looking at a dictionary entry and seeing how it is in the relevant dictionary file. Then change an option such as Type Anywhere and change it to whole word Only, then look at how the dictionary file has changed. I can't remember off the top of my head, but I think the numbers range from 0 to 2 for the Type option.

The last entry I added to my default dictionary appears like this in my default.dic file:

#Welsh town
Hirwaun    Heerwine    1    0

The #Welsh Town is the optional comment you can enter in the dictionary manager.
Then comes the text followed by the way you want it pronounced. Then come the flags for Type and Case Sensitive.

One thing that is interesting and has changed since the last time I edited a dictionary file manually, is that the entries are not comma-separated anymore ... they are separated by four spaces.

Hope this helps :)

Giles


Gene
 

the difference in how entries are separated may well mean that backed up dictionaries from earlier versions of NVDA won't work if you place them in new versions. 

I backed up some dictionaries from old versions but it appears that if I want to use them in new versions, I likely won't be able to.

Gene

On 7/31/2022 8:57 AM, Giles Turnbull wrote:

yes, it is possible to edit the dictionary files manually. They are located in AppData/Roaming/NVDA/speechDicts. The default dictionary is default.dic and any voice dictionaries you might have are in folders under the name of the synth.

One issue I found tricky to figure out was the flags to indicate options like for Type: anywhere or whole word only or regular expression, and for case sensitive or not. You can figure this out by looking at a dictionary entry and seeing how it is in the relevant dictionary file. Then change an option such as Type Anywhere and change it to whole word Only, then look at how the dictionary file has changed. I can't remember off the top of my head, but I think the numbers range from 0 to 2 for the Type option.

The last entry I added to my default dictionary appears like this in my default.dic file:

#Welsh town
Hirwaun    Heerwine    1    0

The #Welsh Town is the optional comment you can enter in the dictionary manager.
Then comes the text followed by the way you want it pronounced. Then come the flags for Type and Case Sensitive.

One thing that is interesting and has changed since the last time I edited a dictionary file manually, is that the entries are not comma-separated anymore ... they are separated by four spaces.

Hope this helps :)

Giles


 

Giles,

Thanks very much.  Your answer reminded me that, at some point, I know I've asked about this before and it may very well have been you that answered.  
Here are two entries from my current default dictionary:
--
unchecky un-checky 0 2
#Mathematical Prime when there is a single letter with an apostrophe following
(\b[a-zA-Z])' \1 prime 0 1
--
The first is a simple whole-word replacement, with no associated comment, and the individual columns are in the following order, and are TAB separated:
Pattern  Replacement String  Case-Sensitivity-Indicator  Type

Case-Sensitivity-Indicator is 0 when case sensitivity is off and 1 when it's on.
Type is:   0 - Anywhere , 1 - Regular Expression, 2 - Whole Word

The second is a regular expression match where I also have a comment, and as you noted when a comment is present it is placed above the line with the above noted columns and prefixed with a pound sign/number sign/hash.

I have never used an Anywhere type match because it is so fraught, so I had to add one just to make sure that the type indicator would, indeed, be zero for this type of match.

This makes it very easy to create specific "testing variants" of a dictionary, which is what I have need to do on occasion.  Given the way NVDA processes the dictionary I sometimes need to strip out anything but what I'm trying to test to determine whether there are what I'll call "substitution of substitution" situations going on, since dictionary processing does not stop upon first match, but continues after the substitution has been done on that match for the remaining dictionary entries.  This can lead to some very interesting results, and I know that Quentin very kindly illustrated this, vividly, some time back when I was asking about dictionary processing.
--

Brian - Windows 10, 64-Bit, Version 21H2, Build 19044  

The difference between a top-flight creative man and the hack is his ability to express powerful meanings indirectly.

         ~ Vance Packard


 

On Sun, Jul 31, 2022 at 10:06 AM, Gene wrote:
I backed up some dictionaries from old versions but it appears that if I want to use them in new versions, I likely won't be able to.
-
Just run them through a global find and replace using TAB as the replacement for comma.  While that may screw up a comment or two that has no effect on dictionary processing and should fix the lines that were once comma separated.

Just based on memory the values used for the case sensitivity indicator and the type have never varied from what they are now, nor would they have any need to have done so.
--

Brian - Windows 10, 64-Bit, Version 21H2, Build 19044  

The difference between a top-flight creative man and the hack is his ability to express powerful meanings indirectly.

         ~ Vance Packard


Gene
 

That's good.  Thanks.

Gene

On 7/31/2022 10:50 AM, Brian Vogel wrote:

On Sun, Jul 31, 2022 at 10:06 AM, Gene wrote:
I backed up some dictionaries from old versions but it appears that if I want to use them in new versions, I likely won't be able to.
-
Just run them through a global find and replace using TAB as the replacement for comma.  While that may screw up a comment or two that has no effect on dictionary processing and should fix the lines that were once comma separated.

Just based on memory the values used for the case sensitivity indicator and the type have never varied from what they are now, nor would they have any need to have done so.
--

Brian - Windows 10, 64-Bit, Version 21H2, Build 19044  

The difference between a top-flight creative man and the hack is his ability to express powerful meanings indirectly.

         ~ Vance Packard



Brian's Mail list account
 

That is odd, I thought they used tab, but then its a while since I looked. Maybe some kind of simple substitution in notepad search and replace might convert them to spaces. There do seem to be some backup dictionaries in my folders, and I do not recall putting them there.
Another item in that folder appears to be the file created when you edit the spoken symbols as I do, so any you change or change the verbosity settings of, end up in a file in that folder as well.
Brian

--
bglists@...
Sent via blueyonder.(Virgin media)
Please address personal E-mail to:-
briang1@..., putting 'Brian Gaff'
in the display name field.

----- Original Message -----
From: "Gene" <gsasner@...>
To: <nvda@nvda.groups.io>
Sent: Sunday, July 31, 2022 3:06 PM
Subject: Re: [nvda] NVDA Dictionary Files


the difference in how entries are separated may well mean that backed up
dictionaries from earlier versions of NVDA won't work if you place them
in new versions.

I backed up some dictionaries from old versions but it appears that if I
want to use them in new versions, I likely won't be able to.

Gene

On 7/31/2022 8:57 AM, Giles Turnbull wrote:
yes, it is possible to edit the dictionary files manually. They are
located in AppData/Roaming/NVDA/speechDicts. The default dictionary is
default.dic and any voice dictionaries you might have are in folders
under the name of the synth.

One issue I found tricky to figure out was the flags to indicate
options like for Type: anywhere or whole word only or regular
expression, and for case sensitive or not. You can figure this out by
looking at a dictionary entry and seeing how it is in the relevant
dictionary file. Then change an option such as Type Anywhere and
change it to whole word Only, then look at how the dictionary file has
changed. I can't remember off the top of my head, but I think the
numbers range from 0 to 2 for the Type option.

The last entry I added to my default dictionary appears like this in
my default.dic file:

#Welsh town
Hirwaun Heerwine 1 0

The #Welsh Town is the optional comment you can enter in the
dictionary manager.
Then comes the text followed by the way you want it pronounced. Then
come the flags for Type and Case Sensitive.

One thing that is interesting and has changed since the last time I
edited a dictionary file manually, is that the entries are not
comma-separated anymore ... they are separated by four spaces.

Hope this helps :)

Giles





Brian's Mail list account
 

I still find it confusing when folk indicate that# is pound when its number or hash, as pound is

£
Brian

--
bglists@...
Sent via blueyonder.(Virgin media)
Please address personal E-mail to:-
briang1@..., putting 'Brian Gaff'
in the display name field.

----- Original Message -----
From: "Brian Vogel" <britechguy@...>
To: <nvda@nvda.groups.io>
Sent: Sunday, July 31, 2022 4:46 PM
Subject: Re: [nvda] NVDA Dictionary Files


Giles,

Thanks very much. Your answer reminded me that, at some point, I know I've asked about this before and it may very well have been you that answered.
Here are two entries from my current default dictionary:
--
unchecky un-checky 0 2
#Mathematical Prime when there is a single letter with an apostrophe following
(\b[a-zA-Z])' \1 prime 0 1
--
The first is a simple whole-word replacement, with no associated comment, and the individual columns are in the following order, and are TAB separated:
Pattern Replacement String Case-Sensitivity-Indicator Type

Case-Sensitivity-Indicator is 0 when case sensitivity is off and 1 when it's on.
Type is: 0 - Anywhere , 1 - Regular Expression, 2 - Whole Word

The second is a regular expression match where I also have a comment, and as you noted when a comment is present it is placed above the line with the above noted columns and prefixed with a pound sign/number sign/hash.

I have never used an Anywhere type match because it is so fraught, so I had to add one just to make sure that the type indicator would, indeed, be zero for this type of match.

This makes it very easy to create specific "testing variants" of a dictionary, which is what I have need to do on occasion. Given the way NVDA processes the dictionary I sometimes need to strip out anything but what I'm trying to test to determine whether there are what I'll call "substitution of substitution" situations going on, since dictionary processing does not stop upon first match, but continues after the substitution has been done on that match for the remaining dictionary entries. This can lead to some very interesting results, and I know that Quentin very kindly illustrated this, vividly, some time back when I was asking about dictionary processing.
--

Brian - Windows 10, 64-Bit, Version 21H2, Build 19044

*The difference between a top-flight creative man and the hack is his ability to express powerful meanings indirectly.*

~ Vance Packard