Class: SentimentInsights::Analyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/sentiment_insights/analyzer.rb

Instance Method Summary collapse

Constructor Details

#initialize(provider: SentimentInsights.configuration.provider) ⇒ Analyzer

Returns a new instance of Analyzer.



12
13
14
# File 'lib/sentiment_insights/analyzer.rb', line 12

def initialize(provider: SentimentInsights.configuration.provider)
  @provider = provider
end

Instance Method Details

#entities(text) ⇒ Object

Entity Recognition



35
36
37
# File 'lib/sentiment_insights/analyzer.rb', line 35

def entities(text)
  SentimentInsights::Insights::Entities.new(@provider).extract(text)
end

#entities_batch(texts, options: {}) ⇒ Object



39
40
41
# File 'lib/sentiment_insights/analyzer.rb', line 39

def entities_batch(texts, options: {})
  SentimentInsights::Insights::Entities.new(@provider).extract_batch(texts, options)
end

#key_phrases(text) ⇒ Object

Key Phrase Extraction



26
27
28
# File 'lib/sentiment_insights/analyzer.rb', line 26

def key_phrases(text)
  SentimentInsights::Insights::KeyPhrases.new(@provider).extract(text)
end

#key_phrases_batch(texts, options: {}) ⇒ Object



30
31
32
# File 'lib/sentiment_insights/analyzer.rb', line 30

def key_phrases_batch(texts, options: {})
  SentimentInsights::Insights::KeyPhrases.new(@provider).extract_batch(texts, options)
end

#sentiment(text) ⇒ Object

Sentiment Analysis



17
18
19
# File 'lib/sentiment_insights/analyzer.rb', line 17

def sentiment(text)
  SentimentInsights::Insights::Sentiment.new(@provider).analyze(text)
end

#sentiment_batch(texts) ⇒ Object



21
22
23
# File 'lib/sentiment_insights/analyzer.rb', line 21

def sentiment_batch(texts)
  SentimentInsights::Insights::Sentiment.new(@provider).analyze_batch(texts)
end

#topics_batch(texts, options: {}) ⇒ Object

Topic Modeling



44
45
46
# File 'lib/sentiment_insights/analyzer.rb', line 44

def topics_batch(texts, options: {})
  SentimentInsights::Insights::Topics.new(@provider).model_topics(texts, options)
end