fonetica 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/CHANGELOG +28 -0
- data/README.textile +66 -0
- data/Rakefile +7 -0
- data/fonetica.gemspec +2 -3
- data/lib/fonetica.rb +12 -10
- data/lib/fonetica/core_ext/string.rb +1 -1
- data/lib/fonetica/version.rb +4 -4
- data/test/string_test.rb +188 -0
- data/{spec/spec_helper.rb → test/test_helper.rb} +2 -0
- metadata +13 -32
- data/.rspec +0 -1
- data/Gemfile.lock +0 -32
- data/autotest/discover.rb +0 -1
- data/spec/fonetica_spec.rb +0 -244
data/.gitignore
CHANGED
data/CHANGELOG
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
0.4.0 [Sat Feb 12 2010]
|
2
|
+
|
3
|
+
* Compatibility with Ruby 1.9
|
4
|
+
* Testing with Test::Unit instead of RSpec
|
5
|
+
* Using singleton instead of module for Fonetica
|
6
|
+
|
7
|
+
0.3.1 [Wed Dec 22 2010]
|
8
|
+
|
9
|
+
* Update gemspec summary
|
10
|
+
|
11
|
+
0.3.0 [Wed Dec 22 2010]
|
12
|
+
|
13
|
+
* Dropped activerecord support
|
14
|
+
* Rename fonetica method to foneticalize
|
15
|
+
* Extract alghoritm to fonetica module
|
16
|
+
|
17
|
+
0.2.0 [Mon Oct 18 2010]
|
18
|
+
|
19
|
+
* Catch case baptista and batista
|
20
|
+
* Cache column renamed from "attribute_fonetica" to "fonetica_attribute"
|
21
|
+
|
22
|
+
0.1.1 [Sat Oct 16 2010]
|
23
|
+
|
24
|
+
* Fix gemspec homepage, summary and description
|
25
|
+
|
26
|
+
0.1.0 [Sat Oct 16 2010]
|
27
|
+
|
28
|
+
* First release
|
data/README.textile
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
h1. Fonetica
|
2
|
+
|
3
|
+
Fonetica implements the "BuscaBR algorithm":http://www.unibratec.com.br/jornadacientifica/diretorio/NOVOB.pdf to match misspelled or ambiguous names at Brazil.
|
4
|
+
|
5
|
+
h2. The Story
|
6
|
+
|
7
|
+
One day I had to perform a phonetic search on a people database using the "Soundex alghoritm":http://en.wikipedia.org/wiki/Soundex but didn't work for names at Brazil like "Wagner Batista" and "Vagner Baptista".
|
8
|
+
|
9
|
+
Then Google suggested me to read the "BuscaBR algorithm":http://www.unibratec.com.br/jornadacientifica/diretorio/NOVOB.pdf.
|
10
|
+
|
11
|
+
h2. Usage
|
12
|
+
|
13
|
+
<pre>
|
14
|
+
require 'fonetica'
|
15
|
+
|
16
|
+
'Wagner Batista'.foneticalize #=> "VM BT"
|
17
|
+
'Vagner Baptista'.foneticalize #=> "VM BT"
|
18
|
+
</pre>
|
19
|
+
|
20
|
+
h3. Using with ActiveRecord
|
21
|
+
|
22
|
+
You can use the fonetica to search on ActiveRecord like this:
|
23
|
+
|
24
|
+
<pre>
|
25
|
+
class Person < ActiveRecord::Base
|
26
|
+
scope :search, lambda { |name| where("#{quoted_table_name}.fonetica LIKE ?", "#{name.foneticalize}%") }
|
27
|
+
|
28
|
+
before_save :foneticalize
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def foneticalize
|
33
|
+
self.fonetica = name.foneticalize
|
34
|
+
end
|
35
|
+
end
|
36
|
+
</pre>
|
37
|
+
|
38
|
+
If you want to match any part, you should change scope to:
|
39
|
+
|
40
|
+
<pre>
|
41
|
+
scope :search, lambda { |name| where("#{quoted_table_name}.fonetica LIKE ?", "%#{name.foneticalize}%") }
|
42
|
+
</pre>
|
43
|
+
|
44
|
+
Remember to add a index on fonetica column.
|
45
|
+
|
46
|
+
h2. How to contribute
|
47
|
+
|
48
|
+
Please ensure that you provide appropriate test coverage and ensure the documentation is up-to-date. Bonus points if you perform your changes in a clean topic branch rather than master, and if you create a pull request for your changes to be discussed and reviewed.
|
49
|
+
|
50
|
+
Please also keep your commits *atomic* so that they are more likely to apply cleanly. That means that each commit should contain the smallest possible logical change. Don't commit two features at once, don't update the gemspec at the same time you add a feature, don't fix a whole bunch of whitespace in a file at the same time you change a few lines, etc, etc.
|
51
|
+
|
52
|
+
h2. Development environment
|
53
|
+
|
54
|
+
<pre>
|
55
|
+
$ git clone http://github.com/sobrinho/fonetica
|
56
|
+
$ cd fonetica
|
57
|
+
$ bundle install
|
58
|
+
$ rake test
|
59
|
+
</pre>
|
60
|
+
|
61
|
+
h2. Project info
|
62
|
+
|
63
|
+
Fonetica is hosted on Github: "http://github.com/sobrinho/fonetica":http://github.com/sobrinho/fonetica, where your contributions, forkings, comments and feedback are greatly welcomed.
|
64
|
+
|
65
|
+
|
66
|
+
Copyright (c) 2010 Gabriel Sobrinho, released under the MIT license.
|
data/Rakefile
CHANGED
data/fonetica.gemspec
CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "fonetica"
|
7
7
|
s.version = Fonetica::Version::STRING
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ["Gabriel Sobrinho"
|
10
|
-
s.email = ["gabriel.sobrinho@gmail.com"
|
9
|
+
s.authors = ["Gabriel Sobrinho"]
|
10
|
+
s.email = ["gabriel.sobrinho@gmail.com"]
|
11
11
|
s.homepage = "http://github.com/sobrinho/fonetica"
|
12
12
|
s.summary = %q{BuscaBR algorithm which allow the comparison of words based on their phonetic likeness}
|
13
13
|
s.files = `git ls-files`.split("\n")
|
@@ -16,5 +16,4 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
18
18
|
s.add_dependency(%q<i18n>, [">= 0.4.1"])
|
19
|
-
s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
|
20
19
|
end
|
data/lib/fonetica.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'singleton'
|
1
3
|
require 'i18n'
|
2
|
-
require 'active_support/core_ext/
|
4
|
+
require 'active_support/core_ext/class/attribute'
|
3
5
|
require 'active_support/inflector/transliterate'
|
4
6
|
require 'fonetica/core_ext/string'
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
class Fonetica
|
9
|
+
include Singleton
|
10
|
+
|
11
|
+
class_attribute :replacements
|
12
|
+
|
11
13
|
self.replacements = [
|
12
14
|
['Y', 'I'],
|
13
15
|
[/BR|BL/, 'B'],
|
@@ -33,15 +35,15 @@ module Fonetica
|
|
33
35
|
['L', 'R'],
|
34
36
|
[/[AEIOUH]/, '']
|
35
37
|
]
|
36
|
-
|
38
|
+
|
37
39
|
def foneticalize(word)
|
38
|
-
result = word.
|
40
|
+
result = word.gsub(/ç/i, 's')
|
39
41
|
result = I18n.transliterate(result).upcase
|
40
|
-
|
42
|
+
|
41
43
|
replacements.each do |search, replace|
|
42
44
|
result.gsub!(search, replace)
|
43
45
|
end
|
44
|
-
|
46
|
+
|
45
47
|
result.squeeze
|
46
48
|
end
|
47
49
|
end
|
data/lib/fonetica/version.rb
CHANGED
data/test/string_test.rb
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
class StringTest < ActiveSupport::TestCase
|
5
|
+
test 'broco and bloco should fonetica to BK' do
|
6
|
+
assert_equal 'BK', 'broco'.foneticalize
|
7
|
+
assert_equal 'BK', 'bloco'.foneticalize
|
8
|
+
end
|
9
|
+
|
10
|
+
test 'casa and kasa should fonetica to KS' do
|
11
|
+
assert_equal 'KS', 'casa'.foneticalize
|
12
|
+
assert_equal 'KS', 'kasa'.foneticalize
|
13
|
+
end
|
14
|
+
|
15
|
+
test 'coroar and koroar should fonetica to KR' do
|
16
|
+
assert_equal 'KR', 'coroar'.foneticalize
|
17
|
+
assert_equal 'KR', 'koroar'.foneticalize
|
18
|
+
end
|
19
|
+
|
20
|
+
test 'cuba and kuba should fonetica to KB' do
|
21
|
+
assert_equal 'KB', 'cuba'.foneticalize
|
22
|
+
assert_equal 'KB', 'kuba'.foneticalize
|
23
|
+
end
|
24
|
+
|
25
|
+
test 'cela and sela should fonetica to SR' do
|
26
|
+
assert_equal 'SR', 'cela'.foneticalize
|
27
|
+
assert_equal 'SR', 'sela'.foneticalize
|
28
|
+
end
|
29
|
+
|
30
|
+
test 'circo and sirco should fonetica to SRK' do
|
31
|
+
assert_equal 'SRK', 'circo'.foneticalize
|
32
|
+
assert_equal 'SRK', 'sirco'.foneticalize
|
33
|
+
end
|
34
|
+
|
35
|
+
test 'roça and rosa should fonetica to RS' do
|
36
|
+
assert_equal 'RS', 'roça'.foneticalize
|
37
|
+
assert_equal 'RS', 'rosa'.foneticalize
|
38
|
+
end
|
39
|
+
|
40
|
+
test 'ameixa and ameicha should fonetica to MS' do
|
41
|
+
assert_equal 'MS', 'ameixa'.foneticalize
|
42
|
+
assert_equal 'MS', 'ameicha'.foneticalize
|
43
|
+
end
|
44
|
+
|
45
|
+
test 'toracs and torax should fonetica to TR' do
|
46
|
+
assert_equal 'TR', 'toracs'.foneticalize
|
47
|
+
assert_equal 'TR', 'torax'.foneticalize
|
48
|
+
end
|
49
|
+
|
50
|
+
test 'compactar and compatar should fonetica to KMPT' do
|
51
|
+
assert_equal 'KMPT', 'compactar'.foneticalize
|
52
|
+
assert_equal 'KMPT', 'compatar'.foneticalize
|
53
|
+
end
|
54
|
+
|
55
|
+
test 'batista and baptista should fonetica to BT' do
|
56
|
+
assert_equal 'BT', 'batista'.foneticalize
|
57
|
+
assert_equal 'BT', 'baptista'.foneticalize
|
58
|
+
end
|
59
|
+
|
60
|
+
test 'gana should fonetica to KMPT' do
|
61
|
+
assert_equal 'GM', 'gana'.foneticalize
|
62
|
+
end
|
63
|
+
|
64
|
+
test 'gostar should fonetica to GT' do
|
65
|
+
assert_equal 'GT', 'gostar'.foneticalize
|
66
|
+
end
|
67
|
+
|
68
|
+
test 'guabiru should fonetica to GBR' do
|
69
|
+
assert_equal 'GBR', 'guabiru'.foneticalize
|
70
|
+
end
|
71
|
+
|
72
|
+
test 'negro and nego should fonetica to MG' do
|
73
|
+
assert_equal 'MG', 'negro'.foneticalize
|
74
|
+
assert_equal 'MG', 'nego'.foneticalize
|
75
|
+
end
|
76
|
+
|
77
|
+
test 'hieróglifo and hierógrifo should fonetica to RGF' do
|
78
|
+
assert_equal 'RGF', 'hieróglifo'.foneticalize
|
79
|
+
assert_equal 'RGF', 'hierógrifo'.foneticalize
|
80
|
+
end
|
81
|
+
|
82
|
+
test 'gene should fonetica to JM' do
|
83
|
+
assert_equal 'JM', 'gene'.foneticalize
|
84
|
+
end
|
85
|
+
|
86
|
+
test 'gibi should fonetica to JB' do
|
87
|
+
assert_equal 'JB', 'gibi'.foneticalize
|
88
|
+
end
|
89
|
+
|
90
|
+
test 'fleugma should fonetica to FRM' do
|
91
|
+
assert_equal 'FRM', 'fleugma'.foneticalize
|
92
|
+
end
|
93
|
+
|
94
|
+
test 'luminar and ruminar should fonetica to RM' do
|
95
|
+
assert_equal 'RM', 'luminar'.foneticalize
|
96
|
+
assert_equal 'RM', 'ruminar'.foneticalize
|
97
|
+
end
|
98
|
+
|
99
|
+
test 'mudez and nudez should fonetica to MD' do
|
100
|
+
assert_equal 'MD', 'mudez'.foneticalize
|
101
|
+
assert_equal 'MD', 'nudez'.foneticalize
|
102
|
+
end
|
103
|
+
|
104
|
+
test 'comendo and comeno should fonetica to KM' do
|
105
|
+
assert_equal 'KM', 'comendo'.foneticalize
|
106
|
+
assert_equal 'KM', 'comeno'.foneticalize
|
107
|
+
end
|
108
|
+
|
109
|
+
test 'bunginganga and bugiganga should fonetica to BJG' do
|
110
|
+
assert_equal 'BJG', 'bunginganga'.foneticalize
|
111
|
+
assert_equal 'BJG', 'bugiganga'.foneticalize
|
112
|
+
end
|
113
|
+
|
114
|
+
test 'philipe and felipe should fonetica to FRP' do
|
115
|
+
assert_equal 'FRP', 'philipe'.foneticalize
|
116
|
+
assert_equal 'FRP', 'felipe'.foneticalize
|
117
|
+
end
|
118
|
+
|
119
|
+
test 'queijo and keijo should fonetica to KJ' do
|
120
|
+
assert_equal 'KJ', 'queijo'.foneticalize
|
121
|
+
assert_equal 'KJ', 'keijo'.foneticalize
|
122
|
+
end
|
123
|
+
|
124
|
+
test 'lagarto and largato should fonetica to RGT' do
|
125
|
+
assert_equal 'RGT', 'lagarto'.foneticalize
|
126
|
+
assert_equal 'RGT', 'largato'.foneticalize
|
127
|
+
end
|
128
|
+
|
129
|
+
test 'perspectiva and pespectiva should fonetica to PSPTV' do
|
130
|
+
assert_equal 'PSPTV', 'perspectiva'.foneticalize
|
131
|
+
assert_equal 'PSPTV', 'pespectiva'.foneticalize
|
132
|
+
end
|
133
|
+
|
134
|
+
test 'lagartixa and largatixa should fonetica to RGTS' do
|
135
|
+
assert_equal 'RGTS', 'lagartixa'.foneticalize
|
136
|
+
assert_equal 'RGTS', 'largatixa'.foneticalize
|
137
|
+
end
|
138
|
+
|
139
|
+
test 'mesmo and mermo should fonetica to MSM' do
|
140
|
+
assert_equal 'MSM', 'mesmo'.foneticalize
|
141
|
+
assert_equal 'MSM', 'mermo'.foneticalize
|
142
|
+
end
|
143
|
+
|
144
|
+
test 'virgem and vige should fonetica to VJ' do
|
145
|
+
assert_equal 'VJ', 'virgem'.foneticalize
|
146
|
+
assert_equal 'VJ', 'vige'.foneticalize
|
147
|
+
end
|
148
|
+
|
149
|
+
test 'superstição and supertição should fonetica to SPTS' do
|
150
|
+
assert_equal 'SPTS', 'superstição'.foneticalize
|
151
|
+
assert_equal 'SPTS', 'supertição'.foneticalize
|
152
|
+
end
|
153
|
+
|
154
|
+
test 'estupro and estrupo should fonetica to TP' do
|
155
|
+
assert_equal 'TP', 'estupro'.foneticalize
|
156
|
+
assert_equal 'TP', 'estrupo'.foneticalize
|
157
|
+
end
|
158
|
+
|
159
|
+
test 'contrato and contlato should fonetica to KMT' do
|
160
|
+
assert_equal 'KMT', 'contrato'.foneticalize
|
161
|
+
assert_equal 'KMT', 'contlato'.foneticalize
|
162
|
+
end
|
163
|
+
|
164
|
+
test 'kubitscheck and kubixeque should fonetica to KBSK' do
|
165
|
+
assert_equal 'KBSK', 'kubitscheck'.foneticalize
|
166
|
+
assert_equal 'KBSK', 'kubixeque'.foneticalize
|
167
|
+
end
|
168
|
+
|
169
|
+
test 'walter and valter should fonetica to VT' do
|
170
|
+
assert_equal 'VT', 'walter'.foneticalize
|
171
|
+
assert_equal 'VT', 'valter'.foneticalize
|
172
|
+
end
|
173
|
+
|
174
|
+
test 'exceder and esceder should fonetica to SD' do
|
175
|
+
assert_equal 'SD', 'exceder'.foneticalize
|
176
|
+
assert_equal 'SD', 'esceder'.foneticalize
|
177
|
+
end
|
178
|
+
|
179
|
+
test 'yara and iara should fonetica to R' do
|
180
|
+
assert_equal 'R', 'yara'.foneticalize
|
181
|
+
assert_equal 'R', 'iara'.foneticalize
|
182
|
+
end
|
183
|
+
|
184
|
+
test 'casa and caza should fonetica to KS' do
|
185
|
+
assert_equal 'KS', 'casa'.foneticalize
|
186
|
+
assert_equal 'KS', 'caza'.foneticalize
|
187
|
+
end
|
188
|
+
end
|
metadata
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fonetica
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gabriel Sobrinho
|
14
|
-
- Wenderson Malheiros
|
15
14
|
autorequire:
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date:
|
18
|
+
date: 2011-02-12 00:00:00 -02:00
|
20
19
|
default_executable:
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
@@ -51,26 +50,9 @@ dependencies:
|
|
51
50
|
version: 0.4.1
|
52
51
|
type: :runtime
|
53
52
|
version_requirements: *id002
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
name: rspec
|
56
|
-
prerelease: false
|
57
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
hash: 15
|
63
|
-
segments:
|
64
|
-
- 2
|
65
|
-
- 0
|
66
|
-
- 0
|
67
|
-
version: 2.0.0
|
68
|
-
type: :development
|
69
|
-
version_requirements: *id003
|
70
53
|
description:
|
71
54
|
email:
|
72
55
|
- gabriel.sobrinho@gmail.com
|
73
|
-
- wmalheiros@gmail.com
|
74
56
|
executables: []
|
75
57
|
|
76
58
|
extensions: []
|
@@ -79,18 +61,17 @@ extra_rdoc_files: []
|
|
79
61
|
|
80
62
|
files:
|
81
63
|
- .gitignore
|
82
|
-
-
|
64
|
+
- CHANGELOG
|
83
65
|
- Gemfile
|
84
|
-
- Gemfile.lock
|
85
66
|
- MIT-LICENSE
|
67
|
+
- README.textile
|
86
68
|
- Rakefile
|
87
|
-
- autotest/discover.rb
|
88
69
|
- fonetica.gemspec
|
89
70
|
- lib/fonetica.rb
|
90
71
|
- lib/fonetica/core_ext/string.rb
|
91
72
|
- lib/fonetica/version.rb
|
92
|
-
-
|
93
|
-
-
|
73
|
+
- test/string_test.rb
|
74
|
+
- test/test_helper.rb
|
94
75
|
has_rdoc: true
|
95
76
|
homepage: http://github.com/sobrinho/fonetica
|
96
77
|
licenses: []
|
@@ -121,10 +102,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
102
|
requirements: []
|
122
103
|
|
123
104
|
rubyforge_project:
|
124
|
-
rubygems_version: 1.
|
105
|
+
rubygems_version: 1.5.2
|
125
106
|
signing_key:
|
126
107
|
specification_version: 3
|
127
108
|
summary: BuscaBR algorithm which allow the comparison of words based on their phonetic likeness
|
128
109
|
test_files:
|
129
|
-
-
|
130
|
-
-
|
110
|
+
- test/string_test.rb
|
111
|
+
- test/test_helper.rb
|
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--colour
|
data/Gemfile.lock
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
fonetica (0.3.0)
|
5
|
-
activesupport (>= 3.0.0)
|
6
|
-
i18n (>= 0.4.1)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
activesupport (3.0.1)
|
12
|
-
diff-lcs (1.1.2)
|
13
|
-
i18n (0.4.2)
|
14
|
-
rspec (2.0.0)
|
15
|
-
rspec-core (= 2.0.0)
|
16
|
-
rspec-expectations (= 2.0.0)
|
17
|
-
rspec-mocks (= 2.0.0)
|
18
|
-
rspec-core (2.0.0)
|
19
|
-
rspec-expectations (2.0.0)
|
20
|
-
diff-lcs (>= 1.1.2)
|
21
|
-
rspec-mocks (2.0.0)
|
22
|
-
rspec-core (= 2.0.0)
|
23
|
-
rspec-expectations (= 2.0.0)
|
24
|
-
|
25
|
-
PLATFORMS
|
26
|
-
ruby
|
27
|
-
|
28
|
-
DEPENDENCIES
|
29
|
-
activesupport (>= 3.0.0)
|
30
|
-
fonetica!
|
31
|
-
i18n (>= 0.4.1)
|
32
|
-
rspec (>= 2.0.0)
|
data/autotest/discover.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Autotest.add_discovery { "rspec2" }
|
data/spec/fonetica_spec.rb
DELETED
@@ -1,244 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Fonetica' do
|
4
|
-
context 'BR = BL = B' do
|
5
|
-
it '"broco" and "bloco" should fonetica to "BK"' do
|
6
|
-
'broco'.foneticalize.should == 'BK'
|
7
|
-
'bloco'.foneticalize.should == 'BK'
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
context 'CA = CO = CU = CK = K' do
|
12
|
-
it '"casa" and "kasa" should fonetica to "KS"' do
|
13
|
-
'casa'.foneticalize.should == 'KS'
|
14
|
-
'kasa'.foneticalize.should == 'KS'
|
15
|
-
end
|
16
|
-
|
17
|
-
it '"coroar" and "koroar" should fonetica to "KR"' do
|
18
|
-
'coroar'.foneticalize.should == 'KR'
|
19
|
-
'koroar'.foneticalize.should == 'KR'
|
20
|
-
end
|
21
|
-
|
22
|
-
it '"cuba" and "kuba" should fonetica to "KB"' do
|
23
|
-
'cuba'.foneticalize.should == 'KB'
|
24
|
-
'kuba'.foneticalize.should == 'KB'
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
context 'CE = CI = Ç = S' do
|
29
|
-
it '"cela" and "sela" should fonetica to "SR"' do
|
30
|
-
'cela'.foneticalize.should == 'SR'
|
31
|
-
'sela'.foneticalize.should == 'SR'
|
32
|
-
end
|
33
|
-
|
34
|
-
it '"circo" and "sirco" should fonetica to "SRK"' do
|
35
|
-
'circo'.foneticalize.should == 'SRK'
|
36
|
-
'sirco'.foneticalize.should == 'SRK'
|
37
|
-
end
|
38
|
-
|
39
|
-
it '"roça" and "rosa" should fonetica to "RS"' do
|
40
|
-
'roça'.foneticalize.should == 'RS'
|
41
|
-
'rosa'.foneticalize.should == 'RS'
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context 'CH = X = S' do
|
46
|
-
it '"ameixa" and "ameicha" should fonetica to "MS"' do
|
47
|
-
'ameixa'.foneticalize.should == 'MS'
|
48
|
-
'ameicha'.foneticalize.should == 'MS'
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
context 'CS = S' do
|
53
|
-
it '"toracs" and "torax" should fonetica to "TR"' do
|
54
|
-
'toracs'.foneticalize.should == 'TR'
|
55
|
-
'torax'.foneticalize.should == 'TR'
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
context 'CT = T' do
|
60
|
-
it '"compactar" and "compatar" should fonetica to "KMPT"' do
|
61
|
-
'compactar'.foneticalize.should == 'KMPT'
|
62
|
-
'compatar'.foneticalize.should == 'KMPT'
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
context 'BT = T' do
|
67
|
-
it '"batista" and "baptista" should fonetica to "BT"' do
|
68
|
-
'batista'.foneticalize.should == 'BT'
|
69
|
-
'baptista'.foneticalize.should == 'BT'
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context 'GA = GO = GU = GL = GR = G' do
|
74
|
-
it '"gana" should fonetica to "KMPT"' do
|
75
|
-
'gana'.foneticalize.should == 'GM'
|
76
|
-
end
|
77
|
-
|
78
|
-
it '"gostar" should fonetica to "GT"' do
|
79
|
-
'gostar'.foneticalize.should == 'GT'
|
80
|
-
end
|
81
|
-
|
82
|
-
it '"guabiru" should fonetica to "GBR"' do
|
83
|
-
'guabiru'.foneticalize.should == 'GBR'
|
84
|
-
end
|
85
|
-
|
86
|
-
it '"negro" and "nego" should fonetica to "MG"' do
|
87
|
-
'negro'.foneticalize.should == 'MG'
|
88
|
-
'nego'.foneticalize.should == 'MG'
|
89
|
-
end
|
90
|
-
|
91
|
-
it '"hieróglifo" and "hierógrifo" should fonetica to "RGF"' do
|
92
|
-
'hieróglifo'.foneticalize.should == 'RGF'
|
93
|
-
'hierógrifo'.foneticalize.should == 'RGF'
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
context 'GE = GI = J' do
|
98
|
-
it '"gene" should fonetica to "JM"' do
|
99
|
-
'gene'.foneticalize.should == 'JM'
|
100
|
-
end
|
101
|
-
|
102
|
-
it '"gibi" should fonetica to "JB"' do
|
103
|
-
'gibi'.foneticalize.should == 'JB'
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
context 'GM = M' do
|
108
|
-
it '"fleugma" should fonetica to "FRM"' do
|
109
|
-
'fleugma'.foneticalize.should == 'FRM'
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
context 'L = R' do
|
114
|
-
it '"luminar" and "ruminar" should fonetica to "RM"' do
|
115
|
-
'luminar'.foneticalize.should == 'RM'
|
116
|
-
'ruminar'.foneticalize.should == 'RM'
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
context 'N = M' do
|
121
|
-
it '"mudez" and "nudez" should fonetica to "MD"' do
|
122
|
-
'mudez'.foneticalize.should == 'MD'
|
123
|
-
'nudez'.foneticalize.should == 'MD'
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
context 'MD = D' do
|
128
|
-
it '"comendo" and "comeno" should fonetica to "KM"' do
|
129
|
-
'comendo'.foneticalize.should == 'KM'
|
130
|
-
'comeno'.foneticalize.should == 'KM'
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
context 'MG = G and MJ = J' do
|
135
|
-
it '"bunginganga" and "bugiganga" should fonetica to "BJG"' do
|
136
|
-
'bunginganga'.foneticalize.should == 'BJG'
|
137
|
-
'bugiganga'.foneticalize.should == 'BJG'
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
context 'PH = F' do
|
142
|
-
it '"philipe" and "felipe" should fonetica to "FRP"' do
|
143
|
-
'philipe'.foneticalize.should == 'FRP'
|
144
|
-
'felipe'.foneticalize.should == 'FRP'
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
context 'PR = P' do
|
149
|
-
it '"estupro" and "estrupo" should fonetica to "TP"' do
|
150
|
-
'estupro'.foneticalize.should == 'TP'
|
151
|
-
'estrupo'.foneticalize.should == 'TP'
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
context 'Q = K' do
|
156
|
-
it '"queijo" and "keijo" should fonetica to "KJ"' do
|
157
|
-
'queijo'.foneticalize.should == 'KJ'
|
158
|
-
'keijo'.foneticalize.should == 'KJ'
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
context 'RG = G, RS = S, and RT = T' do
|
163
|
-
it '"lagarto" and "largato" should fonetica to "RGT"' do
|
164
|
-
'lagarto'.foneticalize.should == 'RGT'
|
165
|
-
'largato'.foneticalize.should == 'RGT'
|
166
|
-
end
|
167
|
-
|
168
|
-
it '"perspectiva" and "pespectiva" should fonetica to "PSPTV"' do
|
169
|
-
'perspectiva'.foneticalize.should == 'PSPTV'
|
170
|
-
'pespectiva'.foneticalize.should == 'PSPTV'
|
171
|
-
end
|
172
|
-
|
173
|
-
it '"lagartixa" and "largatixa" should fonetica to "RGTS"' do
|
174
|
-
'lagartixa'.foneticalize.should == 'RGTS'
|
175
|
-
'largatixa'.foneticalize.should == 'RGTS'
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
context 'RM = SM' do
|
180
|
-
it '"mesmo" and "mermo" should fonetica to "MSM"' do
|
181
|
-
'mesmo'.foneticalize.should == 'MSM'
|
182
|
-
'mermo'.foneticalize.should == 'MSM'
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
context 'RJ = J' do
|
187
|
-
it '"virgem" and "vige" should fonetica to "VJ"' do
|
188
|
-
'virgem'.foneticalize.should == 'VJ'
|
189
|
-
'vige'.foneticalize.should == 'VJ'
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
context 'ST = T' do
|
194
|
-
it '"superstição" and "supertição" should fonetica to "SPTS"' do
|
195
|
-
'superstição'.foneticalize.should == 'SPTS'
|
196
|
-
'supertição'.foneticalize.should == 'SPTS'
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
context 'TR = T, TL = T, and TS = T' do
|
201
|
-
it '"estupro" and "estrupo" should fonetica to "TP"' do
|
202
|
-
'estupro'.foneticalize.should == 'TP'
|
203
|
-
'estrupo'.foneticalize.should == 'TP'
|
204
|
-
end
|
205
|
-
|
206
|
-
it '"contrato" and "contlato" should fonetica to "KMT"' do
|
207
|
-
'contrato'.foneticalize.should == 'KMT'
|
208
|
-
'contlato'.foneticalize.should == 'KMT'
|
209
|
-
end
|
210
|
-
|
211
|
-
it '"kubitscheck" and "kubixeque" should fonetica to "KBSK"' do
|
212
|
-
'kubitscheck'.foneticalize.should == 'KBSK'
|
213
|
-
'kubixeque'.foneticalize.should == 'KBSK'
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
context 'W = V' do
|
218
|
-
it '"walter" and "valter" should fonetica to "VT"' do
|
219
|
-
'walter'.foneticalize.should == 'VT'
|
220
|
-
'valter'.foneticalize.should == 'VT'
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
context 'X = S' do
|
225
|
-
it '"exceder" and "esceder" should fonetica to "SD"' do
|
226
|
-
'exceder'.foneticalize.should == 'SD'
|
227
|
-
'esceder'.foneticalize.should == 'SD'
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
|
-
context 'Y = I' do
|
232
|
-
it '"yara" and "iara" should fonetica to "R"' do
|
233
|
-
'yara'.foneticalize.should == 'R'
|
234
|
-
'iara'.foneticalize.should == 'R'
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
context 'Z = S' do
|
239
|
-
it '"casa" and "caza" should fonetica to "KS"' do
|
240
|
-
'casa'.foneticalize.should == 'KS'
|
241
|
-
'caza'.foneticalize.should == 'KS'
|
242
|
-
end
|
243
|
-
end
|
244
|
-
end
|