Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Cyric
    @Cyric263
    most of the basics looks the same in javascript and python to me
    lol
    python code looks a lot cleaner
    and easier to write
    but javascript has node.js
    but u would think u would use go language on the server side
    youwould think python could work on the server as well?
    cause it has a lot of administration procedures
    not sure if it does tho
    Cyric
    @Cyric263
    I installed NerdTree and ctrlP pluggins! they seem to work
    Cyric
    @Cyric263
    g00d-after noon Powerful-Spirits of the Universe!
    HE Chong
    @Ron89
    hmm, I never did code for server, so I wouldn't say I can offer my opinion on your question... I have friends claiming node-js is for everything. But then, so is Python. Frankly, if there is a project need me to use javascript, I will. But for now, Python is good enough for my need. Ultimately, language is just a tool to express whatever that is needed to be expressed. So at some point, we need to shift our attention from the language we use to what exactly do we want to do, I think...
    Good afternoon, oh, nope, it's mid-night here, lol
    Cyric
    @Cyric263
    I had an idea... i'm not sure why.. or if it is any good... is there a pluggin to make vim work as a tab in say a firefox browser? I'm not sure why this idea popped to my head... I suppose i saw a room called codemirror on gitterim.. that advertised a text editor in the browser... so i automatically thought why not vim in the browser, LOL
    i will duckduckgo search the topic
    omg - theres a vimb or vim file browser and a few other links i'll have to look at
    woah the design vimb webpage almost looks like it used word from microsoft
    Cyric
    @Cyric263
    bbl
    HE Chong
    @Ron89

    OK, I think it is the time I should remind you, this is a Gitter group for thesaurus_query.vim related discussion.

    Please don't treat it like some random discussion group...

    Cyric
    @Cyric263
    k
    HE Chong
    @Ron89

    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,
    Robert Dominguez
    https://robertism.com

    For English query, currently the best thesaurus source would be OpenOffice's thesaurus database.
    Eloi Perdereau
    @perelo
    So sad for thesaurus.com :'(
    Eloi Perdereau
    @perelo
    I have a question on your plugin.
    I see that the function _datamuse_api_wrapper() in backends/datamuse_com_lookup.py have a query_method argument to search for antonyms or 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 word would display the definition along the synonyms, and if nothing found, suggestions.
    HE Chong
    @Ron89
    Hi @perelo , currently I have only exposed synonym for replacement. Designing for anonym replacement is a bit awkward (I mean, I can't think of a case where you type in the exact opposite of what you want to say, then search for its anonym to replace it 😅) in text editing so I didn't expose it. But I think an expansion in query's functionality is possible.
    I am busy with graduation ceremony this weekend
    Will take a look and merge your PR before next weekend. Thank you for the new back end you made 😁😁😁
    Eloi Perdereau
    @perelo

    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 :

    • fix missing space after last comma of the lists (done it in my fork)
    • use user-defaults of splitbelow and splitright instead of forcing belowright split
    • fix next and previous queries. The split gets on 1 line with a "--- More ---" prompt if I do 'n' then 'p'
    • possibility to 'n' and 'p' to query next and previous backends in query mode and not only replacement mode
    • maybe add buffer-local mapping <C-n> and <C-p> instead of 'n' and 'p' characters in a prompt
    • better algorithm for local thesaurus.txt queries (results are too long, how to truncate?)
    • maybe make a generic backend which searches in &thesaurus vim variable ? we should see how to integrate this with g:tq_language

    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!

    HE Chong
    @Ron89

    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~

    Aaron Hayman
    @ahayman

    @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 dictionary_api_com to g:tq_enabled_backend and set your api key to g:tq_dictionary_api_key, ex:

    let g:tq_dictionary_api_key='cxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxa'

    This backend cannot work without an API key.

    The DictionaryApi.com backend returns several categories of information in this order:

    • Synonyms: The most relevant synonyms.
    • Related: Words that are no exactly synonyms, but can be considered related to the word in question.
    • Near: Words that are neither synonyms or antonyms, but are near by words.
    • Antonyms: The most relevant antonyms
    • Definitions: Short definitions. You can replace your word with these, but they're mostly there for information purposes.

    Also, if the word cannot be found, the API may sometimes return a list of word suggestions. These will be returned as Unknown word
    and allow you to choose a replacement from the list.

    Aaron Hayman
    @ahayman

    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.

    Aaron Hayman
    @ahayman

    @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.

    Aaron Hayman
    @ahayman
    Okay, I'm not sure anyone is actually reading these messages, but I updated my fork to handle antonyms. I had to change the core code to do this, but antonyms are now bound to <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.
    Also, I noticed that use_cache wasn't actually being used. So I added a very simple caching system (basically a list). It's currently boundless, so I may limit the cache if I run into problems with memory. Honestly, on any moderately recent machine, I kind of doubt this will be a problem. I'll probably add a cache_limit variable, but for now I'm out of capacity. Gotta an actual job to do. :-)
    HE Chong
    @Ron89
    Oh, sorry for replying late. Thanks for taking the interests in help improving it. Let me take a look at the code in week ends~
    Aaron Hayman
    @ahayman
    No worries, and thanks for taking the time. This has mostly been a way for me to customize your plugin to exactly what I need (high quality synonyms and antonyms) and as that goes it's been wonderful having Merriam-Webster quality thesaurus at my fingertips. I've even been able to use the plugin on my iPad, which has made me giddy. I'd be happy if those changes can help make your project better (and keep the projects from diverging), but either way is fine.
    HE Chong
    @Ron89

    @ahayman , hmm, I notice it's rather difficult for me to make comments on the exact location without a PR or sth. I think it is also a good practise to send in PR in order to merge in new feature.

    Could you branch out the existing changes of your code into a dedicated feature branch, then send in PR into my testing branch? We can then communicate in detail from there. After we made all the necessary revision, I can merge in your changes in testing, trying it on my few devices. Then merge into master when it is stable.

    Aaron Hayman
    @ahayman
    @Ron89 I agree on using a PR, but I’m not quite ready to submit one yet. I will want to clean up my code first, add some docs, etc.
    I’ll try to do that this week.
    Aaron Hayman
    @ahayman
    I would like to know if the approach I’m using for antonyms is reasonable, especially as it regards the other Back Ends. The Merriam-Webster Api returns all data for a single word, allowing me to return antonyms as a separate list along with the synonyms. This allowed me to cache everything at once, but I dont know of the other Apis work the same way. If antonyms require a separate Api call in tge other backends, I need to change the caching logic.
    Also, as a separate issue: Retrieving Antonyms is done using a separate binding. You cannot display both aynonyms and antonyms at the same time. I did this because it was easier, but also because the Merriam Api often returns too much data to display on screen if both antonyms and synonyms are displayed ar once.
    While that seems like a reasonable approach, I want to check with you before I submit a PR.
    HE Chong
    @Ron89
    hmm, using a separate binding is good to me. cs was short for change with synonym. ca for changing with antonym is natural. The API key config keyword is a bit to generic. We better anchor this keyword under the scope of MW backend itself.
    I haven't take a look at caching logic yet. Am thinking of doing so when reviewing the PR.
    HE Chong
    @Ron89
    Both cs and ca are used for changing the current word. Displaying the full list was made as an after thought. Come to think of it, showing both synonym and antonym really only make sense if you are just displaying the full thesaurus information without any changing goal in mind. So I think eventually if we want to do so, we should just change the behavior of :Thesaurus.
    In current implementation, display is made as a substep of query, making it difficult to implement the change stated above. So, later if we want to do that, we probably need to refactor the code a bit.
    Aaron Hayman
    @ahayman
    So the API is literally at https://dictionaryapi.com, which is were I pulled the name from. I waffled on the BE naming, but chose dictionary_api because I thought it would avoid confusion. But you may be right; it does sound a bit generic. I'll look into renaming it merriam_webster.
    Part of my motivation for using ca instead of listing all data was to avoid refactoring. While I've become somewhat familiar with the code, I'm far from being able to accomplish a refactor like that. It sounds like using ca lines up with your approach, though, so I'll leave that alone.
    Aaron Hayman
    @ahayman
    My caching logic is very simple. All I do is keep an array of: [ word, synonyms, antonyms ] and search through it on a query. At the very least, I should add a configurable "limit". What I was concerned about was BackEnds that might return either synonyms or antonyms, but not both. In that case, for example, if the user searches for synonyms, the whole cache is updated for that word. Then, if they search for antonyms for that same word, it would return an empty array. Like I said, the caching is simple, but it worked for merriam-webster, and that was my initial use case. I think I'd need to update it for production, though.