Class: TinyClassifier::Classifier
- Defined in:
- lib/tiny-classifier/classifier.rb
Instance Attribute Summary collapse
-
#classifier ⇒ Object
writeonly
Sets the attribute classifier.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
#classifier, #initialize, #parse_command_line_options
Constructor Details
This class inherits a constructor from TinyClassifier::Base
Instance Attribute Details
#classifier=(value) ⇒ Object (writeonly)
Sets the attribute classifier
29 30 31 |
# File 'lib/tiny-classifier/classifier.rb', line 29 def classifier=(value) @classifier = value end |
Class Method Details
.run(argv = nil) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/tiny-classifier/classifier.rb', line 21 def run(argv=nil) argv ||= ARGV.dup classifier = new classifier.(argv) classifier.run end |
Instance Method Details
#run ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/tiny-classifier/classifier.rb', line 31 def run if input.empty? STDERR.puts("Error: No effective input.") false else label = classifier.classify(input) puts label.downcase true end end |