AFraser
AFraser

Reputation: 1006

Ruby 'uninitialized constant' error even with gem required

I'm trying to use the Ankusa (https://github.com/livingsocial/ankusa) gem in a ruby project I'm working on.

I'm running the code below with the ankusa gem installed but I still get an error: uninitialized constant Ankusa::MemoryStorage (NameError)

require 'rubygems'
require 'ankusa'
require 'ankusa/hbase_storage'

storage = Ankusa::MemoryStorage.new
c = Ankusa::NaiveBayesClassifier.new storage

c.train :spam, "This is some spammy text"
c.train :good, "This is not the bad stuff"

puts c.classify "This is some spammy text"

puts c.classifications "This is some spammy text"

puts c.log_likelihoods "This is some spammy text"

puts c.classnames
storage.close

Any help would be greatly appreciated.

Upvotes: 3

Views: 6025

Answers (1)

sreeni
sreeni

Reputation: 151

have a look at ankusa.rb within the gem folder. It only requires the following:

require 'ankusa/version'
require 'ankusa/extensions'
require 'ankusa/classifier'
require 'ankusa/naive_bayes'
require 'ankusa/kl_divergence'
require 'ankusa/hasher'

so, you might need to require it explicitly

require 'ankusa/memory_storage'

Upvotes: 4

Related Questions