Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YaLafi compatibility with the premium API of LanguageTool #225

Open
jordanwagnr opened this issue Jul 2, 2022 · 4 comments
Open

YaLafi compatibility with the premium API of LanguageTool #225

jordanwagnr opened this issue Jul 2, 2022 · 4 comments
Labels
enhancement New feature or request type: LanguageTool Issues related to LaguageTool

Comments

@jordanwagnr
Copy link

I paid for a premium version of LT thinking it would be just as easy to connect to that server as it was to connect to their public one or to my local one. However, it has turned into a nightmare despite the only difference being an API key I have to pass to the server.

I can easily access the server outside of YaLafi with a call like:
curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'text=This is an test&language=en-US&username=&apiKey=&enabledOnly=false' 'https://api.languagetoolplus.com/v2/check'

I have tried all kinds of different things in YaLafi, but it just keeps bypassing the LT server and starts my local one. It seems like it should be an easy fix, but I am pretty lost on how YaLafi is handling --lt-options.

@torik42
Copy link
Owner

torik42 commented Jul 7, 2022

I added the options --username and --apikey to the --lt-options. Unfortunately, I have no premium subscription, I could test with. If you know how to install from GitHub, you could test my branch https://github.com/torik42/YaLafi/tree/issue-225 and check whether it works as expected. The command after installation would be
python -m yalafi.shell --server lt --lt-options '~--username <username> --apikey <apikey>' document.tex
If it works out, I would add documentation and open a PR. Unfortunately, @matze-dd wasn’t active lately.

@jordanwagnr
Copy link
Author

Wow, thank you so much. It worked almost perfectly. I forgot to mention that in addition to an API key, the URL for the premium server is different. Once I changed the hardcoded URL for the LT server in shell.py to ltserver='https://api.languagetoolplus.com/v2/', it worked flawlessly.

It might be nice to have the URL for a remote LT server as an actual option rather than having to hardcode it. Anyone wanting to connect to a remote LT server that is not the public one hosted by LT will have to change this; however, it is trivially easy to do, so it is not that big of a deal.

Again, thank you so much. I am very happy to have this working. I thought I had wasted money, but now that it is working correctly, I am very happy with it.

@torik42
Copy link
Owner

torik42 commented Jul 8, 2022

That’s great to hear. There already is a PR to allow custom server URLs #222. It would also need some more documentation and for the premium server, one might add --server ltplus to ease the process.

Do you know any documentation or discussion about the difference between api.languagetool.org and api.languagetoolplus.com?

@jordanwagnr
Copy link
Author

The only documentation I know of is the Swagger documentation, which I really haven't found to be very helpful. In general, I have found LT's documentation to be very confusing all around. In fact, I am not even sure that access to this API is even supposed to be available with their premium service. They only gave me an API key after I complained to them that their documentation was misleading. I still haven't gotten a clear answer, so just a heads up to anyone who is considering buying a premium membership.

From what I have gathered, the free public API at api.languagetool.org runs a copy of the basic LT server that is open source, and the one at api.languagetoolplus.com runs the premium version that is closed source and requires an API key to access. The premium features (which are actually very good) must be accessed through this server as they do not allow you to host your own premium server locally. I may be stating the obvious, but that is about the extent of my knowledge on this. I am not experienced at all with web APIs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request type: LanguageTool Issues related to LaguageTool
Projects
None yet
Development

No branches or pull requests

2 participants