Module: Textalytics::Api::Base
- Includes:
- ClassificationEntity, LanguageEntity, SentimentEntity, TopicsEntity, Helpers
- Included in:
- Client
- Defined in:
- lib/textalytics/api/base.rb
Constant Summary
Constants included from Helpers
Helpers::CLASSIFICATION, Helpers::LANGUAGE, Helpers::SENTIMENT, Helpers::TOPICS
Instance Method Summary collapse
-
#classification(options = {}) ⇒ Object
Classification API.
-
#language(options = {}) ⇒ Object
Language Identification API.
-
#sentiment(options = {}) ⇒ Object
Sentiment API.
-
#topics(options = {}) ⇒ Object
Topics Extraction API.
Instance Method Details
#classification(options = {}) ⇒ Object
Classification API
14 15 16 17 18 19 20 |
# File 'lib/textalytics/api/base.rb', line 14 def classification(={}) [:key] = @classification_key [:of] = 'json' query = { query: } response = get(CLASSIFICATION, query) Classification.new(response) end |
#language(options = {}) ⇒ Object
Language Identification API
50 51 52 53 54 55 56 |
# File 'lib/textalytics/api/base.rb', line 50 def language( = {}) [:key] = @language_key [:of] = 'json' query = { query: } response = get(LANGUAGE, query) Language.new(response) end |
#sentiment(options = {}) ⇒ Object
Sentiment API
25 26 27 28 29 30 31 |
# File 'lib/textalytics/api/base.rb', line 25 def sentiment( = {}) [:key] = @sentiment_key [:of] = 'json' query = { query: } response = get(SENTIMENT, query) Sentiment.new(response) end |
#topics(options = {}) ⇒ Object
Topics Extraction API
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/textalytics/api/base.rb', line 35 def topics( = {}) [:key] = @topics_key [:of] = 'json' unless .has_key?(:tt) [:tt] = 'a' end query = { query: } response = get(TOPICS, query) Topics.new(response) end |