jxmorris12 / language_tool_python

a free python grammar checker 📝✅
GNU General Public License v3.0
434 stars 64 forks source link

Use locally downloaded language tool instead of downloading it from url? #53

Closed asnashafiq closed 7 months ago

asnashafiq commented 2 years ago

When using the local server, there is a download from a url for the language tool during initialization. Is it possible to add a local configuration that lets you use an already downloaded tool under LTP_PATH and bypass the download code? Wondering if there's a way to bypass the download from the url with 100% certainty.

Zhao-Qiao commented 2 years ago

I wonder if you have solved this problem? I've been trying to use a locally stored Language Tool as the local server so that my python scripts can run totally offline. But sadly I don't know how to configure it. I've tried to replace LTP_PATH with a path to my project but it didn't work.

Dabirius commented 2 years ago

I had the same issue. For me the following worked:

pip download the installation files on a device with internet connection. Then use these files on the device without internet connection to pip install the module (!pip install language_tool_python --no-index --find-links=file:///PATHTOINSTALLFILES).

To avoid that the python import of the module tries to download LanguageTool{version}.zip and put it in the cache of your device, you need to download the LanguageTool{version}.zip on another device with internet connection (from here https://languagetool.org/download/?C=S;O=D) and always (if cache gets deleted after usage) move these files in the cache of your offline device before importing the module. I used this command: !mv {unzipped folder which needs to be moved to cache} {path to your cache} inside my python script before the import function.

Hope that helps!

pyagoubi commented 2 years ago

I'm having the same issue

I have tried your approach but I'm getting the same error as before. Could you please specify which cache I should move the files to? Is ist the directory of the language-tool library? Thats where I moved it.

Thanks!

Zhao-Qiao commented 2 years ago

I'm having the same issue

I have tried your approach but I'm getting the same error as before. Could you please specify which cache I should move the files to? Is ist the directory of the language-tool library? Thats where I moved it.

Thanks!

I downloaded LanguageTool{version}.zip and moved the unzipped folder to `~/.cache/language_tool_python/' and it worked. Hope that would help.

Dabirius commented 2 years ago

@pyagoubi it was the same path @Zhao-Qiao mentioned above.

pidefrem commented 7 months ago

@jxmorris12 it should be fixed now. The user now can use LTP_JAR_DIR_PATH as mentioned in the README to specify local installation and bypass the download for sure.