On many classes, the initialize method is always the same
def initialize
super
set_options(self.class.options) if self.class.options
self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
buildClassifier(self.class.data)
end
You should create a base module, like RubyMining, with a method that run this procedure
Example:
module RubyMining
def init_classifier
super
set_options(self.class.options) if self.class.options
self.class.data.setClassIndex(self.class.class_index) if self.class.class_index
buildClassifier(self.class.data)
end
end
class Base < NaiveBayes
include ::RubyMining
def initialize
super
init_classifier
end
end
On many classes, the initialize method is always the same
You should create a base module, like RubyMining, with a method that run this procedure
Example: