All Projects → huacnlee → Auto Correct

huacnlee / Auto Correct

Licence: mit
Automatically add whitespace between CJK (Chinese, Japanese, Korean) and half-width characters (alphabetical letters, numerical digits and symbols).

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to Auto Correct

Psscriptanalyzer
Download ScriptAnalyzer from PowerShellGallery
Stars: ✭ 1,137 (+831.97%)
Mutual labels:  formatter
Unimport
A linter, formatter for finding and removing unused import statements.
Stars: ✭ 96 (-21.31%)
Mutual labels:  formatter
Prettier
Prettier is an opinionated code formatter.
Stars: ✭ 41,411 (+33843.44%)
Mutual labels:  formatter
Elm Format
elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide
Stars: ✭ 1,240 (+916.39%)
Mutual labels:  formatter
Parallel Prettier
Concurrent prettier runner
Stars: ✭ 84 (-31.15%)
Mutual labels:  formatter
Kibana Object Format
A Kibana plugin for displaying objects and arrays of objects.
Stars: ✭ 100 (-18.03%)
Mutual labels:  formatter
Typeset
自动修正中文、英文、代码混合排版中的全半角、空格等问题
Stars: ✭ 63 (-48.36%)
Mutual labels:  formatter
Javascriptprettier
A Visual Studio extension
Stars: ✭ 118 (-3.28%)
Mutual labels:  formatter
Phonenumberformatter
UITextField subclass for formatting phone numbers. Allow different formats for different countries(patterns).
Stars: ✭ 85 (-30.33%)
Mutual labels:  formatter
Swimat
An Xcode formatter plug-in to format your swift code.
Stars: ✭ 1,388 (+1037.7%)
Mutual labels:  formatter
Texttable
Swift package for easily rendering text tables. Inspired by the Python tabulate library.
Stars: ✭ 82 (-32.79%)
Mutual labels:  formatter
Black Playground
ambv/black online demo
Stars: ✭ 83 (-31.97%)
Mutual labels:  formatter
Snowonder
🔮 Magical import declarations formatter for Xcode
Stars: ✭ 100 (-18.03%)
Mutual labels:  formatter
Aspnetcorecsvimportexport
ASP.NET Core CSV import export custom formatters
Stars: ✭ 77 (-36.89%)
Mutual labels:  formatter
Pretty Yaml
PyYAML-based module to produce pretty and readable YAML-serialized data
Stars: ✭ 110 (-9.84%)
Mutual labels:  formatter
Align
A general purpose application and library for aligning text.
Stars: ✭ 63 (-48.36%)
Mutual labels:  formatter
Laravel Oh Generators
This package extends the core file generators that are included with Laravel 5 or later.
Stars: ✭ 96 (-21.31%)
Mutual labels:  formatter
Javascript Number Formatter
Lightweight & Fast JavaScript Number Formatter
Stars: ✭ 119 (-2.46%)
Mutual labels:  formatter
Atom Beautify
📣 Help Wanted - Looking for Maintainer: https://github.com/Glavin001/atom-beautify/issues/2572 | 💄 Universal beautification package for Atom editor (⚠️ Currently migrating to https://github.com/Unibeautify/ and have very limited bandwidth for Atom-Beautify Issues. Thank you for your patience and understanding ❤️ )
Stars: ✭ 1,501 (+1130.33%)
Mutual labels:  formatter
Codeview
Codeview is an Android library that lets you preview code in webview very easy and simple with highlights and colors.
Stars: ✭ 103 (-15.57%)
Mutual labels:  formatter

auto-correct

Automatically add whitespace between CJK (Chinese, Japanese, Korean) and half-width characters (alphabetical letters, numerical digits and symbols).

中文、日语、韩语 + 英文混排自动纠正补充空格,此方式已在 Ruby China 使用多年,支持 HTML 处理。

Gem Version build

Other implements

Features

  • Auto add spacings between CJK (Chinese) and English words.
  • HTML content support.

Examples

Usage

AutoCorrect.format method for plain text.

AutoCorrect.format("那里找到Ruby China App下载地址")
# => "那里找到 Ruby China App 下载地址"

AutoCorrect.format("Ruby 2.7版本第1次发布")
# => "Ruby 2.7 版本第 1 次发布"

AutoCorrect.format("于3月10日开始")
# => "于 3 月 10 日开始"

AutoCorrect.format("包装日期为2013年3月10日")
# => "包装日期为2013年3月10日"

AutoCorrect.format("生产环境中使用Ruby")
# => "生产环境中使用 Ruby"

AutoCorrect.format("本番環境でRubyを使用する")
# => "本番環境で Ruby を使用する"

AutoCorrect.format("프로덕션환경에서Ruby사용")
# => "프로덕션환경에서 Ruby 사용"

AutoCorrect.format_html method for HTML content.

AutoCorrect.format_html("<div><p>长桥LongBridge App下载</p><p>最新版本1.0</p></div>")
# => "<div><p>长桥 LongBridge App 下载</p><p>最新版本 1.0</p></div>"

Benchmark

Run rake bench to test:

Warming up --------------------------------------
     format 50 chars     1.886k i/100ms
    format 100 chars     1.060k i/100ms
    format 400 chars   342.000  i/100ms
         format_html    85.000  i/100ms
Calculating -------------------------------------
     format 50 chars     18.842k (± 1.5%) i/s -     94.300k in   5.005815s
    format 100 chars     10.357k (± 1.8%) i/s -     51.940k in   5.016770s
    format 400 chars      3.336k (± 2.2%) i/s -     16.758k in   5.026230s
         format_html    839.761  (± 2.1%) i/s -      4.250k in   5.063225s
Total chars Duration
50 0.33 ms
100 0.60 ms
400 2 ms

FormatHTML

Total chars Duration
2K 7 ms

Use cases

  • Ruby China - 目前整站都做了自动转换处理。

Links

License

This project under MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].