opener-chained-daemon 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9f83c41e8ec2777bc82b612808648602a7b1aadb47644ce6a5e4d82dc25cfadd
4
+ data.tar.gz: ad441801200eb26010ab96f107a461973d6611c467ae240cdc07c476706614ac
5
+ SHA512:
6
+ metadata.gz: 34a82d9a876ebdcfebbe5f8e26864e8bceade4661e15e0241dc2bf8bd895600136332c1857ee917394d12485f7ebdf20e2702e4766a27964e6f01179ed0e1e55
7
+ data.tar.gz: 3445779b8698aecb8911d06121e38efd291c66ce8a2215048b9f11fd65fda2115da2ef49a9dbfc6d6567cd683fad20fce54c80cda6a31a7f0361133fd567663a
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require_relative '../lib/opener/chained_daemon'
5
+
6
+ cli = Opener::ChainedDaemon::CLI.new
7
+ cli.run
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'opener/daemons'
4
+
5
+ controller = Opener::Daemons::Controller.new(
6
+ name: 'opener-chained-daemon',
7
+ exec_path: File.expand_path('../../exec/chained-daemon.rb', __FILE__),
8
+ )
9
+ controller.run
@@ -0,0 +1,31 @@
1
+ module Opener
2
+ class ChainedDaemon
3
+
4
+ DEFAULT_OPTIONS = {
5
+ }
6
+
7
+ def initialize options = {}
8
+ @options = DEFAULT_OPTIONS.merge options
9
+ @queue_map = {
10
+ 'opener-language-identifier': Opener::LanguageIdentifier.new,
11
+ 'opener-tokenizer': Opener::Tokenizer.new,
12
+ 'opener-pos-tagger': Opener::POSTagger.new,
13
+ 'opener-polarity-tagger': Opener::PolarityTagger.new,
14
+ 'opener-property-tagger': Opener::PropertyTagger.new,
15
+ 'opener-ner': Opener::Ner.new,
16
+ 'opener-opinion-detector-basic': Opener::OpinionDetectorBasic.new,
17
+ }
18
+ end
19
+
20
+ def run input
21
+ output = nil
22
+ @queue_map.each do |queue, component|
23
+ File.write "input-#{queue}", input if ENV['DEBUG']
24
+ output = component.run input
25
+ input = output
26
+ end
27
+ output
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,58 @@
1
+ module Opener
2
+ class ChainedDaemon
3
+ ##
4
+ # CLI wrapper around {Opener::ChainedDaemon} using Slop.
5
+ #
6
+ # @!attribute [r] parser
7
+ # @return [Slop]
8
+ #
9
+ class CLI
10
+
11
+ attr_reader :parser
12
+
13
+ def initialize
14
+ @parser = configure_slop
15
+ end
16
+
17
+ ##
18
+ # @param [Array] argv
19
+ #
20
+ def run argv = ARGV
21
+ parser.parse argv
22
+ end
23
+
24
+ ##
25
+ # @return [Slop]
26
+ #
27
+ def configure_slop
28
+ Slop.new strict: false, indent: 2, help: true do
29
+ banner 'Usage: chained-daemon [OPTIONS]'
30
+
31
+ separator <<-EOF.chomp
32
+
33
+ About:
34
+
35
+
36
+ Example:
37
+
38
+ cat some_file.kaf | chained-daemon
39
+ EOF
40
+
41
+ separator "\nOptions:\n"
42
+
43
+ on :v, :version, 'Shows the current version' do
44
+ abort "chained-daemon v#{VERSION} on #{RUBY_DESCRIPTION}"
45
+ end
46
+
47
+ run do |opts, args|
48
+ daemon = ChainedDaemon.new args: args
49
+ input = STDIN.tty? ? nil : STDIN.read
50
+
51
+ puts daemon.run input
52
+ end
53
+ end
54
+ end
55
+
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,7 @@
1
+ module Opener
2
+ class ChainedDaemon
3
+
4
+ VERSION = '1.0.0'
5
+
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ require 'active_support/all'
2
+ require 'oga'
3
+
4
+ require 'opener/daemons'
5
+
6
+ require 'opener/language_identifier'
7
+ require 'opener/tokenizer'
8
+ # require ner before pos_tagger for compatible opennlp
9
+ require 'opener/ner'
10
+ require 'opener/pos_tagger'
11
+ require 'opener/polarity_tagger'
12
+ require 'opener/property_tagger'
13
+ require 'opener/opinion_detector_basic'
14
+
15
+ require_relative 'chained_daemon/chained_daemon'
16
+ require_relative 'chained_daemon/cli'
@@ -0,0 +1,40 @@
1
+ require_relative 'lib/opener/chained_daemon/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'opener-chained-daemon'
5
+ spec.version = Opener::ChainedDaemon::VERSION
6
+ spec.authors = ['development@olery.com']
7
+ spec.summary = 'OpeNER daemon for processing multiple queues at once'
8
+ spec.description = spec.summary
9
+
10
+ spec.license = 'Apache 2.0'
11
+
12
+ spec.files = Dir.glob([
13
+ 'config/**/*',
14
+ 'lib/**/*',
15
+ '*.gemspec',
16
+ 'README.md',
17
+ 'LICENSE.txt',
18
+ ]).select{ |file| File.file? file }
19
+
20
+ spec.bindir = 'bin'
21
+ spec.executables = Dir.glob('bin/*').map { |file| File.basename(file) }
22
+
23
+ spec.add_dependency 'activesupport'
24
+ spec.add_dependency 'opener-daemons'
25
+ spec.add_dependency 'opener-callback-handler', '~> 1.0'
26
+
27
+ spec.add_dependency 'opener-language-identifier'
28
+ spec.add_dependency 'opener-tokenizer'
29
+ spec.add_dependency 'opener-pos-tagger'
30
+ spec.add_dependency 'opener-polarity-tagger'
31
+ spec.add_dependency 'opener-property-tagger'
32
+ spec.add_dependency 'opener-ner'
33
+ spec.add_dependency 'opener-opinion-detector-basic'
34
+
35
+ spec.add_development_dependency 'bundler', '~> 1.3'
36
+ spec.add_development_dependency 'rake'
37
+ spec.add_development_dependency 'pry'
38
+ spec.add_development_dependency 'rspec'
39
+ spec.add_development_dependency 'rack-test'
40
+ end
metadata ADDED
@@ -0,0 +1,262 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: opener-chained-daemon
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - development@olery.com
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-06-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ name: activesupport
20
+ prerelease: false
21
+ type: :runtime
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ name: opener-daemons
34
+ prerelease: false
35
+ type: :runtime
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.0'
47
+ name: opener-callback-handler
48
+ prerelease: false
49
+ type: :runtime
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ name: opener-language-identifier
62
+ prerelease: false
63
+ type: :runtime
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ name: opener-tokenizer
76
+ prerelease: false
77
+ type: :runtime
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ name: opener-pos-tagger
90
+ prerelease: false
91
+ type: :runtime
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ name: opener-polarity-tagger
104
+ prerelease: false
105
+ type: :runtime
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ name: opener-property-tagger
118
+ prerelease: false
119
+ type: :runtime
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ name: opener-ner
132
+ prerelease: false
133
+ type: :runtime
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ name: opener-opinion-detector-basic
146
+ prerelease: false
147
+ type: :runtime
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ requirement: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '1.3'
159
+ name: bundler
160
+ prerelease: false
161
+ type: :development
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '1.3'
167
+ - !ruby/object:Gem::Dependency
168
+ requirement: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ name: rake
174
+ prerelease: false
175
+ type: :development
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ requirement: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ name: pry
188
+ prerelease: false
189
+ type: :development
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ requirement: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: '0'
201
+ name: rspec
202
+ prerelease: false
203
+ type: :development
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ requirement: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - ">="
213
+ - !ruby/object:Gem::Version
214
+ version: '0'
215
+ name: rack-test
216
+ prerelease: false
217
+ type: :development
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ description: OpeNER daemon for processing multiple queues at once
224
+ email:
225
+ executables:
226
+ - chained-daemon
227
+ - chained-daemon-daemon
228
+ extensions: []
229
+ extra_rdoc_files: []
230
+ files:
231
+ - bin/chained-daemon
232
+ - bin/chained-daemon-daemon
233
+ - lib/opener/chained_daemon.rb
234
+ - lib/opener/chained_daemon/chained_daemon.rb
235
+ - lib/opener/chained_daemon/cli.rb
236
+ - lib/opener/chained_daemon/version.rb
237
+ - opener-chained-daemon.gemspec
238
+ homepage:
239
+ licenses:
240
+ - Apache 2.0
241
+ metadata: {}
242
+ post_install_message:
243
+ rdoc_options: []
244
+ require_paths:
245
+ - lib
246
+ required_ruby_version: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
251
+ required_rubygems_version: !ruby/object:Gem::Requirement
252
+ requirements:
253
+ - - ">="
254
+ - !ruby/object:Gem::Version
255
+ version: '0'
256
+ requirements: []
257
+ rubyforge_project:
258
+ rubygems_version: 2.6.13
259
+ signing_key:
260
+ specification_version: 4
261
+ summary: OpeNER daemon for processing multiple queues at once
262
+ test_files: []