language-check icon indicating copy to clipboard operation
language-check copied to clipboard

Upgrade to LanguageTool latest version

Open Kristinita opened this issue 6 years ago • 7 comments

1. Briefly

I don't understand, how I can ignore English words, if I use Russian language by default.

It feature by default, if I run LanguageTool, use:

  1. command line,
  2. Sublime Text LanguageTool plugin.

2. Environment

  • Windows 10 LTSB Enterprise EN,
  • Python 3.6.3,
  • LanguageTool 3.6,
  • language-check 1.1.

3. Argumentation

I write texts in Russian, where can be many words from English. Now language-check check English words as errors.

4. Settings

My file SashaExample.txt:

Sasha Belissimo!

Саша Совершенна!

My file eric_languagetool.py:

from eric_config import all_txt_in_eric_room_wihtout_subfolders
from eric_config import log

import language_check
import os

tool_language = language_check.LanguageTool('ru-RU')

failure_tests = False

for filename in all_txt_in_eric_room_wihtout_subfolders:

    filename_without_path = os.path.basename(filename)

    log.debug(filename_without_path + "\n")
    file_text = open(filename_without_path).read()

    error_list = tool_language.check(file_text)
    print(*error_list, sep='\n\n')
    if not error_list:
        log.debug(
            "Not detect errors and typos in" +
            filename_without_path +
            "\n\n")
    else:
        log.warning(
            "Detect error(s) or/and typo(s) in " + filename_without_path + "\n\n")
        failure_tests = True

if not failure_tests:
    log.notice("LanguageTool no detect errors and typos for all files.")

if failure_tests:
    log.warning(
        "LanguageTool detect error(s) or/and typo(s). Please, review it.")

5. Expected behavior

If I run in console:

D:\SashaPythonista>java -jar "D:/Chocolatey/lib/languagetool/tools/LanguageTool-3.6/languagetool.jar" SashaExample.txt

No errors:

LanguageTool CLI

Also, I can't errors, if I can use Sublime Text LanguageTool package.

6. Actual behavior

I run eric_languagetool.py for SashaExample.txt:

D:\SashaPythonista>language-check --heelp
'language-check' is not recognized as an internal or external command,
operable program or batch file.

D:\SashaPythonista>python "tests/eric_languagetool.py"
Line 1, column 1, Rule ID: MORFOLOGIK_RULE_RU_RU
Message: Найдена орфографическая ошибка
Sasha Belissimo!  Саша Совершенна!
^^^^^

Line 1, column 7, Rule ID: MORFOLOGIK_RULE_RU_RU
Message: Найдена орфографическая ошибка
Sasha Belissimo!  Саша Совершенна!
      ^^^^^^^^^

The same in Interpreter:

>>> import language_check
>>> tool_language = language_check.LanguageTool('ru-RU')
>>> file_text = u'Sasha Belissimo! Саша Совершенна!'
>>> error_list = tool_language.check(file_text)
>>> print(*error_list, sep='\n\n')
Line 1, column 1, Rule ID: MORFOLOGIK_RULE_RU_RU
Message: Найдена орфографическая ошибка
Sasha Belissimo! Саша Совершенна!
^^^^^

Line 1, column 7, Rule ID: MORFOLOGIK_RULE_RU_RU
Message: Найдена орфографическая ошибка
Sasha Belissimo! Саша Совершенна!
      ^^^^^^^^^
>>>

English words in Russian texts check as errors.

7. Did not help

I don't find, how I can solve this problem, in:

  1. language-check description,
  2. issues of this repository.

Thanks.

Kristinita avatar Jan 02 '18 19:01 Kristinita

Thanks for thorough bug report! I'll try to take a look soon.

myint avatar Jan 03 '18 00:01 myint

I can reproduce the output you get from the Python interpreter. But the LanguageTool GUI gives me output. The output matches what I get from Python.

screen shot 2018-01-04 at 17 15 27

>>> import language_check
>>> tool_language = language_check.LanguageTool('ru-RU')
>>> file_text = u'Sasha Belissimo! Саша Совершенна!'
>>> error_list = tool_language.check(file_text)
>>> print(*error_list, sep='\n\n')
Line 1, column 1, Rule ID: MORFOLOGIK_RULE_RU_RU
Message: Найдена орфографическая ошибка
Sasha Belissimo! Саша Совершенна!
^^^^^

Line 1, column 7, Rule ID: MORFOLOGIK_RULE_RU_RU
Message: Найдена орфографическая ошибка
Sasha Belissimo! Саша Совершенна!
      ^^^^^^^^^
>>>

myint avatar Jan 05 '18 01:01 myint

@myint, I remove old LanguageTool → I install 4.0 — newest version at the moment → I don't change settings → I again get expected behavior:

Expected

Can you update LanguageTool to the newest version?

Thanks.

Kristinita avatar Jan 05 '18 05:01 Kristinita

It doesn't look like even LanguageTool 3.6 is compatible:

$ ./language-check -l ru-RU sample.txt
sample.txt:0:-1: API_EOL_PSEUDO_ID: Internal error: The software you're using is making use of an old LanguageTool API. Please ask the software developer to use the recent JSON API. Follow the link below for more information.

I'll rename this issue to mention the upgrade and mark it as an enhancement.

diff --git a/download_lt.py b/download_lt.py
index 62344ad..ff66570 100755
--- a/download_lt.py
+++ b/download_lt.py
@@ -28,7 +28,7 @@ FILENAME = 'LanguageTool-{version}.zip'
 PACKAGE_PATH = 'language_check'
 JAVA_6_COMPATIBLE_VERSION = '2.2'
 JAVA_7_COMPATIBLE_VERSION = '3.1'
-LATEST_VERSION = '3.2'
+LATEST_VERSION = '3.6'
 JAVA_VERSION_REGEX = re.compile(
     r'^(?:java|openjdk) version "(?P<major1>\d+)\.(?P<major2>\d+)\.[^"]+"$',
     re.MULTILINE)

myint avatar Jan 05 '18 14:01 myint

I'm sorry, why 3.6?

4.0 — is the latest stable standalone LanguageTool version.

Thanks.

Kristinita avatar Jan 05 '18 18:01 Kristinita

Okay, I've updated the title.

myint avatar Jan 05 '18 18:01 myint

Hi! Since this project has been abandoned, I started a new fork over at https://github.com/jxmorris12/language_tool_python.

My version supports new versions of Java and LanguageTool. language-check is stuck on Java 8 and LanguageTool 3.2; latest versions are Java 14 and LanguageTool 4.9!

I'm happy to help you with your issue if you raise it over at my repository! Thanks!

jxmorris12 avatar May 01 '20 03:05 jxmorris12