{"id":15621647,"url":"https://github.com/jeertmans/languagetool-rust","last_synced_at":"2025-04-08T01:37:50.150Z","repository":{"id":37417770,"uuid":"492878676","full_name":"jeertmans/languagetool-rust","owner":"jeertmans","description":"LanguageTool API in Rust","archived":false,"fork":false,"pushed_at":"2025-03-13T12:50:42.000Z","size":570,"stargazers_count":170,"open_issues_count":15,"forks_count":7,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-01T00:36:44.262Z","etag":null,"topics":["hacktoberfest","languagetool","rust","wrapper-api"],"latest_commit_sha":null,"homepage":"https://docs.rs/languagetool-rust","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jeertmans.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["jeertmans"]}},"created_at":"2022-05-16T14:47:43.000Z","updated_at":"2025-03-25T01:20:28.000Z","dependencies_parsed_at":"2023-09-26T08:57:00.731Z","dependency_job_id":"820ab078-8992-4ee5-b038-1c975f91c8ef","html_url":"https://github.com/jeertmans/languagetool-rust","commit_stats":{"total_commits":357,"total_committers":9,"mean_commits":"39.666666666666664","dds":0.07282913165266103,"last_synced_commit":"a217b4061f35a915920514ba73a55720f3fdff29"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeertmans%2Flanguagetool-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeertmans%2Flanguagetool-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeertmans%2Flanguagetool-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeertmans%2Flanguagetool-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeertmans","download_url":"https://codeload.github.com/jeertmans/languagetool-rust/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247761052,"owners_count":20991532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","languagetool","rust","wrapper-api"],"created_at":"2024-10-03T09:51:23.467Z","updated_at":"2025-04-08T01:37:50.135Z","avatar_url":"https://github.com/jeertmans.png","language":"Rust","funding_links":["https://github.com/sponsors/jeertmans"],"categories":["Rust"],"sub_categories":[],"readme":"# LanguageTool-Rust\n\n\u003e **Rust bindings to connect with LanguageTool server API.**\n\n*LanguageTool is an open source grammar style checker. It can correct 30+ languages and is free to use, more on that on [languagetool.org](https://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!*\n\n[![Crates.io](https://img.shields.io/crates/v/languagetool-rust)](https://crates.io/crates/languagetool-rust)\n[![docs.rs](https://img.shields.io/docsrs/languagetool-rust)](https://docs.rs/languagetool-rust)\n[![codecov](https://codecov.io/gh/jeertmans/languagetool-rust/branch/main/graph/badge.svg?token=ZDZ8YBQTPH)](https://codecov.io/gh/jeertmans/languagetool-rust)\n\n1. [About](#about)\n2. [CLI Reference](#cli-reference)\n    - [Docker](#docker)\n3. [API Reference](#api-reference)\n    - [Feature Flags](#feature-flags)\n4. [CHANGELOG](https://github.com/jeertmans/languagetool-rust/blob/main/CHANGELOG.md)\n5. [Related Projects](#related-projects)\n6. [Contributing](#contributing)\n\n## About\n\nLanguageTool-Rust (LTRS) is both an executable and a Rust library that aims to provide correct and safe bindings for the LanguageTool API.\n\n*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.*\n\n## Installation\n\nYou can install the latest version with `cargo`.\n\n```bash\ncargo install languagetool-rust --features full\n```\n\n### AUR\n\nIf you are on Arch Linux, you call also install with your [AUR helper](https://wiki.archlinux.org/title/AUR_helpers):\n\n```bash\nparu -S languagetool-rust\n```\n\n## CLI Reference\n\n![Screenshot from CLI](https://raw.githubusercontent.com/jeertmans/languagetool-rust/main/img/screenshot.svg)\n\nThe command line interface of LTRS allows to very quickly use any LanguageTool server to check for grammar and style errors.\n\nThe reference for the CLI can be accessed via `ltrs --help`.\n\nBy default, LTRS uses the LanguageTool public API.\n\n### Example\n\n```bash\n\u003e ltrs ping # to check if the server is alive\nPONG! Delay: 110 ms\n\u003e ltrs languages # to list all languages\n[\n  {\n    \"name\": \"Arabic\",\n    \"code\": \"ar\",\n    \"longCode\": \"ar\"\n  },\n  {\n    \"name\": \"Asturian\",\n    \"code\": \"ast\",\n    \"longCode\": \"ast-ES\"\n  },\n  # ...\n]\n\u003e ltrs check --text \"Some phrase with a smal mistake\"\n{\n  \"language\": {\n    \"code\": \"en-US\",\n    \"detectedLanguage\": {\n      \"code\": \"en-US\",\n      \"confidence\": 0.99,\n      \"name\": \"English (US)\",\n      \"source\": \"ngram\"\n    },\n    \"name\": \"English (US)\"\n  },\n  \"matches\": [\n    {\n      \"context\": {\n        \"length\": 4,\n        \"offset\": 19,\n        \"text\": \"Some phrase with a smal mistake\"\n      },\n      \"contextForSureMatch\": 0,\n      \"ignoreForIncompleteSentence\": false,\n      \"length\": 4,\n      \"message\": \"Possible spelling mistake found.\",\n      \"offset\": 19,\n      \"replacements\": [\n        {\n          \"value\": \"small\"\n        },\n        {\n          \"value\": \"seal\"\n        },\n        # ...\n      }\n      # ...\n    ]\n  # ...\n}\n\u003e ltrs --help # for more details\n```\n\n### Docker\n\nSince 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:\n\n```bash\nltrs docker pull # only once\nltrs docker start # start the LT server\nltrs --hostname http://localhost -p 8010 check -t \"Some tex\"\n# Other commands...\nltrs docker stop # stop the LT server\n```\n\n\u003e *Note:* Docker is a tool that facilitates running applications without worrying about dependencies, platform-related issues, and so on. Installation guidelines can be found [here](https://www.docker.com/get-started/). On Linux platform, you might need to circumvent the *sudo privilege issue* by doing [this](https://docs.docker.com/engine/install/linux-postinstall/).\n\n## API Reference\n\nIf you would like to integrate LTRS within a Rust application or crate, then we recommend reading the [documentation](https://docs.rs/languagetool-rust).\n\nTo use LanguageTool-Rust in your Rust project, add to your `Cargo.toml`:\n\n```toml\n[dependencies]\nlanguagetool-rust = \"^2.1\"\n```\n\n### Example\n\n```rust\nuse languagetool_rust::{check::CheckRequest, server::ServerClient};\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let client = ServerClient::from_env_or_default();\n\n    let req = CheckRequest::default()\n        .with_text(\"Some phrase with a smal mistake\".to_string());\n\n    println!(\n        \"{}\",\n        serde_json::to_string_pretty(\u0026client.check(\u0026req).await?)?\n    );\n    Ok(())\n}\n```\n\n### Feature Flags\n\n#### Default Features\n\n- **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**, **multithreaded**.\n- **native-tls**: Enables TLS functionality provided by `native-tls`.\n\n#### Optional Features\n\n- **annotate**: Adds method(s) to annotate results from check request.\n- **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.\n- **color**: Enables color outputting in the terminal. If **cli** feature is also enabled, the `--color=\u003cWHEN\u003e` option will be available.\n- **full**: Enables all features that are mutually compatible (i.e., `cli-complete`, `docker`, and `unstable`).\n- **multithreaded**: Enables multithreaded requests.\n- **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.\n- **unstable**: Adds more fields to JSON responses that are not present in the [Model | Example Value](https://languagetool.org/http-api/swagger-ui/#!/default/) but might be present in some cases. All added fields are optional, hence the `Option` around them.\n\n## Related Projects\n\nHere are listed some projects that use LTRS.\n\n- [`null-ls`](https://github.com/jose-elias-alvarez/null-ls.nvim): Neovim plugin with LTRS builtin ([see PR](https://github.com/jose-elias-alvarez/null-ls.nvim/pull/997))\n- [`languagetool-code-comments`](https://github.com/dustinblackman/languagetool-code-comments): uses LTRS to check for grammar errors within code comments\n\n*Do you use LTRS in your project? Contact me so I can add it to the list!*\n\n## Contributing\n\nContributions are more than welcome! Please reach me via GitHub for any questions: [Issues](https://github.com/jeertmans/languagetool-rust/issues), [Pull requests](https://github.com/jeertmans/languagetool-rust/pulls) or [Discussions](https://github.com/jeertmans/languagetool-rust/discussions).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeertmans%2Flanguagetool-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeertmans%2Flanguagetool-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeertmans%2Flanguagetool-rust/lists"}