[App][NST/G] Dictionary Management

Search This thread

nmyshkin

Recognized Contributor
Nov 21, 2013
1,613
460
While working on a custom update of the UK ROM to FW 1.2.2, I was intrigued to see that there was a dictionary management Settings option. Of course it didn't work because there were no other dictionaries to download. But the idea stuck with me and eventually led me to develop this app and release it in conjunction with some new sets of single-language and translation dictionaries based on Wiktionary.

Note: this app is for the US version of the NST/G only.

READ THIS: you need to make a complete backup of your device before using this app. Improper use of this app may slowly decrease the available free space in /system, so MAKE A BACKUP.

What this app does

0. Changes the location of the stock dictionary and the way it is accessed (can be undone by "Restore").
1. Allows you to select either internal (/data/media/B&N Downloads/Dictionary) or external (/sdcard/Dictionary) storage for dictionaries.
2. Backs up the stock dictionary to your chosen storage location.
3. Deletes the stock dictionary files from /system/media/reference.
4. Displays up to eight dictionaries you copy to the storage location you have chosen and
5. Allows you to select and "install" an alternate dictionary (or the stock dictionary)

The only time dictionary files are actually moved is during the backup or restoration process. This takes a minute or so. Otherwise only symlinks are created and deleted in /system/media/reference, and these point back to the storage location.

Changes in dictionaries are immediate, no reboot required.

Requirements

1. Root
2. sqlite (in attached zip package)
3. basewords.db and inflectedwords.db files for the language pair or language you desire

Q&A

1. I already have an alternative dictionary I am using. Can it be used with this app?

Yes. The files can be placed in an appropriately named folder in the storage location and the app will find them. The name of the folder is the display name in the app. However, if you have removed the stock dictionary it is best to restore it properly first. To do this safely, refer to the instructions for manually installing dictionaries found in the companion post. Once the stock dictionary is back where it belongs you can run the app and proceed through setup. Then you can place your alternate dictionary in your chosen storage location. All dictionaries must contain both a basewords.db and inflectedwords.db. DO NOT select a dictionary with this app which does not have both files present!

2. My dictionary does not show any "source" like the stock dictionary and the ones you made.

When the stock dictionary is moved to the storage location a one-item table is added to basewords.db. This contains the identifying string used in the app display (the table is removed during the "Restore" process). You can add a similar table to your dictionary using SQlite. If you don't have SQlite on your computer and don't want to fuss with it, you can download the SQlite Database Browser instead. It will open your basewords.db file and there is a tab on the console labeled "Execute SQL". This provides a place for you to type in SQlite commands and execute them. To add the table:
Code:
CREATE TABLE nook_metadata (source TEXT);   (execute--click the "play" symbol)
INSERT INTO nook_metadata (source) VALUES('your string here');  (execute--click the "play" symbol)
Be sure to "Write Changes" before exiting.

Installation and setup

1. This is a Tasker-generated app and requires two library files (in attached zip package) or it will not install. If you already have one of my other Tasker-generated apps you can discard these files. Otherwise, copy them as indicated below:

/system/etc/permissions/com.google.android.maps.xml
/system/framework/com.google.android.maps.jar

Set permissions for both files to rw-r--r-- and reboot. Without these files resident, the app will not install.

2. If you don't already have sqlite, copy the file from the zip as below:

/system/bin/sqlite

Set the permissions to rwx r-x r-x and reboot.

3. Install the Dictionaries app with a file manager or via ADB.

4. On first run the app requests SuperUser permission. You then select either internal or external storage for dictionaries.

5. Next the stock dictionary is backed up. If you want to stop using the app it is very important to use the "Restore" option on the bottom right of the main screen. Otherwise you will be left without any dictionary at all!

6. At this point setup dialog with the app ends. Now is the time to copy any alternative dictionaries to the storage location you selected. This can be done by transferring the folders/files to your sdcard or /media, and then using a file manager to move the files to the proper location (/data/media/B&N Downloads/Dictionary OR /sdcard/Dictionary). For example, if you are going to use an "English-French" dictionary, you would want a folder /sdcard/Dictionary/English-French. In that folder you would place the basewords.db and inflectedwords.db for that language pair. The folder name you use will be the display name in the app. During setup the app creates the folder "English" within the Dictionary folder in your storage location of choice. You should not change the name of this folder. Sorry.

