Class: VaderSentimentRuby::Checker::NegationChecker
- Inherits:
-
Object
- Object
- VaderSentimentRuby::Checker::NegationChecker
- Defined in:
- lib/vader_sentiment_ruby/checker/negation_checker.rb
Overview
Checks for negation
Instance Method Summary collapse
- #call ⇒ Float
-
#initialize(valence, words_and_emoticons, start_index, index) ⇒ NegationChecker
constructor
A new instance of NegationChecker.
Constructor Details
#initialize(valence, words_and_emoticons, start_index, index) ⇒ NegationChecker
Returns a new instance of NegationChecker.
11 12 13 14 15 16 |
# File 'lib/vader_sentiment_ruby/checker/negation_checker.rb', line 11 def initialize(valence, words_and_emoticons, start_index, index) @valence = valence @words_and_emoticons_lower = words_and_emoticons.map { |word| word.to_s.downcase } @start_index = start_index @index = index end |
Instance Method Details
#call ⇒ Float
19 20 21 22 23 24 25 26 |
# File 'lib/vader_sentiment_ruby/checker/negation_checker.rb', line 19 def call valence = @valence valence = check_zero_index(valence) if @start_index.zero? valence = check_first_index(valence) if @start_index == 1 valence = check_second_index(valence) if @start_index == 2 valence end |