Class: VaderSentimentRuby::Checker::SpecialIdiomsChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/vader_sentiment_ruby/checker/special_idioms_checker.rb

Overview

Checks text for special idioms

Instance Method Summary collapse

Constructor Details

#initialize(valence, words_and_emoticons, index) ⇒ SpecialIdiomsChecker

Returns a new instance of SpecialIdiomsChecker.

Parameters:

  • valence (Float)

    Current valence

  • words_and_emoticons (Array)

    Array of words

  • index (Integer)

    Current word index



10
11
12
13
14
# File 'lib/vader_sentiment_ruby/checker/special_idioms_checker.rb', line 10

def initialize(valence, words_and_emoticons, index)
  @valence = valence
  @words_and_emoticons_lower = words_and_emoticons.map { |word| word.to_s.downcase }
  @index = index
end

Instance Method Details

#callFloat

Returns:

  • (Float)


17
18
19
20
21
22
23
24
25
# File 'lib/vader_sentiment_ruby/checker/special_idioms_checker.rb', line 17

def call
  valence = @valence

  valence = update_valence_checking_preceding_words(valence)

  valence = update_valence_checking_subsequent_words(valence)

  update_valence_checking_n_grams(valence)
end