Class: VaderSentimentRuby::SentimentPropertiesIdentifier

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

Overview

Identify sentiment-relevant string-level properties of input text.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ SentimentPropertiesIdentifier

Returns a new instance of SentimentPropertiesIdentifier.

Parameters:

  • text (String)


9
10
11
12
13
14
15
# File 'lib/vader_sentiment_ruby/sentiment_properties_identifier.rb', line 9

def initialize(text)
  text = text.to_s.encode('utf-8') unless text.is_a? String
  @text = text
  @words_and_emoticons = prepare_words_and_emoticons
  # Doesn't separate words from adjacent punctuation (keeps emoticons & contractions)
  @is_cap_diff = text_contains_mixed_cases?
end

Instance Attribute Details

#is_cap_diffObject (readonly)

Returns the value of attribute is_cap_diff.



6
7
8
# File 'lib/vader_sentiment_ruby/sentiment_properties_identifier.rb', line 6

def is_cap_diff
  @is_cap_diff
end

#words_and_emoticonsObject (readonly)

Returns the value of attribute words_and_emoticons.



6
7
8
# File 'lib/vader_sentiment_ruby/sentiment_properties_identifier.rb', line 6

def words_and_emoticons
  @words_and_emoticons
end