Sha256: 7ad7299b966219df9dbf0190c5ab8a24706a7bce483e1622f3d627952968f27d

Contents?: true

Size: 756 Bytes

Versions: 3

Compression:

Stored size: 756 Bytes

Contents

#!/usr/bin/env ruby

require 'classifier'
require 'madeleine'

m = SnapshotMadeleine.new(File.expand_path("~/.bayes_data")) {
	Classifier::Bayes.new 'Interesting', 'Uninteresting'
}

case ARGV[0]
when "add"
	case ARGV[1].downcase
	when "interesting"
		m.system.train_interesting File.open(ARGV[2]).read
		puts "#{ARGV[2]} has been classified as interesting"
	when "uninteresting"
		m.system.train_uninteresting File.open(ARGV[2]).read
		puts "#{ARGV[2]} has been classified as uninteresting"
	else
		puts "Invalid category: choose between interesting and uninteresting"
		exit(1)
	end
when "classify"
	puts m.system.classify(File.open(ARGV[1]).read)
else
	puts "Invalid option: choose add [category] [file] or clasify [file]"
	exit(1)
end

m.take_snapshot

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
classifier-1.0 bin/bayes.rb
classifier-1.1 bin/bayes.rb
classifier-1.1.1 bin/bayes.rb