Ron89 / thesaurus_query.vim

Multi-language Thesaurus Query and Replacement plugin for Vim/NeoVim
http://www.vim.org/scripts/script.php?script_id=5341
Apache License 2.0
220 stars 23 forks source link

Possible alternative local backend #13

Closed Futurile closed 8 years ago

Futurile commented 8 years ago

I found a mention of this script online: http://www.vim.org/scripts/script.php?script_id=2528

It uses thesaurus files from Open Office so they could be installed locally or the plugin could grab them I guess. They are idx files, but I'm not sure about that format. Might be worth a look.

Thanks for the plugin!

Ron89 commented 8 years ago

Hi, thanks for your suggestion. I have looked into the data structure of openoffice's thesaurus database and wrote a wrapper for it. It works on my machine with both Python2 and Python3 intepreter, but I don't know how it would behave on other platforms.

Because it is a new backend that need to be tested, and that not all distros these days carries OpenOffice, I didn't enable this backend by default. To use it, please set the variable as below:


    let g:tq_enabled_backends=["openoffice_en" ,"thesaurus_com",other_backends_you_like,...]
    let g:tq_openoffice_en_file="/path/to/your/th_en_US_v2"

Note that for g:tq_openoffice_en_file, don't add filetype extension .idx or .dat to it. Only the path and main file name would suffice. Extensions of index and data file are dealt with by the program already.

Ron89 commented 8 years ago

Tested to be working and set as default already, please check it out.

Futurile commented 8 years ago

Thanks for the reminder, just tested it. It works really well.

In case anyone reads this later I'm using Ubuntu 14.04 LTS. My tests were:

a. Define OpenOffice file location Turned off the network, defined the backend in Vim:

let g:tq_enabled_backends=["openoffice_en"]
let g:tq_open_office_en_file="/usr/share/myspell/dicts/th_en_US_v2"

Did tests using the words - turtle, chuckle, contrary and melee - found options for all of them

b. Undefined OpenOffice backend location I saw that in the README.md you say that the backend location doesn't need to be defined if it's in the default location on Linux of "/usr/share/myspell/dicts/th_en_US_v2". So commented it out and redid the test - again found options for all words.

I've now got it switched on and working for general usage - thanks so much! I have a connected feature request to be able to cycle around backends, but will open another issue ;-)