opener-scorer 1.1.5 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +38 -41
- data/bin/scorer +4 -4
- data/bin/scorer-daemon +5 -5
- data/bin/scorer-server +6 -4
- data/exec/scorer.rb +3 -3
- data/lib/opener/scorer.rb +9 -5
- data/lib/opener/scorer/cli.rb +59 -0
- data/lib/opener/scorer/output.rb +0 -3
- data/lib/opener/scorer/output_processor.rb +96 -65
- data/lib/opener/scorer/server.rb +15 -28
- data/lib/opener/scorer/version.rb +1 -1
- data/opener-scorer.gemspec +15 -16
- metadata +37 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a70520b811f55477a7c7c4a080a81802c4745cd
|
4
|
+
data.tar.gz: d35154b0aaeb1bc37799fbef5a431320b7f69c17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26cc6e64fbbaa18be63c025222f7d834fa495aeef44e0e9c5b10e5756cfa2a7393b83c43ed29deaae94f85ee3410c063bf2864109ad64a5856f39d44a1c89250
|
7
|
+
data.tar.gz: 305139f6f15af3be653c2f91bbfd06f354b29c436c3601879b70388a6cf24e4527ca6c7a932b69ead78930f80979fb6fb053313c645c8b2b5b573d76a95b43e0
|
data/README.md
CHANGED
@@ -1,38 +1,42 @@
|
|
1
|
-
Scorer
|
2
|
-
------------
|
1
|
+
# Scorer
|
3
2
|
|
4
|
-
Component that stores results from the Opener Web Services chain into a MySQL
|
3
|
+
Component that stores results from the Opener Web Services chain into a MySQL
|
4
|
+
Database and shows them into your browser.
|
5
5
|
|
6
|
-
It can be used instead of Opener Outlet, to calculate overall sentiment score
|
6
|
+
It can be used instead of Opener Outlet, to calculate overall sentiment score
|
7
|
+
and sentiment score per topic.
|
7
8
|
|
8
|
-
|
9
|
+
## Confused by some terminology?
|
9
10
|
|
10
|
-
This software is part of a larger collection of natural language processing
|
11
|
+
This software is part of a larger collection of natural language processing
|
12
|
+
tools known as "the OpeNER project". You can find more information about the
|
13
|
+
project at [the OpeNER portal](http://opener-project.github.io). There you can
|
14
|
+
also find references to terms like KAF (an XML standard to represent linguistic
|
15
|
+
annotations in texts), component, cores, scenario's and pipelines.
|
11
16
|
|
12
|
-
|
13
|
-
Quick Use Example
|
14
|
-
-----------------
|
17
|
+
## Quick Use Example
|
15
18
|
|
16
19
|
Installing the scorer can be done by executing:
|
17
20
|
|
18
21
|
gem install opener-scorer
|
19
22
|
|
20
|
-
Please
|
23
|
+
Please keep in mind that all components in OpeNER take KAF as an input and
|
24
|
+
output KAF by default.
|
21
25
|
|
22
26
|
### Command line interface
|
23
27
|
|
24
|
-
You should now be able to call the scorer as a regular shell command: by its
|
28
|
+
You should now be able to call the scorer as a regular shell command: by its
|
29
|
+
name. Once installed the gem normally sits in your path so you can call it
|
30
|
+
directly from anywhere.
|
25
31
|
|
26
|
-
This aplication reads a text from standard input in order to rate the given
|
32
|
+
This aplication reads a text from standard input in order to rate the given
|
33
|
+
text:
|
27
34
|
|
28
35
|
cat some_kind_of_kaf_file.kaf | scorer
|
29
36
|
|
30
|
-
|
31
37
|
This will output (JSON Format):
|
32
38
|
|
33
|
-
|
34
|
-
{"overall":-0.06666666666666667,"Restaurant":0.3333333333333333,"Staff":-1.0,"Rooms":1.0,"Facilities":-1.0}
|
35
|
-
```
|
39
|
+
{"overall":-0.06666666666666667,"Restaurant":0.3333333333333333,"Staff":-1.0,"Rooms":1.0,"Facilities":-1.0}
|
36
40
|
|
37
41
|
### Webservices
|
38
42
|
|
@@ -40,28 +44,33 @@ You can launch a webservice by executing:
|
|
40
44
|
|
41
45
|
scorer-server
|
42
46
|
|
43
|
-
This will launch a mini webserver with the webservice. It defaults to port 9292,
|
47
|
+
This will launch a mini webserver with the webservice. It defaults to port 9292,
|
48
|
+
so you can access it at <http://localhost:9292>.
|
44
49
|
|
45
|
-
To launch it on a different port provide the `-p [port-number]` option like
|
50
|
+
To launch it on a different port provide the `-p [port-number]` option like
|
51
|
+
this:
|
46
52
|
|
47
53
|
scorer-server -p 1234
|
48
54
|
|
49
55
|
It then launches at <http://localhost:1234>
|
50
56
|
|
51
|
-
Documentation on the Webservice is provided by surfing to the urls provided
|
52
|
-
|
57
|
+
Documentation on the Webservice is provided by surfing to the urls provided
|
58
|
+
above. For more information on how to launch a webservice run the command with
|
59
|
+
the `--help` option.
|
53
60
|
|
54
61
|
### Daemon
|
55
62
|
|
56
|
-
Last but not least the scorer comes shipped with a daemon that can read jobs
|
63
|
+
Last but not least the scorer comes shipped with a daemon that can read jobs
|
64
|
+
(and write) jobs to and from Amazon SQS queues. For more information type:
|
57
65
|
|
58
66
|
scorer-daemon -h
|
59
67
|
|
68
|
+
## Description of dependencies
|
60
69
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
70
|
+
This component runs best if you run it in an environment suited for OpeNER
|
71
|
+
components. You can find an installation guide and helper tools in the
|
72
|
+
[OpeNER installer](https://github.com/opener-project/opener-installer) and an
|
73
|
+
[installation guide on the Opener Website](http://opener-project.github.io/getting-started/how-to/local-installation.html)
|
65
74
|
|
66
75
|
At least you need the following system setup:
|
67
76
|
|
@@ -69,29 +78,17 @@ At least you need the following system setup:
|
|
69
78
|
|
70
79
|
* JRuby 1.7.9 or newer
|
71
80
|
|
72
|
-
|
73
|
-
--------
|
74
|
-
|
75
|
-
The component is a fat wrapper around the actual language technology core. You can find the core technolies in the following repositories:
|
76
|
-
|
77
|
-
* (link to) Related Core readmes
|
78
|
-
|
79
|
-
Where to go from here
|
80
|
-
---------------------
|
81
|
+
## Where to go from here
|
81
82
|
|
82
83
|
* [Check the project website](http://opener-project.github.io)
|
83
84
|
* [Checkout the webservice](http://opener.olery.com/scorer)
|
84
85
|
|
85
|
-
Report problem/Get help
|
86
|
-
-----------------------
|
86
|
+
## Report problem/Get help
|
87
87
|
|
88
|
-
If you encounter problems, please email support@opener-project.eu or leave an issue in the
|
88
|
+
If you encounter problems, please email support@opener-project.eu or leave an issue in the
|
89
89
|
[issue tracker](https://github.com/opener-project/scorer/issues).
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
Contributing
|
94
|
-
------------
|
91
|
+
## Contributing
|
95
92
|
|
96
93
|
1. Fork it <http://github.com/opener-project/scorer/fork>
|
97
94
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
data/bin/scorer
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require 'json'
|
3
|
-
require_relative '../lib/opener/scorer/output_processor'
|
4
2
|
|
5
|
-
|
3
|
+
require_relative '../lib/opener/scorer'
|
6
4
|
|
7
|
-
|
5
|
+
cli = Opener::Scorer::CLI.new
|
6
|
+
|
7
|
+
cli.run
|
data/bin/scorer-daemon
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'opener/daemons'
|
4
4
|
|
5
|
-
|
5
|
+
controller = Opener::Daemons::Controller.new(
|
6
|
+
:name => 'opener-scorer',
|
7
|
+
:exec_path => File.expand_path('../../exec/scorer.rb', __FILE__)
|
8
|
+
)
|
6
9
|
|
7
|
-
|
8
|
-
:name => 'scorer',
|
9
|
-
:exec_path => exec_path
|
10
|
-
)
|
10
|
+
controller.run
|
data/bin/scorer-server
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'opener/webservice'
|
4
4
|
|
5
|
-
|
5
|
+
parser = Opener::Webservice::OptionParser.new(
|
6
|
+
'opener-scorer',
|
7
|
+
File.expand_path('../../config.ru', __FILE__)
|
8
|
+
)
|
6
9
|
|
7
|
-
|
8
|
-
cli.run
|
10
|
+
parser.run
|
data/exec/scorer.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'opener/daemons'
|
4
|
+
|
4
5
|
require_relative '../lib/opener/scorer'
|
5
6
|
|
6
|
-
|
7
|
-
daemon = Opener::Daemons::Daemon.new(Opener::Scorer, options)
|
7
|
+
daemon = Opener::Daemons::Daemon.new(Opener::Scorer::OutputProcessor)
|
8
8
|
|
9
|
-
daemon.start
|
9
|
+
daemon.start
|
data/lib/opener/scorer.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'securerandom'
|
3
|
+
|
4
|
+
require 'active_record'
|
5
|
+
require 'nokogiri'
|
6
|
+
require 'sinatra/base'
|
7
|
+
require 'slop'
|
8
|
+
|
9
|
+
require_relative 'scorer/cli'
|
1
10
|
require_relative 'scorer/output'
|
2
11
|
require_relative 'scorer/output_processor'
|
3
12
|
require_relative 'scorer/version'
|
4
13
|
require_relative 'scorer/server'
|
5
14
|
require_relative '../../config/database'
|
6
|
-
|
7
|
-
module Opener
|
8
|
-
class Scorer
|
9
|
-
end
|
10
|
-
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Opener
|
2
|
+
class Scorer
|
3
|
+
##
|
4
|
+
# CLI wrapper around {Opener::Scorer} using Slop.
|
5
|
+
#
|
6
|
+
# @!attribute [r] parser
|
7
|
+
# @return [Slop]
|
8
|
+
#
|
9
|
+
class CLI
|
10
|
+
attr_reader :parser
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@parser = configure_slop
|
14
|
+
end
|
15
|
+
|
16
|
+
##
|
17
|
+
# @param [Array] argv
|
18
|
+
#
|
19
|
+
def run(argv = ARGV)
|
20
|
+
parser.parse(argv)
|
21
|
+
end
|
22
|
+
|
23
|
+
##
|
24
|
+
# @return [Slop]
|
25
|
+
#
|
26
|
+
def configure_slop
|
27
|
+
return Slop.new(:strict => false, :indent => 2, :help => true) do
|
28
|
+
banner 'Usage: scorer [OPTIONS]'
|
29
|
+
|
30
|
+
separator <<-EOF.chomp
|
31
|
+
|
32
|
+
About:
|
33
|
+
|
34
|
+
Calculates and stores a score in MySQL based on an input KAF document.
|
35
|
+
This command reads input from STDIN.
|
36
|
+
|
37
|
+
Example:
|
38
|
+
|
39
|
+
cat some_file.kaf | scorer
|
40
|
+
EOF
|
41
|
+
|
42
|
+
separator "\nOptions:\n"
|
43
|
+
|
44
|
+
on :v, :version, 'Shows the current version' do
|
45
|
+
abort "scorer v#{VERSION} on #{RUBY_DESCRIPTION}"
|
46
|
+
end
|
47
|
+
|
48
|
+
run do |opts, args|
|
49
|
+
scorer = OutputProcessor.new
|
50
|
+
input = STDIN.tty? ? nil : STDIN.read
|
51
|
+
output = scorer.process(input)
|
52
|
+
|
53
|
+
puts JSON.dump(output)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end # CLI
|
58
|
+
end # Scorer
|
59
|
+
end # Opener
|
data/lib/opener/scorer/output.rb
CHANGED
@@ -1,34 +1,38 @@
|
|
1
|
-
require 'nokogiri'
|
2
|
-
|
3
1
|
module Opener
|
4
2
|
class Scorer
|
5
3
|
##
|
6
4
|
# Class that given a raw xml input, it will calculate the overall sentiment
|
7
5
|
# score and the scores per topic, given that it is a valid KAF document.
|
8
6
|
#
|
9
|
-
# @!attribute [r]
|
7
|
+
# @!attribute [r] request_id
|
10
8
|
# @return [String]
|
11
9
|
#
|
12
|
-
# @!attribute [r] lemmas_array
|
13
|
-
# @return [Array]
|
14
|
-
#
|
15
|
-
# @!attribute [r] lemmas_hash
|
16
|
-
# @return [Hash]
|
17
|
-
#
|
18
|
-
# @!attribute [r] polarities_hash
|
19
|
-
# @return [Hash]
|
20
|
-
#
|
21
10
|
class OutputProcessor
|
22
|
-
|
11
|
+
attr_reader :request_id
|
12
|
+
|
13
|
+
##
|
14
|
+
# @param [Hash] options
|
15
|
+
#
|
16
|
+
# @option options [Symbol] :request_id
|
17
|
+
#
|
18
|
+
def initialize(options = {})
|
19
|
+
@request_id = options[:request_id]
|
20
|
+
end
|
23
21
|
|
24
22
|
##
|
23
|
+
# Runs the processor and returns the results as a String.
|
24
|
+
#
|
25
25
|
# @param [String] input
|
26
|
+
# @return [String]
|
26
27
|
#
|
27
|
-
def
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
def run(input)
|
29
|
+
output = Output.new
|
30
|
+
output.uuid = request_id
|
31
|
+
output.text = JSON.dump(process(input))
|
32
|
+
|
33
|
+
output.save!
|
34
|
+
|
35
|
+
return output.text
|
32
36
|
end
|
33
37
|
|
34
38
|
##
|
@@ -36,18 +40,21 @@ module Opener
|
|
36
40
|
#
|
37
41
|
# @return [Hash]
|
38
42
|
#
|
39
|
-
def process
|
40
|
-
|
43
|
+
def process(input)
|
44
|
+
document = Nokogiri::XML(input)
|
45
|
+
scores = {}
|
41
46
|
|
42
|
-
build_lemmas_hash
|
43
|
-
build_polarities_hash
|
47
|
+
lemmas_hash = build_lemmas_hash(document)
|
48
|
+
polarities_hash = build_polarities_hash(document)
|
49
|
+
overall_score = get_overall_score(document)
|
44
50
|
|
45
|
-
if overall_score
|
51
|
+
if overall_score
|
46
52
|
scores[:overall] = overall_score
|
47
53
|
end
|
48
54
|
|
49
55
|
lemmas_hash.keys.each do |topic|
|
50
|
-
score = get_topic_score(topic)
|
56
|
+
score = get_topic_score(topic, lemmas_hash, polarities_hash)
|
57
|
+
|
51
58
|
if score
|
52
59
|
scores[topic] = score
|
53
60
|
end
|
@@ -59,91 +66,115 @@ module Opener
|
|
59
66
|
protected
|
60
67
|
|
61
68
|
##
|
62
|
-
#
|
63
|
-
#
|
69
|
+
# @param [Nokogiri::XML::Document] document
|
70
|
+
# @return [Hash]
|
64
71
|
#
|
65
|
-
def build_lemmas_hash
|
66
|
-
|
72
|
+
def build_lemmas_hash(document)
|
73
|
+
lemmas_hash = Hash.new { |hash, key| hash[key] = [] }
|
74
|
+
|
75
|
+
document.css('features properties property').each do |property|
|
67
76
|
lemma = property.attr('lemma').to_sym
|
68
|
-
|
77
|
+
|
69
78
|
property.css('references target').each do |target|
|
70
79
|
lemma_id = target.attr('id')
|
71
|
-
|
80
|
+
|
72
81
|
lemmas_hash[lemma] << lemma_id
|
73
82
|
end
|
74
83
|
end
|
84
|
+
|
85
|
+
return lemmas_hash
|
75
86
|
end
|
76
87
|
|
77
88
|
##
|
78
89
|
# Create a hash with all lemma ids that have a polarity.
|
79
90
|
#
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
91
|
+
# @param [Nokogiri::XML::Document] document
|
92
|
+
# @return [Hash]
|
93
|
+
#
|
94
|
+
def build_polarities_hash(document)
|
95
|
+
polarities_hash = Hash.new { |hash, key| hash[key] = [] }
|
96
|
+
opinions = document.at('opinions')
|
97
|
+
|
98
|
+
return polarities_hash unless opinions
|
99
|
+
|
100
|
+
opinions.css('opinion').each do |opinion|
|
101
|
+
polarity = opinion.at('opinion_expression').attr('polarity').to_sym
|
102
|
+
op_target = opinion.at('opinion_target')
|
103
|
+
op_expr = opinion.at('opinion_expression')
|
104
|
+
|
105
|
+
if op_target
|
106
|
+
op_target.css('span target').each do |target|
|
107
|
+
polarities_hash[target.attr('id')] << polarity
|
89
108
|
end
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
109
|
+
end
|
110
|
+
|
111
|
+
if op_expr
|
112
|
+
op_expr.css('span target').each do |target|
|
113
|
+
polarities_hash[target.attr('id')] << polarity
|
95
114
|
end
|
96
115
|
end
|
97
116
|
end
|
117
|
+
|
118
|
+
return polarities_hash
|
98
119
|
end
|
99
120
|
|
100
121
|
##
|
101
122
|
# Get the score for all lemmas that have a polarity.
|
102
123
|
#
|
124
|
+
# @param [Nokogiri::XML::Docuemnt] document
|
103
125
|
# @return [Float]
|
104
126
|
#
|
105
|
-
def get_overall_score
|
106
|
-
score = 0
|
127
|
+
def get_overall_score(document)
|
107
128
|
polarities = []
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
negative = polarities.count(:negative)
|
115
|
-
|
116
|
-
return if (positive + negative) == 0
|
117
|
-
|
118
|
-
score = ((positive - negative).to_f) / (positive + negative)
|
129
|
+
opinions = document.at('opinions')
|
130
|
+
|
131
|
+
return 0.0 unless opinions
|
132
|
+
|
133
|
+
opinions.css('opinion').each do |opinion|
|
134
|
+
polarities << opinion.at('opinion_expression').attr('polarity').to_sym
|
119
135
|
end
|
120
|
-
|
136
|
+
|
137
|
+
positive = polarities.count(:positive)
|
138
|
+
negative = polarities.count(:negative)
|
139
|
+
|
140
|
+
return if (positive + negative) == 0
|
141
|
+
|
142
|
+
return ((positive - negative).to_f) / (positive + negative)
|
121
143
|
end
|
122
144
|
|
123
145
|
##
|
124
146
|
# Given a topic, return the sentiment score of the lemmas of this topic.
|
125
147
|
#
|
126
|
-
# @
|
148
|
+
# @param [String] topic
|
149
|
+
# @param [Hash] lemmas_hash
|
150
|
+
# @param [Hash] polarities_hash
|
151
|
+
# @return [Float]
|
127
152
|
#
|
128
|
-
def get_topic_score(topic)
|
129
|
-
|
153
|
+
def get_topic_score(topic, lemmas_hash, polarities_hash)
|
154
|
+
if lemmas_hash[topic].empty?
|
155
|
+
return 0.0
|
156
|
+
else
|
157
|
+
return calculate_score(lemmas_hash[topic], polarities_hash)
|
158
|
+
end
|
130
159
|
end
|
131
160
|
|
132
161
|
##
|
133
162
|
# Given an array of lemma ids, calculate the sentiment score.
|
134
163
|
#
|
164
|
+
# @param [Array] lemma_ids
|
165
|
+
# @param [Hash] polarities_hash
|
135
166
|
# @return [Float]
|
136
167
|
#
|
137
|
-
def calculate_score(lemma_ids)
|
168
|
+
def calculate_score(lemma_ids, polarities_hash)
|
138
169
|
polarities = []
|
139
170
|
|
140
171
|
lemma_ids.each do |id|
|
141
172
|
polarities << polarities_hash[id]
|
142
|
-
end
|
143
|
-
|
173
|
+
end
|
174
|
+
|
144
175
|
positive = polarities.flatten.count(:positive)
|
145
176
|
negative = polarities.flatten.count(:negative)
|
146
|
-
|
177
|
+
|
147
178
|
return if (positive + negative) == 0
|
148
179
|
|
149
180
|
score = ((positive - negative).to_f) / (positive + negative)
|
data/lib/opener/scorer/server.rb
CHANGED
@@ -1,16 +1,15 @@
|
|
1
|
-
require '
|
2
|
-
require 'nokogiri'
|
1
|
+
require 'opener/webservice'
|
3
2
|
|
4
3
|
module Opener
|
5
4
|
class Scorer
|
6
|
-
|
5
|
+
##
|
6
|
+
# Server for storing scorer data in MySQL.
|
7
|
+
#
|
8
|
+
class Server < Webservice::Server
|
9
|
+
set :views, File.expand_path('../views', __FILE__)
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
output.uuid = params[:request_id]
|
11
|
-
output.text = OutputProcessor.new(params[:input]).process.to_json
|
12
|
-
output.save
|
13
|
-
end
|
11
|
+
self.text_processor = OutputProcessor
|
12
|
+
self.accepted_params = [:input, :request_id]
|
14
13
|
|
15
14
|
get '/' do
|
16
15
|
if params[:request_id]
|
@@ -22,31 +21,19 @@ module Opener
|
|
22
21
|
|
23
22
|
get '/:request_id' do
|
24
23
|
unless params[:request_id] == 'favicon.ico'
|
25
|
-
|
26
|
-
output = Output.find_by_uuid(params[:request_id])
|
24
|
+
output = Output.find_by_uuid(params[:request_id])
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
scores = JSON.parse(output.text)
|
31
|
-
body( {:uuid=>output.uuid, :scores=>scores}.to_json)
|
32
|
-
else
|
33
|
-
halt(404, "No record found for ID #{params[:request_id]}")
|
34
|
-
end
|
35
|
-
rescue => error
|
36
|
-
error_callback = params[:error_callback]
|
26
|
+
if output
|
27
|
+
content_type(:json)
|
37
28
|
|
38
|
-
|
29
|
+
scores = JSON.parse(output.text)
|
39
30
|
|
40
|
-
|
31
|
+
body({:uuid=>output.uuid, :scores=>scores}.to_json)
|
32
|
+
else
|
33
|
+
halt(404, "No record found for ID #{params[:request_id]}")
|
41
34
|
end
|
42
35
|
end
|
43
36
|
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
def submit_error(url, message)
|
48
|
-
HTTPClient.post(url, :body => {:error => message})
|
49
|
-
end
|
50
37
|
end # Server
|
51
38
|
end # Scorer
|
52
39
|
end # Opener
|
data/opener-scorer.gemspec
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
require File.expand_path('../lib/opener/scorer/version', __FILE__)
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
|
-
gem.name
|
5
|
-
gem.version
|
6
|
-
gem.authors
|
7
|
-
gem.summary
|
8
|
-
gem.description
|
9
|
-
gem.homepage
|
10
|
-
gem.has_rdoc
|
4
|
+
gem.name = 'opener-scorer'
|
5
|
+
gem.version = Opener::Scorer::VERSION
|
6
|
+
gem.authors = ['development@olery.com']
|
7
|
+
gem.summary = 'Component for calculating scores of KAF documents'
|
8
|
+
gem.description = gem.summary
|
9
|
+
gem.homepage = "http://opener-project.github.com/"
|
10
|
+
gem.has_rdoc = 'yard'
|
11
|
+
gem.license = 'Apache 2.0'
|
12
|
+
|
11
13
|
gem.required_ruby_version = '>= 1.9.2'
|
12
|
-
gem.license = 'Apache 2.0'
|
13
14
|
|
14
15
|
gem.files = Dir.glob([
|
15
16
|
'config/**/*',
|
@@ -24,17 +25,15 @@ Gem::Specification.new do |gem|
|
|
24
25
|
gem.executables = Dir.glob('bin/*').map { |file| File.basename(file) }
|
25
26
|
|
26
27
|
gem.add_dependency 'builder'
|
27
|
-
gem.add_dependency 'sinatra', '~>1.4.2'
|
28
|
-
gem.add_dependency 'sinatra-contrib'
|
29
28
|
gem.add_dependency 'nokogiri'
|
30
|
-
gem.add_dependency '
|
31
|
-
gem.add_dependency 'uuidtools'
|
32
|
-
gem.add_dependency 'puma'
|
33
|
-
gem.add_dependency 'opener-daemons'
|
29
|
+
gem.add_dependency 'slop', '~> 3.5'
|
34
30
|
gem.add_dependency 'jdbc-mysql'
|
35
31
|
gem.add_dependency 'activerecord-jdbcmysql-adapter'
|
36
|
-
gem.add_dependency 'activerecord', '~>3.2'
|
37
|
-
|
32
|
+
gem.add_dependency 'activerecord', '~> 3.2'
|
33
|
+
|
34
|
+
gem.add_dependency 'opener-daemons', '~> 2.2'
|
35
|
+
gem.add_dependency 'opener-webservice', '~> 2.1'
|
36
|
+
gem.add_dependency 'opener-core', '~> 2.2'
|
38
37
|
|
39
38
|
gem.add_development_dependency 'rspec'
|
40
39
|
gem.add_development_dependency 'cucumber'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opener-scorer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- development@olery.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -24,34 +24,6 @@ dependencies:
|
|
24
24
|
version: '0'
|
25
25
|
prerelease: false
|
26
26
|
type: :runtime
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: sinatra
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.4.2
|
34
|
-
requirement: !ruby/object:Gem::Requirement
|
35
|
-
requirements:
|
36
|
-
- - ~>
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: 1.4.2
|
39
|
-
prerelease: false
|
40
|
-
type: :runtime
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: sinatra-contrib
|
43
|
-
version_requirements: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
requirements:
|
50
|
-
- - '>='
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '0'
|
53
|
-
prerelease: false
|
54
|
-
type: :runtime
|
55
27
|
- !ruby/object:Gem::Dependency
|
56
28
|
name: nokogiri
|
57
29
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -67,35 +39,21 @@ dependencies:
|
|
67
39
|
prerelease: false
|
68
40
|
type: :runtime
|
69
41
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
71
|
-
version_requirements: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
requirement: !ruby/object:Gem::Requirement
|
77
|
-
requirements:
|
78
|
-
- - '>='
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version: '0'
|
81
|
-
prerelease: false
|
82
|
-
type: :runtime
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: uuidtools
|
42
|
+
name: slop
|
85
43
|
version_requirements: !ruby/object:Gem::Requirement
|
86
44
|
requirements:
|
87
|
-
- -
|
45
|
+
- - ~>
|
88
46
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
47
|
+
version: '3.5'
|
90
48
|
requirement: !ruby/object:Gem::Requirement
|
91
49
|
requirements:
|
92
|
-
- -
|
50
|
+
- - ~>
|
93
51
|
- !ruby/object:Gem::Version
|
94
|
-
version: '
|
52
|
+
version: '3.5'
|
95
53
|
prerelease: false
|
96
54
|
type: :runtime
|
97
55
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
56
|
+
name: jdbc-mysql
|
99
57
|
version_requirements: !ruby/object:Gem::Requirement
|
100
58
|
requirements:
|
101
59
|
- - '>='
|
@@ -109,7 +67,7 @@ dependencies:
|
|
109
67
|
prerelease: false
|
110
68
|
type: :runtime
|
111
69
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
70
|
+
name: activerecord-jdbcmysql-adapter
|
113
71
|
version_requirements: !ruby/object:Gem::Requirement
|
114
72
|
requirements:
|
115
73
|
- - '>='
|
@@ -123,59 +81,59 @@ dependencies:
|
|
123
81
|
prerelease: false
|
124
82
|
type: :runtime
|
125
83
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
84
|
+
name: activerecord
|
127
85
|
version_requirements: !ruby/object:Gem::Requirement
|
128
86
|
requirements:
|
129
|
-
- -
|
87
|
+
- - ~>
|
130
88
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
89
|
+
version: '3.2'
|
132
90
|
requirement: !ruby/object:Gem::Requirement
|
133
91
|
requirements:
|
134
|
-
- -
|
92
|
+
- - ~>
|
135
93
|
- !ruby/object:Gem::Version
|
136
|
-
version: '
|
94
|
+
version: '3.2'
|
137
95
|
prerelease: false
|
138
96
|
type: :runtime
|
139
97
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
98
|
+
name: opener-daemons
|
141
99
|
version_requirements: !ruby/object:Gem::Requirement
|
142
100
|
requirements:
|
143
|
-
- -
|
101
|
+
- - ~>
|
144
102
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
103
|
+
version: '2.2'
|
146
104
|
requirement: !ruby/object:Gem::Requirement
|
147
105
|
requirements:
|
148
|
-
- -
|
106
|
+
- - ~>
|
149
107
|
- !ruby/object:Gem::Version
|
150
|
-
version: '
|
108
|
+
version: '2.2'
|
151
109
|
prerelease: false
|
152
110
|
type: :runtime
|
153
111
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
112
|
+
name: opener-webservice
|
155
113
|
version_requirements: !ruby/object:Gem::Requirement
|
156
114
|
requirements:
|
157
115
|
- - ~>
|
158
116
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
117
|
+
version: '2.1'
|
160
118
|
requirement: !ruby/object:Gem::Requirement
|
161
119
|
requirements:
|
162
120
|
- - ~>
|
163
121
|
- !ruby/object:Gem::Version
|
164
|
-
version: '
|
122
|
+
version: '2.1'
|
165
123
|
prerelease: false
|
166
124
|
type: :runtime
|
167
125
|
- !ruby/object:Gem::Dependency
|
168
|
-
name: opener-
|
126
|
+
name: opener-core
|
169
127
|
version_requirements: !ruby/object:Gem::Requirement
|
170
128
|
requirements:
|
171
|
-
- -
|
129
|
+
- - ~>
|
172
130
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
131
|
+
version: '2.2'
|
174
132
|
requirement: !ruby/object:Gem::Requirement
|
175
133
|
requirements:
|
176
|
-
- -
|
134
|
+
- - ~>
|
177
135
|
- !ruby/object:Gem::Version
|
178
|
-
version: '
|
136
|
+
version: '2.2'
|
179
137
|
prerelease: false
|
180
138
|
type: :runtime
|
181
139
|
- !ruby/object:Gem::Dependency
|
@@ -234,30 +192,31 @@ dependencies:
|
|
234
192
|
version: '0'
|
235
193
|
prerelease: false
|
236
194
|
type: :development
|
237
|
-
description:
|
195
|
+
description: Component for calculating scores of KAF documents
|
238
196
|
email:
|
239
197
|
executables:
|
240
|
-
- scorer
|
241
|
-
- scorer-daemon
|
242
198
|
- scorer-server
|
199
|
+
- scorer-daemon
|
200
|
+
- scorer
|
243
201
|
extensions: []
|
244
202
|
extra_rdoc_files: []
|
245
203
|
files:
|
246
204
|
- config/database.rb
|
247
205
|
- lib/opener/scorer.rb
|
206
|
+
- lib/opener/scorer/version.rb
|
248
207
|
- lib/opener/scorer/output.rb
|
249
|
-
- lib/opener/scorer/output_processor.rb
|
250
208
|
- lib/opener/scorer/server.rb
|
251
|
-
- lib/opener/scorer/
|
209
|
+
- lib/opener/scorer/cli.rb
|
210
|
+
- lib/opener/scorer/output_processor.rb
|
252
211
|
- lib/opener/scorer/views/index.erb
|
253
212
|
- config.ru
|
254
213
|
- opener-scorer.gemspec
|
255
214
|
- README.md
|
256
215
|
- LICENSE.txt
|
257
216
|
- exec/scorer.rb
|
258
|
-
- bin/scorer
|
259
|
-
- bin/scorer-daemon
|
260
217
|
- bin/scorer-server
|
218
|
+
- bin/scorer-daemon
|
219
|
+
- bin/scorer
|
261
220
|
homepage: http://opener-project.github.com/
|
262
221
|
licenses:
|
263
222
|
- Apache 2.0
|
@@ -281,5 +240,6 @@ rubyforge_project:
|
|
281
240
|
rubygems_version: 2.1.9
|
282
241
|
signing_key:
|
283
242
|
specification_version: 4
|
284
|
-
summary:
|
243
|
+
summary: Component for calculating scores of KAF documents
|
285
244
|
test_files: []
|
245
|
+
has_rdoc: yard
|