fonemas 0.3.2 → 0.3.3

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
- MGNhZjA4ZWJkZDFjY2ViYTEzYjljOGFlODI5ZmNlNDMxNzAxNDM2OQ==
4
+ NWY2MDgwYzMxMDBiNzRiNWVhOTk0YWEwNTYyMmViY2ZkNDRlZDdkOQ==
5
5
  data.tar.gz: !binary |-
6
- YWFjMmNhZjA1NTA0MDA2YTljOTIyNDU3MmFiNTI1NTAxNjUyYjM2Zg==
6
+ Mzk5NjRjYWVkZjQzMmVjZmE3YWY5OGM2MmJhODdkNjM4OWExZjg2Zg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MmEyZWVhNTRiNzQ2YTA0NDE4OGY1ZGU4MWNkZWQ2MmUxMzM0ZmI5N2I2Yzg2
10
- NTdkNjAzMDg3ZTE3MmExYWI5NDg4YzAyMWY4Y2NiZmUwNzdmZThmYjM1YTRi
11
- NmVhMTZkNDc0ZWRiNWZjYWJlZDFhMjJkNGQwNjZmNGRjMWE3NmU=
9
+ YjUzNzU1ZGQyMTc2NGNhNmM2N2U5OWU0NDIwYjZmOTg3ZGVkMTIwZjJlMjg4
10
+ ZTliYzU1ZDdkZmQyNWU5NWZiOGZiNDFmODA3NjJmMDA2NzVhMjI0NDBkZTIz
11
+ ZDdkMDExNTU2ZDE0OTIwMTQ2ODNiOWJkZDM5M2Q2MDRmNTY0MmE=
12
12
  data.tar.gz: !binary |-
13
- MzU3N2JjOGYzZmYzMTZmZmViYTIyNzI3NDRlNzc4MDg4N2QxMWY2MGRmZjAw
14
- MmI5ZThmMDYzYjZkZWJlNDc3Y2RkNzQ4Y2Y5ZjUyMTMwYjEwZGQ2YTk4OGFk
15
- NWMzZDI2YzVjODJhNTY5NGFiNzhhNWE0NzkwOTk2MzhkMThkOTA=
13
+ YWMwMjI5OTQxYjlhODk3MDllNjNhYWIzNzhkY2NmMWQ0NmY4OWM0ZjM3MmI4
14
+ NWQ5NmI3N2Y3Zjc4NDVlODg3ZDEyZTEwNzgwYzczZjNiMDVhZjY5YTk1MzY1
15
+ ZWVhZjI1YTAwMGYzNWQzNDQ2MzEyNzdhMzFhYmIwMWUwYjY4Zjg=
@@ -1,3 +1,3 @@
1
1
  module Fonemas
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
data/lib/fonemas.rb CHANGED
@@ -36,7 +36,7 @@ module Fonemas
36
36
  def self.isTonica(word,i)
37
37
  #falta considerar las palabras que poseen acento pero no tilde
38
38
  return true if word.size == 1
39
- tildes = %w(á é í ó ú ã)
39
+ tildes = %w(á é í ó ú ã ä ë)
40
40
  w = word.join
41
41
  if tildes.include? word[i]
42
42
  return true
@@ -46,7 +46,7 @@ module Fonemas
46
46
  #puts es.visualize(w)
47
47
  hh = es.visualize(w).split("-")
48
48
  #puts hh.size
49
- if w =~ /[áéíóú]/
49
+ if w =~ /[áéíóúãäë]/
50
50
  #acento ya existe en otra silaba
51
51
  return false
52
52
  else
@@ -211,17 +211,7 @@ module Fonemas
211
211
  for i in 0..(word.length-1)
212
212
  letra = word[i]
213
213
  case letra
214
- when 'á','ã' then
215
- fonema << 'aa'
216
- when 'é' then
217
- fonema << 'ee'
218
- when 'í' then
219
- fonema << 'ii'
220
- when 'ó' then
221
- fonema << 'oo'
222
- when 'ú' then
223
- fonema << 'uu'
224
- when 'a' then
214
+ when 'a','á','ä','ã' then
225
215
  if isTonica(word,i)
226
216
  fonema << 'aa'
227
217
  else
@@ -273,7 +263,7 @@ module Fonemas
273
263
  else
274
264
  fonema << 'd'
275
265
  end
276
- when 'e' then
266
+ when 'e','é','ë' then
277
267
  if isTonica(word,i)
278
268
  fonema << 'ee'
279
269
  else
@@ -299,14 +289,18 @@ module Fonemas
299
289
  fonema << ['','g']
300
290
  end
301
291
  #nada
302
- when 'i' then
292
+ when 'i','í' then
303
293
  if isTonica(word,i)
304
294
  fonema << 'ii'
305
295
  else
306
296
  fonema << 'i'
307
297
  end
308
298
  when 'j' then
309
- fonema << 'j'
299
+ if word[i+1] == 'o' and word[i+2] == 'ã'
300
+ fonema << 'll'
301
+ else
302
+ fonema << 'j'
303
+ end
310
304
  when 'k' then
311
305
  fonema << 'k'
312
306
  when 'l' then
@@ -319,7 +313,7 @@ module Fonemas
319
313
  fonema << 'n'
320
314
  when 'ñ' then
321
315
  fonema << 'nh'
322
- when 'o' then
316
+ when 'o','ó' then
323
317
  if isTonica(word,i)
324
318
  fonema << 'oo'
325
319
  else
@@ -353,7 +347,7 @@ module Fonemas
353
347
  fonema << 't'
354
348
  when 'ü' then
355
349
  fonema << 'u'
356
- when 'u' then
350
+ when 'u','ú' then
357
351
  if word[i-1] == 'g' and i == 1 and isTonica(word,i+1)
358
352
  fonema << ['gu']
359
353
  elsif isTonica(word,i)
@@ -92,6 +92,7 @@ describe Fonemas do
92
92
  Fonemas.fonemas('y').should include('ll ee')
93
93
  Fonemas.fonemas('z').should include('s ee t a')
94
94
  Fonemas.fonemas('é').should include('ee')
95
+ Fonemas.fonemas('joão').should include('ll o aa o')
95
96
  end
96
97
 
97
98
  it 'test diptongos' do
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.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Bahamondez Honores