opener-scorer 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -11
- data/lib/opener/scorer/output_processor.rb +23 -19
- data/lib/opener/scorer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8802ca3c86e72507ce243c6e2badbeb7faf085f5
|
4
|
+
data.tar.gz: 0cb8522c369dd16acbead79b80b8e999f03ca91a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97ca8dfa7f8685c4068d9fb2b1e2c776146ab641c8f236efea452dfb9bfed031af42653f463dd1795414630d70ece2db7a7fe43af67cd1a6e38a5d7114210535
|
7
|
+
data.tar.gz: 198af49a23c4f18fffef93ca42d8f5615c1d8a17a4cf218e5d010d64768d10e8e922353e15502a8320bbd40687f9c3563bbb3e46910298d8bedce994ba8f8e8e
|
data/README.md
CHANGED
@@ -69,16 +69,6 @@ At least you need the following system setup:
|
|
69
69
|
|
70
70
|
* JRuby 1.7.9 or newer
|
71
71
|
|
72
|
-
Domain Adaption
|
73
|
-
---------------
|
74
|
-
|
75
|
-
TODO
|
76
|
-
|
77
|
-
Language Extension
|
78
|
-
------------------
|
79
|
-
|
80
|
-
TODO
|
81
|
-
|
82
72
|
The Core
|
83
73
|
--------
|
84
74
|
|
@@ -89,7 +79,7 @@ The component is a fat wrapper around the actual language technology core. You c
|
|
89
79
|
Where to go from here
|
90
80
|
---------------------
|
91
81
|
|
92
|
-
* [Check the project
|
82
|
+
* [Check the project website](http://opener-project.github.io)
|
93
83
|
* [Checkout the webservice](http://opener.olery.com/scorer)
|
94
84
|
|
95
85
|
Report problem/Get help
|
@@ -78,18 +78,20 @@ module Opener
|
|
78
78
|
# Create a hash with all lemma ids that have a polarity.
|
79
79
|
#
|
80
80
|
def build_polarities_hash
|
81
|
-
input.at('opinions')
|
82
|
-
|
83
|
-
|
84
|
-
opinion.at('opinion_target')
|
85
|
-
|
86
|
-
|
81
|
+
if opinions = input.at('opinions')
|
82
|
+
opinions.css('opinion').each do |opinion|
|
83
|
+
polarity = opinion.at('opinion_expression').attr('polarity').to_sym
|
84
|
+
if opinion.at('opinion_target')
|
85
|
+
opinion.at('opinion_target').css('span target').each do |target|
|
86
|
+
polarities_hash[target.attr('id')] ||= []
|
87
|
+
polarities_hash[target.attr('id')] << polarity
|
88
|
+
end
|
87
89
|
end
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
if targets = opinion.at('opinion_expression')
|
91
|
+
opinion.at('opinion_expression').css('span target').each do |target|
|
92
|
+
polarities_hash[target.attr('id')] ||= []
|
93
|
+
polarities_hash[target.attr('id')] << polarity
|
94
|
+
end
|
93
95
|
end
|
94
96
|
end
|
95
97
|
end
|
@@ -101,18 +103,20 @@ module Opener
|
|
101
103
|
# @return [Float]
|
102
104
|
#
|
103
105
|
def get_overall_score
|
106
|
+
score = 0
|
104
107
|
polarities = []
|
105
|
-
input.at('opinions')
|
106
|
-
|
107
|
-
|
108
|
+
if opinions = input.at('opinions')
|
109
|
+
input.at('opinions').css('opinion').each do |opinion|
|
110
|
+
polarities << opinion.at('opinion_expression').attr('polarity').to_sym
|
111
|
+
end
|
108
112
|
|
109
|
-
|
110
|
-
|
113
|
+
positive = polarities.count(:positive)
|
114
|
+
negative = polarities.count(:negative)
|
111
115
|
|
112
|
-
|
113
|
-
|
114
|
-
score = ((positive - negative).to_f) / (positive + negative)
|
116
|
+
return if (positive + negative) == 0
|
115
117
|
|
118
|
+
score = ((positive - negative).to_f) / (positive + negative)
|
119
|
+
end
|
116
120
|
return score
|
117
121
|
end
|
118
122
|
|
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: 1.1.
|
4
|
+
version: 1.1.1
|
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-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|