LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Auto copy Firefox words in persdict.dat to other word files. (https://www.linuxquestions.org/questions/linux-software-2/auto-copy-firefox-words-in-persdict-dat-to-other-word-files-4175509976/)

linustalman 07-03-2014 08:20 AM

Auto copy Firefox words in persdict.dat to other word files.
 
Hi.

I add custom words in Firefox to this file: ~/.mozilla/firefox/XXXXXXXX.default/persdict.dat

I'd like a command to auto copy those persdict.dat words to these 2 files:
~/.config/enchant/en.dic
~/.thunderbird/YYYYYYYY.default/persdict.dat'

Thanks.

unSpawn 07-04-2014 01:09 AM

What's the format of these files? Plain text, Mork, sqlite3 database or?..

linustalman 07-04-2014 04:05 AM

Quote:

Originally Posted by unSpawn (Post 5198388)
What's the format of these files? Plain text, Mork, sqlite3 database or?..


Hi unSpawn.

Using the file command:
.mozilla...persdict.dat: C++ source, UTF-8 Unicode text
.thunderbird...persdict.dat: ASCII text
.config/enchant/en.dic: C++ source, UTF-8 Unicode text

unSpawn 07-04-2014 01:24 PM

No idea what char sequences make it say "C++ source" but for me (FF 30.0 here) the "persdict.dat" appears to be plain text. I don't have any .config/enchant/ dictionaries in use. http://www.abisource.com/enchant/ says enchant isn't a spell checking library at all but requires backends like aspell. Could you read one of your ~/.config/enchant/*.dic files to see what it contains?

linustalman 07-05-2014 08:55 AM

Quote:

Originally Posted by unSpawn (Post 5198716)
No idea what char sequences make it say "C++ source" but for me (FF 30.0 here) the "persdict.dat" appears to be plain text. I don't have any .config/enchant/ dictionaries in use. http://www.abisource.com/enchant/ says enchant isn't a spell checking library at all but requires backends like aspell. Could you read one of your ~/.config/enchant/*.dic files to see what it contains?

I ran this on a test Linux Mint 17 MATE VirtualBox VM in ~/.mozilla: file persdict.dat persdict.dat: ASCII text

The en.dic file in ~/.config/enchant/ contains words I've added manually overtime.

unSpawn 07-06-2014 06:20 AM

OK, so basically both are ASCII text files. You could (should) make backups and $(sort -u $EACH_FILE) and create a central source from which to populate those three files (inotify CLOSE_WRITE trigger?) but I'm not sure if those changes will stick while the application is running. Only one way to find out ;-p

linustalman 07-06-2014 12:54 PM

Quote:

Originally Posted by unSpawn (Post 5199444)
OK, so basically both are ASCII text files. You could (should) make backups and $(sort -u $EACH_FILE) and create a central source from which to populate those three files (inotify CLOSE_WRITE trigger?) but I'm not sure if those changes will stick while the application is running. Only one way to find out ;-p

Could you elaborate on that? Giving a step by step process?

linustalman 07-08-2014 02:34 PM

The most important bit is to copy (with a single command to add to an alias) all the contents of the .mozilla persdict.dat file to the .thunderbird persdict.dat file. I can manually update the en.dic file.

unSpawn 07-08-2014 04:52 PM

I think I'm making this too difficult ;-p If all three dictionaries are plain text files containing only the words you add one per line then why not simply symlink two to the one you always edit?

linustalman 07-09-2014 08:43 AM

Quote:

Originally Posted by unSpawn (Post 5200733)
I think I'm making this too difficult ;-p If all three dictionaries are plain text files containing only the words you add one per line then why not simply symlink two to the one you always edit?

The perfect solution. Cheers unSpawn.

I used the Firefox persdict.dat as the main file and linked from it with the same name to .thunderbird and changed link name to 'en.dic' for the file in .config/enchant/ which is used by Pluma, etc.

linustalman 08-04-2014 04:00 AM

Can I also use this with LibreOffice spellcheck?


All times are GMT -5. The time now is 11:56 PM.