phonetic_encoder 1.1.0 → 1.1.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/CHANGELOG.md +14 -0
- data/README.md +20 -8
- data/lib/phonetic_encoder/{strings.rb → overloads.rb} +0 -0
- data/lib/phonetic_encoder/version.rb +1 -1
- data/lib/phonetic_encoder.rb +5 -5
- 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: ef09ba6e1ff4070a55837c16e282cb74c00d650f7532091ad0f192360be31056
|
4
|
+
data.tar.gz: cf43b47eae23bce2a4195cbf3819eedc688251579f42864142f1686f489e89cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f41d259ad06f95e562ee5ffcd89ad9e5f00b9ba6db463cd057aaebf3aecf1b4666df6dc7f1ae8c9caa38a8987abc3a8956a68263287a17fc92bca5c5b84afe6
|
7
|
+
data.tar.gz: 4739dd1378159379e83e14ca5adf9755608b51047caee47960ce7c70df0b51ca9c27e6418205cba4a5571b584124cb4bc83c9788f5bf4e4129750f9e7e112b05
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## 1.1.1 (January 24, 2019)
|
2
|
+
|
3
|
+
IMPROVEMENTS:
|
4
|
+
|
5
|
+
* Small tweak to rename the strings.rb to overloads.rb to keep it generic across multiple gems. ([@TGWolf][])
|
6
|
+
|
7
|
+
## 1.1.0 (January 24, 2019)
|
8
|
+
|
9
|
+
IMPROVEMENTS:
|
10
|
+
|
11
|
+
* Move the code inside of a module namespace. ([@TGWolf][])
|
12
|
+
* Extend the strings class so that str.phonetic_encoder works. ([@TGWolf][])
|
13
|
+
* Update the documentation. ([@TGWolf][])
|
14
|
+
|
1
15
|
## 1.0.0 (January 24, 2019)
|
2
16
|
|
3
17
|
* Initial Release ([@TGWolf][])
|
data/README.md
CHANGED
@@ -33,9 +33,13 @@ Or install it yourself as:
|
|
33
33
|
You can use the default built in dictionary which is NATO.
|
34
34
|
|
35
35
|
```ruby
|
36
|
-
|
36
|
+
require 'phonetic_encoder'
|
37
37
|
|
38
|
-
puts
|
38
|
+
puts PhoneticEncoder::Encoder.encode('abc')
|
39
|
+
|
40
|
+
# or
|
41
|
+
|
42
|
+
puts 'abc'.phonetic_encode
|
39
43
|
```
|
40
44
|
|
41
45
|
### Extended Usage
|
@@ -43,21 +47,29 @@ You can use the default built in dictionary which is NATO.
|
|
43
47
|
You can also use the built-in 'sounds' dictionary.
|
44
48
|
|
45
49
|
```ruby
|
46
|
-
|
50
|
+
require 'phonetic_encoder'
|
51
|
+
|
52
|
+
puts PhoneticEncoder::Encoder.encode('abc', 'sounds')
|
53
|
+
|
54
|
+
# or
|
47
55
|
|
48
|
-
|
56
|
+
'abc'.phonetic_encode('sounds')
|
49
57
|
```
|
50
58
|
|
51
59
|
### Advanced Usage
|
52
60
|
|
53
61
|
You can define your own dictionary, the below example just does a single item, but you can make the set as large as you need.
|
54
62
|
|
55
|
-
```
|
56
|
-
|
63
|
+
```ruby
|
64
|
+
require 'phonetic_encoder'
|
65
|
+
|
66
|
+
PhoneticEncoder::Encoder.custom('custom', 'a' => 'apple', 'b' => 'ballon', 'c' => 'cat')
|
67
|
+
|
68
|
+
puts PhoneticEncoder::Encoder.encode('abc', 'custom')
|
57
69
|
|
58
|
-
|
70
|
+
# or
|
59
71
|
|
60
|
-
|
72
|
+
'abc'.phonetic_encode('custom')
|
61
73
|
```
|
62
74
|
|
63
75
|
## Development
|
File without changes
|
data/lib/phonetic_encoder.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require_relative 'phonetic_encoder/version'
|
2
|
-
require_relative 'phonetic_encoder/
|
2
|
+
require_relative 'phonetic_encoder/overloads'
|
3
3
|
require_relative 'phonetic_encoder/dicts/nato'
|
4
4
|
require_relative 'phonetic_encoder/dicts/sounds'
|
5
5
|
|
@@ -22,6 +22,10 @@ module PhoneticEncoder
|
|
22
22
|
$dict[name] = dict
|
23
23
|
end
|
24
24
|
|
25
|
+
def self.letter_from_dictionary(letter, dict)
|
26
|
+
dict.key?(letter) ? dict[letter].downcase : letter
|
27
|
+
end
|
28
|
+
|
25
29
|
def self.encode(text, dict_name = 'nato')
|
26
30
|
setup
|
27
31
|
|
@@ -36,9 +40,5 @@ module PhoneticEncoder
|
|
36
40
|
end
|
37
41
|
result.rstrip
|
38
42
|
end
|
39
|
-
|
40
|
-
def self.letter_from_dictionary(letter, dict)
|
41
|
-
dict.key?(letter) ? dict[letter].downcase : letter
|
42
|
-
end
|
43
43
|
end
|
44
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phonetic_encoder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Gurney
|
@@ -78,7 +78,7 @@ files:
|
|
78
78
|
- lib/phonetic_encoder.rb
|
79
79
|
- lib/phonetic_encoder/dicts/nato.rb
|
80
80
|
- lib/phonetic_encoder/dicts/sounds.rb
|
81
|
-
- lib/phonetic_encoder/
|
81
|
+
- lib/phonetic_encoder/overloads.rb
|
82
82
|
- lib/phonetic_encoder/version.rb
|
83
83
|
- phonetic_encoder.gemspec
|
84
84
|
homepage: https://github.com/WolfSoftware/phonetic_encoder
|