Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 28 lines (22 sloc) 670 Bytes
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), '..', 'config', 'environment')
require 'net/imap'
require 'net/http'
require 'rubygems'
require 'logger'
log = Logger.new(STDOUT)
log.info Time.now.to_s + " Warming up processor to extract entities form news_items..."
begin
news_items = NewsItem.all
log.info " - Starting to process #{news_items.length} news_items..."
nr = 1
news_items.each do |ni|
log.info(" -- Processing News Item #{nr} with id #{ni.id} and title #{ni.headline}")
ni.detect_entities
sleep 1
nr += 1
end
rescue => e
log.warn e
end
log.info Time.now.to_s + " Done processing all news_items..."