Class: Wave::Sentiment

Inherits:
Object
  • Object
show all
Defined in:
lib/wave/sentiment.rb

Overview

Sentiment — Sentiment and emotion analysis

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Sentiment

Returns a new instance of Sentiment.



6
7
8
# File 'lib/wave/sentiment.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#analyze_text(body) ⇒ Object

Analyze text directly (operationId: analyzeText, POST /sentiment/analyze).



26
27
28
# File 'lib/wave/sentiment.rb', line 26

def analyze_text(body)
  @client.request("POST", "/sentiment/analyze", body: body)
end

#create_analysis(body) ⇒ Object

Create a sentiment analysis (operationId: createSentimentAnalysis, POST /sentiment).



21
22
23
# File 'lib/wave/sentiment.rb', line 21

def create_analysis(body)
  @client.request("POST", "/sentiment", body: body)
end

#list_analyses(page: nil, per_page: nil, status: nil) ⇒ Object

List sentiment analyses (operationId: listSentimentAnalyses, GET /sentiment).



11
12
13
14
15
16
17
18
# File 'lib/wave/sentiment.rb', line 11

def list_analyses(page: nil, per_page: nil, status: nil)
  query = {
    "page" => page,
    "perPage" => per_page,
    "status" => status,
  }
  @client.request("GET", "/sentiment", query: query)
end