From 58b9ff09b0c073ba48a6be219b0f1252d1b75574 Mon Sep 17 00:00:00 2001 From: HE Chong Date: Sun, 2 Oct 2016 12:25:46 +0800 Subject: [PATCH] add documentation for new cilin_txt backend --- README.md | 13 +++++++ .../thesaurus_query/backends/cilin_lookup.py | 2 +- doc/thesaurus_query.txt | 37 +++++++++++++------ 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index fe4bef8..5f08d37 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,19 @@ backends is behaving properly. g:tq_mthesaur_file="~/.config/nvim/thesaurus/mthesaur.txt"` into your `.vimrc` file if your `mthesaur.txt` is placed in folder "~/.config/nvim/thesaurus/". +* **cilin\_txt** queries from local `cilin.txt`. It makes use of a Chinese + thesaurus source "cilin.txt". For this backend to + work, be sure to download the file from + [this github + repo](https://github.com/shijiebei2009/Algorithms/blob/master/src/main/resources/cilin.txt) + and place it under "~/.vim/thesaurus". If you place the file elsewhere, + change global variable |g:tq_cilin_txt_file| to point to the file you + downloaded, eg. put the following line `let + g:tq_cilin_txt_file="~/.config/nvim/thesaurus/cilin.txt"` into your `.vimrc` + file if your `cilin.txt` is placed in folder "~/.config/nvim/thesaurus/". + Note that if you downloaded "cilin.txt" from elsewhere, make sure that your + source `cilin.txt` is utf-8 encoded. Or the plugin won't function correctly + with the file. * **jeck\_ru** is a *Russian* thesaurus backend. It queries [jeck.ru](http://jeck.ru/tools/SynonymsDictionary) for synonym resources. This website didn't provide standard API to use. Hence functionality of this diff --git a/autoload/thesaurus_query/backends/cilin_lookup.py b/autoload/thesaurus_query/backends/cilin_lookup.py index cd3312e..6c04736 100644 --- a/autoload/thesaurus_query/backends/cilin_lookup.py +++ b/autoload/thesaurus_query/backends/cilin_lookup.py @@ -43,7 +43,7 @@ def query(word): def _cilin_file_locate(): verified_file = get_variable( - "tq_cilin_file", + "tq_cilin_txt_file", "~/.vim/thesaurus/cilin.txt") if os.path.exists(os.path.expanduser(verified_file)): return (True, verified_file) diff --git a/doc/thesaurus_query.txt b/doc/thesaurus_query.txt index 57ba331..e04b507 100644 --- a/doc/thesaurus_query.txt +++ b/doc/thesaurus_query.txt @@ -36,23 +36,24 @@ mode or manual input. But for the latter two cases, auto-replacement function is not activated by default. Multiple backends are used for this plugin, by default, three are enabled: - * Online backend querys from [Thesaurus.com](http://thesaurus.com/) for + + * "thesaurus_com" Online backend querys from + [Thesaurus.com](http://thesaurus.com/) for synonym, so internet connection is required for this backend's functionality. - * Local backend querys from OpenOffice's MyThes thesaurus source. If you - have OpenOffice (Not LibreOffice) installed on your Machine, the files - should be `/usr/share/myspell/dicts/th_en_US_v2[.idx,.dat]`, and the - backend would function properly. But if OpenOffice isn't provided by - the distro-repo or if the thesaurus database is provided elsewhere, + * "openoffice_en" querys from OpenOffice's thesaurus source. If + you have OpenOffice (Not LibreOffice) installed on your Machine, the + files should be `/usr/share/myspell/dicts/th_en_US_v2[.idx,.dat]`, and + the backend would function properly. But if OpenOffice isn't provided + by the distro-repo or if the thesaurus database is provided elsewhere, you'll need to manually indicate the database location in your system by setting `g:tq_openoffice_en_file`. E.g. If my database files are `~/Downloads/Mythes-1.0/th_en_US_new[.idx,.dat]`, my setting needs to be > let g:tq_openoffice_en_file="~/Downloads/MyThes-1.0/th_en_US_new" < - - * Local backend querys from `mthesaur.txt`. For this backend to work, + * "mthesaur_txt" querys from `mthesaur.txt`. For this backend to work, be sure to download the file from [gutenberg.org](http://www.gutenberg.org/files/3202/files/) and place it under "~/.vim/thesaurus". If you place the file elsewhere, change @@ -142,7 +143,8 @@ g:tq_enabled_backends~ available options: `woxikon_de`, `jeck_ru`, `thesaurus_com`, `datamuse_com`, `mthesaur_txt` > - let g:tq_enabled_backends = ["woxikon_de", \ + let g:tq_enabled_backends = ["cilin_txt", \ + "woxikon_de", \ "jeck_ru", \ "thesaurus_com", \ "openoffice_en", \ @@ -155,7 +157,8 @@ g:tq_online_backends_timeout~ < g/b:tq_language~ - Each query backend are associated with a Language(English, Russian, etc.) + Each query backend are associated with a Language: English (en), Chinese + (cn), German (de), Russian(ru), etc. This variable decides of all backends enabled by `g:tq_enabled_backends`, which one to be used in general(g:) session or specific buffer(b:), based on the language they are associatd @@ -166,8 +169,8 @@ g/b:tq_language~ `let g:tq_language='en' All backends, regardless of their specific language, are to be used let g:tq_language='All' - English and Russian Query Backends are to be used in current buffer: - let b:tq_language=['en', 'ru'] > + English and Chinese Query Backends are to be used in current buffer: + let b:tq_language=['en', 'cn'] > let g:tq_language=['en'] < @@ -182,6 +185,16 @@ g:tq_use_local_thesaurus_source_as_primary~ let g:tq_use_local_thesaurus_source_as_primary=0 < +g:tq_cilin_txt_file~ + this variable is offered by tq_cilin_txt_lookup. Used to determine locate + `cilin.txt` file from your computer. If no `cilin.txt` is found at this + location, location specified in &thesaurus will be checked. Default + `cilin.txt` location would be "~/.vim/thesaurus/cilin.txt". Note that this + plugin recognize only utf-8 decoding, hence only utf-8 encoding `cilin` + will be correctly used. > + let g:tq_cilin_txt_file="~/.vim/thesaurus/cilin.txt" +< + g:tq_openoffice_en_file~ this variable is offered by openoffice_en_lookup. Used to determine locate OpenOffice thesaurus plugin's index and database file from your