vietnamese_accentless 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +5 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +55 -0
- data/README.md +36 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/vietnamese_accentless/constants.rb +16 -0
- data/lib/vietnamese_accentless/version.rb +5 -0
- data/lib/vietnamese_accentless.rb +25 -0
- data/sig/vietnamese_accentless.rbs +4 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9760df6d75ab4edf1bb2cc893dbf4b86dc6623d95384301f0120a73efaa64299
|
4
|
+
data.tar.gz: c51e1646a9ce879419bb1f2203bb7afeea73b72b19558f45c9674c32e9d5b6a1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: be085e10ba377387a5400d3c85b11845bb58593d18c74e936268298754a791b4a556a655716047c8f14660113e586a4c1430e6ef73f2623f62dce1525d52b3eb
|
7
|
+
data.tar.gz: fd7c4b631900545f7a6d654bf150b9d232c64c4044787a2105a82f605b89a5bcc561cb13ab2f39aed20e65758feaae21e280d3bd12f46a0d622ac3c909da426d
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
vietnamese_accentless (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
diff-lcs (1.5.0)
|
11
|
+
parallel (1.21.0)
|
12
|
+
parser (3.0.3.2)
|
13
|
+
ast (~> 2.4.1)
|
14
|
+
rainbow (3.0.0)
|
15
|
+
rake (13.0.6)
|
16
|
+
regexp_parser (2.2.0)
|
17
|
+
rexml (3.2.5)
|
18
|
+
rspec (3.10.0)
|
19
|
+
rspec-core (~> 3.10.0)
|
20
|
+
rspec-expectations (~> 3.10.0)
|
21
|
+
rspec-mocks (~> 3.10.0)
|
22
|
+
rspec-core (3.10.1)
|
23
|
+
rspec-support (~> 3.10.0)
|
24
|
+
rspec-expectations (3.10.1)
|
25
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
+
rspec-support (~> 3.10.0)
|
27
|
+
rspec-mocks (3.10.2)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.10.0)
|
30
|
+
rspec-support (3.10.3)
|
31
|
+
rubocop (1.24.0)
|
32
|
+
parallel (~> 1.10)
|
33
|
+
parser (>= 3.0.0.0)
|
34
|
+
rainbow (>= 2.2.2, < 4.0)
|
35
|
+
regexp_parser (>= 1.8, < 3.0)
|
36
|
+
rexml
|
37
|
+
rubocop-ast (>= 1.15.0, < 2.0)
|
38
|
+
ruby-progressbar (~> 1.7)
|
39
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
40
|
+
rubocop-ast (1.15.0)
|
41
|
+
parser (>= 3.0.1.1)
|
42
|
+
ruby-progressbar (1.11.0)
|
43
|
+
unicode-display_width (2.1.0)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
x86_64-darwin-21
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
rake (~> 13.0)
|
50
|
+
rspec (~> 3.0)
|
51
|
+
rubocop (~> 1.21)
|
52
|
+
vietnamese_accentless!
|
53
|
+
|
54
|
+
BUNDLED WITH
|
55
|
+
2.3.1
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# VietnameseAccentless
|
2
|
+
|
3
|
+
Remove accent from Vietnamese text
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'vietnamese_accentless'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install vietnamese_accentless
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
VietnameseAccentless.convert('Tôi yêu Việt Nam')
|
25
|
+
# => Toi yeu Viet Nam
|
26
|
+
```
|
27
|
+
|
28
|
+
## Development
|
29
|
+
|
30
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
31
|
+
|
32
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/YutoYasunaga/vietnamese_accentless.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'vietnamese_accentless'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
A_LINE_DOWNCASE = 'àáạảãâầấậẩẫăằắặẳẵ'
|
4
|
+
A_LINE_UPCASE = 'ÀÁẠẢÃĂẰẮẶẲẴÂẦẤẬẨẪ'
|
5
|
+
O_LINE_DOWNCASE = 'òóọỏõôồốộổỗơờớợởỡ'
|
6
|
+
O_LINE_UPCASE = 'ÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠ'
|
7
|
+
E_LINE_DOWNCASE = 'èéẹẻẽêềếệểễ'
|
8
|
+
E_LINE_UPCASE = 'ÈÉẸẺẼÊỀẾỆỂỄ'
|
9
|
+
U_LINE_DOWNCASE = 'ùúụủũưừứựửữ'
|
10
|
+
U_LINE_UPCASE = 'ƯỪỨỰỬỮÙÚỤỦŨ'
|
11
|
+
I_LINE_DOWNCASE = 'ìíịỉĩ'
|
12
|
+
I_LINE_UPCASE = 'ÌÍỊỈĨ'
|
13
|
+
Y_LINE_DOWNCASE = 'ỳýỵỷỹ'
|
14
|
+
Y_LINE_UPCASE = 'ỲÝỴỶỸ'
|
15
|
+
D_LINE_DOWNCASE = 'đ'
|
16
|
+
D_LINE_UPCASE = 'Đ'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'vietnamese_accentless/version'
|
4
|
+
require 'vietnamese_accentless/constants'
|
5
|
+
|
6
|
+
module VietnameseAccentless
|
7
|
+
class Error < StandardError; end
|
8
|
+
|
9
|
+
def self.convert(string)
|
10
|
+
string = string.tr(A_LINE_DOWNCASE, 'a')
|
11
|
+
string = string.tr(A_LINE_UPCASE, 'A')
|
12
|
+
string = string.tr(O_LINE_DOWNCASE, 'o')
|
13
|
+
string = string.tr(O_LINE_UPCASE, 'O')
|
14
|
+
string = string.tr(E_LINE_DOWNCASE, 'e')
|
15
|
+
string = string.tr(E_LINE_UPCASE, 'E')
|
16
|
+
string = string.tr(U_LINE_DOWNCASE, 'u')
|
17
|
+
string = string.tr(U_LINE_UPCASE, 'U')
|
18
|
+
string = string.tr(I_LINE_DOWNCASE, 'i')
|
19
|
+
string = string.tr(I_LINE_UPCASE, 'I')
|
20
|
+
string = string.tr(Y_LINE_DOWNCASE, 'y')
|
21
|
+
string = string.tr(Y_LINE_UPCASE, 'Y')
|
22
|
+
string = string.tr(D_LINE_DOWNCASE, 'd')
|
23
|
+
string.tr(D_LINE_UPCASE, 'D')
|
24
|
+
end
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vietnamese_accentless
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yuto Yasunaga
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-12-24 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- yuto.yasunaga@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".rspec"
|
21
|
+
- ".rubocop.yml"
|
22
|
+
- Gemfile
|
23
|
+
- Gemfile.lock
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- bin/console
|
27
|
+
- bin/setup
|
28
|
+
- lib/vietnamese_accentless.rb
|
29
|
+
- lib/vietnamese_accentless/constants.rb
|
30
|
+
- lib/vietnamese_accentless/version.rb
|
31
|
+
- sig/vietnamese_accentless.rbs
|
32
|
+
homepage: https://github.com/YutoYasunaga/vietnamese_accentless
|
33
|
+
licenses: []
|
34
|
+
metadata:
|
35
|
+
homepage_uri: https://github.com/YutoYasunaga/vietnamese_accentless
|
36
|
+
source_code_uri: https://github.com/YutoYasunaga/vietnamese_accentless.git
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.6.0
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubygems_version: 3.2.32
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: Remove accent from Vietnamese text
|
56
|
+
test_files: []
|