Class: WePredict::Classifiers::Classifier

Inherits:
API
  • Object
show all
Defined in:
lib/wepredict/classifier.rb

Direct Known Subclasses

Sentiment

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from API

endpoint, make_request

Constructor Details

#initializeClassifier

Returns a new instance of Classifier.



5
6
7
# File 'lib/wepredict/classifier.rb', line 5

def initialize
  @api_key = Classifier.api_key
end

Class Method Details

.api_keyObject



14
15
16
17
18
19
20
# File 'lib/wepredict/classifier.rb', line 14

def self.api_key
  f = File.open(File.expand_path("~/.wepredict"), 'r')
  k = f.read(32)
  f.close

  k
end

.classify(options) ⇒ Object



9
10
11
12
# File 'lib/wepredict/classifier.rb', line 9

def self.classify(options)
  params? options, [:text]
  make_request("classifiers/#{self.class_name}/classify", options.merge(:api_key => self.api_key))
end