onlyoffice_language_helper 0.2.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onlyoffice_language_helper/detect_language.rb +6 -2
- data/lib/onlyoffice_language_helper/name.rb +1 -0
- data/lib/onlyoffice_language_helper/spell_checker/config.rb +3 -0
- data/lib/onlyoffice_language_helper/spell_checker.rb +63 -25
- data/lib/onlyoffice_language_helper/version.rb +2 -1
- metadata +140 -28
- data/lib/onlyoffice_language_helper/spell_checker/dictionaries_threads.rb +0 -62
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23f037370c055f1bb2705656ec0b7cddd5236c0725909a5c147053c46705f80a
|
4
|
+
data.tar.gz: 6899e8b66be0f46f2ffb2edb727f66f5d008e0322c5e5d59f3a09161782019c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 407a8dba3654b6e5a1210d0fda7027753236e0e3fb183454f4e387bfefd98013d32decc8e561d52c39c6ee111d777e10b33744def1a5709a503fb607fb9108ad
|
7
|
+
data.tar.gz: d3a308d417e561c8477abbd5eedd483acc643f893daa575d120d80016e05ca502337015d732cd6087a3bbb69370f4dc4b85c77a456d2399734d5a7a0561562fc
|
@@ -10,11 +10,15 @@ module OnlyofficeLanguageHelper
|
|
10
10
|
# @return [Array, String] initialized keys
|
11
11
|
attr_accessor :api_keys
|
12
12
|
|
13
|
+
# Detect language of text
|
14
|
+
# @param text [String] text to detect
|
15
|
+
# @return [String] possible language
|
13
16
|
def detect_language(text)
|
14
17
|
change_key_on_active
|
15
18
|
DetectLanguage.detect(text)
|
16
19
|
end
|
17
20
|
|
21
|
+
# @return [Array<String>] list of all possible languages
|
18
22
|
def all_languages
|
19
23
|
change_key_on_active
|
20
24
|
DetectLanguage.languages
|
@@ -25,7 +29,7 @@ module OnlyofficeLanguageHelper
|
|
25
29
|
# Set value to variable DetectLanguageWrapper.keys
|
26
30
|
# @return [Array, String] list of keys
|
27
31
|
def read_keys
|
28
|
-
return [ENV['DETECT_LANGUAGE_KEY']] if ENV
|
32
|
+
return [ENV['DETECT_LANGUAGE_KEY']] if ENV.key?('DETECT_LANGUAGE_KEY')
|
29
33
|
|
30
34
|
OnlyofficeFileHelper::FileHelper
|
31
35
|
.read_array_from_file("#{Dir.home}/.detect_language/keys")
|
@@ -43,7 +47,7 @@ module OnlyofficeLanguageHelper
|
|
43
47
|
end
|
44
48
|
return true if DetectLanguage.user_status['status'] == 'ACTIVE'
|
45
49
|
end
|
46
|
-
raise 'All keys are non-active. '\
|
50
|
+
raise 'All keys are non-active. ' \
|
47
51
|
'Please register more detectlanguage.com accounts'
|
48
52
|
end
|
49
53
|
end
|
@@ -4,13 +4,16 @@ module OnlyofficeLanguageHelper
|
|
4
4
|
module SpellChecker
|
5
5
|
# Spellchecker config
|
6
6
|
class Config
|
7
|
+
# @return [String] language to expect
|
7
8
|
attr_accessor :expected_language
|
9
|
+
# @return [String] path to lang file
|
8
10
|
attr_accessor :dictionaries_path
|
9
11
|
|
10
12
|
def initialize
|
11
13
|
default_configuration
|
12
14
|
end
|
13
15
|
|
16
|
+
# @return [nil] default configuration for SpellChecker
|
14
17
|
def default_configuration
|
15
18
|
@expected_language = 'en_US'
|
16
19
|
@dictionaries_path = File.dirname(__dir__)
|
@@ -1,12 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'hunspell
|
3
|
+
require 'ffi/hunspell'
|
4
4
|
require 'httparty'
|
5
5
|
require 'json'
|
6
6
|
require 'cgi'
|
7
7
|
require 'whatlanguage'
|
8
8
|
require_relative 'spell_checker/config'
|
9
|
-
require_relative 'spell_checker/dictionaries_threads'
|
10
9
|
|
11
10
|
# Spellchecker stuff
|
12
11
|
module OnlyofficeLanguageHelper
|
@@ -21,62 +20,101 @@ module OnlyofficeLanguageHelper
|
|
21
20
|
include HTTParty
|
22
21
|
attr_reader :config
|
23
22
|
|
23
|
+
# Configure Spellchecker
|
24
24
|
def self.configure
|
25
25
|
OnlyofficeLoggerHelper.log('Begin configuring SpellChecker')
|
26
26
|
config
|
27
27
|
yield(@config) if block_given?
|
28
28
|
check_language
|
29
|
-
|
30
|
-
path_to_dic_aff(:dic))
|
29
|
+
FFI::Hunspell.directories = all_languages_dictonaries
|
31
30
|
OnlyofficeLoggerHelper.log('Configuring complete!')
|
32
31
|
end
|
33
32
|
|
33
|
+
# Check in all known dictionaries
|
34
|
+
# @param string [String] string to check
|
35
|
+
# @return [Array<Hash>] result of check
|
34
36
|
def self.check_in_all_dictionaries(string)
|
35
|
-
|
36
|
-
@dictionaries ||= DictionariesThreads.new
|
37
|
+
results = []
|
37
38
|
split_text_by_words(string).map do |word|
|
38
|
-
|
39
|
-
|
39
|
+
word_hash = {}
|
40
|
+
word_hash[word] = check_word_in_all(word)
|
41
|
+
results << word_hash
|
40
42
|
end
|
43
|
+
results
|
41
44
|
end
|
42
45
|
|
46
|
+
# Check word in all dictionaries
|
47
|
+
# @param [String] word to check
|
48
|
+
# @return [Hash] word check result
|
49
|
+
def self.check_word_in_all(word)
|
50
|
+
word_results = {}
|
51
|
+
|
52
|
+
@threads = []
|
53
|
+
available_languages.each do |language|
|
54
|
+
@threads << Thread.new do
|
55
|
+
word_results[language] = check_single_word(word, language)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
@threads.each(&:join)
|
59
|
+
word_results
|
60
|
+
end
|
61
|
+
|
62
|
+
# Check if word correct in single language
|
63
|
+
# @param [String] word to check
|
64
|
+
# @param [String] language to check
|
65
|
+
# @return [Boolean] result of check
|
66
|
+
def self.check_single_word(word, language)
|
67
|
+
dict = FFI::Hunspell.dict(language)
|
68
|
+
result = dict.check?(word)
|
69
|
+
dict.close
|
70
|
+
OnlyofficeLoggerHelper.log("Word `#{word}` in `#{language}` correct: #{result}")
|
71
|
+
result
|
72
|
+
end
|
73
|
+
|
74
|
+
# Get path to dic aff
|
75
|
+
# @param extension [String] extension of dictionaries
|
76
|
+
# @param language [String] language to get
|
77
|
+
# @return [String] path
|
43
78
|
def self.path_to_dic_aff(extension, language = config.expected_language)
|
44
|
-
"#{config.dictionaries_path}/dictionaries/"\
|
45
|
-
|
79
|
+
"#{config.dictionaries_path}/dictionaries/" \
|
80
|
+
"#{language}/#{language}.#{extension}"
|
46
81
|
end
|
47
82
|
|
83
|
+
# Split text by words
|
84
|
+
# @param string [String] multi-word text
|
85
|
+
# @return [Array<String>] uniq words
|
48
86
|
def self.split_text_by_words(string)
|
49
87
|
string.to_s.scan(/\b[[:word:]['-]]+\b/u).uniq
|
50
88
|
end
|
51
89
|
|
52
|
-
|
53
|
-
unless spellcheck_result[config.expected_language]
|
54
|
-
warn("Word '#{word}' was not found in "\
|
55
|
-
"'#{config.expected_language}' dictionary!")
|
56
|
-
spellcheck_result['suggestions'] = @dictionary.suggest(word)
|
57
|
-
end
|
58
|
-
{ word => spellcheck_result }
|
59
|
-
end
|
60
|
-
|
90
|
+
# @return [Config] get current config
|
61
91
|
def self.config
|
62
92
|
@config ||= Config.new
|
63
93
|
end
|
64
94
|
|
95
|
+
# @return [nil] Reset config to default
|
65
96
|
def self.reset_config
|
66
97
|
@config = Config.new
|
67
98
|
end
|
68
99
|
|
69
|
-
|
70
|
-
return if @dictionary
|
71
|
-
|
72
|
-
raise 'Call SpellChecker.configure method before using it!'
|
73
|
-
end
|
74
|
-
|
100
|
+
# @return [nil] check if current language has dictonaries
|
75
101
|
def self.check_language
|
76
102
|
unless File.exist?(path_to_dic_aff(:dic)) ||
|
77
103
|
File.exist?(path_to_dic_aff(:aff))
|
78
104
|
raise 'Incorrect language'
|
79
105
|
end
|
80
106
|
end
|
107
|
+
|
108
|
+
# @return [Array<String>] list of available dictonaries
|
109
|
+
def self.available_languages
|
110
|
+
all_languages_dictonaries.map { |dir| File.basename(dir) }
|
111
|
+
end
|
112
|
+
|
113
|
+
# @return [Array<String>] list of all dictionaries dir
|
114
|
+
def self.all_languages_dictonaries
|
115
|
+
Dir.glob("#{Dir.pwd}/lib/onlyoffice_language_helper/dictionaries/*").select do |fn|
|
116
|
+
File.directory?(fn)
|
117
|
+
end
|
118
|
+
end
|
81
119
|
end
|
82
120
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onlyoffice_language_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ONLYOFFICE
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: detect_language
|
@@ -17,56 +17,56 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '1
|
20
|
+
version: '1'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '1
|
27
|
+
version: '1'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: ffi-hunspell
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '0
|
34
|
+
version: '0'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '0
|
41
|
+
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: httparty
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 0.10.0
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 0.10.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: onlyoffice_file_helper
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - "
|
60
|
+
- - "<"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: '
|
62
|
+
version: '2'
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - "<"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
69
|
+
version: '2'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: onlyoffice_logger_helper
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,28 +87,140 @@ dependencies:
|
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '1
|
90
|
+
version: '1'
|
91
91
|
type: :runtime
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '1
|
97
|
+
version: '1'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: codecov
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: overcommit
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
98
126
|
- !ruby/object:Gem::Dependency
|
99
127
|
name: rake
|
100
128
|
requirement: !ruby/object:Gem::Requirement
|
101
129
|
requirements:
|
102
130
|
- - "~>"
|
103
131
|
- !ruby/object:Gem::Version
|
104
|
-
version: '13
|
132
|
+
version: '13'
|
105
133
|
type: :development
|
106
134
|
prerelease: false
|
107
135
|
version_requirements: !ruby/object:Gem::Requirement
|
108
136
|
requirements:
|
109
137
|
- - "~>"
|
110
138
|
- !ruby/object:Gem::Version
|
111
|
-
version: '13
|
139
|
+
version: '13'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: rspec
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '3'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '3'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: rubocop
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - "~>"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '1'
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - "~>"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '1'
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: rubocop-performance
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - "~>"
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '1'
|
175
|
+
type: :development
|
176
|
+
prerelease: false
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - "~>"
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '1'
|
182
|
+
- !ruby/object:Gem::Dependency
|
183
|
+
name: rubocop-rake
|
184
|
+
requirement: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - "~>"
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
type: :development
|
190
|
+
prerelease: false
|
191
|
+
version_requirements: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - "~>"
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '0'
|
196
|
+
- !ruby/object:Gem::Dependency
|
197
|
+
name: rubocop-rspec
|
198
|
+
requirement: !ruby/object:Gem::Requirement
|
199
|
+
requirements:
|
200
|
+
- - "~>"
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: '2'
|
203
|
+
type: :development
|
204
|
+
prerelease: false
|
205
|
+
version_requirements: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - "~>"
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '2'
|
210
|
+
- !ruby/object:Gem::Dependency
|
211
|
+
name: yard
|
212
|
+
requirement: !ruby/object:Gem::Requirement
|
213
|
+
requirements:
|
214
|
+
- - ">="
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: 0.9.20
|
217
|
+
type: :development
|
218
|
+
prerelease: false
|
219
|
+
version_requirements: !ruby/object:Gem::Requirement
|
220
|
+
requirements:
|
221
|
+
- - ">="
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: 0.9.20
|
112
224
|
description: ONLYOFFICE Helper Gem for language operation. Used in QA
|
113
225
|
email:
|
114
226
|
- shockwavenn@gmail.com
|
@@ -223,17 +335,17 @@ files:
|
|
223
335
|
- lib/onlyoffice_language_helper/name.rb
|
224
336
|
- lib/onlyoffice_language_helper/spell_checker.rb
|
225
337
|
- lib/onlyoffice_language_helper/spell_checker/config.rb
|
226
|
-
- lib/onlyoffice_language_helper/spell_checker/dictionaries_threads.rb
|
227
338
|
- lib/onlyoffice_language_helper/version.rb
|
228
|
-
homepage: https://github.com/
|
339
|
+
homepage: https://github.com/ONLYOFFICE-QA/onlyoffice_language_helper
|
229
340
|
licenses:
|
230
341
|
- AGPL-3.0
|
231
342
|
metadata:
|
232
|
-
bug_tracker_uri: https://github.com/
|
233
|
-
changelog_uri: https://github.com/
|
343
|
+
bug_tracker_uri: https://github.com/ONLYOFFICE-QA/onlyoffice_language_helper/issues
|
344
|
+
changelog_uri: https://github.com/ONLYOFFICE-QA/onlyoffice_language_helper/blob/master/CHANGELOG.md
|
234
345
|
documentation_uri: https://www.rubydoc.info/gems/onlyoffice_language_helper
|
235
|
-
homepage_uri: https://github.com/
|
236
|
-
source_code_uri: https://github.com/
|
346
|
+
homepage_uri: https://github.com/ONLYOFFICE-QA/onlyoffice_language_helper
|
347
|
+
source_code_uri: https://github.com/ONLYOFFICE-QA/onlyoffice_language_helper
|
348
|
+
rubygems_mfa_required: 'true'
|
237
349
|
post_install_message:
|
238
350
|
rdoc_options: []
|
239
351
|
require_paths:
|
@@ -242,14 +354,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
242
354
|
requirements:
|
243
355
|
- - ">="
|
244
356
|
- !ruby/object:Gem::Version
|
245
|
-
version: '
|
357
|
+
version: '2.7'
|
246
358
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
247
359
|
requirements:
|
248
360
|
- - ">="
|
249
361
|
- !ruby/object:Gem::Version
|
250
362
|
version: '0'
|
251
363
|
requirements: []
|
252
|
-
rubygems_version: 3.
|
364
|
+
rubygems_version: 3.3.20
|
253
365
|
signing_key:
|
254
366
|
specification_version: 4
|
255
367
|
summary: ONLYOFFICE Helper Gem for language operation
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module OnlyofficeLanguageHelper
|
4
|
-
module SpellChecker
|
5
|
-
# Threads for spellchecker
|
6
|
-
class DictionariesThreads
|
7
|
-
attr_accessor :word
|
8
|
-
|
9
|
-
Thread.abort_on_exception = true
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
@dictionaries = {}
|
13
|
-
Dir.glob("#{SpellChecker.config.dictionaries_path}/dictionaries/*")
|
14
|
-
.select { |f| File.directory?(f) }.each do |lang|
|
15
|
-
@dictionaries[File.basename(lang)] =
|
16
|
-
Hunspell.new(SpellChecker.path_to_dic_aff(:aff,
|
17
|
-
File.basename(lang)),
|
18
|
-
SpellChecker.path_to_dic_aff(:dic,
|
19
|
-
File.basename(lang)))
|
20
|
-
end
|
21
|
-
init_threads_data
|
22
|
-
end
|
23
|
-
|
24
|
-
def threads
|
25
|
-
@threads ||= init_threads
|
26
|
-
end
|
27
|
-
|
28
|
-
def check_word(word)
|
29
|
-
@result = {}
|
30
|
-
@word = word.to_s
|
31
|
-
start_threads
|
32
|
-
end
|
33
|
-
|
34
|
-
def start_threads
|
35
|
-
threads.each(&:run)
|
36
|
-
until @result.length == @dictionaries.length
|
37
|
-
end
|
38
|
-
@result
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def init_threads_data
|
44
|
-
@result = {}
|
45
|
-
threads
|
46
|
-
end
|
47
|
-
|
48
|
-
def init_threads
|
49
|
-
@threads = []
|
50
|
-
@dictionaries.each do |key, value|
|
51
|
-
@threads << Thread.new do
|
52
|
-
loop do
|
53
|
-
@result[key] = value.check(@word.to_s)
|
54
|
-
Thread.stop
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
@threads
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|