Class: SyllabsApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/syllabs-api/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ Client

Returns a new instance of Client.



4
5
6
7
8
9
# File 'lib/syllabs-api/client.rb', line 4

def initialize(api_key)
  raise InvalidKey if api_key.nil?
  @api_key = api_key
rescue Exception => e
  raise e
end

Instance Method Details

#entities(text) ⇒ Object



23
24
25
26
27
# File 'lib/syllabs-api/client.rb', line 23

def entities(text)
  Modules::NamedEntityExtraction::Base.process(@api_key, text).entities
rescue Exception => e
  raise e
end

#evaluations(text) ⇒ Object



17
18
19
20
21
# File 'lib/syllabs-api/client.rb', line 17

def evaluations(text)
  Modules::SentimentAnalysis::Base.process(@api_key, text).evaluations
rescue Exception => e
  raise e
end

#extract_from_url(url) ⇒ Object



29
30
31
32
33
# File 'lib/syllabs-api/client.rb', line 29

def extract_from_url(url)
  Modules::Extract::Base.process(@api_key, url).text
rescue Exception => e
  raise e
end

#languages(text) ⇒ Object



35
36
37
38
39
# File 'lib/syllabs-api/client.rb', line 35

def languages(text)
  Modules::LanguageDetection::Base.process(@api_key, text).languages
rescue Exception => e
  raise e
end

#terms(text) ⇒ Object



11
12
13
14
15
# File 'lib/syllabs-api/client.rb', line 11

def terms(text)
  Modules::Terms::Base.process(@api_key, text).terms
rescue Exception => e
  raise e
end