<commit_before>require 'spec_helper'

describe Idhja22::Node do
  before(:all) do
    @ds = Idhja22::Dataset.from_csv(File.join(File.dirname(__FILE__),'large_spec_data.csv'))
  end

end

describe Idhja22::LeafNode do
  describe('#get_rules') do
    it 'should return the probability' do
      l = Idhja22::LeafNode.new(0.75)
      l.get_rules.should == ['then chance of liking = 0.75']
    end
  end
  
end

describe Idhja22::DecisionNode do
  describe('#get_rules') do
    
  end
end<commit_msg>added a spec for DecisionNode#get_rules<commit_after>require 'spec_helper'

describe Idhja22::LeafNode do
  describe('#get_rules') do
    it 'should return the probability' do
      l = Idhja22::LeafNode.new(0.75)
      l.get_rules.should == ['then chance of liking = 0.75']
    end
  end
  
end

describe Idhja22::DecisionNode do
  before(:all) do
    @ds = Idhja22::Dataset.from_csv(File.join(File.dirname(__FILE__),'large_spec_data.csv'))
  end

  describe('#get_rules') do
    it 'should return a list of rules' do
      l = Idhja22::DecisionNode.new(@ds.split(2), '3', [],   0.75)
      l.get_rules.should == ["3 == a and then chance of liking = 0.75", "3 == b and then chance of liking = 0.75"]
    end
  end
end
{'fraction_non_alphanumeric': 0.1301482701812191, 'fraction_numerical': 0.03706754530477759, 'mean_word_length': 3.6551724137931036, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2049672', 'n_tokens_mistral': 472, 'n_tokens_neox': 441, 'n_words': 109}