auto-correct 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -12
- data/lib/auto-correct/format.rb +1 -1
- data/lib/auto-correct/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0601f319b91d591f58b600938a273a7f2865b98c836271718addbd1113ba0ee0
|
|
4
|
+
data.tar.gz: 36acc277500cc855010af480979dae9c47b7fa941703d5459a2c302050bbc86a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e08ebc0e999f36ecd8b64fd82e6433044c99d53a47c80f1114557a483958647454888bfd577729805c140416e5160f0acc9ad302dbfec090807bfff919de051a
|
|
7
|
+
data.tar.gz: 358a903572c678ea9b233c69d71e714dd5265d97d7c644c8214e838f7928656b7a86029096a1fc9181489c684d884587002593d6b8bb4c58a96d433dd8cab7ec
|
data/README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Automatically add spaces between Chinese and English words.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
中文英文混排自动纠正补充空格,此方式已在 Ruby China 使用多年,支持 HTML 处理。
|
|
6
6
|
|
|
7
7
|
[](https://rubygems.org/gems/auto-correct) [](http://travis-ci.org/huacnlee/auto-correct)
|
|
8
|
+
Status](https://api.travis-ci.org/huacnlee/auto-correct.svg?branch=master&.svg)](http://travis-ci.org/huacnlee/auto-correct)
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
## Other implements
|
|
@@ -18,22 +18,24 @@ Status](https://api.travis-ci.org/huacnlee/auto-correct.svg?branch=master&.svg)]
|
|
|
18
18
|
- Auto add spacings between Chinese and English words.
|
|
19
19
|
- HTML content support.
|
|
20
20
|
|
|
21
|
+
[Examples](https://github.com/huacnlee/auto-correct/blob/master/test/format_test.rb)
|
|
22
|
+
|
|
21
23
|
## Usage
|
|
22
24
|
|
|
23
25
|
`AutoCorrect.format` method for plain text.
|
|
24
26
|
|
|
25
27
|
```ruby
|
|
26
|
-
AutoCorrect.format("
|
|
27
|
-
# => "
|
|
28
|
+
AutoCorrect.format("那里找到Ruby China App下载地址")
|
|
29
|
+
# => "那里找到 Ruby China App 下载地址"
|
|
28
30
|
|
|
29
|
-
AutoCorrect.format("
|
|
30
|
-
# => "
|
|
31
|
+
AutoCorrect.format("Ruby 2.7版本第1次发布")
|
|
32
|
+
# => "Ruby 2.7 版本第 1 次发布"
|
|
31
33
|
|
|
32
|
-
AutoCorrect.format("
|
|
33
|
-
# => "
|
|
34
|
+
AutoCorrect.format("于3月10日开始")
|
|
35
|
+
# => "于 3 月 10 日开始"
|
|
34
36
|
|
|
35
|
-
AutoCorrect.format("
|
|
36
|
-
# => "
|
|
37
|
+
AutoCorrect.format("包装日期为2013年3月10日")
|
|
38
|
+
# => "包装日期为2013年3月10日"
|
|
37
39
|
```
|
|
38
40
|
|
|
39
41
|
`AutoCorrect.format_html` method for HTML content.
|
|
@@ -47,10 +49,9 @@ AutoCorrect.format_html("<div><p>长桥LongBridge App下载</p><p>最新版本1.
|
|
|
47
49
|
|
|
48
50
|
TODO
|
|
49
51
|
|
|
50
|
-
|
|
51
52
|
## Use cases
|
|
52
53
|
|
|
53
|
-
* [Ruby China](
|
|
54
|
+
* [Ruby China](https://ruby-china.org) - 目前整站的标题都做了自动转换处理。
|
|
54
55
|
|
|
55
56
|
## Links
|
|
56
57
|
|
data/lib/auto-correct/format.rb
CHANGED
|
@@ -4,7 +4,7 @@ class AutoCorrect
|
|
|
4
4
|
rule '\p{Han}', '[0-9a-zA-Z]', space: true, reverse: true
|
|
5
5
|
|
|
6
6
|
# SpecialSymbol
|
|
7
|
-
rule '\p{Han}', '[
|
|
7
|
+
rule '\p{Han}', '[\|+$@#*]', space: true, reverse: true
|
|
8
8
|
rule '\p{Han}', '[\[\(‘“]', space: true
|
|
9
9
|
rule '[’”\]\)!%]', '\p{Han}', space: true
|
|
10
10
|
rule '[”\]\)!]', '[a-zA-Z0-9]+', space: true
|
data/lib/auto-correct/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: auto-correct
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Luikore
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2020-
|
|
12
|
+
date: 2020-03-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: nokogiri
|