AutoCorrrect for Rust
A linter and formatter for help you improve copywriting, to correct spaces, punctuations between CJK (Chinese, Japanese, Korean).
Like Eslint, Rubocop, Gofmt ..., AutoCorrect allows us to checking soure code, and output as colorized diff with corrected suggest. You can intergrating to CI (GitLab CI, GitHub Action, Travis CI....) for use to checking the contents in source code. Recognize the file name, and find out the strings and the comment part.
基于 Rust 编写的 CLI 工具,用于「自动纠正」或「检查并建议」文案,给 CJK(中文、日语、韩语)与英文混写的场景,补充正确的空格,同时尝试以安全的方式自动纠正标点符号等等。
类似 ESlint、Rubocop、Gofmt 等工具,AutoCorrect 可以用于 CI 环境,它提供 Lint 功能能便捷的检测出项目中有问题的文案,起到统一规范的作用。
支持各种类型源代码文件支持,能自动识别文件名,并准确找到字符串、注释做自动纠正。
此方案最早于 2013 年 出现于 Ruby China 的项目,并逐步完善规则细节,当前准确率较高(级少数异常情况),你可以放心用来辅助你完整自动纠正动作。
Features
- Auto add spacings between CJK (Chinese, Japanese, Korean) and English words.
- Multiple file content support (HTML, YAML, Rust, Go, SQL, Ruby, Python, Objective-C, Swift, Java, Kotlin, Dart, JavaScript, CSharp ...).
- Fullwidth -> halfwidth (only for [a-zA-Z0-9], and
:
in time). - Correct punctuations into Fullwidth near the CJK.
- Lint checking and output diff or JSON result, so you can integrating to everwhere (GitLab CI, GitHub Action, VS Code, Vim, Emacs...)
- Allows to use
.gitignore
or.autocorrectignore
to ignore files that you wants ignore.
Usage
In your Cargo.toml
[]
= "1.0.0"
Use autocorrect::format
to format plain text.
extern crate autocorrect;
License
This project under MIT license.