module See5
Constants
- VERSION
Public Class Methods
audit(data, class_attribute:)
click to toggle source
# File lib/see5.rb, line 22 def self.audit(data, class_attribute:) prepare_tmp_files(data, class_attribute: class_attribute) run_gritbot See5::GritbotOutputParser.parse_file("/tmp/ruby-see5.gritbot_output") end
prepare_tmp_files(data, class_attribute:)
click to toggle source
# File lib/see5.rb, line 29 def self.prepare_tmp_files(data, class_attribute:) schema = See5::Schema.from_dataset(data, class_attribute: class_attribute) See5::InputFileWriter.write_files(data: data, schema: schema) end
run_gritbot()
click to toggle source
# File lib/see5.rb, line 38 def self.run_gritbot system("#{gritbot_executable} -s -f /tmp/ruby-see5 -r > /tmp/ruby-see5.gritbot_output") end
run_see5()
click to toggle source
# File lib/see5.rb, line 34 def self.run_see5 system("#{see5_executable} -f /tmp/ruby-see5 -r > /tmp/ruby-see5.rules_output") end
train(data, class_attribute:)
click to toggle source
# File lib/see5.rb, line 13 def self.train(data, class_attribute:) prepare_tmp_files(data, class_attribute: class_attribute) run_see5 output = See5::RulesOutputParser.parse_file("/tmp/ruby-see5.rules_output") See5::Model.new(**output) end
Private Class Methods
gritbot_executable()
click to toggle source
# File lib/see5.rb, line 48 def self.gritbot_executable @gritbot_executable ||= see5_installer_path ? "#{see5_installer_path}/ext/gritbot/gritbot" : "gritbot" end
see5_executable()
click to toggle source
# File lib/see5.rb, line 44 def self.see5_executable @see5_executable ||= see5_installer_path ? "#{see5_installer_path}/ext/c5.0/c5.0" : "c5.0" end
see5_installer_path()
click to toggle source
# File lib/see5.rb, line 52 def self.see5_installer_path @see5_installer_path ||= Bundler.rubygems.find_name("see5-installer").first&.full_gem_path end