dover_to_calais 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.yardopts +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +77 -0
- data/Rakefile +1 -0
- data/dover_to_calais.gemspec +33 -0
- data/lib/dover_to_calais.rb +279 -0
- data/lib/dover_to_calais/ontology.rb +147 -0
- data/lib/dover_to_calais/version.rb +3 -0
- metadata +156 -0
data/.gitignore
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Fred Heath
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# DoverToCalais
|
2
|
+
|
3
|
+
DoverToCalais allows the user to send a wide range of data sources (files & URLs)
|
4
|
+
to [OpenCalais](http://www.opencalais.com/about) and receive asynchronous responses when [OpenCalais](http://www.opencalais.com/about) has finished processing
|
5
|
+
the inputs. In addition, DoverToCalais enables the filtering of the response in order to
|
6
|
+
find relevant tags and/or tag values.
|
7
|
+
|
8
|
+
## What is OpenCalais?
|
9
|
+
In short -and quoting the [OpenCalais](http://www.opencalais.com/about) creators:
|
10
|
+
|
11
|
+
*The OpenCalais Web Service automatically creates rich semantic metadata for the content you submit – in well under a second. Using natural language processing (NLP), machine learning and other methods, Calais analyzes your document and finds the entities within it. But, Calais goes well beyond classic entity identification and returns the facts and events hidden within your text as well.*
|
12
|
+
|
13
|
+
## Why use OpenCalais?
|
14
|
+
There are many reasons, mainly to:
|
15
|
+
|
16
|
+
* incorporate tags into other applications, such as search, news aggregation, blogs, catalogs, etc.
|
17
|
+
* enrich search by looking for deeper, contextual meaning instead of merely phrases or keywords.
|
18
|
+
* help to discern relationships between semantic entities.
|
19
|
+
* facilitate data processing and analysis by allowing easy filtering of relevant data sources and the discarding of irrelevant ones.
|
20
|
+
|
21
|
+
|
22
|
+
## DoverToCalais Features
|
23
|
+
1. **Supports many data sources**: Thanks to the power of [Yomu](https://github.com/Erol/yomu), DoverToCalais can process a vast range of files (and, of course, web pages), extract text from them and send
|
24
|
+
them to OpenCalais for analysis and tag generation.
|
25
|
+
|
26
|
+
2. **Asynchronous responses (callbacks)**:
|
27
|
+
Users can set callbacks to receive the processed meta-data, once the OpenCalais Web Service response has been received.
|
28
|
+
Furthermore, a user can set multiple callbacks for the same request (data source), thus enabling cleaner,
|
29
|
+
more modular code.
|
30
|
+
|
31
|
+
3. **Result filtering**: DoverToCalais uses the OpenCalais [Simple XML Format](http://www.opencalais.com/documentation/calais-web-service-api/interpreting-api-response/simple-format) as its preferred response format. The user can work directly with the XML-formatted response, or -if feeling a bit lazy- can take advantage of the DoverToCalais filtering functionality and receive specific entities, optionally based on specified conditions.
|
32
|
+
|
33
|
+
For more details of the features and code samples, see [Usage](#usage).
|
34
|
+
|
35
|
+
##Pre-requisites
|
36
|
+
|
37
|
+
To use the OpenCalais Web Service and -by extension- DoverToCalais, one needs to possess an OpenCalais API key, which is easily obtainable from the [OpenCalais web site](http://www.opencalais.com/APIkey).
|
38
|
+
|
39
|
+
Also, DoverToCalais requires the presence of a working [JRE](http://en.wikipedia.org/wiki/JRE#Execution_environment).
|
40
|
+
|
41
|
+
|
42
|
+
## Installation
|
43
|
+
|
44
|
+
Add this line to your application's Gemfile:
|
45
|
+
|
46
|
+
gem 'dover_to_calais'
|
47
|
+
|
48
|
+
And then execute:
|
49
|
+
|
50
|
+
$ bundle
|
51
|
+
|
52
|
+
Or install it yourself as:
|
53
|
+
|
54
|
+
$ gem install dover_to_calais
|
55
|
+
|
56
|
+
## Dependencies
|
57
|
+
DoverToCalais has been developed in Ruby 1.9.3 and requires the following gems (for development purposes only)
|
58
|
+
|
59
|
+
* 'nokogiri', 1.6.0
|
60
|
+
* 'eventmachine', 1.0.3
|
61
|
+
* 'em-http-request', 1.1.0
|
62
|
+
* 'open-uri',
|
63
|
+
* 'yomu', 0.1.9
|
64
|
+
|
65
|
+
As [Yomu](https://github.com/Erol/yomu) depends on a working JRE in order to function, so does DoverToCalais.
|
66
|
+
|
67
|
+
## Usage
|
68
|
+
|
69
|
+
TODO: Write usage instructions here
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
1. Fork it
|
74
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
75
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
76
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
77
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'dover_to_calais/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dover_to_calais"
|
8
|
+
spec.version = DoverToCalais::VERSION
|
9
|
+
spec.authors = ["Fred Heath"]
|
10
|
+
spec.email = ["fred@bootstrap.me.uk"]
|
11
|
+
spec.description = %q{DoverToCalais allows the user to send a wide range of data sources (files & URLs)
|
12
|
+
to OpenCalais and receive asynchronous responses when OpenCalais has finished processing
|
13
|
+
the inputs. In addition, DoverToCalais enables the filtering of the response in order to
|
14
|
+
find relevant tags and/or tag values. }
|
15
|
+
spec.summary = %q{An easy-to-use wrapper round the OpenCalais semantic analysis web service. }
|
16
|
+
spec.homepage = ""
|
17
|
+
spec.license = "MIT"
|
18
|
+
|
19
|
+
|
20
|
+
spec.add_runtime_dependency "nokogiri", "~>1.6.0"
|
21
|
+
spec.add_runtime_dependency "eventmachine", "~>1.0.3"
|
22
|
+
spec.add_runtime_dependency "em-http-request", "~>1.1.0"
|
23
|
+
spec.add_runtime_dependency "yomu", "~>0.1.9"
|
24
|
+
|
25
|
+
spec.files = `git ls-files`.split($/)
|
26
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
27
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
|
31
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
32
|
+
spec.add_development_dependency "rake"
|
33
|
+
end
|
@@ -0,0 +1,279 @@
|
|
1
|
+
require "dover_to_calais/version" #gem lib file
|
2
|
+
require "dover_to_calais/ontology" #gem lib file
|
3
|
+
require 'open-uri' # in std library
|
4
|
+
require 'nokogiri'
|
5
|
+
require 'eventmachine'
|
6
|
+
require 'em-http-request'
|
7
|
+
require 'yomu'
|
8
|
+
|
9
|
+
|
10
|
+
module DoverToCalais
|
11
|
+
|
12
|
+
|
13
|
+
PROXY = nil
|
14
|
+
|
15
|
+
# The ResponseItem structure holds all potential text and attribute values of an OpenCalais
|
16
|
+
# XML Simple format element.
|
17
|
+
class ResponseItem < Struct.new(:name, :value, :relevance, :count, :normalized, :importance, :originalValue)
|
18
|
+
#
|
19
|
+
# @!attribute [r] name
|
20
|
+
# @return [String] the element's name.
|
21
|
+
#
|
22
|
+
#
|
23
|
+
# @!attribute [r] value
|
24
|
+
# @return [String] the element's text value.
|
25
|
+
#
|
26
|
+
#
|
27
|
+
# @!attribute [r] relevance
|
28
|
+
# The importance of the element in the context of the given input, in the range 0-1
|
29
|
+
# (1 being the most relevant and important). The score has 3-digit precision after the decimal point.
|
30
|
+
# @return [Float] the element's relevance, in the range 0-1.
|
31
|
+
#
|
32
|
+
#
|
33
|
+
# @!attribute [r] count
|
34
|
+
# @return [Integer] the count (frequency) of the element in the given input.
|
35
|
+
#
|
36
|
+
#
|
37
|
+
# @!attribute [r] normalized
|
38
|
+
# If the element is one of: (Company, City, ProvinceOrState, Country) OpenCalais
|
39
|
+
# provides disambiguation of its value in the 'normalized' attribute. For instance, the element
|
40
|
+
# <City>Birmingham</City> may include the attribute normalized = "Birmingham, UK" in order to avoid
|
41
|
+
# confusion with the city of Birmingham, USA.
|
42
|
+
# @return [String] the element text's disambiguated value
|
43
|
+
#
|
44
|
+
#
|
45
|
+
# @!attribute [r] importance
|
46
|
+
# Only applicable to the SocialTag element.
|
47
|
+
# @return [1, 2] the importance of the SocialTag.
|
48
|
+
#
|
49
|
+
#
|
50
|
+
# @!attribute [r] originalValue
|
51
|
+
# Only applicable to the SocialTag element.
|
52
|
+
# @return [String] The original value of the SocialTag.
|
53
|
+
#
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
# This class is responsible for creating a response object that will be passed to {Dover}, after
|
58
|
+
# the data source has been analysed by OpenCalais. If the response contains valid data, the
|
59
|
+
# {#error} attribute will be nil. The response object will then contain the OpenCalais response
|
60
|
+
# as an XML string. The user can then call {#filter} to filter the response.
|
61
|
+
# If the response doesn't contain valid, processed data then the {#error} won't be nil (i.e. will
|
62
|
+
# be true). The {#error} attribute can then be read in order to find the cause of the error.
|
63
|
+
#
|
64
|
+
# @!attribute [r] error
|
65
|
+
# @return [String, nil] any error that occurred as a result of the OpenCalais API call,
|
66
|
+
# nil if none occurred
|
67
|
+
#
|
68
|
+
class ResponseData
|
69
|
+
attr_reader :error
|
70
|
+
|
71
|
+
# creates a new ResponseData object, passing the name of the data source to be processed
|
72
|
+
#
|
73
|
+
# @param xml_data [ Nokogiri::XML::NodeSet, nil] the xml data returned by OpenCalais
|
74
|
+
# @param error [ String, nil] an error description if the OpenCalais call has failed
|
75
|
+
def initialize(xml_data = nil, error = nil)
|
76
|
+
if xml_data
|
77
|
+
@raw = xml_data
|
78
|
+
else
|
79
|
+
@error = error
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Returns the response data as an XML string or an error, if one has occurred.
|
84
|
+
#
|
85
|
+
# @return [String] an XML string
|
86
|
+
def to_s
|
87
|
+
@raw ? @raw.to_s : @error
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
# Filters the response object to extract relevant data.
|
92
|
+
#
|
93
|
+
# @param params [Hash] a filter Hash (see code samples)
|
94
|
+
# @return [Array[ResponseItem]] a list of relevant response items
|
95
|
+
def filter(params)
|
96
|
+
result = Array.new
|
97
|
+
begin
|
98
|
+
if @raw
|
99
|
+
|
100
|
+
if params[:given]
|
101
|
+
found = @raw.xpath("//#{params[:given][:entity]}[contains(text(), #{params[:given][:value].inspect})]")
|
102
|
+
if found.size > 0
|
103
|
+
@raw.xpath("//#{params[:entity]}[contains(text(), #{params[:value].inspect})]").each do |node|
|
104
|
+
result << create_response_item(node)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
else # no conditional
|
108
|
+
@raw.xpath("//#{params[:entity]}[contains(text(), #{params[:value].inspect})]").each do |node|
|
109
|
+
result << create_response_item(node)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
return result
|
114
|
+
else # no xml data
|
115
|
+
puts 'ERR: no valid xml data!'
|
116
|
+
|
117
|
+
end #if
|
118
|
+
|
119
|
+
rescue Exception=>e
|
120
|
+
puts "ERR: #filter: #{e}"
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
#return result
|
125
|
+
|
126
|
+
end #method
|
127
|
+
|
128
|
+
def create_response_item(node)
|
129
|
+
node_relevance = node.attribute('relevance').text.to_f if node.has_attribute?('relevance')
|
130
|
+
node_count = node.attribute('count').text.to_i if node.has_attribute?('count')
|
131
|
+
node_normalized = node.attribute('normalized').text if node.has_attribute?('normalized')
|
132
|
+
node_importance = node.attribute('importance').text.to_i if node.has_attribute?('importance')
|
133
|
+
|
134
|
+
ResponseItem.new(node.name,
|
135
|
+
node.content,
|
136
|
+
node_relevance,
|
137
|
+
node_count,
|
138
|
+
node_normalized,
|
139
|
+
node_importance,
|
140
|
+
node.xpath('originalValue').text )
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
public :filter
|
145
|
+
private :create_response_item
|
146
|
+
|
147
|
+
end #class
|
148
|
+
|
149
|
+
|
150
|
+
#====================================================================================
|
151
|
+
|
152
|
+
# This class is responsible for parsing, reading and sending to OpenCalais, text from a data source.
|
153
|
+
# The data source is passed to the class constructor and can be pretty much any form of document or URL.
|
154
|
+
# The class allows the user to specify one or more callbacks, to be called when the data source has been
|
155
|
+
# processed by OpenCalais ({#to_calais}).
|
156
|
+
#
|
157
|
+
# @!attribute [r] data_src
|
158
|
+
# @return [String] the data source to be processed, either a file path or a URL.
|
159
|
+
#
|
160
|
+
# @!attribute [r] error
|
161
|
+
# @return [String, nil] any error that occurred during data-source processing, nil if none occurred
|
162
|
+
#
|
163
|
+
class Dover
|
164
|
+
|
165
|
+
CALAIS_SERVICE = 'https://api.opencalais.com/tag/rs/enrich'
|
166
|
+
|
167
|
+
attr_reader :data_src, :error
|
168
|
+
|
169
|
+
# creates a new Dover object, passing the name of the data source to be processed
|
170
|
+
#
|
171
|
+
# @param data_src [String] the name of the data source to be processed
|
172
|
+
def initialize(data_src)
|
173
|
+
@data_src = data_src
|
174
|
+
@callbacks = []
|
175
|
+
analyse_this
|
176
|
+
end
|
177
|
+
|
178
|
+
|
179
|
+
# uses the {https://github.com/Erol/yomu yomu} gem to extract text from a number of document formats and URLs.
|
180
|
+
# If an exception occurs, it is written to the {@error} instance variable
|
181
|
+
#
|
182
|
+
# @param [String] src the name of the data source (file-path or URI)
|
183
|
+
# @return [String, nil] the extracted text, or nil if an exception occurred.
|
184
|
+
def get_src_data(src)
|
185
|
+
begin
|
186
|
+
yomu = Yomu.new src
|
187
|
+
|
188
|
+
rescue Exception=>e
|
189
|
+
@error = "ERR: #{e}"
|
190
|
+
else
|
191
|
+
yomu.text
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
# Defines the user callbacks. If the data source is successfully read, then this method will store a
|
197
|
+
# user-defined block which will be called on completion of the OpenCalais HTTP request. If the data source
|
198
|
+
# cannot be read -for whatever reason- then the block will immediately be called, passing the parameter that
|
199
|
+
# caused the read failure.
|
200
|
+
#
|
201
|
+
# @param block a user-defined block
|
202
|
+
# @return N/A
|
203
|
+
def to_calais(&block)
|
204
|
+
#fred rules ok
|
205
|
+
if @document
|
206
|
+
@callbacks << block
|
207
|
+
else
|
208
|
+
result = ResponseData.new nil, @error
|
209
|
+
block.call(result)
|
210
|
+
end
|
211
|
+
|
212
|
+
end #method
|
213
|
+
|
214
|
+
#
|
215
|
+
def analyse_this
|
216
|
+
|
217
|
+
@document = get_src_data(@data_src)
|
218
|
+
begin
|
219
|
+
if @document
|
220
|
+
response = nil
|
221
|
+
|
222
|
+
connection_options = {:inactivity_timeout => 0}
|
223
|
+
|
224
|
+
|
225
|
+
if DoverToCalais::PROXY &&
|
226
|
+
DoverToCalais::PROXY.class.eql?('Hash') &&
|
227
|
+
DoverToCalais::PROXY.keys[0].eql?(:proxy)
|
228
|
+
|
229
|
+
connection_options = connection_options.merge(DoverToCalais::PROXY)
|
230
|
+
end
|
231
|
+
|
232
|
+
request_options = {
|
233
|
+
:body => @document.to_s,
|
234
|
+
:head => {
|
235
|
+
'x-calais-licenseID' => DoverToCalais::API_KEY,
|
236
|
+
:content_type => 'TEXT/RAW',
|
237
|
+
:enableMetadataType => 'GenericRelations,SocialTags',
|
238
|
+
:outputFormat => 'Text/Simple'}
|
239
|
+
}
|
240
|
+
|
241
|
+
http = EventMachine::HttpRequest.new(CALAIS_SERVICE, connection_options ).post request_options
|
242
|
+
|
243
|
+
|
244
|
+
http.callback do
|
245
|
+
http.response.match(/<OpenCalaisSimple>/) do |m|
|
246
|
+
response = Nokogiri::XML('<OpenCalaisSimple>' + m.post_match) do |config|
|
247
|
+
#strict xml parsing, disallow network connections
|
248
|
+
config.strict.nonet
|
249
|
+
end #block
|
250
|
+
end #block
|
251
|
+
|
252
|
+
result = response ? ResponseData.new(response, nil) : ResponseData.new(nil,'ERR: unable to find <OpenCalaisSimple> tag in response data')
|
253
|
+
@callbacks.each { |c| c.call(result) }
|
254
|
+
end #callback
|
255
|
+
|
256
|
+
|
257
|
+
http.errback do
|
258
|
+
|
259
|
+
result = ResponseData.new nil, "#{http.error}"
|
260
|
+
@callbacks.each { |c| c.call(result) }
|
261
|
+
end #errback
|
262
|
+
|
263
|
+
|
264
|
+
end #if
|
265
|
+
rescue Exception=>e
|
266
|
+
puts "ERR: #{e}"
|
267
|
+
exit 0
|
268
|
+
end
|
269
|
+
|
270
|
+
end #method
|
271
|
+
|
272
|
+
|
273
|
+
public :to_calais
|
274
|
+
private :get_src_data, :analyse_this
|
275
|
+
|
276
|
+
|
277
|
+
end #class
|
278
|
+
|
279
|
+
end
|
@@ -0,0 +1,147 @@
|
|
1
|
+
# ontology.rb
|
2
|
+
#
|
3
|
+
# Copyright 2013 Fred <fred@fred-Veriton-X270>
|
4
|
+
#
|
5
|
+
# This program is free software; you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation; either version 2 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
# MA 02110-1301, USA.
|
19
|
+
#
|
20
|
+
#
|
21
|
+
|
22
|
+
|
23
|
+
module CalaisOntology
|
24
|
+
CALAIS_ENTITIES = %w(
|
25
|
+
Anniversary
|
26
|
+
City
|
27
|
+
Company
|
28
|
+
Continent
|
29
|
+
Country
|
30
|
+
Currency
|
31
|
+
EmailAddress
|
32
|
+
EntertainmentAwardEvent
|
33
|
+
Facility
|
34
|
+
FaxNumber
|
35
|
+
Holiday
|
36
|
+
IndustryTerm
|
37
|
+
MarketIndex
|
38
|
+
MedicalCondition
|
39
|
+
MedicalTreatment
|
40
|
+
Movie
|
41
|
+
MusicAlbum
|
42
|
+
MusicGroup
|
43
|
+
NaturalFeature
|
44
|
+
OperatingSystem
|
45
|
+
Organization
|
46
|
+
Person
|
47
|
+
PhoneNumber
|
48
|
+
PoliticalEvent
|
49
|
+
Product
|
50
|
+
ProgrammingLanguage
|
51
|
+
ProvinceOrState
|
52
|
+
PublishedMedium
|
53
|
+
RadioProgram
|
54
|
+
RadioStation
|
55
|
+
Region
|
56
|
+
SportsEvent
|
57
|
+
SportsGame
|
58
|
+
SportsLeague
|
59
|
+
TVShow
|
60
|
+
TVStation
|
61
|
+
Technology
|
62
|
+
URL
|
63
|
+
)
|
64
|
+
|
65
|
+
CALAIS_EVENTS = %w(
|
66
|
+
Acquisition
|
67
|
+
Alliance
|
68
|
+
AnalystEarningsEstimate
|
69
|
+
AnalystRecommendation
|
70
|
+
Arrest
|
71
|
+
Bankruptcy
|
72
|
+
BonusSharesIssuance
|
73
|
+
BusinessRelation
|
74
|
+
Buybacks
|
75
|
+
CompanyAccountingChange
|
76
|
+
CompanyEarningsAnnouncement
|
77
|
+
CompanyEarningsGuidance
|
78
|
+
CompanyExpansion
|
79
|
+
CompanyForceMajeure
|
80
|
+
CompanyInvestment
|
81
|
+
CompanyLaborIssues
|
82
|
+
CompanyLayoffs
|
83
|
+
CompanyLegalIssues
|
84
|
+
CompanyListingChange
|
85
|
+
CompanyMeeting
|
86
|
+
CompanyNameChange
|
87
|
+
CompanyReorganization
|
88
|
+
CompanyRestatement
|
89
|
+
ConferenceCall
|
90
|
+
Conviction
|
91
|
+
CreditRating
|
92
|
+
DebtFinancing
|
93
|
+
DelayedFiling
|
94
|
+
DiplomaticRelations
|
95
|
+
Dividend
|
96
|
+
EmploymentChange
|
97
|
+
EnvironmentalIssue
|
98
|
+
Extinction
|
99
|
+
FDAPhase
|
100
|
+
Indictment
|
101
|
+
IPO
|
102
|
+
JointVenture
|
103
|
+
ManMadeDisaster
|
104
|
+
Merger
|
105
|
+
MovieRelease
|
106
|
+
MusicAlbumRelease
|
107
|
+
NaturalDisaster
|
108
|
+
PatentFiling
|
109
|
+
PatentIssuance
|
110
|
+
PersonTravel
|
111
|
+
PoliticalEndorsement
|
112
|
+
PoliticalRelationship
|
113
|
+
PollsResult
|
114
|
+
ProductIssues
|
115
|
+
ProductRecall
|
116
|
+
ProductRelease
|
117
|
+
SocialTags
|
118
|
+
SecondaryIssuance
|
119
|
+
PersonCommunication
|
120
|
+
StockSplit
|
121
|
+
Trial
|
122
|
+
VotingResult
|
123
|
+
)
|
124
|
+
|
125
|
+
CALAIS_TOPICS = %w(
|
126
|
+
Business_Finance
|
127
|
+
Disaster_Accident
|
128
|
+
Education
|
129
|
+
Entertainment_Culture
|
130
|
+
Environment
|
131
|
+
Health_Medical_Pharma
|
132
|
+
Hospitality_Recreation
|
133
|
+
Human_Interest
|
134
|
+
Labor
|
135
|
+
Law_Crime
|
136
|
+
Politics
|
137
|
+
Religion_Belief
|
138
|
+
Social_Issues
|
139
|
+
Sports
|
140
|
+
Technology_Internet
|
141
|
+
Weather
|
142
|
+
War_Conflict
|
143
|
+
Other
|
144
|
+
)
|
145
|
+
|
146
|
+
end
|
147
|
+
|
metadata
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dover_to_calais
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Fred Heath
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-10-04 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: nokogiri
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.6.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.6.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: eventmachine
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.0.3
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.0.3
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: em-http-request
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.1.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: yomu
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.1.9
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.1.9
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: bundler
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '1.3'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '1.3'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rake
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
description: ! "DoverToCalais allows the user to send a wide range of data sources
|
111
|
+
(files & URLs)\n to OpenCalais and receive asynchronous
|
112
|
+
responses when OpenCalais has finished processing\n the
|
113
|
+
inputs. In addition, DoverToCalais enables the filtering of the response in order
|
114
|
+
to\n find relevant tags and/or tag values. "
|
115
|
+
email:
|
116
|
+
- fred@bootstrap.me.uk
|
117
|
+
executables: []
|
118
|
+
extensions: []
|
119
|
+
extra_rdoc_files: []
|
120
|
+
files:
|
121
|
+
- .gitignore
|
122
|
+
- .yardopts
|
123
|
+
- Gemfile
|
124
|
+
- LICENSE.txt
|
125
|
+
- README.md
|
126
|
+
- Rakefile
|
127
|
+
- dover_to_calais.gemspec
|
128
|
+
- lib/dover_to_calais.rb
|
129
|
+
- lib/dover_to_calais/ontology.rb
|
130
|
+
- lib/dover_to_calais/version.rb
|
131
|
+
homepage: ''
|
132
|
+
licenses:
|
133
|
+
- MIT
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
require_paths:
|
137
|
+
- lib
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
requirements: []
|
151
|
+
rubyforge_project:
|
152
|
+
rubygems_version: 1.8.24
|
153
|
+
signing_key:
|
154
|
+
specification_version: 3
|
155
|
+
summary: An easy-to-use wrapper round the OpenCalais semantic analysis web service.
|
156
|
+
test_files: []
|