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

Introduce new env var LTP_JAR_DIR_PATH to let the user specify a custom installation path of LT #86

Merged

Conversation

pidefrem
Copy link
Contributor

@pidefrem pidefrem commented Apr 11, 2024

Fixes #84
Fixes #82

At the moment, language_tool_python will download a fixed version of LanguageTool (LT).

There was also a inconsistency in the code when a more recent version of LT is installed in the download path:

  • the package will still download the hard-coded version
  • but it will use the more recent version found in the download path

Now the user can specify the LTP_JAR_DIR_PATH environment variable.
If this variable is defined, the package will look for the LanguageTool jar files in this folder.
Otherwise it will download LanguageTool is the download folder.

The user can also change the LanguageTool version that is downloaded:

tool = LanguageTool(language_tool_download_version="6.3")

I also took the liberty to fix some formatting.

Note that in the tests tests/test_local.bash, the sentence 'These are "dumb" quotes.' is now accepted by the 6.4 version of the LanguageTool.
Using the 6.4 version, I also got a different ordering of the suggestions, so I only check the set and I am flexible on the order.

@pidefrem
Copy link
Contributor Author

@jxmorris12 I fixed some typos, the CI should run fine now.

@jxmorris12 jxmorris12 merged commit 908dcc6 into jxmorris12:master Apr 11, 2024
3 checks passed
@jxmorris12
Copy link
Owner

thanks -- this is really helpful :)

@pidefrem pidefrem deleted the deactivate_download_if_env_var_defined branch April 11, 2024 21:29
ybracke pushed a commit to ybracke/transnormer-data that referenced this pull request Apr 18, 2024
Background: Some rules and many RuleIDs changed between v6.3 and v6.4 and my personal rule list is currently based on v6.3.
Thus, in general, we could make the LT version flexible. This now possible in language_tool_python, see PR [#82](jxmorris12/language_tool_python#86).
Note that, because of a mistake in the language_tool_python code, the program will print "Downloading LanguageTool 6.4", regardless of the version that is specified via LanguageTool(language_tool_download_version).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants