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

Upgrade to LanguageTool latest version #50

Open
Kristinita opened this issue Jan 2, 2018 · 7 comments
Open

Upgrade to LanguageTool latest version #50

Kristinita opened this issue Jan 2, 2018 · 7 comments

Comments

@Kristinita
Copy link

Kristinita commented Jan 2, 2018

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.

@myint
Copy link
Owner

myint commented Jan 3, 2018

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

@myint
Copy link
Owner

myint commented Jan 5, 2018

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! Саша Совершенна!
      ^^^^^^^^^
>>>

@Kristinita
Copy link
Author

@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.

@myint
Copy link
Owner

myint commented Jan 5, 2018

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 myint changed the title [Question] Ignoring second language words if 2 languages in a file Upgrade to LanguageTool >= 3.6 Jan 5, 2018
@Kristinita
Copy link
Author

Kristinita commented Jan 5, 2018

I'm sorry, why 3.6?

4.0 — is the latest stable standalone LanguageTool version.

Thanks.

@myint myint changed the title Upgrade to LanguageTool >= 3.6 Upgrade to LanguageTool latest version Jan 5, 2018
@myint
Copy link
Owner

myint commented Jan 5, 2018

Okay, I've updated the title.

@jxmorris12
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants