fonemas 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjcyOWI3ZDZlMTgzZWVkZWM2MDZhZTA3ZWM1ZjAwM2UzNDRhNGFmYQ==
4
+ YTdkOTBkYzM3NjE5YzkwYWYwZjc4NGM3MzAzOGIxYjlmMDRmZTBlYQ==
5
5
  data.tar.gz: !binary |-
6
- MDc3NzdlNjIyNGI5ZjBkOGNjNDA5MWZiZWNiNDMyMzFlNzc1ZTNiMA==
6
+ YjBiZTE4YzkwYjFmZGUwZDBlYWE1YzYxMzI0MGZiMDE5MDIyZTVkZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZmM5NWE1OGY1YzIyMmQ4ZDUzOTdiOTQ4ZDBjZmFjZTBhZjg5ZmUzOGYwYzY2
10
- NTY4YmY5NWRiYmQzMmI1Y2IyNDMxZDhiNGEyZDcxZTg0M2M2NjA3Mjg1MjM5
11
- NTM3NWI2NzY1YTM2MDlkOTE2MGMxOTBkMDNmYWMzMDdlZDI2ZDQ=
9
+ M2M4OTc5MzhmZTg0ODJkNzE0Nzk0OTE3YTBjOWEzZWVjODdmZmJlZmZjY2Zj
10
+ YmE2OWU1NjAwZjM2MjQxMTM2ZWUxNDNiMWU4YmE4MjVmOGIzNzkxODgyODMw
11
+ YmVlMDI4NzAzODA5ZDZhOTZhMDk4OGM4YTUxNzU1ZjIzODY0OWE=
12
12
  data.tar.gz: !binary |-
13
- MDEwNGYyYTg5NDAxMmI1MTY5OWI5MzlmMmY1YTNkOWZjZWE5OTQ2OWExYmZj
14
- MWM5MDgyY2ZkMjBhOTFjNjI4M2M0OTcwZTk2NjY2MmE0MzlmZDA3ODViMjI1
15
- NzRiYjJkMWZjNzkwNjFkZDNjNzJkZjk4ZjlmOTk3YWM2ZjJmMjM=
13
+ NTc3M2U3ZmUwYWEwMWM3ZmE0OTc1MTNhZDdhMjY2ODg2MjUzOTY5NzViYjQw
14
+ M2JjNjgwYmVkYWI3MDE3ODFlOWE5ZGFmMjc2MGY0NzVlNGE5ZDRhMWM4MDdi
15
+ MzhlMTE1NmQ1MzBmYTQzNWZkNjY0YWY4YjNmYjRkNDViZmUxNDk=
@@ -9,6 +9,11 @@ if ARGV.include?('--list')
9
9
  exit
10
10
  end
11
11
 
12
+ if ARGV.include?('--version')
13
+ puts Fonemas.version
14
+ exit
15
+ end
16
+
12
17
  ARGF.set_encoding('UTF-8')
13
18
 
14
19
  input = ARGF.readlines
@@ -22,4 +22,5 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "rspec"
24
24
  spec.add_runtime_dependency "text-hyphen", '~> 1.4.1'
25
+ spec.add_runtime_dependency "unicode_utils", '~> 1.4.0'
25
26
  end
@@ -3,6 +3,7 @@ require "fonemas/version"
3
3
 
4
4
  module Fonemas
5
5
  require 'text/hyphen'
6
+ require 'unicode_utils'
6
7
 
7
8
  def self.version
8
9
  VERSION
@@ -12,9 +13,13 @@ module Fonemas
12
13
  s = text.gsub(/,/,' ')
13
14
  s = s.gsub(/\s+/,' ')
14
15
  s = s.chomp.strip
15
- s = s.downcase
16
+ s = downcase(s)
16
17
  return s
17
18
  end
19
+
20
+ def self.downcase(text)
21
+ UnicodeUtils.downcase(text)
22
+ end
18
23
 
19
24
  def self.lastVocal(word,from)
20
25
  #puts "last vocal for #{word} from #{from}"
@@ -130,7 +135,7 @@ module Fonemas
130
135
  end
131
136
 
132
137
  def self.separar(word)
133
- word = word.downcase
138
+ word = downcase(word)
134
139
  output = []
135
140
  i = 0
136
141
  while(i < word.length)
@@ -347,9 +352,22 @@ module Fonemas
347
352
  #puts "pre: #{fonema}"
348
353
  t = normalize(generateFonemas(fonema))
349
354
  #puts "out: #{t}"
355
+
356
+ #self.checkFonemas(t)
357
+
350
358
  return t
351
359
  end
352
360
 
361
+ #def self.checkFonemas(p)
362
+ # #un ultimo chequeo de seguridad
363
+ # for pronunciacion in p
364
+ # for fonema in pronunciacion.split(" ")
365
+ # raise "fonema invalido" unless lista_de_fonemas.include? fonema
366
+ # end
367
+ # end
368
+ #
369
+ #end
370
+
353
371
  def self.generateFonemas(fonema,i=0,current=[])
354
372
  if i == fonema.length
355
373
  return current.join(' ')
@@ -1,3 +1,3 @@
1
1
  module Fonemas
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
@@ -49,6 +49,10 @@ describe Fonemas do
49
49
 
50
50
 
51
51
  end
52
+
53
+ it 'soporta mayúsculas acentuadas' do
54
+ Fonemas.fonemas('África').should include('aa f r i k a')
55
+ end
52
56
 
53
57
  it 'test diptongos' do
54
58
  Fonemas.isDiptongo("buitre",1,2).should be(true)
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.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manuel Bahamondez Honores
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.4.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: unicode_utils
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 1.4.0
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 1.4.0
69
83
  description: Creación de fonemas para ser utilizadas en el reconocimiento de voz con
70
84
  cmu sphinx
71
85
  email: