Class: VaderSentimentRuby::PunctuationEmphasisAmplifier

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

Overview

Adds emphasis factor from exclamation points and question marks

Constant Summary collapse

EXCLAMATION_MARK =
'!'
QUESTION_MARK =
'?'
EXCLAMATION_MARK_RATING_INCREASE =

Empirically derived mean sentiment intensity rating increases for exclamation points and question marks

0.292
QUESTION_MARK_RATING_INCREASE =
0.18

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ PunctuationEmphasisAmplifier

Returns a new instance of PunctuationEmphasisAmplifier.

Parameters:

  • text (String)


13
14
15
# File 'lib/vader_sentiment_ruby/punctuation_emphasis_amplifier.rb', line 13

def initialize(text)
  @text_array = text.split('')
end

Instance Method Details

#callFloat, Integer

Returns Emphasis factor.

Returns:

  • (Float, Integer)

    Emphasis factor



18
19
20
# File 'lib/vader_sentiment_ruby/punctuation_emphasis_amplifier.rb', line 18

def call
  (amplify_exclamation_points + amplify_question_marks).round(3)
end