Generally the files are large enough that you will want to move one at a time. Files can also be transferred via ADB, but if you chose internal storage, the command syntax is complicated by the "&" character and spaces in the directory name. Be sure to use double quotes as in the example below:
Code:
adb push basewords.db "/data/media/B&N Downloads/Dictionary/German-English/basewords.db"
Be sure EACH folder for a dictionary contains a basewords.db file and an inflectedwords.db file. Failure to place both files in a folder may result in a crash of the app if that dictionary is selected and a potential loss of storage space in /system.

7. After moving the dictionary files to your chosen storage location, accessing the app will show the available dictionaries. Choose which one you want and tap "Confirm". The job is done and the app closes. The dictionary is immediately available.

If you change your mind, just use the exit arrow to leave the app without tapping on "Confirm".

8. If you don't want to use the Dictionary Management app any longer, open it and tap on "Restore". This will delete the symlinks in /system/media/reference and copy the stock dictionary from its (backup) storage location back to /system/media/reference. Everything returns to normal, but any dictionaries you copied onto the device remain in place (that includes a copy of the stock dictionary). You can remove them with a file manager or ADB.
 

Attachments

  • dictionaries_app.jpg
    dictionaries_app.jpg
    34.7 KB · Views: 22
  • Dictionaries_app.zip
    888.3 KB · Views: 14
Last edited:
  • Like
Reactions: aiamuzz

aiamuzz

Senior Member
Dec 24, 2011
495
46
@nmyshkin ...

exited to try it ... but OP says its only for US devices ... I think mine is a UK device ... Any way i can get it to work my UK NST/G ?

I like the fact that this dictionary looks like a stock option of 'Dictionary Management' within the Stock Settings ... i would love to manage dictionaries ... One question though ... all these dictionaries, i'am guessing in to whose from within the Nook Stock Reader ... am i right ?

Cheers.
 

nmyshkin

Recognized Contributor
Nov 21, 2013
1,613
460
@nmyshkin ...

exited to try it ... but OP says its only for US devices ... I think mine is a UK device ... Any way i can get it to work my UK NST/G ?

I like the fact that this dictionary looks like a stock option of 'Dictionary Management' within the Stock Settings ... i would love to manage dictionaries ... One question though ... all these dictionaries, i'am guessing in to whose from within the Nook Stock Reader ... am i right ?

Cheers.
UK device vs. UK ROM. When you boot do you get the "Read Forever" logo (US ROM) or the multi-language splash screen (UK ROM)? [see images below] When you shut down, is the screen all in English (US ROM) or again a multi-language screen (UK ROM).

When you look up a word from the stock reader, does the Lookup window say the dictionary is the Merriam-Webster (US ROM) or the Oxford English (UK ROM)?

Finally, in the stock settings under "Reader" is there already a (non-functional) Dictionary Management page (UK ROM)?

So that's how you tell. Alas, as I stated in the companion thread with the new dictionaries, I have not been able to generate a working dictionary for the UK ROM. Yet. So this is only for the US version. This app would not run properly on the UK version, and even if it did, the dictionaries would not work.

If, OTOH, you have a UK ROM and a working alternative dictionary already, it would be really easy for me to produce a version of this app that would work on the UK ROM.

And yes, this is for the stock reader and its Lookup function.
 

Attachments

  • booting_US.png
    booting_US.png
    11.1 KB · Views: 1
  • booting_UK.png
    booting_UK.png
    19.2 KB · Views: 1
Last edited:

aiamuzz

Senior Member
Dec 24, 2011
495
46
UK device vs. UK ROM. When you boot do you get the "Read Forever" logo (US ROM) or the multi-language splash screen (UK ROM)? [see images below] When you shut down, is the screen all in English (US ROM) or again a multi-language screen (UK ROM).

When you look up a word from the stock reader, does the Lookup window say the dictionary is the Merriam-Webster (US ROM) or the Oxford English (UK ROM)?

Finally, in the stock settings under "Reader" is there already a (non-functional) Dictionary Management page (UK ROM)?

