views:

90

answers:

1

Hi,

Just learning Ruby and found something bizarre (at least for ansi-c programmer).

Having Mac OS X 10.6.2, ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0], feed-normalizer 1.5.1 and crm114 1.0.3

require 'rubygems'
require 'crm114'
require 'feed-normalizer'
#FeedNormalizer::FeedNormalizer.parse open("http://news.google.com/news?ned=us&topic=w&output=rss")

crm = Classifier::CRM114.new([:interesting, :boring])

crm.train! :interesting, 'Some data set with a decent signal to noise ratio.'
crm.train! :boring, 'Pig latin, as in lorem ipsum dolor sit amet.'

puts crm.classify 'Lorem ipsum'

Running above file:

$ ruby crmdebug.rb 
interesting
0.5

Fine, this is just demoing.

Now uncommenting the line #FeedNormalizer...

And running the file without comment:

$ ruby crmdebug.rb 
nil
0.0

?! What an earth is happening here? Why FeedNormalizer usage breaks crm114 (those aren't related)? How to debug this kind of situation? Is this typical that some another class breaks other classes? Did reboot also (hey this is Mac ;) )

A: 

I was not able to duplicate this problem. Here are the steps I took:

 sudo apt-get install crm114
 sudo gem install crm114
 sudo gem install feed-normalizer

All OK. Now running the sample code with feed-normalizer commented out.

$ ruby crmdebug.rb 
interesting
0.5

...and uncommented:

$ ruby crmdebug.rb 
interesting
0.5

Ubuntu 2.6.24-26, ruby 1.8.6. Sorry, that's all I got.

zetetic