Class: TinyClassifier::Command::Classify
- Defined in:
- lib/tiny-classifier/command/classify.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(argv = []) ⇒ Classify
constructor
A new instance of Classify.
- #run ⇒ Object
Methods inherited from Base
#data_file_name, #data_file_path, #parse_command_line_options, run
Constructor Details
#initialize(argv = []) ⇒ Classify
Returns a new instance of Classify.
21 22 23 24 |
# File 'lib/tiny-classifier/command/classify.rb', line 21 def initialize(argv=[]) super (argv) end |
Instance Method Details
#run ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# 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 |