Class: VaderSentimentRuby::PunctuationEmphasisAmplifier
- Inherits:
-
Object
- Object
- VaderSentimentRuby::PunctuationEmphasisAmplifier
- 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
-
#call ⇒ Float, Integer
Emphasis factor.
-
#initialize(text) ⇒ PunctuationEmphasisAmplifier
constructor
A new instance of PunctuationEmphasisAmplifier.
Constructor Details
#initialize(text) ⇒ PunctuationEmphasisAmplifier
Returns a new instance of PunctuationEmphasisAmplifier.
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
#call ⇒ Float, Integer
Returns 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 |