class Analyser

Public Class Methods

new() click to toggle source
# File lib/engine/analyser.rb, line 6
def initialize
  @positive = Corpus.new
  @negative = Corpus.new
end

Public Instance Methods

analyse(sentence) click to toggle source
# File lib/engine/analyser.rb, line 23
def analyse sentence
  Classifier.new(@positive, @negative).classify(sentence)
end
train_negative(path) click to toggle source
# File lib/engine/analyser.rb, line 17
def train_negative path
  puts 'Training analyser with -ve sentiment'
  @negative.load_from_directory path
  puts '-ve sentiment training complete'
end
train_positive(path) click to toggle source
# File lib/engine/analyser.rb, line 11
def train_positive path
  puts 'Training analyser with +ve sentiment'
  @positive.load_from_directory path
  puts '+ve sentiment training complete'
end