voxbi 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b5a0f249450500b684befb0d4fd66ee616e2942
4
- data.tar.gz: 0da72b942a34d063389c7bced85f457e790038c8
3
+ metadata.gz: b87bc7c3f0788335b456103556ed58f675e784a7
4
+ data.tar.gz: 991f5febdc75d7794af20ebcdd4bc162dfcbcf8f
5
5
  SHA512:
6
- metadata.gz: fe731147f47211ff4ba5b3524eae8d5408d94cc2128a5d94d780635f6f0aa1dad79483bf6a0b0bd1959b31877b05dea149158de971ffed86f36784a82fb808cd
7
- data.tar.gz: 617d703d0ea7a3f93f4f37279962d99521afc16e0a9845ffda7feac95fd252683408a77d9221ca948be3a9a3e4361e83a600236ce4407eb05dbf52c9ec01d6f7
6
+ metadata.gz: 2cf9c08ec6f342d5b99fbd1bd90514464cab722d4a17c8afb16dc8ab16ff2dece2f89104d912c0de3efc46ef268d4a23ca236b063d32cbe8ad6c4e485fc51163
7
+ data.tar.gz: fec2687fc73a8036d9fd89cd139b04f64851239e47defca2345f9dec03807333f353a5254ae86652c013f13a08077fe904a243e25d0391dfc092e32803289f35
data/README.md CHANGED
@@ -9,12 +9,21 @@
9
9
  gem install voxbi
10
10
  ~~~
11
11
 
12
- *Use voxbi* :
12
+ *Use voxbi as an executable* :
13
13
 
14
14
  ~~~
15
15
  $ voxbi Bonjour
16
16
 
17
17
  "bσʒur"
18
- Playing WAVE '/home/<USER>/.gem/ruby/gems/voxbi-0.1.3/data/paires.wav'
18
+ Playing WAVE '/home/<USER>/.gem/ruby/gems/voxbi-0.1.4/data/paires.wav'
19
19
  ~~~
20
20
 
