class TinyClassifier::Command::Classify

Public Class Methods

new(argv=[]) click to toggle source
Calls superclass method TinyClassifier::Command::Base::new
# File lib/tiny-classifier/command/classify.rb, line 21
def initialize(argv=[])
  super
  parse_command_line_options(argv)
end

Public Instance Methods

run() click to toggle source
Calls superclass method TinyClassifier::Command::Base::run
# File lib/tiny-classifier/command/classify.rb, line 26
def run
  super
  raise NoEffectiveInput.new if input.empty?
  raise NoTrainingData.new(data_file_path) unless data_file_path.exist?

  category = classifier.classify(input)
  $stdout.puts(category.downcase)
  true
rescue StandardError => error
  handle_error(error)
end