fonemas 0.0.14 → 0.0.15

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
- ODkyMjhhMTk2OGVkODQxZGNhN2M2ZWIxZDM3ODMwNzRmNThlOTM1Yw==
4
+ YzM5MmU1ZjZmYzA0NmVlZWQyYWE3OWI1MWRiY2FkN2Q1ZGI2NzVkZQ==
5
5
  data.tar.gz: !binary |-
6
- ZjUzMDk1MGJkYTJiMGJlOTk1ZmU0Y2ZkYWU5NDIwZDM3YjFkMGFhYg==
6
+ MGNiMDZmYmE1YmVkMDY5YzYyNmY4ZDM5YTk1MzVlMWNkNTViN2Q5NQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YzMwMTI4MTE1MzYxMmUwM2UyYTkzNWNkNjc4ZjQ5NjcyNzVlYjBiMzQ3MDEz
10
- NGVhOGY3YTY5NGU3OTFhY2Q5OGNjYTBkZDNhODM0ZTkyZTE4NDI4MzVmMjY2
11
- YTEyZDEzOTAzNGVkY2I5ZjExNTVjYzk1Y2ViNmMwNDgxY2FhNjU=
9
+ YzljNjZiYzg5ZWE0ZDA2NzYzMWJkNDNjYjM5NmVjZjhhZjVhYzFhMWQ2MzFm
10
+ Y2MyNGJiZDE5M2EyNzZlNWVkZGM5MzM2NTc2ODkxZTZkMzBlYmJiZmQxNmM0
11
+ OGIwNTZmOWQ3ZjQyNTg1NmUyNzkwZDljYmQwYzI2NTc1MDJkZmQ=
12
12
  data.tar.gz: !binary |-
13
- NjZiZGVjZjBjMzIwYWU1MGUwZmRlNjY5OWJmZjBiMTk4NDgzYjg4MWYxMzUw
14
- ZTgzOGY0Zjg5YmQzMGNjNmMyYTU3ZTIyNmM3MWVkZjQ1ODgzYmVjMDVlZjVl
15
- NzIwMjBkMjY1ZmQ5MDZmMDRjMzM4NWNiYjk4OGFjNDM5ZjNkMTU=
13
+ YjY1Mjg4OTdjMDIxMmM1NjgxMGZlOGYwNDY1OGFkZWJhYzA0ZDUwMWVlZWYz
14
+ MGFhNGRiMGM4ODEyNTE4MWFlOGNjMWU2YWZkZDI3NjIxNGYyZWJjNWNmMTZi
15
+ NWI1ZGNhMGRhNzQ3NmExN2NhZWRkNmM4Y2QzMDFiYmI0NDBlZmU=
data/lib/fonemas.rb CHANGED
@@ -330,43 +330,51 @@ module Fonemas
330
330
 
331
331
 
332
332
  end
333
-
334
- return generateFonemas(fonema)
333
+ #puts "pre: #{fonema}"
334
+ t = normalize(generateFonemas(fonema))
335
+ #puts "out: #{t}"
336
+ return t
335
337
  end
336
338
 
337
- def self.generateFonemas(fonema)
338
- salidas = 1
339
- for i in fonema
340
- if i.class.name == 'Array'
341
- salidas *= i.size
339
+ def self.generateFonemas(fonema,i=0,current=[])
340
+ if i == fonema.length
341
+ return current.join(' ')
342
342
  end
343
- end
344
- #puts "salidas: #{salidas}"
345
343
 
346
- outputs = []
347
- for j in 1..salidas
348
- outputs[j-1] = []
349
- end
350
- for i in 0..(fonema.size-1)
351
344
  c = fonema[i]
352
345
  if c.class.name == 'Array'
353
- for j in 1..salidas
354
- t = c[(j-1)%c.size]
355
- outputs[j-1] += [t] unless t.size == 0
346
+ output = []
347
+ for j in c
348
+ output << generateFonemas(fonema,i+1,current + [j])
356
349
  end
350
+ return output
357
351
  else
358
- for j in 1..salidas
359
- outputs[j-1] += [c]
360
- end
352
+ return generateFonemas(fonema,i+1,current + [c])
361
353
  end
362
354
 
363
- end
355
+ end
364
356
 
365
- salida = []
366
- for i in outputs
367
- salida << i.join(" ")
357
+
358
+ def self.normalize(t)
359
+ @output = []
360
+ anormalize(t)
361
+ return @output
362
+ end
363
+
364
+ def self.anormalize(t)
365
+ #puts "pre normalize: #{t}"
366
+ if t.class.name == 'Array'
367
+ for i in t
368
+ anormalize(i)
369
+ end
370
+ else
371
+ #puts "found #{t}"
372
+ @output << t
368
373
  end
369
374
 
370
- return salida
371
375
  end
376
+
377
+
378
+
379
+
372
380
  end
@@ -1,3 +1,3 @@
1
1
  module Fonemas
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
@@ -16,4 +16,15 @@ describe Fonemas do
16
16
  end
17
17
  end
18
18
 
19
+ it 'combinar fonemas' do
20
+ test = ['a',['b','c'],['d','e']]
21
+ output = Fonemas.normalize(Fonemas.generateFonemas(test))
22
+ output.should include('a b d')
23
+ output.should include('a b e')
24
+ output.should include('a c d')
25
+ output.should include('a c e')
26
+
27
+
28
+ end
29
+
19
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fonemas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Bahamondez Honores
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-10 00:00:00.000000000 Z
11
+ date: 2013-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler