fonemas 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2I5YWE1ZDk0ZjNiODY1Yzg1ZTY3MjE2ODUwZTQ2MjExMzU1NjNkOA==
4
+ OTZlZGNhZmEzYzllN2MxYmYwMGQ4ODIzNjRjNTcwMmQzODI2ZGEyMQ==
5
5
  data.tar.gz: !binary |-
6
- MmMyNTY2ZmVlYjM5ZjFhYjBkZjVmZmUyNjE3NGUyODJlYTVmNWY1Nw==
6
+ MDNmMjNhNjAwNTczNTdmNWRlNzExMmFhNGI1YjlkNDc0Y2ZmZjExOA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZjYwNTcyNmQzMjlhYjAyZDM4MThmZWMwZWM4YzY3MWYyYTk5ZDEzNzUzYzg5
10
- NGNiMDU3YjI4OGU1MjFmMzAyYmMwNDA4NGUyNjQ1ZjRhNGM0Y2M5OWU2NDQw
11
- MzlkMjExNThiMjA5ZmRkZjliOTg1MTYwMmY1ODcwZjliMmFjNzA=
9
+ MjkyNDVhZDNlYWE2YmQ4MWRmM2MwOTU3ZTlmOGI2NjllMDE2N2I3MGUwNGIz
10
+ MzIxZDcwNTFhODBiOTJmMDg0MGVjYzliOWI0MjRhMTU0MWU4Njg5ZmZmYWEx
11
+ YjNlMWJiMDI4MTc2M2IwNGVhZTY0MmZjMWVjODE3NTQ2NTFiMzU=
12
12
  data.tar.gz: !binary |-
13
- MzAzN2Y0NzBkZmZiNWMwYzdkZmRlZmRhZDZmOTE0MjA0YjU3YmEzNTE3OGM4
14
- NzBlY2RlZjY5ZWVhMmFmNWFjOGQwZTE0NWFiNWQ2NjBlYTAzMTQzNjkyNjZl
15
- YTUzMjFmMWI1NjRhYTk1YzMwMGQ1NTFmZmVhNDRkZDVkZmM5NzQ=
13
+ M2ZjMTNmMjAxOTc3ZDVlMDhkMWU5MGIwNzAyMWQ1ZGUxMzFmOTU0ZTVkNmJh
14
+ NzhiZTU1MzNmOTMxODllZWZhNDk2YTRkNTk5YmIxYzFkYjZjYTNlMjA0ZWEw
15
+ YjAzNGM2ZDNmNmJjNWY2ZDcyY2NjZTQxMjFiMWNiZmQ1YTZkNGE=
data/lib/fonemas.rb CHANGED
@@ -157,7 +157,43 @@ module Fonemas
157
157
  return output
158
158
  end
159
159
 
160
+ def self.fonemaLetra(letra)
161
+ case letra
162
+ when 'a' then ['aa']
163
+ when 'b' then ['b ee']
164
+ when 'c' then ['s ee']
165
+ when 'd' then ['d ee']
166
+ when 'e' then ['ee']
167
+ when 'f' then ['ee f ee']
168
+ when 'g' then ['g ee']
169
+ when 'h' then ['aa ch e']
170
+ when 'i' then ['ii']
171
+ when 'j' then ['j oo t a']
172
+ when 'k' then ['k aa']
173
+ when 'l' then ['ee l e']
174
+ when 'm' then ['ee m e']
175
+ when 'n' then ['ee n e']
176
+ when 'ñ' then ['ee nh e']
177
+ when 'o' then ['oo']
178
+ when 'p' then ['p ee']
179
+ when 'q' then ['c uu']
180
+ when 'r' then ['ee rr ee','ee r ee']
181
+ when 's' then ['ee s e']
182
+ when 't' then ['t ee']
183
+ when 'u' then ['uu']
184
+ when 'v' then ['b ee','uu b e']
185
+ when 'w' then ['d o b l e b ee','d o b l e uu v e']
186
+ when 'x' then ['ee k i s']
187
+ when 'y' then ['ll ee']
188
+ when 'z' then ['z ee t a']
189
+ end
190
+ end
191
+
192
+
160
193
  def self.fonemas(word)
194
+ if word.size == 1
195
+ return fonemaLetra(word)
196
+ end
161
197
  if word.include?('_')
162
198
  output = []
163
199
  for a in word.split('_')
@@ -190,8 +226,7 @@ module Fonemas
190
226
  end
191
227
  when 'b','v' then
192
228
  if word.size() == 1
193
- fonema << 'bb'
194
- fonema << 'ee'
229
+ return Fonemas.fonemas('be')
195
230
  elsif isVocal(word,i-1) and (word[i+1] == 'b' or word[i+1] == 'v')
196
231
  fonema << ['bb','']
197
232
  elsif i == 0 and isVocal(word,i+1)
@@ -265,7 +300,9 @@ module Fonemas
265
300
  end
266
301
  end
267
302
  when 'h' then
268
- if word[i+1] == 'u' and isDiptongo(word,i+1,i+2)
303
+ if word.size == 1
304
+ return Fonemas.fonemas('hache')
305
+ elsif word[i+1] == 'u' and isDiptongo(word,i+1,i+2)
269
306
  fonema << ['','g']
270
307
  end
271
308
  #nada
@@ -1,3 +1,3 @@
1
1
  module Fonemas
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -25,7 +25,6 @@ describe Fonemas do
25
25
  Fonemas.fonemas('obvio').should include('oo b i o')
26
26
  Fonemas.fonemas('guerra').should_not include('ee rr a')
27
27
  Fonemas.fonemas('d').should_not include('')
28
- Fonemas.fonemas('d').should include('d e')
29
28
 
30
29
 
31
30
 
@@ -58,10 +57,44 @@ describe Fonemas do
58
57
 
59
58
  it 'palabras deletreadas' do
60
59
  Fonemas.fonemas('_a_b_c').should be_a_kind_of(Array)
61
- Fonemas.fonemas('_a_b_c').should include('aa bb ee s ee')
60
+ Fonemas.fonemas('_a_b_c').should include('aa b ee s ee')
62
61
  Fonemas.fonemas('_a').should include('aa')
63
62
  end
64
63
 
64
+ it 'letras' do
65
+ Fonemas.fonemas('h').should include('aa ch e')
66
+ Fonemas.fonemas('a').should include('aa')
67
+ Fonemas.fonemas('b').should include('b ee')
68
+ Fonemas.fonemas('c').should include('s ee')
69
+ Fonemas.fonemas('d').should include('d ee')
70
+ Fonemas.fonemas('e').should include('ee')
71
+ Fonemas.fonemas('f').should include('ee f ee')
72
+ Fonemas.fonemas('g').should include('g ee')
73
+ Fonemas.fonemas('h').should include('aa ch e')
74
+ Fonemas.fonemas('i').should include('ii')
75
+ Fonemas.fonemas('j').should include('j oo t a')
76
+ Fonemas.fonemas('k').should include('k aa')
77
+ Fonemas.fonemas('l').should include('ee l e')
78
+ Fonemas.fonemas('m').should include('ee m e')
79
+ Fonemas.fonemas('n').should include('ee n e')
80
+ Fonemas.fonemas('ñ').should include('ee nh e')
81
+ Fonemas.fonemas('o').should include('oo')
82
+ Fonemas.fonemas('p').should include('p ee')
83
+ Fonemas.fonemas('q').should include('c uu')
84
+ Fonemas.fonemas('r').should include('ee rr ee')
85
+ Fonemas.fonemas('r').should include('ee r ee')
86
+ Fonemas.fonemas('s').should include('ee s e')
87
+ Fonemas.fonemas('t').should include('t ee')
88
+ Fonemas.fonemas('u').should include('uu')
89
+ Fonemas.fonemas('v').should include('b ee')
90
+ Fonemas.fonemas('v').should include('uu b e')
91
+ Fonemas.fonemas('w').should include('d o b l e b ee')
92
+ Fonemas.fonemas('w').should include('d o b l e uu v e')
93
+ Fonemas.fonemas('x').should include('ee k i s')
94
+ Fonemas.fonemas('y').should include('ll ee')
95
+ Fonemas.fonemas('z').should include('z ee t a')
96
+ end
97
+
65
98
  it 'test diptongos' do
66
99
  Fonemas.isDiptongo("buitre",1,2).should be(true)
67
100
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fonemas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Bahamondez Honores