voxbi 1.0.5 → 1.0.6

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: 41108b63c80b692d9f0c3eba09782a7565c6bd68
4
- data.tar.gz: 465f1b68e7ee7e455bfe3bffc074322f8478f257
3
+ metadata.gz: 09d5b0a2815bb800e3b9bc30b31c9033ffcfac69
4
+ data.tar.gz: 9e9e875c17139f514b70171d0225466187920a87
5
5
  SHA512:
6
- metadata.gz: 65a76f3ed1361264dad019b6926c0ca03f4b5529cb0a1849691dbf62eda709f0c3ef87235f54356c4b525507e72bf1b8d0605e63b6b856fc63e92054b659fd52
7
- data.tar.gz: 2f6b3087dbee91a0fc32397bda8c94de254f9b5fa1e860356824f9450328ae399917549322568fa6573c22fdaada08f524c7394a5889437a358928a510847b60
6
+ metadata.gz: 0ce6964e0284dfc6cc53f728894da94cc35b6f699f05b8cfc9b02e99d75967f9e663abef91cc0ea1904d8aa2c0999ce5a9d75b9d588931ab01877d1176fc014d
7
+ data.tar.gz: 973a6d97ce259e90c45d2163d014271e9f76cb29c2a6761af9465606458d90815feb9501c2617c63e9fddfa8ffeb7749908bf2ee21a63f86a9c8fc8844791f06
@@ -0,0 +1,11 @@
1
+ require "timeout"
2
+
3
+ module Timeoutable
4
+ DEFAULT_TIMEOUT = 0.5.freeze
5
+
6
+ def with_timeout(&block)
7
+ Timeout::timeout(DEFAULT_TIMEOUT){ block.call }
8
+ rescue
9
+ ''
10
+ end
11
+ end
@@ -1,4 +1,6 @@
1
1
  class GetPairsService
2
+ include Timeoutable
3
+
2
4
  attr_reader :phonetic_text
3
5
 
4
6
  def initialize(phonetic_text)
@@ -20,7 +22,7 @@ class GetPairsService
20
22
  while word.length != 0
21
23
  matching_pair = RuleStore.available_pairs.detect{ |pair| word.match(/^#{pair}/) }
22
24
  word.sub!(/^#{matching_pair}/,"")
23
- pairs << matching_pair
25
+ pairs << matching_pair.dup
24
26
  end
25
27
  end
26
28
  end
@@ -1,8 +1,5 @@
1
- require "timeout"
2
-
3
1
  class PhoneticsConverterService
4
- DEFAULT_TIMEOUT = 5.freeze
5
-
2
+ include Timeoutable
6
3
  attr_accessor :word, :phonetized_word
7
4
 
8
5
  def initialize(word)
@@ -12,17 +9,10 @@ class PhoneticsConverterService
12
9
 
13
10
  def call
14
11
  with_timeout { phonetize_word }
15
- phonetized_word
16
12
  end
17
13
 
18
14
  private
19
15
 
20
- def with_timeout(&block)
21
- Timeout::timeout(DEFAULT_TIMEOUT) do
22
- block.call
23
- end
24
- end
25
-
26
16
  def phonetize_word
27
17
  dup_word = word.dup
28
18
 
@@ -32,6 +22,8 @@ class PhoneticsConverterService
32
22
  phonetized_word << phonetic.to_s
33
23
  end
34
24
  end
25
+
26
+ phonetized_word
35
27
  end
36
28
 
37
29
  def conversion_rule_for(word)
Binary file
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'voxbi'
3
- s.version = '1.0.5'
3
+ s.version = '1.0.6'
4
4
  s.date = '2018-04-03'
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: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Galaad Gauthier
@@ -319,6 +319,7 @@ files:
319
319
  - data/pairs/ϵ.ogg
320
320
  - lib/extensions/string.rb
321
321
  - lib/modules/rule_parsable.rb
322
+ - lib/modules/timeoutable.rb
322
323
  - lib/rule_store.rb
323
324
  - lib/services/get_pairs_service.rb
324
325
  - lib/services/get_syllables_service.rb
@@ -328,6 +329,7 @@ files:
328
329
  - lib/voxbi.rb
329
330
  - voxbi-1.0.1.gem
330
331
  - voxbi-1.0.4.gem
332
+ - voxbi-1.0.5.gem
331
333
  - voxbi-1.0.gem
332
334
  - voxbi.gemspec
333
335
  homepage: https://github.com/Galaad-Gauthier/VoxBi