voxbi 0.1.3 → 0.1.4

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: aa7b09a4d0e18b27113683378c1515dfa1d8a556
4
- data.tar.gz: 44ba00d9e344cfe2444a23672c67744f8c5dfe00
3
+ metadata.gz: 3b5a0f249450500b684befb0d4fd66ee616e2942
4
+ data.tar.gz: 0da72b942a34d063389c7bced85f457e790038c8
5
5
  SHA512:
6
- metadata.gz: a26c2225250c7a20a2f91d3dc139c13d85ce04f70e7b0141e788b7514db664299ecfd2f2a118ff30163d3a8c80e2bcd7cc1f9741dcf60b4f76d8084fad760b0e
7
- data.tar.gz: 08e2b71305b6df853917cbd5a87da0bc5322270dd7bb8473008b47571474ea1d79161aa7bcac0a6a61a824d3a59d60e1360036b5ffe91bbbd3da54a9f80b5446
6
+ metadata.gz: fe731147f47211ff4ba5b3524eae8d5408d94cc2128a5d94d780635f6f0aa1dad79483bf6a0b0bd1959b31877b05dea149158de971ffed86f36784a82fb808cd
7
+ data.tar.gz: 617d703d0ea7a3f93f4f37279962d99521afc16e0a9845ffda7feac95fd252683408a77d9221ca948be3a9a3e4361e83a600236ce4407eb05dbf52c9ec01d6f7
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  #VoxBi
2
2
 
3
+
3
4
  *Requires* : Sox
4
5
 
5
6
  *Install voxbi* :
@@ -14,6 +15,6 @@ gem install voxbi
14
15
  $ voxbi Bonjour
15
16
 
16
17
  "bσʒur"
17
- Playing WAVE '/home/<USER>/.gem/ruby/gems/voxbi-0.1.0/data/paires.wav'
18
+ Playing WAVE '/home/<USER>/.gem/ruby/gems/voxbi-0.1.3/data/paires.wav'
18
19
  ~~~
19
20
 
data/data/paires.wav CHANGED
Binary file
data/lib/voxbi.rb ADDED
@@ -0,0 +1,48 @@
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
data/lib/voxbi.rb~ ADDED
@@ -0,0 +1,50 @@
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])
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.3'
3
+ s.version = '0.1.4'
4
4
  s.date = '2013-08-16'
5
5
  s.summary = "VoxBi"
6
6
  s.description = "Easy-to-use french voice synthesizer"
@@ -12,4 +12,5 @@ Gem::Specification.new do |s|
12
12
  s.homepage =
13
13
  'https://github.com/Galaad-Gauthier/VoxBi'
14
14
  s.license = 'MIT'
15
+ s.add_dependency "json"
15
16
  end
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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Galaad Gauthier
@@ -9,7 +9,21 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2013-08-16 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  description: Easy-to-use french voice synthesizer
14
28
  email: coontail7@gmail.com
15
29
  executables:
@@ -18,6 +32,8 @@ extensions: []
18
32
  extra_rdoc_files: []
19
33
  files:
20
34
  - voxbi.gemspec
35
+ - lib/voxbi.rb
36
+ - lib/voxbi.rb~
21
37
  - data/paires.wav
22
38
  - data/paires/jɛ.ogg
23
39
  - data/paires/wα.ogg