Registry / serialization / language-tool-python

language-tool-python

JSON →
library3.4.0pypypi✓ verified 85d ago

language_tool_python is an actively maintained Python wrapper for LanguageTool, an open-source grammar, style, and spell checker. It facilitates grammar checking by either running a local LanguageTool Java server, utilizing the public LanguageTool API, or connecting to a custom remote LanguageTool server. The library sees regular minor and patch releases, ensuring active development and updates.

pip install language-tool-python
INSTALL
IMPORT
SIG · LANGUAGE-TOOL-PYTH
L
language-tool-python
serializationpythonv3.4.0
Install
2.5s avg
Import
676ms
Disk
22MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.714s · 23.8MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.5s · import 0.637s · 24MB
22MB installed
● package 22MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LanguageTool
from language_tool_python import LanguageTool
import language_tool_python.LanguageTool
The primary class for interacting with LanguageTool, supporting local, public, and custom remote servers.
LanguageToolPublicAPI
from language_tool_python import LanguageToolPublicAPI
from language_tool_python import PublicAPI
A specialized class for direct interaction with the public LanguageTool API.

This quickstart demonstrates how to use `language-tool-python` with both a local LanguageTool server (which requires a Java JRE) and the public LanguageTool API. It checks a sample sentence for grammar errors and applies corrections. The `with` statement is recommended for proper resource management.

import language_tool_python # For local server (requires Java JRE installed) # Ensure Java Runtime Environment (JRE) is installed and accessible in your PATH try: with language_tool_python.LanguageTool('en-US') as tool: text = "This are a example of bad grammer." matches = tool.check(text) print("Original text:", text) print("Detected errors:", matches) corrected_text = tool.correct(text) print("Corrected text:", corrected_text) except Exception as e: print(f"Could not initialize local LanguageTool server: {e}") print("Trying public API...") # For public LanguageTool API # Note: Public API has rate limits. For heavy usage, consider a local/remote server. try: with language_tool_python.LanguageToolPublicAPI('en-US') as tool: text_public = "He don't like it." matches_public = tool.check(text_public) print("\nOriginal text (Public API):", text_public) print("Detected errors (Public API):", matches_public) corrected_text_public = tool.correct(text_public) print("Corrected text (Public API):", corrected_text_public) except Exception as e: print(f"Could not use public LanguageTool API: {e}") print("Check your internet connection or API rate limits.")
Debug
Known issues
gotchaA Java Runtime Environment (JRE) is required on your system to run the local LanguageTool server (the default mode). Specific Java versions are required depending on the LanguageTool version: Java >= 9 for LT < 6.6, and Java >= 17 for LT >= 6.6.
fix
Install a compatible JRE and ensure `java` is in your system's PATH.
affects: All versions (for local server mode)
gotchaThe `proxies` parameter in the `LanguageTool` constructor is only effective when `remote_server` is also specified. Passing `proxies` without `remote_server` will raise a `ValueError`.
fix
Only use `proxies` when connecting to a specific `remote_server`. If you intend to use a local server, remove the `proxies` argument.
affects: All versions
deprecatedUsing the public LanguageTool API (`LanguageToolPublicAPI`) is subject to rate limits. For intensive or production use, it is highly recommended to run your own local LanguageTool server or connect to a custom remote server.
fix
For high-volume usage, configure `language-tool-python` to use a local LanguageTool server (requires Java) or your own remote LanguageTool instance.
affects: All versions
breakingAs of April 2020 (starting with version 2.x), `language-tool-python` no longer supports LanguageTool server versions older than 4.0.
fix
Ensure you are using LanguageTool server version 4.0 or newer. The library by default downloads the latest compatible version.
affects: < 2.0.0
Errors
Common errors & fixes
FileNotFoundError: [Errno 2] No such file or directory: 'java'
The Java Runtime Environment (JRE) is either not installed or not correctly configured in your system's PATH, which is required to run the local LanguageTool server.
fix
Install a compatible JRE (Java 17 or newer is recommended for recent LanguageTool versions) and ensure the `java` executable is available in your system's PATH. On Linux/macOS, check `java --version`. On Windows, ensure Java's `bin` directory is in the Path environment variable.
ModuleNotFoundError: No module named 'language_tool_python'
The `language-tool-python` library is not installed in your current Python environment, or you are running the script in a different environment.
fix
Install the library using `pip install language-tool-python`. If already installed, verify your Python environment by checking `pip list` or `conda list`.
ValueError: proxies works only with remote_server
You have provided the `proxies` argument to `language_tool_python.LanguageTool` without also specifying the `remote_server` argument. Proxies are only used for remote HTTP connections.
fix
Remove the `proxies` argument if you intend to use a local LanguageTool server, or add the `remote_server` argument with a valid URL if you intend to use a remote server with proxies.
AttributeError: 'Match' object has no attribute 'some_invalid_attribute'
You are trying to access an attribute on a `Match` object that does not exist or has a different name than expected. This can happen from typos or outdated examples.
fix
Refer to the official documentation or the `Match` object's `__dict__` for available attributes. Common attributes include `ruleId`, `message`, `replacements`, `offset`, `errorLength`, `context`, `category`.
Upgrade
Version history
3.4.0latest on PyPI · released May 14, 2026
Audit
Dependencies
requestsrequiredUsed for making HTTP requests to LanguageTool servers (public or remote).
tqdmrequiredProvides progress bars for operations like downloading LanguageTool JAR files.
packagingrequiredUsed for version parsing and comparison.
psutilrequiredUsed for process management, particularly when running a local LanguageTool Java server.
tomlrequiredUsed for reading TOML configuration files.
Agent activity
35 hits · last 30 days
node
30
OpenAI (training)
1
Resources
language-tool-python — pip install language-tool-python · libregistry