opener-opinion-detector 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/opener/opinion_detector.rb +1 -2
- data/lib/opener/opinion_detector/version.rb +1 -1
- data/lib/opener/opinion_detector/views/index.erb +1 -1
- data/opener-opinion-detector.gemspec +1 -1
- metadata +77 -80
- data/lib/opener/opinion_detector/error_layer.rb +0 -89
- data/lib/opener/opinion_detector/views/result.erb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd4ccf126d4764aa0f03767d416de983926ff459
|
4
|
+
data.tar.gz: 31f562c0407fbb527e16be99bf573cda8666be94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5606e384090e8f7775133cc1c1d9bbe5a7506a8f98829e833c7a0df1792c2ed34dde65038dab74580fd051a896f7a8cf5215ff53f32fc3ed1a0ca9abd3a57b89
|
7
|
+
data.tar.gz: 4a1f448a2a61141e43ffb84d3962327a36ac5120ee1b2858450d019ef47a2f30737ce4084bdca2395ac93908277256cb4d7e8425b769ed7e8651d4cb19cb3734
|
@@ -5,7 +5,6 @@ require 'optparse'
|
|
5
5
|
|
6
6
|
require_relative 'opinion_detector/version'
|
7
7
|
require_relative 'opinion_detector/cli'
|
8
|
-
require_relative 'opinion_detector/error_layer'
|
9
8
|
|
10
9
|
module Opener
|
11
10
|
##
|
@@ -58,7 +57,7 @@ module Opener
|
|
58
57
|
return stdout
|
59
58
|
|
60
59
|
rescue Exception => error
|
61
|
-
return ErrorLayer.new(input, error.message, self.class).add
|
60
|
+
return Opener::Core::ErrorLayer.new(input, error.message, self.class).add
|
62
61
|
end
|
63
62
|
end
|
64
63
|
|
@@ -126,7 +126,7 @@
|
|
126
126
|
<p>* required</p>
|
127
127
|
<p>** When entering a value no response will be displayed in the browser.</p>
|
128
128
|
|
129
|
-
<form action="
|
129
|
+
<form action="" method="POST">
|
130
130
|
<div>
|
131
131
|
<label for="input"/>Type your text here*</label>
|
132
132
|
<br/>
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
|
|
26
26
|
gem.add_dependency 'httpclient'
|
27
27
|
gem.add_dependency 'puma'
|
28
28
|
gem.add_dependency 'opener-daemons'
|
29
|
-
gem.add_dependency 'opener-core', '~> 1.0'
|
29
|
+
gem.add_dependency 'opener-core', '~> 1.0.2'
|
30
30
|
gem.add_dependency 'opener-webservice'
|
31
31
|
|
32
32
|
gem.add_development_dependency 'rspec'
|
metadata
CHANGED
@@ -1,189 +1,189 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opener-opinion-detector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- development@olery.com
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opener-opinion-detector-base
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
15
20
|
requirement: !ruby/object:Gem::Requirement
|
16
21
|
requirements:
|
17
|
-
- -
|
22
|
+
- - '>='
|
18
23
|
- !ruby/object:Gem::Version
|
19
24
|
version: '0'
|
20
|
-
type: :runtime
|
21
25
|
prerelease: false
|
26
|
+
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
22
29
|
version_requirements: !ruby/object:Gem::Requirement
|
23
30
|
requirements:
|
24
|
-
- -
|
31
|
+
- - '>='
|
25
32
|
- !ruby/object:Gem::Version
|
26
33
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: nokogiri
|
29
34
|
requirement: !ruby/object:Gem::Requirement
|
30
35
|
requirements:
|
31
|
-
- -
|
36
|
+
- - '>='
|
32
37
|
- !ruby/object:Gem::Version
|
33
38
|
version: '0'
|
34
|
-
type: :runtime
|
35
39
|
prerelease: false
|
40
|
+
type: :runtime
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sinatra
|
36
43
|
version_requirements: !ruby/object:Gem::Requirement
|
37
44
|
requirements:
|
38
|
-
- -
|
45
|
+
- - ~>
|
39
46
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: sinatra
|
47
|
+
version: 1.4.2
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
44
49
|
requirements:
|
45
|
-
- -
|
50
|
+
- - ~>
|
46
51
|
- !ruby/object:Gem::Version
|
47
52
|
version: 1.4.2
|
48
|
-
type: :runtime
|
49
53
|
prerelease: false
|
54
|
+
type: :runtime
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: httpclient
|
50
57
|
version_requirements: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - '>='
|
53
60
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: httpclient
|
61
|
+
version: '0'
|
57
62
|
requirement: !ruby/object:Gem::Requirement
|
58
63
|
requirements:
|
59
|
-
- -
|
64
|
+
- - '>='
|
60
65
|
- !ruby/object:Gem::Version
|
61
66
|
version: '0'
|
62
|
-
type: :runtime
|
63
67
|
prerelease: false
|
68
|
+
type: :runtime
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: puma
|
64
71
|
version_requirements: !ruby/object:Gem::Requirement
|
65
72
|
requirements:
|
66
|
-
- -
|
73
|
+
- - '>='
|
67
74
|
- !ruby/object:Gem::Version
|
68
75
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: puma
|
71
76
|
requirement: !ruby/object:Gem::Requirement
|
72
77
|
requirements:
|
73
|
-
- -
|
78
|
+
- - '>='
|
74
79
|
- !ruby/object:Gem::Version
|
75
80
|
version: '0'
|
76
|
-
type: :runtime
|
77
81
|
prerelease: false
|
82
|
+
type: :runtime
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: opener-daemons
|
78
85
|
version_requirements: !ruby/object:Gem::Requirement
|
79
86
|
requirements:
|
80
|
-
- -
|
87
|
+
- - '>='
|
81
88
|
- !ruby/object:Gem::Version
|
82
89
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: opener-daemons
|
85
90
|
requirement: !ruby/object:Gem::Requirement
|
86
91
|
requirements:
|
87
|
-
- -
|
92
|
+
- - '>='
|
88
93
|
- !ruby/object:Gem::Version
|
89
94
|
version: '0'
|
90
|
-
type: :runtime
|
91
95
|
prerelease: false
|
96
|
+
type: :runtime
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: opener-core
|
92
99
|
version_requirements: !ruby/object:Gem::Requirement
|
93
100
|
requirements:
|
94
|
-
- -
|
101
|
+
- - ~>
|
95
102
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: opener-core
|
103
|
+
version: 1.0.2
|
99
104
|
requirement: !ruby/object:Gem::Requirement
|
100
105
|
requirements:
|
101
|
-
- -
|
106
|
+
- - ~>
|
102
107
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
104
|
-
type: :runtime
|
108
|
+
version: 1.0.2
|
105
109
|
prerelease: false
|
110
|
+
type: :runtime
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: opener-webservice
|
106
113
|
version_requirements: !ruby/object:Gem::Requirement
|
107
114
|
requirements:
|
108
|
-
- -
|
115
|
+
- - '>='
|
109
116
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: opener-webservice
|
117
|
+
version: '0'
|
113
118
|
requirement: !ruby/object:Gem::Requirement
|
114
119
|
requirements:
|
115
|
-
- -
|
120
|
+
- - '>='
|
116
121
|
- !ruby/object:Gem::Version
|
117
122
|
version: '0'
|
118
|
-
type: :runtime
|
119
123
|
prerelease: false
|
124
|
+
type: :runtime
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec
|
120
127
|
version_requirements: !ruby/object:Gem::Requirement
|
121
128
|
requirements:
|
122
|
-
- -
|
129
|
+
- - '>='
|
123
130
|
- !ruby/object:Gem::Version
|
124
131
|
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rspec
|
127
132
|
requirement: !ruby/object:Gem::Requirement
|
128
133
|
requirements:
|
129
|
-
- -
|
134
|
+
- - '>='
|
130
135
|
- !ruby/object:Gem::Version
|
131
136
|
version: '0'
|
132
|
-
type: :development
|
133
137
|
prerelease: false
|
138
|
+
type: :development
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: cucumber
|
134
141
|
version_requirements: !ruby/object:Gem::Requirement
|
135
142
|
requirements:
|
136
|
-
- -
|
143
|
+
- - '>='
|
137
144
|
- !ruby/object:Gem::Version
|
138
145
|
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: cucumber
|
141
146
|
requirement: !ruby/object:Gem::Requirement
|
142
147
|
requirements:
|
143
|
-
- -
|
148
|
+
- - '>='
|
144
149
|
- !ruby/object:Gem::Version
|
145
150
|
version: '0'
|
146
|
-
type: :development
|
147
151
|
prerelease: false
|
152
|
+
type: :development
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: pry
|
148
155
|
version_requirements: !ruby/object:Gem::Requirement
|
149
156
|
requirements:
|
150
|
-
- -
|
157
|
+
- - '>='
|
151
158
|
- !ruby/object:Gem::Version
|
152
159
|
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: pry
|
155
160
|
requirement: !ruby/object:Gem::Requirement
|
156
161
|
requirements:
|
157
|
-
- -
|
162
|
+
- - '>='
|
158
163
|
- !ruby/object:Gem::Version
|
159
164
|
version: '0'
|
160
|
-
type: :development
|
161
165
|
prerelease: false
|
166
|
+
type: :development
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rake
|
162
169
|
version_requirements: !ruby/object:Gem::Requirement
|
163
170
|
requirements:
|
164
|
-
- -
|
171
|
+
- - '>='
|
165
172
|
- !ruby/object:Gem::Version
|
166
173
|
version: '0'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: rake
|
169
174
|
requirement: !ruby/object:Gem::Requirement
|
170
175
|
requirements:
|
171
|
-
- -
|
176
|
+
- - '>='
|
172
177
|
- !ruby/object:Gem::Version
|
173
178
|
version: '0'
|
174
|
-
type: :development
|
175
179
|
prerelease: false
|
176
|
-
|
177
|
-
requirements:
|
178
|
-
- - ">="
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '0'
|
180
|
+
type: :development
|
181
181
|
description: Gem that wraps up the different existing opinion detectors
|
182
|
-
email:
|
182
|
+
email:
|
183
183
|
executables:
|
184
|
-
- opinion-detector-server
|
185
184
|
- opinion-detector
|
186
185
|
- opinion-detector-daemon
|
186
|
+
- opinion-detector-server
|
187
187
|
extensions: []
|
188
188
|
extra_rdoc_files: []
|
189
189
|
files:
|
@@ -195,35 +195,32 @@ files:
|
|
195
195
|
- exec/opinion-detector.rb
|
196
196
|
- lib/opener/opinion_detector.rb
|
197
197
|
- lib/opener/opinion_detector/cli.rb
|
198
|
-
- lib/opener/opinion_detector/error_layer.rb
|
199
198
|
- lib/opener/opinion_detector/public/markdown.css
|
200
199
|
- lib/opener/opinion_detector/server.rb
|
201
200
|
- lib/opener/opinion_detector/version.rb
|
202
201
|
- lib/opener/opinion_detector/views/index.erb
|
203
|
-
- lib/opener/opinion_detector/views/result.erb
|
204
202
|
- opener-opinion-detector.gemspec
|
205
203
|
homepage: http://opener-project.github.com/
|
206
204
|
licenses: []
|
207
205
|
metadata: {}
|
208
|
-
post_install_message:
|
206
|
+
post_install_message:
|
209
207
|
rdoc_options: []
|
210
208
|
require_paths:
|
211
209
|
- lib
|
212
210
|
required_ruby_version: !ruby/object:Gem::Requirement
|
213
211
|
requirements:
|
214
|
-
- -
|
212
|
+
- - '>='
|
215
213
|
- !ruby/object:Gem::Version
|
216
214
|
version: 1.9.2
|
217
215
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
216
|
requirements:
|
219
|
-
- -
|
217
|
+
- - '>='
|
220
218
|
- !ruby/object:Gem::Version
|
221
219
|
version: '0'
|
222
220
|
requirements: []
|
223
|
-
rubyforge_project:
|
221
|
+
rubyforge_project:
|
224
222
|
rubygems_version: 2.2.2
|
225
|
-
signing_key:
|
223
|
+
signing_key:
|
226
224
|
specification_version: 4
|
227
225
|
summary: Gem that wraps up the different existing opinion detectors
|
228
226
|
test_files: []
|
229
|
-
has_rdoc: yard
|
@@ -1,89 +0,0 @@
|
|
1
|
-
module Opener
|
2
|
-
class OpinionDetector
|
3
|
-
##
|
4
|
-
# Add Error Layer to KAF file instead of throwing an error.
|
5
|
-
#
|
6
|
-
class ErrorLayer
|
7
|
-
attr_accessor :input, :document, :error, :klass
|
8
|
-
|
9
|
-
def initialize(input, error, klass)
|
10
|
-
@input = input.to_s
|
11
|
-
# Make sure there is always a document, even if it is empty.
|
12
|
-
@document = Nokogiri::XML(input) rescue Nokogiri::XML(nil)
|
13
|
-
@error = error
|
14
|
-
@klass = klass
|
15
|
-
end
|
16
|
-
|
17
|
-
def add
|
18
|
-
if is_xml?
|
19
|
-
unless has_errors_layer?
|
20
|
-
add_errors_layer
|
21
|
-
end
|
22
|
-
else
|
23
|
-
add_root
|
24
|
-
add_text
|
25
|
-
add_errors_layer
|
26
|
-
end
|
27
|
-
add_error
|
28
|
-
|
29
|
-
xml = !!document.encoding ? document.to_xml : document.to_xml(:encoding => "UTF-8")
|
30
|
-
|
31
|
-
return xml
|
32
|
-
end
|
33
|
-
|
34
|
-
##
|
35
|
-
# Check if the document is a valid XML file.
|
36
|
-
#
|
37
|
-
def is_xml?
|
38
|
-
!!document.root
|
39
|
-
end
|
40
|
-
|
41
|
-
##
|
42
|
-
# Add root element to the XML file.
|
43
|
-
#
|
44
|
-
def add_root
|
45
|
-
root = Nokogiri::XML::Node.new "KAF", document
|
46
|
-
document.add_child(root)
|
47
|
-
end
|
48
|
-
|
49
|
-
##
|
50
|
-
# Check if the document already has an errors layer.
|
51
|
-
#
|
52
|
-
def has_errors_layer?
|
53
|
-
!!document.at('errors')
|
54
|
-
end
|
55
|
-
|
56
|
-
##
|
57
|
-
# Add errors element to the XML file.
|
58
|
-
#
|
59
|
-
def add_errors_layer
|
60
|
-
node = Nokogiri::XML::Node.new "errors", document
|
61
|
-
document.root.add_child(node)
|
62
|
-
end
|
63
|
-
|
64
|
-
##
|
65
|
-
# Add the text file incase it is not a valid XML document. More
|
66
|
-
# info for debugging.
|
67
|
-
#
|
68
|
-
def add_text
|
69
|
-
node = Nokogiri::XML::Node.new "raw", document
|
70
|
-
node.inner_html = input
|
71
|
-
document.root.add_child(node)
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
##
|
76
|
-
# Add the actual error to the errors layer.
|
77
|
-
#
|
78
|
-
def add_error
|
79
|
-
node = document.at('errors')
|
80
|
-
error_node = Nokogiri::XML::Node.new "error", node
|
81
|
-
error_node['class'] = klass.to_s
|
82
|
-
error_node['version'] = klass::VERSION
|
83
|
-
error_node.inner_html = error
|
84
|
-
node.add_child(error_node)
|
85
|
-
end
|
86
|
-
|
87
|
-
end # ErrorLayer
|
88
|
-
end # OpinionDetector
|
89
|
-
end # Opener
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<link type="text/css" rel="stylesheet" charset="UTF-8" href="markdown.css"/>
|
5
|
-
<title>Language Detector Webservice</title>
|
6
|
-
</head>
|
7
|
-
<body>
|
8
|
-
<h1>Output URL</h1>
|
9
|
-
<p>
|
10
|
-
When ready, you can view the result
|
11
|
-
<a href=<%= output_url %>>here</a>
|
12
|
-
</p>
|
13
|
-
|
14
|
-
</body>
|
15
|
-
</html>
|