spellchecker icon indicating copy to clipboard operation
spellchecker copied to clipboard

Custom location of dictionaries

Open zdposter opened this issue 2 years ago • 4 comments

Please allow to set custom location of (hunspell) dictionaries - I do not want to have the same dictionaries on multiple location.

zdposter avatar Jun 25 '22 18:06 zdposter

What locations are you using? Maybe we could just add them for everyone if that makes sense. Also, which operating system? On the other hand, have you considered symlinking?

krassowski avatar Jun 25 '22 19:06 krassowski

I use windows. I did not consider symlink - IMO that is workaround. I prefer cleaner solution with config option. Hunspell is used these projects I use regularly: libreoffice, chromium, firefox, thunderbird, notepad++ (maybe more).

Hunspell checks for env variable DICPATH + it looks at many different locations (hunspell.exe -D):

SEARCH PATH:
.;;C:\Hunspell\;C:\Users\USER\Application Data\OpenOffice.org 2\user\wordbook;C:\Users\USER\AppData\Roaming\LibreOffice\4\user\wordbook;C:\Program files\OpenOffice.org 2.4\share\dict\ooo\;C:\Program files\OpenOffice.org 2.3\share\dict\ooo\;C:\Program files\OpenOffice.org 2.2\share\dict\ooo\;C:\Program files\OpenOffice.org 2.1\share\dict\ooo\;C:\Program files\OpenOffice.org 2.0\share\dict\ooo\C:\Program Files\LibreOffice\share\extensions;C:\Program Files (x86)\LibreOffice\share\extensions
AVAILABLE DICTIONARIES (path is not mandatory for -d option):
C:\Users\USER\AppData\Roaming\LibreOffice\4\user\wordbook\standard

https://github.com/hunspell/hunspell/blob/80d24cc3a664d04bbc62be27e1580d1aa181900b/src/tools/hunspell.cxx#L2041-L2060

https://github.com/hunspell/hunspell/blob/80d24cc3a664d04bbc62be27e1580d1aa181900b/src/tools/hunspell.cxx#L118-L147

zdposter avatar Jun 26 '22 12:06 zdposter

I think that it would be nice to add these here:

https://github.com/jupyterlab-contrib/spellchecker/blob/05487e2c588961ff8e1550cc55c5e80516294bed/jupyterlab_spellchecker/dictionaries.py#L21-L23

Though we would likely need to do some variable name expansions to cover USERs and possibly allow glob patterns to allow for different open/libre office versions?

https://github.com/jupyterlab-contrib/spellchecker/blob/05487e2c588961ff8e1550cc55c5e80516294bed/jupyterlab_spellchecker/dictionaries.py#L124

krassowski avatar Jul 02 '22 15:07 krassowski

This looks good so far, the problem is to cover all possible directories for the different OSes. Linux is easy, but for Darwin you have different ways to install the dictionaries, my dictionaries are in ~/Library/Spellchecker ... actually I don't have a clue how this can be addressed in Windows ...

ocordes avatar Jul 06 '22 09:07 ocordes