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 +8 -8
- data/lib/fonemas.rb +33 -25
- data/lib/fonemas/version.rb +1 -1
- data/spec/fonemas/fonema_spec.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzM5MmU1ZjZmYzA0NmVlZWQyYWE3OWI1MWRiY2FkN2Q1ZGI2NzVkZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGNiMDZmYmE1YmVkMDY5YzYyNmY4ZDM5YTk1MzVlMWNkNTViN2Q5NQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzljNjZiYzg5ZWE0ZDA2NzYzMWJkNDNjYjM5NmVjZjhhZjVhYzFhMWQ2MzFm
|
10
|
+
Y2MyNGJiZDE5M2EyNzZlNWVkZGM5MzM2NTc2ODkxZTZkMzBlYmJiZmQxNmM0
|
11
|
+
OGIwNTZmOWQ3ZjQyNTg1NmUyNzkwZDljYmQwYzI2NTc1MDJkZmQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
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
|
-
|
339
|
-
|
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
|
-
|
354
|
-
|
355
|
-
|
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
|
-
|
359
|
-
outputs[j-1] += [c]
|
360
|
-
end
|
352
|
+
return generateFonemas(fonema,i+1,current + [c])
|
361
353
|
end
|
362
354
|
|
363
|
-
|
355
|
+
end
|
364
356
|
|
365
|
-
|
366
|
-
|
367
|
-
|
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
|
data/lib/fonemas/version.rb
CHANGED
data/spec/fonemas/fonema_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|