Question

I'm using the Calais gem with Ruby 1.9.3 and when I use the following code snippet:

   rdf = Calais.process_document(
       :content => text,
       :content_type => :html,
       :license_id => 'xxxxxxxxxxxxxxxxxxxxxx',
       # :output_format => :json,
       :metadata_enables => ["SocialTags"]

   )

I'm sure the text is there. The stacktrace is below. Does anyone know what can be amiss?

Completed 500 Internal Server Error in 39423ms

TypeError - can't convert nil into String:
  (gem) calais-0.0.13/lib/calais/response.rb:92:in `parse'
  (gem) calais-0.0.13/lib/calais/response.rb:92:in `block in extract_data'
  (gem) nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:239:in `block in each'
  (gem) nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:238:in `upto'
  (gem) nokogiri-1.5.6/lib/nokogiri/xml/node_set.rb:238:in `each'
  (gem) calais-0.0.13/lib/calais/response.rb:90:in `extract_data'
  (gem) calais-0.0.13/lib/calais/response.rb:29:in `initialize'
  (gem) calais-0.0.13/lib/calais.rb:56:in `new'
  (gem) calais-0.0.13/lib/calais.rb:56:in `process_document'
Was it helpful?

Solution

It seems to be a issue in calais gem maybe with newer versions of nokigiri.

try this fork the commits shows it has fixed the nokogiri 1.5.6 issue.

https://github.com/bborn/calais/commits/master

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top