mhayashi1120/Emacs-langtool

Feature: Enable using the web version of the language tool.

markokocic opened this issue · 3 comments

Allow option to connect to and use the remote web version of language tool without installing the language server itself.

I configured langtool the following way:

(use-package langtool
  :ensure t :defer t
  :custom
  (langtool-http-server-host "languagetool.org")
  (langtool-http-server-port 443)
  (langtool-http-server-stream-type 'ssl)
  )

I also changed langtool-client-http-post to post to /api/v2/check instead of /v2/check

In theory, that should be enough to use https://languagetool.org/api/v2/ as a language server. However, when trying to call it from emacs, I get the following error:

error in process sentinel: langtool-http--parse-response-header: Parse error. Not found http header separator.
error in process sentinel: Parse error. Not found http header separator.

That wouldn't be possible as the LanguageTool Online Server only meant to be used as a test server, if you do more than 20 request in a minute, you will be banned from the server.

http://wiki.languagetool.org/public-http-api [20 requests per IP per minute (this is supposed to be a peak value - don't constantly send this many requests or we would have to block you)]

As @PillFall mentionned, that should not be used for other purpose than testing.
Working if changed to :

(use-package langtool :ensure t) 
(setq langtool-http-server-stream-type 'ssl) 
(setq langtool-http-server-host "api.languagetool.org")
(setq langtool-http-server-port 443)