voxbi 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/pairs.wav +0 -0
- data/lib/modules/rulable.rb +23 -14
- data/lib/services/get_pairs_service.rb +2 -0
- data/lib/services/linkage_service.rb +7 -6
- data/lib/services/phonetics_converter_service.rb +2 -0
- data/lib/voxbi.rb +2 -0
- data/voxbi-1.0.gem +0 -0
- data/voxbi.gemspec +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66709d394039ca32bf2e281070564b930df34563
|
4
|
+
data.tar.gz: 92ee45c2410eb395252fed922f5a101776c4d820
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6f273ead2258f7ecb5c8a468b73f5691052025c2d7224f657eb2243fe62843c440b70175f48ea6ff53da47b679cec6c3c11ed395ff7eb32518ec282c552befa
|
7
|
+
data.tar.gz: 39b04b8eb7ce1d87e35c3dde0a847925fbd0efa99ec095a69d33fca4183202c8ea8583385f5a8d77c7f50f1508419afde29739cbd3485985a225dfd5a5218120
|
data/data/pairs.wav
CHANGED
Binary file
|
data/lib/modules/rulable.rb
CHANGED
@@ -3,23 +3,13 @@ require "csv"
|
|
3
3
|
|
4
4
|
module Rulable
|
5
5
|
DATA_PATH = File.expand_path('../../data', __dir__)
|
6
|
-
CSV_FILENAMES = %
|
7
|
-
JSON_FILENAMES = %
|
6
|
+
CSV_FILENAMES = %i(conversion linkage exceptions available_pairs).freeze
|
7
|
+
JSON_FILENAMES = %i(dictionary).freeze
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
memoize_file_content(filename, :csv)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
JSON_FILENAMES.each do |filename|
|
16
|
-
define_method(filename) do
|
17
|
-
memoize_file_content(filename, :json)
|
18
|
-
end
|
9
|
+
def self.included(klass)
|
10
|
+
klass.extend(Macros)
|
19
11
|
end
|
20
12
|
|
21
|
-
private
|
22
|
-
|
23
13
|
def memoize_file_content(filename, file_format)
|
24
14
|
instance_variable_get("@#{filename}") ||
|
25
15
|
instance_variable_set("@#{filename}", parse_rule_file(filename, file_format))
|
@@ -44,4 +34,23 @@ module Rulable
|
|
44
34
|
"#{DATA_PATH}/#{filename}" + ".#{file_format}"
|
45
35
|
end
|
46
36
|
|
37
|
+
module Macros
|
38
|
+
def memoize_csv(*filenames)
|
39
|
+
permitted_filenames = filenames.select{ |filename| CSV_FILENAMES.include?(filename) }
|
40
|
+
memoize_file(permitted_filenames, file_format: :csv)
|
41
|
+
end
|
42
|
+
|
43
|
+
def memoize_json(*filenames)
|
44
|
+
permitted_filenames = filenames.select{ |filename| JSON_FILENAMES.include?(filename) }
|
45
|
+
memoize_file(permitted_filenames, file_format: :json)
|
46
|
+
end
|
47
|
+
|
48
|
+
def memoize_file(filenames, file_format:)
|
49
|
+
filenames.each do |filename|
|
50
|
+
define_method(filename) do
|
51
|
+
memoize_file_content(filename, file_format)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
47
56
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
class LinkageService
|
2
2
|
include Rulable
|
3
3
|
|
4
|
+
memoize_csv :linkage
|
5
|
+
|
4
6
|
attr_accessor :prepared_text, :phonetic_text
|
5
7
|
|
6
8
|
def initialize(prepared_text, phonetic_text)
|
@@ -9,10 +11,7 @@ class LinkageService
|
|
9
11
|
end
|
10
12
|
|
11
13
|
def call
|
12
|
-
dup_phonetic_text
|
13
14
|
apply_linkage
|
14
|
-
|
15
|
-
@dup_phonetic_text
|
16
15
|
end
|
17
16
|
|
18
17
|
private
|
@@ -23,15 +22,17 @@ class LinkageService
|
|
23
22
|
|
24
23
|
def apply_linkage
|
25
24
|
prepared_text.each_with_index do |word, index|
|
26
|
-
if
|
27
|
-
link_string = word[-1] +
|
25
|
+
if dup_phonetic_text[index+1]
|
26
|
+
link_string = word[-1] + dup_phonetic_text[index+1][0]
|
28
27
|
linkage_rule = linkage_rule_for(link_string)
|
29
28
|
|
30
29
|
if linkage_rule
|
31
|
-
|
30
|
+
dup_phonetic_text[index+1] = linkage_rule[1].to_s + dup_phonetic_text[index+1]
|
32
31
|
end
|
33
32
|
end
|
34
33
|
end
|
34
|
+
|
35
|
+
dup_phonetic_text
|
35
36
|
end
|
36
37
|
|
37
38
|
def linkage_rule_for(link_string)
|
data/lib/voxbi.rb
CHANGED
data/voxbi-1.0.gem
ADDED
Binary file
|
data/voxbi.gemspec
CHANGED
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:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Galaad Gauthier
|
@@ -325,6 +325,7 @@ files:
|
|
325
325
|
- lib/services/phonetics_converter_service.rb
|
326
326
|
- lib/services/prepare_text_service.rb
|
327
327
|
- lib/voxbi.rb
|
328
|
+
- voxbi-1.0.gem
|
328
329
|
- voxbi.gemspec
|
329
330
|
homepage: https://github.com/Galaad-Gauthier/VoxBi
|
330
331
|
licenses:
|