mhayashi1120 / Emacs-langtool

LanguageTool for Emacs
GNU General Public License v3.0
377 stars 31 forks source link

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

Open markokocic opened 4 years ago

markokocic commented 4 years ago

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

markokocic commented 4 years ago

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.
PillFall commented 4 years ago

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)]

dotgreg commented 2 years ago

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)