So that's how you tell. Alas, as I stated in the companion thread with the new dictionaries, I have not been able to generate a working dictionary for the UK ROM. Yet. So this is only for the US version. This app would not run properly on the UK version, and even if it did, the dictionaries would not work.

If, OTOH, you have a UK ROM and a working alternative dictionary already, it would be really easy for me to produce a version of this app that would work on the UK ROM.

And yes, this is for the stock reader and its Lookup function.

@nmyshkin ... wonderful ...

1. Boots Up to a 'Read Forever' screen - US ROM !
2. Shuts down to an all English 'Your NOOK has turned off completely. Press the ' ' button on the back to power up. ...nook ... By Barnes & Noble - US ROM
3. Stock reader has 'Merriam Webster's Collegiate Dictionary Eleventh Edition' - US ROM
;
4. Reader page in settings however has only one page with 'Page forward and backward' settings. I can't seem to find any other page, tried swiping up and down as well as sideways but nothing showed up - UK ROM ???

5. I don't seem to have the alternate dictionary option in the stock reader look-up of Merriam Webster's Dictionary - UK ROM ???


Can I attempt installing this dictionary app, as 3/5 aspects point to a US ROM ... and ... Only 2/5 aspects point to a UK ROM.
 

aiamuzz

Senior Member
Dec 24, 2011
495
46
@nmyshkin ... sorry, couldn't hold the exitement and i tried it even before you replied to my earlier posts.

Currently my device is sitting on 'Please Wait ... " for quite a while now, after i installed the app and choosing the SD card as the location, this 'Please Wait ...' message is is sitting there for more than 15 minutes now ... Does it so long ?
 

nmyshkin

Recognized Contributor
Nov 21, 2013
1,613
460
@nmyshkin ... sorry, couldn't hold the exitement and i tried it even before you replied to my earlier posts.

Currently my device is sitting on 'Please Wait ... " for quite a while now, after i installed the app and choosing the SD card as the location, this 'Please Wait ...' message is is sitting there for more than 15 minutes now ... Does it so long ?
No. That is not normal and suggests a crash.

Yes, you have a US ROM.

Did you remember to install sqlite?
 

aiamuzz

Senior Member
Dec 24, 2011
495
46
No. That is not normal and suggests a crash.

Yes, you have a US ROM.

Did you remember to install sqlite?

my bad ... it was an issue with sqlite3 file permission being set wrong ... i corrected that and its whirring away ...

Come clarifications :
1. When sideloading dictionaries in /sdcard/Dictionary ... as the first dictionary in this folder is another folder with the name 'English' ... do we have to first create a folder for the type of dictionary and then dump those 2 database files into the respectively created folders ?

2. Can we switch dictionaries from within the stock reader from inside the dictionary that opens when we lookup ?

Another feather in your cap ... I must say you ARE very meticulous and tidy in your work ... Attention to detail is your strong suit i am sure ... the dictionaries are really well organized and the OP is as easy as it gets ...

Cheers.
 

nmyshkin

Recognized Contributor
Nov 21, 2013
1,613
460
Some clarifications :
1. When sideloading dictionaries in /sdcard/Dictionary ... as the first dictionary in this folder is another folder with the name 'English' ... do we have to first create a folder for the type of dictionary and then dump those 2 database files into the respectively created folders ?
The "English" folder is where the stock dictionary lives now. So, yes, you create a folder with the name you want to display in the app, and then copy in the two db files.
2. Can we switch dictionaries from within the stock reader from inside the dictionary that opens when we lookup ?
Alas, no. This is a feature in the UK ROM, and I considered a potential overlay to mimic it, but I couldn't find a suitable trigger to manage the overlay.
 

nmyshkin

Recognized Contributor
Nov 21, 2013
1,613
460
my bad ... it was an issue with sqlite3 file permission being set wrong ... i corrected that and its whirring away ...
OK, there is some funny business beyond what is happening with your device. I have an email notification of a post that is non-existent:
Ok ... i tried sideloading those folders i had renamed on my laptop and then i transferred it by a data cable. Initially I crammed all of your dictionaries in the /sdcard/Dictionary/ folder and when i tried opening the Dictionaries App it didn't open, then i created an archived folder inside and moved all but 5(1+4) dictionaries and tried opening, but the Dictionaries App isn't opening ... i only get a notification saying 'Dictionaries App was granted super user rights' ... but the app never really opens ... wonder why it isn't opening ...
Within the /sdcard/Dictionary folder the app places an "English" folder during setup. Then the stock dictionary files are moved there (basewords.db and inflectedwords.db). To add a dictionary, you need to create your own folder within /sdcard/Dictionary like "English-German" or whatever. Then place the basewords.db and inflectedwords.db for that dictionary in the folder (yes, you have to unzip the dictionary files you download). If you do that and the app does not open, then I believe what you have is commonly described as "a hot mess".

So....before I go off on a long diagnostic discourse, did you get it to work now? If not, the quickest "fix" is to restore the backup you made (?) before you installed the app and start again, paying attention to sqlite permissions this time. If you don't have an immediate backup and it's still not working, I will help you diagnose the issue and try to fix it.

Edit: and BTW, you can turn off that annoying SuperUser toast if you want. It's one thing for it to ask for initial permission, but it's really annoying to be told every time root access is used by an app that has already been granted permission.

oh really UK ROM does have that option inside the lookup dictionaries ?
Can @Renate be of any help, given her knowledge of the nuts and bolts of the NST/G's ... thanks to her i am able to have a pin lock on my NST/G ... may be she can help you find the trigger to enable the overlay on non-UK ROM 's ...
Well, the option is there in the UK ROM version and it takes you to the dictionary management settings page, but there's no way to know what it does after that since there are no other dictionaries to try. It may take you back to the Reader/Lookup screen or it may not.

Remember that @Renate is not really working with the NST any more, and even if she were, my Tasker "apps" do things in ways that mostly skirt around issues with the OS or "collaborate" with it, not change it. In any case, attempts to make changes in the Reader or related apps will run up against the system signature issue, and that's a no-go. The appearance of the Lookup window is not something I have been able to detect short of constantly scanning for the currently focused window, so that's no good. My very old version of Tasker can send intents but it can't listen for them, so that's no good. I think what we have is "good enough". Best to find a dictionary you like rather then constantly jumping from one to another while still in the same book.

And BTW, the Lockpin settings (and clearing them), are easily available from my Nook Settings app. Just a shameless plug .
Security.png
 
Last edited:

aiamuzz

Senior Member
Dec 24, 2011
495
46
hahahaha ... B&N ... needs to hire you for bringing about changes to NST/G that they had already given up(forgotten in fact) ...

@nmyshkin ... the fact that all your efforts on apps and functionalities you've worked seem 100% stock as far as UI/UX is concerned ...

If you had just mentioned you were an official B&N executive, and given your changes / improvement you've brought about to this device, no one will ever doubt you, the'll easily believe B&N is doing all this ... even if there was B&N support for our device they wouldn't have been willing to go to the extent you've gone with your customizations and true value additions.

