百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

languagetool-rust

> 编程语言
开源

Rust 中的 LanguageTool API

197 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Rust 中的 LanguageTool API

LanguageTool-Rust

Rust bindings to connect with LanguageTool server API.

LanguageTool is an open source grammar style checker. It can correct 30+ languages and is free to use, more on that on languagetool.org. There is a public API (with a free tier), but you can also host your own server locally. LanguageTool-Rust helps you communicate with those servers very easily via Rust code!

  1. About
  2. CLI Reference
    • Docker
  3. API Reference
    • Feature Flags
  4. CHANGELOG
  5. Related Projects
  6. Contributing

About

LanguageTool-Rust (LTRS) is both an executable and a Rust library that strives to provide correct and safe bindings for the LanguageTool API.

Disclaimer: the current work relies on an approximation of the LanguageTool API. We try to avoid breaking changes as much as possible, but we still highly depend on the future evolutions of LanguageTool.

Installation

You can install the latest version with cargo.

bash
cargo install languagetool-rust --features full

AUR

If you are on Arch Linux, you call also install with your AUR helper:

bash
paru -S languagetool-rust

CLI Reference

The command line interface of LTRS allows to very quickly use any LanguageTool server to check for grammar and style errors.

The reference for the CLI can be accessed via ltrs --help.

By default, LTRS uses the LanguageTool public API.

Example

…

Docker

Since LanguageTool's installation might not be straightforward, we provide a basic Docker integration that allows to pull, start, and stop LanguageTool Docker containers in a few lines:

bash
ltrs docker pull # only once
ltrs docker start # start the LT server
ltrs --hostname http://localhost -p 8010 check -t "Some tex"
# Other commands...
ltrs docker stop # stop the LT server

Note: Docker is a tool that facilitates running applications without worrying about local dependencies, platform-related issues, and so on. Installation guidelines can be found online. On Linux platforms, you might need to circumvent the sudo privilege issue by doing this.

API Reference

If you would like to integrate LTRS within a Rust application or crate, then we recommend reading the documentation.

To use LanguageTool-Rust in your Rust project, add to your Cargo.toml:

toml
[dependencies]
languagetool-rust = "^2.1"

Example

rust
use languagetool_rust::api::{check, server::ServerClient};
use std::borrow::Cow;

#[tokio::main]
async fn main() -> Result> {
    let client = ServerClient::from_env_or_default();

    let req = check::Request::default()
        .with_text("Some phrase with a smal mistake");  // # codespell:ignore smal

    println!(
        "{}",
        serde_json::to_string_pretty(&client.check(&req).await?)?
    );
    Ok(())
}

Feature Flags

Below are listed the various feature flags you can enable when compiling LTRS.

Default Features

  • cli: Adds command-line related methods for multiple structures. This feature is required to install the LTRS CLI, and enables the following features: annotate, color, html, markdown, multithreaded, typst.
  • native-tls: Enables TLS functionality provided by native-tls.

Optional Features

  • annotate: Adds method(s) to annotate results from check request.
  • cli-complete: Adds commands to generate completion files for various shells. This feature also activates the cli feature. Enter ltrs completions --help to get help with installing completion files.
  • color: Enables color outputting in the terminal. If cli feature is also enabled, the --color= option will be available.
  • full: Enables all features that are mutually compatible (i.e., cli-complete, docker, and undoc).
  • html: Enables HTML parser utilities.
  • markdown: Enables Markdown parser utilities (and also HTML).
  • multithreaded: Enables multithreaded requests.
  • native-tls-vendored: Enables the vendored feature of native-tls. This or native-tls should be activated if you are planning to use HTTPS servers.
  • typst: Enables Typst parser utilities.
  • undoc: Adds more fields to JSON responses that are not present in the Model | Example Value but might be present in some cases. All added fields are stored in a hashmap as JSON values.

Related Projects

Here are listed some projects that use LTRS.

  • null-ls: Neovim plugin with LTRS builtin (see PR)
  • languagetool-code-comments: uses LTRS to check for grammar errors within code comments

Do you use LTRS in your project? Contact me so I can add it to the list!

Contributing

Contributions are more than welcome!

First, check out the CHANGELOG guide for detailed information about how to contribute to this project.

Should you have any question, feel free to reach out via: Issues for bugs, Pull requests for code contributions or Discussions for anything else.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rusthacktoberfestlanguagetoolrustwrapper-api

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言