Class: TinyClassifier::Command::Base
- Inherits:
-
Object
- Object
- TinyClassifier::Command::Base
show all
- Defined in:
- lib/tiny-classifier/command/base.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(argv = []) ⇒ Base
Returns a new instance of Base.
38
39
40
41
42
43
|
# File 'lib/tiny-classifier/command/base.rb', line 38
def initialize(argv=[])
@categories = nil
@tokenizer = Tokenizer.new
@data_dir = Dir.pwd
@verbose = false
end
|
Instance Attribute Details
#classifier ⇒ Object
53
54
55
|
# File 'lib/tiny-classifier/command/base.rb', line 53
def classifier
@classifier ||= prepare_classifier
end
|
#tokenizer ⇒ Object
Returns the value of attribute tokenizer.
35
36
37
|
# File 'lib/tiny-classifier/command/base.rb', line 35
def tokenizer
@tokenizer
end
|
Class Method Details
.run(argv = nil) ⇒ Object
28
29
30
31
32
|
# File 'lib/tiny-classifier/command/base.rb', line 28
def run(argv=nil)
argv ||= ARGV.dup
command = new(argv)
command.run
end
|
Instance Method Details
#data_file_name ⇒ Object
57
58
59
|
# File 'lib/tiny-classifier/command/base.rb', line 57
def data_file_name
"tc.#{@categories.basename}.dat"
end
|
#data_file_path ⇒ Object
61
62
63
|
# File 'lib/tiny-classifier/command/base.rb', line 61
def data_file_path
@data_file_path ||= prepare_data_file_path
end
|
#parse_command_line_options(command_line_options) ⇒ Object
49
50
51
|
# File 'lib/tiny-classifier/command/base.rb', line 49
def parse_command_line_options(command_line_options)
option_parser.parse!(command_line_options)
end
|
#run ⇒ Object
45
46
47
|
# File 'lib/tiny-classifier/command/base.rb', line 45
def run
raise NoCategories.new unless @categories
end
|