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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4187df29dee8957fae802117f08a7ec12650227
4
- data.tar.gz: 1066aa4aadd7ae98f9542ab7eefa665401916eb5
3
+ metadata.gz: 8802ca3c86e72507ce243c6e2badbeb7faf085f5
4
+ data.tar.gz: 0cb8522c369dd16acbead79b80b8e999f03ca91a
5
5
  SHA512:
6
- metadata.gz: 81598a43002dddbb215da11e8f0d5e2d50d513a20ef86b0d55a853a420b25c30680a361562d6daac4bbe5ab132c99b2782b52cf40567fd5869245cc8aca8a4af
7
- data.tar.gz: b5bad591a495a08dbf2e5c5fd7de25c8d419bb3e4b066de533b065ed32244c12a80579a39489e2059cf7c0effeaf6c2c1c01861f2dea39489477ed7260152e09
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 websitere](http://opener-project.github.io)
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').css('opinion').each do |opinion|
82
- polarity = opinion.at('opinion_expression').attr('polarity').to_sym
83
- if opinion.at('opinion_target')
84
- opinion.at('opinion_target').css('span target').each do |target|
85
- polarities_hash[target.attr('id')] ||= []
86
- polarities_hash[target.attr('id')] << polarity
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
- end
89
- if targets = opinion.at('opinion_expression')
90
- opinion.at('opinion_expression').css('span target').each do |target|
91
- polarities_hash[target.attr('id')] ||= []
92
- polarities_hash[target.attr('id')] << polarity
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').css('opinion').each do |opinion|
106
- polarities << opinion.at('opinion_expression').attr('polarity').to_sym
107
- end
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
- positive = polarities.count(:positive)
110
- negative = polarities.count(:negative)
113
+ positive = polarities.count(:positive)
114
+ negative = polarities.count(:negative)
111
115
 
112
- return if (positive + negative) == 0
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
 
@@ -1,5 +1,5 @@
1
1
  module Opener
2
2
  class Scorer
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
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.0
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-05-29 00:00:00.000000000 Z
11
+ date: 2014-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder