Top Related Projects
:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
The pluggable natural language linter for text and markdown.
A linter for prose.
Naive linter for English prose
Catch insensitive, inconsiderate writing
Quick Overview
LanguageTool is an open-source proofreading software for various languages. It helps users check for grammar, style, and spelling issues in their text. LanguageTool can be used as a standalone application, integrated into other software, or accessed through its API.
Pros
- Supports over 20 languages with varying levels of rule coverage
- Highly customizable with the ability to add custom rules
- Available as a desktop application, browser extension, and API
- Free and open-source with an active community
Cons
- Some advanced features require a premium subscription
- May produce false positives or miss certain errors
- Performance can be slower for very large texts
- Requires internet connection for some features (e.g., style suggestions)
Code Examples
Here are a few examples of using LanguageTool with its Java API:
- Basic text check:
JLanguageTool langTool = new JLanguageTool(new AmericanEnglish());
List<RuleMatch> matches = langTool.check("A sentence with a error in the Hitchhiker's Guide tot he Galaxy.");
for (RuleMatch match : matches) {
System.out.println("Potential error at line " +
match.getLine() + ", column " +
match.getColumn() + ": " + match.getMessage());
System.out.println("Suggested correction(s): " +
match.getSuggestedReplacements());
}
- Using a specific language model:
Language language = Languages.getLanguageForShortCode("en-US");
JLanguageTool langTool = new JLanguageTool(language);
langTool.activateLanguageModelRules(new File("/path/to/language-model"));
List<RuleMatch> matches = langTool.check("Your text to check goes here.");
- Disabling specific rules:
JLanguageTool langTool = new JLanguageTool(new BritishEnglish());
langTool.disableRule("UPPERCASE_SENTENCE_START");
List<RuleMatch> matches = langTool.check("this is a test.");
Getting Started
To use LanguageTool in your Java project:
- Add the LanguageTool dependency to your project (e.g., using Maven):
<dependency>
<groupId>org.languagetool</groupId>
<artifactId>language-en</artifactId>
<version>5.9</version>
</dependency>
- Create a
JLanguageTool
instance and use it to check text:
import org.languagetool.JLanguageTool;
import org.languagetool.language.AmericanEnglish;
import org.languagetool.rules.RuleMatch;
JLanguageTool langTool = new JLanguageTool(new AmericanEnglish());
List<RuleMatch> matches = langTool.check("Your text to check.");
// Process the matches as needed
Competitor Comparisons
:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
Pros of Vale
- Highly customizable with support for custom styles and vocabularies
- Lightweight and fast, with minimal dependencies
- Integrates well with various text editors and CI/CD pipelines
Cons of Vale
- Less comprehensive out-of-the-box language support compared to LanguageTool
- Requires more initial setup and configuration for optimal use
- Limited natural language processing capabilities
Code Comparison
Vale configuration example:
StylesPath = styles
MinAlertLevel = suggestion
[*.md]
BasedOnStyles = Vale, proselint
LanguageTool usage example:
JLanguageTool langTool = new JLanguageTool(new AmericanEnglish());
List<RuleMatch> matches = langTool.check("A sentence with a error in the Hitchhiker's Guide tot he Galaxy");
Vale focuses on customizable, rule-based checks, while LanguageTool offers more advanced language processing capabilities. Vale's configuration is typically YAML-based, whereas LanguageTool uses Java for its core functionality. Both tools can be integrated into various workflows, but Vale's lightweight nature makes it easier to incorporate into existing pipelines.
The pluggable natural language linter for text and markdown.
Pros of textlint
- Highly customizable with a plugin-based architecture
- Supports multiple markup languages (Markdown, AsciiDoc, Re:VIEW)
- Easier to integrate into existing workflows and CI/CD pipelines
Cons of textlint
- Smaller community and fewer pre-built rules compared to LanguageTool
- Primarily focused on technical writing and documentation
- May require more setup and configuration for general-purpose use
Code Comparison
textlint:
import { TextLintEngine } from "textlint";
const engine = new TextLintEngine();
const results = await engine.executeOnFiles(["README.md"]);
console.log(results[0].messages);
LanguageTool:
JLanguageTool langTool = new JLanguageTool(new AmericanEnglish());
List<RuleMatch> matches = langTool.check("A sentence with a error in the Hitchhiker's Guide tot he Galaxy");
for (RuleMatch match : matches) {
System.out.println("Potential error at line " + match.getLine() + ", column " + match.getColumn() + ": " + match.getMessage());
}
textlint is more flexible and easier to integrate into JavaScript-based projects, while LanguageTool offers a more comprehensive set of pre-built rules and supports a wider range of languages out of the box. textlint is better suited for technical documentation and customized linting rules, while LanguageTool excels in general-purpose grammar and style checking across multiple languages.
A linter for prose.
Pros of Proselint
- Lightweight and focused on writing style, not just grammar
- Easy to integrate into various text editors and workflows
- Provides specific, actionable advice for improving prose
Cons of Proselint
- Limited language support compared to LanguageTool
- Fewer grammar and spelling checks
- Less frequent updates and smaller community
Code Comparison
LanguageTool (Java):
public class Rule {
public RuleMatch[] match(AnalyzedSentence sentence) throws IOException {
// Rule implementation
}
}
Proselint (Python):
def check(text):
"""Run checks against text."""
return [check for check in checks if check(text)]
LanguageTool offers a more structured approach with dedicated classes for rules, while Proselint uses a simpler function-based system. LanguageTool's architecture allows for more complex rule implementations, whereas Proselint focuses on concise, easily extensible checks.
LanguageTool is a comprehensive, multi-language grammar and style checker with a large rule set and active community. It's suitable for various applications, from word processors to web services. Proselint, on the other hand, is a lightweight, Python-based tool specifically designed for improving writing style. It's ideal for writers and editors looking for focused feedback on prose quality rather than comprehensive grammar checking.
Naive linter for English prose
Pros of write-good
- Lightweight and focused on writing style improvements
- Easy to integrate into various text editors and workflows
- Provides specific suggestions for improving clarity and readability
Cons of write-good
- Limited language support compared to LanguageTool
- Less comprehensive grammar and spelling checks
- Smaller community and fewer regular updates
Code Comparison
LanguageTool (Java):
public class Main {
public static void main(String[] args) throws IOException {
JLanguageTool langTool = new JLanguageTool(new AmericanEnglish());
List<RuleMatch> matches = langTool.check("A sentence with a error in the Hitchhiker's Guide tot he Galaxy");
for (RuleMatch match : matches) {
System.out.println("Potential error at line " + match.getLine() + ", column " + match.getColumn() + ": " + match.getMessage());
}
}
}
write-good (JavaScript):
var writeGood = require('write-good');
var suggestions = writeGood('So the cat was stolen.');
console.log(suggestions);
The code comparison shows that LanguageTool requires more setup and is more verbose, while write-good is simpler to use but offers less customization. LanguageTool provides more detailed error information, including line and column numbers, whereas write-good focuses on quick, straightforward suggestions for improving writing style.
Catch insensitive, inconsiderate writing
Pros of Alex
- Focused on inclusive language and catching insensitive writing
- Lightweight and easy to integrate into existing workflows
- Supports multiple languages and can be extended with custom rules
Cons of Alex
- Limited scope compared to LanguageTool's comprehensive grammar and style checks
- Less mature project with fewer contributors and updates
- May produce false positives for certain writing styles or contexts
Code Comparison
Alex:
const alex = require('alex');
const report = alex('He\'s very talented.');
console.log(report.messages);
LanguageTool:
JLanguageTool langTool = new JLanguageTool(new AmericanEnglish());
List<RuleMatch> matches = langTool.check("He's very talented.");
for (RuleMatch match : matches) {
System.out.println("Potential error at line " + match.getLine() + ", column " + match.getColumn() + ": " + match.getMessage());
}
Alex focuses on a specific use case (inclusive language) and offers a simpler API, while LanguageTool provides more comprehensive language checking capabilities with a more complex implementation. Alex is better suited for quick integration and specific inclusivity checks, whereas LanguageTool offers broader language support and more extensive grammar and style analysis.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
LanguageTool
LanguageTool is an Open Source proofreading software for English, Spanish, French, German, Portuguese, Polish, Dutch, and more than 20 other languages. It finds many errors that a simple spell checker cannot detect.
- LanguageTool Forum
- How to run your own LanguageTool server
- HTTP API documentation
- How to use our public server via HTTP
- How to use LanguageTool from Java (Javadoc)
For more information, please see our homepage at https://languagetool.org, this README, and CHANGES.
The LanguageTool core (this repo) is freely available under the LGPL 2.1 or later.
Docker
Try one of the following projects for a community-contributed Docker file:
- https://github.com/meyayl/docker-languagetool (Docker Hub)
- https://github.com/Erikvl87/docker-languagetool (Docker Hub)
- https://github.com/silvio/docker-languagetool (Docker Hub)
Contributions
The development overview describes how you can contribute error detection rules.
For more technical details, see our dev pages.
Scripted installation and building
To install or build using a script, simply type:
curl -L https://raw.githubusercontent.com/languagetool-org/languagetool/master/install.sh | sudo bash <options>
If you wish to have more options, download the install.sh
script. Usage options follow:
sudo bash install.sh <options>
Usage: install.sh <option> <package>
Options:
-h --help Show help
-b --build Builds packages from the bleeding edge development copy of LanguageTool
-c --command <command> Specifies post-installation command to run (default gui when screen is detected)
-q --quiet Shut up LanguageTool installer! Only tell me important stuff!
-t --text <file> Specifies what text to be spellchecked by LanguageTool command line (default spellcheck.txt)
-d --depth <value> Specifies the depth to clone when building LanguageTool yourself (default 1).
-p --package <package> Specifies package to install when building (default all)
-o --override <OS> Override automatic OS detection with <OS>
-a --accept Accept the oracle license at http://java.com/license. Only run this if you have seen the license and agree to its terms!
-r --remove <all/partial> Removes LanguageTool install. <all> uninstalls the dependencies that were auto-installed. (default partial)
Packages(only if -b is specified):
standalone Installs standalone package
wikipedia Installs Wikipedia package
office-extension Installs the LibreOffice/OpenOffice extension package
Commands:
GUI Runs GUI version of LanguageTool
commandline Runs command line version of LanguageTool
server Runs server version of LanguageTool
Alternate way to build from source
Before start: you will need to clone from GitHub and install Java 17 and Apache Maven.
Warning: a complete clone requires downloading more than 500 MB and needs more than 1500 MB on disk. This can be reduced if you only need the last few revisions of the master branch by creating a shallow clone:
git clone --depth 5 https://github.com/languagetool-org/languagetool.git
A shallow clone downloads less than 60 MB and needs less than 200 MB on disk.
In the root project folder, run:
mvn clean test
(sometimes you can skip Maven step for repeated builds)
./build.sh languagetool-standalone package -DskipTests
Test the result in languagetool-standalone/target/
.
./build.sh languagetool-wikipedia package -DskipTests
Test the result in languagetool-wikipedia/target
.
Now you can use the bleeding edge development copy of LanguageTool *.jar
files, be aware that it might contain regressions.
How to run under Mac M1 or M2
- Install Brew for Rosetta:
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
- Install openjdk for Rosetta:
arch -x86_64 brew install openjdk
- Install Maven for Rosetta:
arch -x86_64 brew install maven
- Now run build scripts
License
Unless otherwise noted, this software - the LanguageTool core - is distributed under the LGPL, see file COPYING.txt.
Top Related Projects
:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
The pluggable natural language linter for text and markdown.
A linter for prose.
Naive linter for English prose
Catch insensitive, inconsiderate writing
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot