fonemas 0.2.1 → 0.2.2

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
- MDA2YmM2OWMyYjJlOTM4NTM5YzRiZWIxMDYzMmQyOWY1MmYzNDczYQ==
4
+ NTljZGFkNDZlZTQ5MDhmZTM2NGY1YjY4NmQ3NTY5MTU5MTVmMTZmMQ==
5
5
  data.tar.gz: !binary |-
6
- ZmRlOTcyMDViYTFiNzhiNTU1ZTI2ZDZmOTNmNjRiMzU2YmNkZmMwZA==
6
+ NGI2YWU2MmVhNDU4YWFmNGEwMjg3MjBlMGU3NTk0ZjAyNjhhMTU0OQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Mzc2NDk4NWFiNTdhMGEzYTVjNTg3ODM2ZTc2NzRmM2JlMzcyNzI4MDgzY2E2
10
- YzU4NWQ1YTM1NmEzYzAzYTk3YTcwNDkxOGJkOWVlMjFlOWU0MGNjMGQzOGE0
11
- MjE4MmZiMjE5MjRlMmYwMDFiYmFjNTc0Nzk2YjgyY2VjOWFkNGQ=
9
+ ZjgxMmI4ZDgzNTExMGM0NWQ2MTdhMTZkYzNjOWQ0YTg2Y2I4MTQ0OGZiMzgw
10
+ ZTNjNzM3YmYxNDk1YTFlNTU1NTFjYTk3NjI2YjA4ZTEyN2U4NzQzNjkzZjc3
11
+ OGM4MjcwNDE0ZmJlYmIxYzQ1YjZhZDEyNjQ0OTFiNDdmZWNhMDk=
12
12
  data.tar.gz: !binary |-
13
- YzNlMmZhMDFkZDgwZGIzYTA5YTkyOWQ3OGQ5OTc2YmNiNWEzYzg3NzkxNzM3
14
- MzA0ZDM1NzA3NjU4ODZhNzc3ZmM0Mjc3NDFmMzA2ZWQ3OTAwYWY3YTQ3MmRi
15
- NWY1Yzk3MTI0YzAyN2ZlNjU0MGE3MWU0MzM2ZGZlZWVlMjAwZTY=
13
+ NTE5NDBiYWRmODFhNmIwMTIzMDU4OTgxZWJjZDdmOTQ4MzJjNDQ4MzI3Yzgy
14
+ NDE2MTQwMjlkYmY3MTI3MzI1M2JlNzRmNjYxYjhmMTAwZjE5YzZjNTQ2ZWI5
15
+ MWFhNzM4MmYwMzUyNGIxYjE0OGFlYzE3NjJiZWVhY2U1Yzk2ODg=
@@ -35,6 +35,7 @@ module Fonemas
35
35
 
36
36
  def self.isTonica(word,i)
37
37
  #falta considerar las palabras que poseen acento pero no tilde
38
+ return true if word.size == 1
38
39
  tildes = %w(á é í ó ú)
39
40
  w = word.join
40
41
  if tildes.include? word[i]
@@ -157,6 +158,15 @@ module Fonemas
157
158
  end
158
159
 
159
160
  def self.fonemas(word)
161
+ if word.include?('_')
162
+ output = []
163
+ for a in word.split('_')
164
+ if a.size > 0
165
+ output << Fonemas.fonemas(a)
166
+ end
167
+ end
168
+ return output.join(' ')
169
+ end
160
170
  word = separar(word)
161
171
  fonema = []
162
172
  for i in 0..(word.length-1)
@@ -179,7 +189,10 @@ module Fonemas
179
189
  fonema << 'a'
180
190
  end
181
191
  when 'b','v' then
182
- if isVocal(word,i-1) and (word[i+1] == 'b' or word[i+1] == 'v')
192
+ if word.size() == 1
193
+ fonema << 'bb'
194
+ fonema << 'ee'
195
+ elsif isVocal(word,i-1) and (word[i+1] == 'b' or word[i+1] == 'v')
183
196
  fonema << ['bb','']
184
197
  elsif i == 0 and isVocal(word,i+1)
185
198
  if word[i+1] == 'u' and isDiptongo(word,i+1,i+2)
@@ -203,7 +216,10 @@ module Fonemas
203
216
  fonema << 'bb'
204
217
  end
205
218
  when 'c' then
206
- if word[i+1] == 'e' or word[i+1] == 'i'
219
+ if word.size() == 1
220
+ fonema << 's'
221
+ fonema << 'ee'
222
+ elsif word[i+1] == 'e' or word[i+1] == 'i'
207
223
  fonema << 's'
208
224
  else
209
225
  fonema << 'k'
@@ -1,3 +1,3 @@
1
1
  module Fonemas
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -56,6 +56,10 @@ describe Fonemas do
56
56
  Fonemas.fonemas('África').should include('aa f r i k a')
57
57
  end
58
58
 
59
+ it 'palabras deletreadas' do
60
+ Fonemas.fonemas('_a_b_c').should include('aa bb ee s ee')
61
+ end
62
+
59
63
  it 'test diptongos' do
60
64
  Fonemas.isDiptongo("buitre",1,2).should be(true)
61
65
  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.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Bahamondez Honores