Class: TinyClassifier::Command::Untrain
- Defined in:
- lib/tiny-classifier/command/untrain.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(argv = []) ⇒ Untrain
constructor
A new instance of Untrain.
- #run ⇒ Object
Methods inherited from Base
#data_file_name, #data_file_path, #parse_command_line_options, run
Constructor Details
#initialize(argv = []) ⇒ Untrain
Returns a new instance of Untrain.
21 22 23 24 25 26 |
# File 'lib/tiny-classifier/command/untrain.rb', line 21 def initialize(argv=[]) super option_parser. += " CATEGORY" *categories = (argv) @category = categories.first end |
Instance Method Details
#run ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tiny-classifier/command/untrain.rb', line 28 def run super @category = prepare_category(@category) log("untraining as: #{@category}") raise NoEffectiveInput.new if input.empty? raise NoTrainingData.new(data_file_path) unless data_file_path.exist? classifier.untrain(@category, input) save true rescue StandardError => error handle_error(error) end |