Class: Forematter::Commands::Classify

Inherits:
Forematter::CommandRunner show all
Defined in:
lib/forematter/commands/classify.rb

Instance Method Summary collapse

Methods inherited from Forematter::CommandRunner

#call

Instance Method Details

#runObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/forematter/commands/classify.rb', line 28

def run
  load_classifier

  puts 'Getting categories'
  categories_for(files_with(field)).each do |cat|
    bayes.add_category(cat.to_sym)
  end

  puts 'Training classifier'
  files_with(field).each { |file| train(file) }

  puts 'Classifying files'
  files_to_classify.each { |file| file.write if classify(file) }
end