mhayashi1120 / Emacs-langtool

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

Error with "--langguagemodel" option #34

Open puth7 opened 6 years ago

puth7 commented 6 years ago

Hi, I was trying to add the --languagemodel option with the english n-gram data, but it does not work as expected (it was fine without the --langguagemodel). The init.el file is as follow:

(setq langtool-language-tool-jar "/opt/program/nux/LanguageTool-4.1/languagetool-commandline.jar" )
(require 'langtool)

(setq langtool-java-user-arguments '(--languagemodel "/opt/program/nux/LanguageTool-4.1/ngrams"))

When I run M-x langtool-check, it gave error message LanguageTool exited abnormally with code 1 (Unrecognized option: --languagemodel /opt/program/nux/LanguageTool-4.1/ngrams)

Did I made a mistake? Thanks!

heikkil commented 6 years ago

@puth7, I think --languagemodel string should be inside those quotes. The error comes from that. However, adding it in and escaping the quotes does not solve the problem.

Documentation states that langtool-user-arguments works the same as langtool-java-user-arguments, but when I set it to '(\"--languagemodel ~/data/lt\"), I get an stringp error.

Setting it to "--languagemodel ~/data/lt" does not give an error but does not do anything.

Adding --languagemodel option to the languagetool command line tool works for me, so the correct syntax should be possible to find.

puth7 commented 6 years ago

Hi @heikkil, Thanks for your response.
The command line "--langguagemodel" option also works fine with me. I absolutely agree with you, so far my best approach is trial and error.

eli-tziperman commented 6 years ago

hi, was this problem solved? I was having the same issue, and I think I resolved it, using the following settings:

'(langtool-default-language "en-US") '(langtool-disabled-rules " ") '(langtool-language-tool-jar "/usr/local/LanguageTool-4.2/languagetool-commandline.jar") '(langtool-mother-tongue "en")

and (setq langtool-user-arguments '("--languagemodel" "/usr/local/LanguageTool-n-gram/"))

not sure if all are actually necessary...

gwern commented 4 years ago

Experimenting, it seems that it's undocumented that each space-separated string on the CLI must also be separate spaces in the langtool-user-arguments list as well. That's why '("--languagemodel" "/usr/local/LanguageTool-n-gram/") works, but '("--languagemodel /usr/local/LanguageTool-n-gram/") does not.