Skip to content

Instantly share code, notes, and snippets.

Last active Dec 25, 2015
What would you like to do?
Use DoverToCalais to find all Persons or Organizations with a relevance score greater than 0.1, if the data source contains an environmental event.
require 'dover_to_calais' do
# use Control + C to stop the EM
Signal.trap('INT') { EventMachine.stop }
Signal.trap('TERM') { EventMachine.stop }
DoverToCalais::API_KEY = 'my_opencalais_key'
source = ''
dover =
dover.to_calais do |response|
if response.error
puts response.error
organisations = response.filter({:entity => 'Organization', :given => {:entity => 'Event', :value => 'Environment'}})
persons = response.filter({:entity => 'Person', :given => {:entity => 'Event', :value => 'Environment'}})
results = organisations | persons
results.each do |item|
puts item.value if item.relevance > 0.1
end #if
end #block
end #EM run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment