Guys, I want to announce here that this plugin will no longer support thesaurus.com because it has taken legal action against its upstream Python project "thesaurus". Here is the email the author of that project sent to me few weeks ago.
The fated day has arrived. Earlier today as I was enjoying a lecture on undecidability, I got an email: “Infringement of Dictionary.com’s Intellectual Property Rights”. Thought you should know.
They want me to cease-and-desist by May 3rd. I don’t really know what happens to the forks at that point… I’m going to first try purging the master branch and replacing it with a README that explains the situation. This way, users can still click on the forks and find one to use. If the old code is still accessible somehow from my root url, I’ll probably have to delete the whole thing and then recreate the project at the same url, again with just a README.
I recommend this guy’s fork: https://github.com/ryh95/thesaurus . He’s added asyncio support and logging. Probably doesn’t work on Python 2.
Sigh. The world needs more Piratpartiets. One good thing might come of this— this lawyer’s going to get the best damn response imaginable. He’s going to think he accidentally emailed a crackhead poet.
Thanks for your support,
query_methodargument to search for
suggestions. I also added this argument for the french support with synonymo.fr but how can we use this ? Only synonyms are looked up. It would be great if
:Thesaurus wordwould display the definition along the synonyms, and if nothing found, suggestions.
haha you're right about replacing words by their antonyms! Though, I like querying antonyms, so for now, I just made a small hack to do this for my french backends. Implementing it for real would require quite some refactoring imo.
Moreover, I think your plugin is great but could benefit some improvements. Few things that came in mind right now :
splitrightinstead of forcing
<C-p>instead of 'n' and 'p' characters in a prompt
Anyhow, congratz! for your graduation :D :D I'm myself in the process of writing my PhD thesis in CS theory, and when motivation goes down, I 'sharpen my (vim) tools' ;)
So let me know if you're interrested in pull request, and/or talking further!
fix next and previous queries. The split gets on 1 line with a "--- More ---" prompt if I do 'n' then 'p'
Yes, Vim's messaging system is not ideal for frequent user interaction. But currently I don't have much idea on what can be done on it.
possibility to 'n' and 'p' to query next and previous backends in query mode and not only replacement mode
The query mode was kind of an after-thought. But what you proposed is a good idea. To achieve this, we should allow the key press on thesaurus buffer to control the
tq_framework's query session, and
tq_framework.session_terminate() only when user leave the buffer.
better algorithm for local thesaurus.txt queries (results are too long, how to truncate?)
A truncate mechanism already exists, actually, you can truncate the result based on two criteria, albeit neither of them ideal:
" This variable is for replacing candidate display. If value is -1, no " truncate of output is made upon number of definitions. Else, if number is n, " only synonyms of the first n word definitions were retained. if !exists("g:tq_truncation_on_definition_num") let g:tq_truncation_on_definition_num = -1 endif " This variable is for replacing candidate display. If value is -1, no " truncate of output is made upon number of synonyms from a single definition. " Else, if number is n, only first n synonyms of that definition will be " retained. if !exists("g:tq_truncation_on_syno_list_size") let g:tq_truncation_on_syno_list_size = -1 endif
Glad to know that you are wrapping up with your phD as well~ It's always exciting moving from one phase of life into another. Mine was in Physics. Though nowadays I am working on Applied Cryptography in a small Software company. So... although I do enjoy myself these days, the Doctor I got was a wrong kind, I think 😅. Hopefully you'll have a better time finding interesting opportunity in consistent of what you studied.
I think most of this plugin was created when I was spending most of my time writing. I made it to address my pain point of not being able to efficiently finding appropriate words while writing essays with Vim. As you are also spending most of your time writing nowadays, I believe you already have your assessment on addressing what problem can help you with your productivity the most. If you find some of the items you mentioned above addressing your pain point, please help with the feature development. PR is always welcomed~
@perelo Hi! So, I forked the repo and added a new backend for my own use: http://dictionaryapi.com (Merriam-Webster API). Is this something you would be interested in merging back into your repo? Here's the details of what the backend does:
This is the Merriam-Webster API and as such is a very high-quality back end. However, it does require registration on their website as a developer in order to gain access to the API Keys. They do explicitly state that it is free for non-commercial use up to 1,000 queries a day, which should be sufficient for most needs. Make sure you select the
Thesaurus api key, as that is what you will need in order for this backend to work.
In order to use this backend, add
g:tq_enabled_backend and set your api key to
This backend cannot work without an API key.
The DictionaryApi.com backend returns several categories of information in this order:
Also, if the word cannot be found, the API may sometimes return a list of word suggestions. These will be returned as
and allow you to choose a replacement from the list.
Also, the output is a little weird because you don't technically support anything but Synonyms. The output format ends up being something like:
Found as: Synonyms Synonyms: .... word list Found as: Related Synonyms: ... word list ...
I think it would probably look better if the
Synonyms: tag said
Select List: or
Word List: or something like that, but I didn't want to hack the rest of the project to change it.
@Ron89 My apologies. Please see my posts above if you have time. I didn't even realize til now that I had originally pinged the wrong person.
Also, I added a secondary option to the output format to break up synonyms only by the short definition. This may actually be the better default, as I think it aligns with your output format perfectly.
<leader>ca. Back-ends can optionally return antonyms by simply returning them as an additional list (identical to synonyms) in the query result. Those are then use only if
<leader>ca(bound to: ThesaurusQueryReplaceCurrentWordAntonym, a new function) is used.