Class: Sentimentalizer

Inherits:
Object
  • Object
show all
Defined in:
lib/sentimentalizer.rb

Class Method Summary collapse

Class Method Details

.analyze(sentence, as_json = nil) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/sentimentalizer.rb', line 13

def self.analyze(sentence, as_json=nil)
  unless as_json
    @analyser.analyse(sentence)
  else
    @analyser.analyse(sentence).to_json
  end
end

.setupObject



7
8
9
10
11
# File 'lib/sentimentalizer.rb', line 7

def self.setup
  @analyser = Analyser.new
  @analyser.train_positive "#{File.dirname(__FILE__)}/data/positive"
  @analyser.train_negative "#{File.dirname(__FILE__)}/data/negative"
end