Class: Airmail::Sentiment
- Inherits:
-
Object
- Object
- Airmail::Sentiment
- Defined in:
- lib/airmail/sentiment.rb
Instance Method Summary collapse
- #analyze(phrase) ⇒ Object
-
#initialize(*pattern) ⇒ Sentiment
constructor
A new instance of Sentiment.
Constructor Details
#initialize(*pattern) ⇒ Sentiment
Returns a new instance of Sentiment.
4 5 6 |
# File 'lib/airmail/sentiment.rb', line 4 def initialize(*pattern) @pattern = /#{"(" + pattern.map{|a| or_regex(a) }.join(').*?(') + ")"}/ end |
Instance Method Details
#analyze(phrase) ⇒ Object
8 9 10 |
# File 'lib/airmail/sentiment.rb', line 8 def analyze(phrase) sentiments = @pattern.match phrase end |