Simply Fantastic !!!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    While working on a custom update of the UK ROM to FW 1.2.2, I was intrigued to see that there was a dictionary management Settings option. Of course it didn't work because there were no other dictionaries to download. But the idea stuck with me and eventually led me to develop this app and release it in conjunction with some new sets of single-language and translation dictionaries based on Wiktionary.

    Note: this app is for the US version of the NST/G only.

    READ THIS: you need to make a complete backup of your device before using this app. Improper use of this app may slowly decrease the available free space in /system, so MAKE A BACKUP.

    What this app does

    0. Changes the location of the stock dictionary and the way it is accessed (can be undone by "Restore").
    1. Allows you to select either internal (/data/media/B&N Downloads/Dictionary) or external (/sdcard/Dictionary) storage for dictionaries.
    2. Backs up the stock dictionary to your chosen storage location.
    3. Deletes the stock dictionary files from /system/media/reference.
    4. Displays up to eight dictionaries you copy to the storage location you have chosen and
    5. Allows you to select and "install" an alternate dictionary (or the stock dictionary)

    The only time dictionary files are actually moved is during the backup or restoration process. This takes a minute or so. Otherwise only symlinks are created and deleted in /system/media/reference, and these point back to the storage location.

    Changes in dictionaries are immediate, no reboot required.

    Requirements

    1. Root
    2. sqlite (in attached zip package)
    3. basewords.db and inflectedwords.db files for the language pair or language you desire

    Q&A

    1. I already have an alternative dictionary I am using. Can it be used with this app?

    Yes. The files can be placed in an appropriately named folder in the storage location and the app will find them. The name of the folder is the display name in the app. However, if you have removed the stock dictionary it is best to restore it properly first. To do this safely, refer to the instructions for manually installing dictionaries found in the companion post. Once the stock dictionary is back where it belongs you can run the app and proceed through setup. Then you can place your alternate dictionary in your chosen storage location. All dictionaries must contain both a basewords.db and inflectedwords.db. DO NOT select a dictionary with this app which does not have both files present!

    2. My dictionary does not show any "source" like the stock dictionary and the ones you made.

    When the stock dictionary is moved to the storage location a one-item table is added to basewords.db. This contains the identifying string used in the app display (the table is removed during the "Restore" process). You can add a similar table to your dictionary using SQlite. If you don't have SQlite on your computer and don't want to fuss with it, you can download the SQlite Database Browser instead. It will open your basewords.db file and there is a tab on the console labeled "Execute SQL". This provides a place for you to type in SQlite commands and execute them. To add the table:
    Code:
    CREATE TABLE nook_metadata (source TEXT);   (execute--click the "play" symbol)
    INSERT INTO nook_metadata (source) VALUES('your string here');  (execute--click the "play" symbol)
    Be sure to "Write Changes" before exiting.

    Installation and setup

    1. This is a Tasker-generated app and requires two library files (in attached zip package) or it will not install. If you already have one of my other Tasker-generated apps you can discard these files. Otherwise, copy them as indicated below:

    /system/etc/permissions/com.google.android.maps.xml
    /system/framework/com.google.android.maps.jar

    Set permissions for both files to rw-r--r-- and reboot. Without these files resident, the app will not install.

    2. If you don't already have sqlite, copy the file from the zip as below:

    /system/bin/sqlite

    Set the permissions to rwx r-x r-x and reboot.

    3. Install the Dictionaries app with a file manager or via ADB.

    4. On first run the app requests SuperUser permission. You then select either internal or external storage for dictionaries.

    5. Next the stock dictionary is backed up. If you want to stop using the app it is very important to use the "Restore" option on the bottom right of the main screen. Otherwise you will be left without any dictionary at all!

    6. At this point setup dialog with the app ends. Now is the time to copy any alternative dictionaries to the storage location you selected. This can be done by transferring the folders/files to your sdcard or /media, and then using a file manager to move the files to the proper location (/data/media/B&N Downloads/Dictionary OR /sdcard/Dictionary). For example, if you are going to use an "English-French" dictionary, you would want a folder /sdcard/Dictionary/English-French. In that folder you would place the basewords.db and inflectedwords.db for that language pair. The folder name you use will be the display name in the app. During setup the app creates the folder "English" within the Dictionary folder in your storage location of choice. You should not change the name of this folder. Sorry.

    Generally the files are large enough that you will want to move one at a time. Files can also be transferred via ADB, but if you chose internal storage, the command syntax is complicated by the "&" character and spaces in the directory name. Be sure to use double quotes as in the example below:
    Code:
    adb push basewords.db "/data/media/B&N Downloads/Dictionary/German-English/basewords.db"
    Be sure EACH folder for a dictionary contains a basewords.db file and an inflectedwords.db file. Failure to place both files in a folder may result in a crash of the app if that dictionary is selected and a potential loss of storage space in /system.

    7. After moving the dictionary files to your chosen storage location, accessing the app will show the available dictionaries. Choose which one you want and tap "Confirm". The job is done and the app closes. The dictionary is immediately available.

    If you change your mind, just use the exit arrow to leave the app without tapping on "Confirm".

    8. If you don't want to use the Dictionary Management app any longer, open it and tap on "Restore". This will delete the symlinks in /system/media/reference and copy the stock dictionary from its (backup) storage location back to /system/media/reference. Everything returns to normal, but any dictionaries you copied onto the device remain in place (that includes a copy of the stock dictionary). You can remove them with a file manager or ADB.