21
+ *Use voxbi as a library*
22
+
23
+ ~~~
24
+ > apimatch("la tour eiffel")
25
+ => ["la", "tur", "ɛfɛl"]
26
+
27
+ > voxbi("Voulez vous coucher avec moi ce soir ?")
28
+ => Playing WAVE '/home/<USER>/.gem/ruby/gems/voxbi-0.1.4/data/paires.wav'
29
+ ~~~
data/bin/voxbi CHANGED
@@ -1,50 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "json"
4
-
5
- ROOT = File.expand_path("../..", __FILE__)
6
- SPE = /([(0-9)|•|—|–|\-|,|?|!|^|\r|°|“|”|...|\u00a0|«|»|…|\\|\/|!|?|\"|\'|\[|\]|\(|\)|\]|<|>|=|+|%|$|&|#|;|*|:|}|{|`])/
7
-
8
- def parseCSV(path)
9
- Hash[File.open("#{ROOT}/data/#{path}.csv").read.split("\n").map {|ligne| ligne.split("#")}]
10
- end
11
-
12
- def exceptions
13
- @exceptions ||= JSON.parse(File.read("#{ROOT}/data/phono.json"))
14
- end
15
-
16
- def conversion
17
- @conversion ||= parseCSV "conversion"
18
- end
19
-
20
- def apimatch(texte)
21
- texte = texte.downcase
22
- texte.gsub(SPE, "").split.map do |mot|
23
- exceptions[mot] || "".tap do |result|
24
- conversion.select { |regle| mot =~ /#{regle}/ }.first.tap do |regle, api|
25
- mot.sub! /#{regle}/, ""
26
- result << api.to_s
27
- end until mot.empty?
28
- end
29
- end
30
- end
31
-
32
- def voxbi(texte)
33
- paires_dispo = File.open("#{ROOT}/data/paires_disponibles.csv").read.split("\n")
34
- api = apimatch(texte).join "_"
35
- puts api.inspect
36
- fichiers = []
37
- while api.length !=0
38
- paires_dispo.each do |paires|
39
- if api.match(/^#{paires}/)
40
- fichiers << "#{ROOT}/data/paires/#{paires}.ogg"
41
- api = api.sub(/^#{paires}/,"")
42
- break
43
- end
44
- end
45
- end
46
- `sox #{fichiers.join(" ")} #{ROOT}/data/paires.wav`
47
- `aplay #{ROOT}/data/paires.wav`
48
- end
4
+ root = File.expand_path("../..", __FILE__)
5
+ require "#{root}/lib/voxbi.rb"
49
6
 
50
7
  voxbi(ARGV[0])
data/data/paires.wav CHANGED
Binary file
data/lib/voxbi.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require "json"
4
4
 
5
5
  ROOT = File.expand_path("../..", __FILE__)
6
- SPE = /([(0-9)|•|—|–|\-|,|?|!|^|\r|°|“|”|...|\u00a0|«|»|…|\\|\/|!|?|\"|\'|\[|\]|\(|\)|\]|<|>|=|+|%|$|&|#|;|*|:|}|{|`])/
6
+ SPE = /([(0-9)|•|—|–|\-|\’|,|?|!|^|\r|°|“|”|...|\u00a0|«|»|…|\\|\/|!|?|\"|\'|\[|\]|\(|\)|\]|<|>|=|+|%|$|&|#|;|*|:|}|{|`])/
7
7
 
8
8
  def parseCSV(path)
9
9
  Hash[File.open("#{ROOT}/data/#{path}.csv").read.split("\n").map {|ligne| ligne.split("#")}]
data/voxbi.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'voxbi'
3
- s.version = '0.1.4'
3
+ s.version = '0.1.5'
4
4
  s.date = '2013-08-16'
5
5
  s.summary = "VoxBi"
6
6
  s.description = "Easy-to-use french voice synthesizer"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voxbi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Galaad Gauthier
@@ -33,7 +33,6 @@ extra_rdoc_files: []
33
33
  files:
34
34
  - voxbi.gemspec
35
35
  - lib/voxbi.rb
36
- - lib/voxbi.rb~
37
36
  - data/paires.wav
38
37
  - data/paires/jɛ.ogg
39
38
  - data/paires/wα.ogg
data/lib/voxbi.rb~ DELETED
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "json"
4
-
5
- ROOT = File.expand_path("../..", __FILE__)
6
- SPE = /([(0-9)|•|—|–|\-|,|?|!|^|\r|°|“|”|...|\u00a0|«|»|…|\\|\/|!|?|\"|\'|\[|\]|\(|\)|\]|<|>|=|+|%|$|&|#|;|*|:|}|{|`])/
7
-
8
- def parseCSV(path)
9
- Hash[File.open("#{ROOT}/data/#{path}.csv").read.split("\n").map {|ligne| ligne.split("#")}]
10
- end
11
-
12
- def exceptions
13
- @exceptions ||= JSON.parse(File.read("#{ROOT}/data/phono.json"))
14
- end
15
-
16
- def conversion
17
- @conversion ||= parseCSV "conversion"
18
- end
19
-
20
- def apimatch(texte)
21
- texte = texte.downcase
22
- texte.gsub(SPE, "").split.map do |mot|
23
- exceptions[mot] || "".tap do |result|
24
- conversion.select { |regle| mot =~ /#{regle}/ }.first.tap do |regle, api|
25
- mot.sub! /#{regle}/, ""
26
- result << api.to_s
27
- end until mot.empty?
28
- end
29
- end
30
- end
31
-
32
- def voxbi(texte)
33
- paires_dispo = File.open("#{ROOT}/data/paires_disponibles.csv").read.split("\n")
34
- api = apimatch(texte).join "_"
35
- puts api.inspect
36
- fichiers = []
37
- while api.length !=0
38
- paires_dispo.each do |paires|
39
- if api.match(/^#{paires}/)
40
- fichiers << "#{ROOT}/data/paires/#{paires}.ogg"
41
- api = api.sub(/^#{paires}/,"")
42
- break
43
- end
44
- end
45
- end
46
- `sox #{fichiers.join(" ")} #{ROOT}/data/paires.wav`
47
- `aplay #{ROOT}/data/paires.wav`
48
- end
49
-
50
- voxbi(ARGV[0])