File: test_data_loader.rb

package info (click to toggle)
ruby-classifier-reborn 2.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,424 kB
  • sloc: ruby: 2,021; makefile: 7
file content (16 lines) | stat: -rw-r--r-- 481 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# encoding: utf-8

module TestDataLoader
  def self.sms_data
    @@sms_data ||= self.load_sms_data
  end

  def self.load_sms_data
    sms_spam_collection = File.expand_path(File.dirname(__FILE__) + '/corpus/SMSSpamCollection.tsv')
    File.read(sms_spam_collection).force_encoding("utf-8").split("\n")
  end

  def self.report_insufficient_data(available, required)
    puts "\e[31mInsufficient records in the dataset: available #{available}, required #{required}\e[0m"
  end
end