aylien_text_api 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/LICENSE +1 -1
  4. data/aylien_text_api.gemspec +2 -2
  5. data/lib/aylien_text_api.rb +1 -1
  6. data/lib/aylien_text_api/client.rb +59 -15
  7. data/lib/aylien_text_api/configuration.rb +3 -2
  8. data/lib/aylien_text_api/connection.rb +1 -1
  9. data/lib/aylien_text_api/error.rb +1 -1
  10. data/lib/aylien_text_api/version.rb +2 -2
  11. data/spec/fixtures/aylien_text_api/client/absa_with_invalid_client.yml +38 -0
  12. data/spec/fixtures/aylien_text_api/client/absa_with_invalid_params.yml +57 -0
  13. data/spec/fixtures/aylien_text_api/client/absa_with_text.yml +229 -0
  14. data/spec/fixtures/aylien_text_api/client/absa_with_unauthenticated_client.yml +42 -0
  15. data/spec/fixtures/aylien_text_api/client/absa_with_valid_url.yml +407 -0
  16. data/spec/fixtures/aylien_text_api/client/absa_with_value_as_text.yml +229 -0
  17. data/spec/fixtures/aylien_text_api/client/absa_with_value_as_valid_url.yml +407 -0
  18. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_client.yml +3 -3
  19. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_params.yml +5 -5
  20. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_taxonomy.yml +5 -5
  21. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_text.yml +5 -5
  22. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_unauthenticated_client.yml +3 -3
  23. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_valid_url.yml +100 -100
  24. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_text.yml +5 -5
  25. data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_valid_url.yml +100 -100
  26. data/spec/fixtures/aylien_text_api/client/classify_with_invalid_client.yml +3 -3
  27. data/spec/fixtures/aylien_text_api/client/classify_with_invalid_params.yml +6 -6
  28. data/spec/fixtures/aylien_text_api/client/classify_with_text.yml +5 -5
  29. data/spec/fixtures/aylien_text_api/client/classify_with_unauthenticated_client.yml +3 -3
  30. data/spec/fixtures/aylien_text_api/client/classify_with_valid_url.yml +90 -90
  31. data/spec/fixtures/aylien_text_api/client/classify_with_value_as_text.yml +5 -5
  32. data/spec/fixtures/aylien_text_api/client/classify_with_value_as_valid_url.yml +90 -90
  33. data/spec/fixtures/aylien_text_api/client/combined_with_invalid_client.yml +3 -3
  34. data/spec/fixtures/aylien_text_api/client/combined_with_invalid_params.yml +5 -5
  35. data/spec/fixtures/aylien_text_api/client/combined_with_text.yml +9 -9
  36. data/spec/fixtures/aylien_text_api/client/combined_with_unauthenticated_client.yml +3 -3
  37. data/spec/fixtures/aylien_text_api/client/combined_with_valid_url.yml +259 -255
  38. data/spec/fixtures/aylien_text_api/client/combined_with_value_as_text.yml +9 -9
  39. data/spec/fixtures/aylien_text_api/client/combined_with_value_as_valid_url.yml +259 -255
  40. data/spec/fixtures/aylien_text_api/client/concepts_with_invalid_client.yml +3 -3
  41. data/spec/fixtures/aylien_text_api/client/concepts_with_invalid_params.yml +5 -5
  42. data/spec/fixtures/aylien_text_api/client/concepts_with_text.yml +10 -10
  43. data/spec/fixtures/aylien_text_api/client/concepts_with_unauthenticated_client.yml +3 -3
  44. data/spec/fixtures/aylien_text_api/client/concepts_with_valid_url.yml +25 -85
  45. data/spec/fixtures/aylien_text_api/client/concepts_with_value_as_text.yml +10 -10
  46. data/spec/fixtures/aylien_text_api/client/concepts_with_value_as_valid_url.yml +25 -85
  47. data/spec/fixtures/aylien_text_api/client/entities_with_invalid_client.yml +3 -3
  48. data/spec/fixtures/aylien_text_api/client/entities_with_invalid_params.yml +5 -5
  49. data/spec/fixtures/aylien_text_api/client/entities_with_text.yml +5 -5
  50. data/spec/fixtures/aylien_text_api/client/entities_with_unauthenticated_client.yml +3 -3
  51. data/spec/fixtures/aylien_text_api/client/entities_with_valid_url.yml +5 -5
  52. data/spec/fixtures/aylien_text_api/client/entities_with_value_as_text.yml +5 -5
  53. data/spec/fixtures/aylien_text_api/client/entities_with_value_as_valid_url.yml +5 -5
  54. data/spec/fixtures/aylien_text_api/client/extract_with_invalid_client.yml +3 -3
  55. data/spec/fixtures/aylien_text_api/client/extract_with_invalid_params.yml +6 -6
  56. data/spec/fixtures/aylien_text_api/client/extract_with_unauthenticated_client.yml +3 -3
  57. data/spec/fixtures/aylien_text_api/client/extract_with_valid_url.yml +255 -255
  58. data/spec/fixtures/aylien_text_api/client/extract_with_value_as_text.yml +5 -5
  59. data/spec/fixtures/aylien_text_api/client/extract_with_value_as_valid_url.yml +255 -255
  60. data/spec/fixtures/aylien_text_api/client/hashtags_with_invalid_client.yml +3 -3
  61. data/spec/fixtures/aylien_text_api/client/hashtags_with_invalid_params.yml +5 -5
  62. data/spec/fixtures/aylien_text_api/client/hashtags_with_text.yml +5 -5
  63. data/spec/fixtures/aylien_text_api/client/hashtags_with_unauthenticated_client.yml +3 -3
  64. data/spec/fixtures/aylien_text_api/client/hashtags_with_valid_url.yml +13 -42
  65. data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_text.yml +5 -5
  66. data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_valid_url.yml +13 -42
  67. data/spec/fixtures/aylien_text_api/client/image_tags_with_invalid_client.yml +3 -3
  68. data/spec/fixtures/aylien_text_api/client/image_tags_with_invalid_params.yml +6 -6
  69. data/spec/fixtures/aylien_text_api/client/image_tags_with_unauthenticated_client.yml +3 -3
  70. data/spec/fixtures/aylien_text_api/client/image_tags_with_valid_url.yml +8 -8
  71. data/spec/fixtures/aylien_text_api/client/image_tags_with_value_as_text.yml +5 -5
  72. data/spec/fixtures/aylien_text_api/client/image_tags_with_value_as_valid_url.yml +8 -8
  73. data/spec/fixtures/aylien_text_api/client/language_with_invalid_client.yml +3 -3
  74. data/spec/fixtures/aylien_text_api/client/language_with_invalid_params.yml +5 -5
  75. data/spec/fixtures/aylien_text_api/client/language_with_unauthenticated_client.yml +3 -3
  76. data/spec/fixtures/aylien_text_api/client/language_with_valid_text.yml +6 -6
  77. data/spec/fixtures/aylien_text_api/client/language_with_valid_url.yml +13 -37
  78. data/spec/fixtures/aylien_text_api/client/language_with_value_as_text.yml +6 -6
  79. data/spec/fixtures/aylien_text_api/client/language_with_value_as_valid_url.yml +13 -37
  80. data/spec/fixtures/aylien_text_api/client/microformats_with_invalid_client.yml +3 -3
  81. data/spec/fixtures/aylien_text_api/client/microformats_with_invalid_params.yml +5 -5
  82. data/spec/fixtures/aylien_text_api/client/microformats_with_unauthenticated_client.yml +3 -3
  83. data/spec/fixtures/aylien_text_api/client/microformats_with_valid_url.yml +6 -6
  84. data/spec/fixtures/aylien_text_api/client/microformats_with_value_as_valid_url.yml +6 -6
  85. data/spec/fixtures/aylien_text_api/client/rate_limits.yml +6 -6
  86. data/spec/fixtures/aylien_text_api/client/rate_limits_with_invalid_client.yml +3 -3
  87. data/spec/fixtures/aylien_text_api/client/rate_limits_with_unauthenticated_client.yml +3 -3
  88. data/spec/fixtures/aylien_text_api/client/related_with_invalid_client.yml +3 -3
  89. data/spec/fixtures/aylien_text_api/client/related_with_invalid_params.yml +6 -6
  90. data/spec/fixtures/aylien_text_api/client/related_with_phrase.yml +5 -5
  91. data/spec/fixtures/aylien_text_api/client/related_with_unauthenticated_client.yml +3 -3
  92. data/spec/fixtures/aylien_text_api/client/related_with_value_as_phrase.yml +5 -5
  93. data/spec/fixtures/aylien_text_api/client/related_with_value_as_valid_url.yml +5 -5
  94. data/spec/fixtures/aylien_text_api/client/sentiment_with_invalid_client.yml +3 -3
  95. data/spec/fixtures/aylien_text_api/client/sentiment_with_invalid_params.yml +5 -5
  96. data/spec/fixtures/aylien_text_api/client/sentiment_with_text.yml +5 -5
  97. data/spec/fixtures/aylien_text_api/client/sentiment_with_unauthenticated_client.yml +3 -3
  98. data/spec/fixtures/aylien_text_api/client/sentiment_with_valid_url.yml +15 -40
  99. data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_text.yml +5 -5
  100. data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_valid_url.yml +15 -40
  101. data/spec/fixtures/aylien_text_api/client/summarize_with_invalid_client.yml +3 -3
  102. data/spec/fixtures/aylien_text_api/client/summarize_with_invalid_params.yml +5 -5
  103. data/spec/fixtures/aylien_text_api/client/summarize_with_title_and_text.yml +5 -5
  104. data/spec/fixtures/aylien_text_api/client/summarize_with_unauthenticated_client.yml +3 -3
  105. data/spec/fixtures/aylien_text_api/client/summarize_with_valid_url.yml +12 -52
  106. data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_text_and_title.yml +5 -5
  107. data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_text_and_without_title.yml +5 -5
  108. data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_valid_url.yml +12 -52
  109. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_invalid_client.yml +3 -3
  110. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_invalid_params.yml +5 -5
  111. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_text.yml +5 -5
  112. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_unauthenticated_client.yml +3 -3
  113. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_valid_url.yml +42 -42
  114. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_text.yml +5 -5
  115. data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_valid_url.yml +42 -42
  116. data/spec/lib/aylien_text_api/absa.rb +102 -0
  117. data/spec/lib/aylien_text_api/classify.rb +1 -1
  118. data/spec/lib/aylien_text_api/client_spec.rb +1 -0
  119. metadata +21 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9653194b79d0e509f24f5a5f727a8e1531d4abb9
4
- data.tar.gz: 234122c1114c791b556981e74a61039d5e552c51
3
+ metadata.gz: fb740f7faa70a0e3eac16d82927d02c4fbd35cae
4
+ data.tar.gz: dce53f0252457ad79ce510642ca3a0d51ffbab87
5
5
  SHA512:
6
- metadata.gz: ebba1dd1f818a5b422c997aa11570975e217e6e8adac76fb7bd59217af19636aee8d75ca55773ba68d46f4dee5c7f4245fa6afd9fbfec2312dfa69b5d75fbd2a
7
- data.tar.gz: 13281615357b6fbc0554ed59e12e1a04debe53ca6098e2b0ccb732c45eaf6ccef260280b8c2cdc81de66f735f023267f053bf4da6c1134b8e974639791ded05b
6
+ metadata.gz: 99bbb2e9ff6b37852ab1ae7373d212fbe215c2d4b7de0d61d0e902abd15a4db9b550834b198938becf4b0a03ac306c3416d35f8ecb193b80f122b76879819363
7
+ data.tar.gz: 718d244f2b8e6763810ec5ccd65e5242be9246851c2f2cbfdd468f0a4e2421231e6c96656fb10924e23a2c59799f5282007964e368d96adac6177b5abd875433
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aylien_text_api (0.5.1)
4
+ aylien_text_api (0.6.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -28,4 +28,4 @@ DEPENDENCIES
28
28
  webmock (~> 1.20)
29
29
 
30
30
  BUNDLED WITH
31
- 1.10.6
31
+ 1.11.2
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2015 Aylien, Inc. All Rights Reserved.
1
+ Copyright 2016 Aylien, Inc. All Rights Reserved.
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
7
7
  s.version = AylienTextApi::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Aylien Inc.", "Hamed Ramezanian"]
10
- s.license = 'Apache License, Version 2.0'
11
- s.email = ["hello@aylien.com", "hamed.r.nik@gmail.com"]
10
+ s.license = 'Apache-2.0'
11
+ s.email = ["support@aylien.com", "hamed.r.nik@gmail.com"]
12
12
  s.homepage = "https://github.com/AYLIEN/aylien_textapi_ruby"
13
13
  s.summary = %q{AYLIEN Text Analysis API is a package of Natural Language Processing and Machine Learning-powered tools for analyzing and extracting various kinds of information from text and images.}
14
14
  s.description = %q{AYLIEN Text Analysis API is a package of Natural Language Processing and Machine Learning-powered tools for analyzing and extracting various kinds of information from text and images.}
@@ -1,4 +1,4 @@
1
- # Copyright 2015 Aylien, Inc. All Rights Reserved.
1
+ # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2015 Aylien, Inc. All Rights Reserved.
1
+ # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ module AylienTextApi
18
18
  attr_accessor *Configuration::VALID_CONFIG_KEYS
19
19
 
20
20
  # Creates a Client object.
21
+ #
21
22
  # @param [Hash] options Configuration params
22
23
  # @option options [String] :app_id The APP_ID
23
24
  # @option options [String] :app_key The APP_KEY
@@ -53,7 +54,7 @@ module AylienTextApi
53
54
  @connection.request
54
55
  end
55
56
 
56
- # Like extract, but calls request! so an exception is raised
57
+ # Same as extract, but calls request! so an exception is raised
57
58
  # if the request fails.
58
59
  #
59
60
  def extract!(value=nil, params={})
@@ -84,7 +85,7 @@ module AylienTextApi
84
85
  @connection.request
85
86
  end
86
87
 
87
- # Like classify_by_taxonomy, but calls request! so an exception is raised
88
+ # Same as classify_by_taxonomy, but calls request! so an exception is raised
88
89
  # if the request fails.
89
90
  #
90
91
  def classify_by_taxonomy!(value=nil, params={})
@@ -115,7 +116,7 @@ module AylienTextApi
115
116
  @connection.request
116
117
  end
117
118
 
118
- # Like classify, but calls request! so an exception is raised
119
+ # Same as classify, but calls request! so an exception is raised
119
120
  # if the request fails.
120
121
  #
121
122
  def classify!(value=nil, params={})
@@ -148,7 +149,7 @@ module AylienTextApi
148
149
  @connection.request
149
150
  end
150
151
 
151
- # Like concepts, but calls request! so an exception is raised
152
+ # Same as concepts, but calls request! so an exception is raised
152
153
  # if the request fails.
153
154
  #
154
155
  def concepts!(value=nil, params={})
@@ -179,7 +180,7 @@ module AylienTextApi
179
180
  @connection.request
180
181
  end
181
182
 
182
- # Like hashtags, but calls request! so an exception is raised
183
+ # Same as hashtags, but calls request! so an exception is raised
183
184
  # if the request fails.
184
185
  #
185
186
  def hashtags!(value=nil, params={})
@@ -212,7 +213,7 @@ module AylienTextApi
212
213
  @connection.request
213
214
  end
214
215
 
215
- # Like entities, but calls request! so an exception is raised
216
+ # Same as entities, but calls request! so an exception is raised
216
217
  # if the request fails.
217
218
  #
218
219
  def entities!(value=nil, params={})
@@ -241,7 +242,7 @@ module AylienTextApi
241
242
  @connection.request
242
243
  end
243
244
 
244
- # Like language, but calls request! so an exception is raised
245
+ # Same as language, but calls request! so an exception is raised
245
246
  # if the request fails.
246
247
  #
247
248
  def language!(value=nil, params={})
@@ -273,7 +274,7 @@ module AylienTextApi
273
274
  @connection.request
274
275
  end
275
276
 
276
- # Like sentiment, but calls request! so an exception is raised
277
+ # Same as sentiment, but calls request! so an exception is raised
277
278
  # if the request fails.
278
279
  #
279
280
  def sentiment!(value=nil, params={})
@@ -313,7 +314,7 @@ module AylienTextApi
313
314
  @connection.request
314
315
  end
315
316
 
316
- # Like summarize, but calls request! so an exception is raised
317
+ # Same as summarize, but calls request! so an exception is raised
317
318
  # if the request fails.
318
319
  #
319
320
  def summarize!(value=nil, params={})
@@ -342,7 +343,7 @@ module AylienTextApi
342
343
  @connection.request
343
344
  end
344
345
 
345
- # Like related, but calls request! so an exception is raised
346
+ # Same as related, but calls request! so an exception is raised
346
347
  # if the request fails.
347
348
  #
348
349
  def related!(value=nil, params={})
@@ -372,7 +373,7 @@ module AylienTextApi
372
373
  @connection.request
373
374
  end
374
375
 
375
- # Like microformats, but calls request! so an exception is raised
376
+ # Same as microformats, but calls request! so an exception is raised
376
377
  # if the request fails.
377
378
  #
378
379
  def microformats!(value=nil, params={})
@@ -403,7 +404,7 @@ module AylienTextApi
403
404
  @connection.request
404
405
  end
405
406
 
406
- # Like unsupervised_classify, but calls request! so an exception is raised
407
+ # Same as unsupervised_classify, but calls request! so an exception is raised
407
408
  # if the request fails.
408
409
  #
409
410
  def unsupervised_classify!(value=nil, params={})
@@ -432,7 +433,7 @@ module AylienTextApi
432
433
  @connection.request
433
434
  end
434
435
 
435
- # Like combined, but calls request! so an exception is raised
436
+ # Same as combined, but calls request! so an exception is raised
436
437
  # if the request fails.
437
438
  #
438
439
  def combined!(value=nil, params={})
@@ -458,7 +459,7 @@ module AylienTextApi
458
459
  @connection.request
459
460
  end
460
461
 
461
- # Like image_tags, but calls request! so an exception is raised
462
+ # Same as image_tags, but calls request! so an exception is raised
462
463
  # if the request fails.
463
464
  #
464
465
  def image_tags!(value=nil, params={})
@@ -468,6 +469,38 @@ module AylienTextApi
468
469
  @connection.request!
469
470
  end
470
471
 
472
+ # Detects aspects and sentiment of a body of text.
473
+ # Given a review for a product or service, analyzes the sentiment of the
474
+ # review towards each of the aspects of the product or review that are
475
+ # mentioned in it.
476
+ #
477
+ # @param [String] value (nil) URL or Text
478
+ # @param [Hash] params The ABSA endpoint options
479
+ # @option params [String] :url The URL
480
+ # @option params [String] :text Text
481
+ # @option params [String] :domain Domain which document belongs to
482
+ #
483
+ # @return [Hash, nil] A hash of result. See
484
+ # http://docs.aylien.com/docs/absa for more information
485
+ # on the data returned.
486
+ #
487
+ def aspect_based_sentiment(value=nil, params={})
488
+ endpoint, params, config = common_endpoint(value, params,
489
+ Configuration::ENDPOINTS[:absa])
490
+ @connection = Connection.new(endpoint, params, config)
491
+ @connection.request
492
+ end
493
+
494
+ # Same as aspect_based_sentiment, but calls request! so an exception is raised
495
+ # if the request fails.
496
+ #
497
+ def aspect_based_sentiment!(value=nil, params={})
498
+ endpoint, params, config = common_endpoint(value, params,
499
+ Configuration::ENDPOINTS[:absa])
500
+ @connection = Connection.new(endpoint, params, config)
501
+ @connection.request!
502
+ end
503
+
471
504
  # Returns current client's rate limit values. If it gets failed,
472
505
  # nil will be returned.
473
506
  #
@@ -513,6 +546,17 @@ module AylienTextApi
513
546
  end
514
547
  end
515
548
 
549
+ if endpoint == Configuration::ENDPOINTS[:absa]
550
+ if params[:domain] && !params[:domain].empty?
551
+ endpoint = Configuration::ENDPOINTS[:absa]
552
+ .gsub(/\:domain/, params[:domain])
553
+ else
554
+ error_message = "Invalid domain. Domain can't be blank."
555
+ error = AylienTextApi::Error::InvalidInput.new(error_message)
556
+ raise error
557
+ end
558
+ end
559
+
516
560
  config = {}
517
561
  Configuration::VALID_CONFIG_KEYS.each do |key|
518
562
  config[key] = send(key)
@@ -1,4 +1,4 @@
1
- # Copyright 2015 Aylien, Inc. All Rights Reserved.
1
+ # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -39,7 +39,8 @@ module AylienTextApi
39
39
  microformats: 'microformats',
40
40
  unsupervised_classify: 'classify/unsupervised',
41
41
  image_tags: 'image-tags',
42
- combined: 'combined'
42
+ combined: 'combined',
43
+ absa: 'absa/:domain'
43
44
  }
44
45
 
45
46
  # Build accessor methods for every config options so we can do this, for example:
@@ -1,4 +1,4 @@
1
- # Copyright 2015 Aylien, Inc. All Rights Reserved.
1
+ # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2015 Aylien, Inc. All Rights Reserved.
1
+ # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2015 Aylien, Inc. All Rights Reserved.
1
+ # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module AylienTextApi
16
- VERSION = "0.5.1" unless defined? AylienTextApi::VERSION
16
+ VERSION = "0.6.0" unless defined? AylienTextApi::VERSION
17
17
  end
@@ -0,0 +1,38 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.aylien.com/api/v1/absa/restaurants
6
+ body:
7
+ encoding: US-ASCII
8
+ string: text=We+visited+here+during+our+recent+trip+to+Sydney+and+%0A++++++overall+we+were+very+impressed.+We+decided+to+make+a+reservation+online%2C+%0A++++++which+was+quick+and+easy+with+instant+confirmation.+%0A++++++It+was+nice+to+be+able+to+view+the+table+layout+and+select+our+own+online.+%0A++++++The+location+is+spectacular+with+stunning+views+of+the+harbour+%0A++++++and+Opera+House.+It+truly+was+amazing.+%0A++++++Despite+this%2C+however%2C+the+restaurant+was++only+about+25%25+%0A++++++full+and+so+the+atmosphere+was+a+bit+flat.+Perhaps+this+was+to+our+%0A++++++benefit+as+we+received+top+class+service+from+our+waiter%2C+%0A++++++Brandon%2C+who+was+not+only+friendly+and+funny+but+extremely+%0A++++++knowledgeable+when+it+came+to+food+and+wine+pairings.+%0A++++++Speaking+of+wine%2C+the+list+was+extensive+-+we+loved+it+-+%0A++++++and+it+took+us+what+seemed+like+an+hour+to+eventually+%0A++++++decide+on+a+local+Shiraz.+Now+on+to+the+most+important+%0A++++++aspect%2C+the+food.+Our+seafood+starters+were+delicious%2C+%0A++++++as+were+out+fillet+steak+mains.+%0A++++++The+one+and+only+real+disappointment+was+the+dessert+which+was+served+%0A++++++with+no+real+imagination+and+looked+like+it+had+been+purchased+%0A++++++yesterday+at+the+local+grocery+store.+%0A++++++All+in+all%2C+my+favourite+Sydney+restaurant+so+far.+%0A++++++So+many+positives+and+really+good+value+too.+Highly+recommend%21&domain=restaurants
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Aylien Text API Ruby Gem 0.6.0
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ response:
19
+ status:
20
+ code: 403
21
+ message: Forbidden
22
+ headers:
23
+ Server:
24
+ - openresty/1.9.3.2
25
+ Date:
26
+ - Thu, 28 Apr 2016 10:36:21 GMT
27
+ Content-Type:
28
+ - text/plain; charset=us-ascii
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: Authentication parameters missing
36
+ http_version:
37
+ recorded_at: Thu, 28 Apr 2016 10:36:21 GMT
38
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.aylien.com/api/v1/absa/restaurants
6
+ body:
7
+ encoding: US-ASCII
8
+ string: wrong_param=We+visited+here+during+our+recent+trip+to+Sydney+and+%0A++++++overall+we+were+very+impressed.+We+decided+to+make+a+reservation+online%2C+%0A++++++which+was+quick+and+easy+with+instant+confirmation.+%0A++++++It+was+nice+to+be+able+to+view+the+table+layout+and+select+our+own+online.+%0A++++++The+location+is+spectacular+with+stunning+views+of+the+harbour+%0A++++++and+Opera+House.+It+truly+was+amazing.+%0A++++++Despite+this%2C+however%2C+the+restaurant+was++only+about+25%25+%0A++++++full+and+so+the+atmosphere+was+a+bit+flat.+Perhaps+this+was+to+our+%0A++++++benefit+as+we+received+top+class+service+from+our+waiter%2C+%0A++++++Brandon%2C+who+was+not+only+friendly+and+funny+but+extremely+%0A++++++knowledgeable+when+it+came+to+food+and+wine+pairings.+%0A++++++Speaking+of+wine%2C+the+list+was+extensive+-+we+loved+it+-+%0A++++++and+it+took+us+what+seemed+like+an+hour+to+eventually+%0A++++++decide+on+a+local+Shiraz.+Now+on+to+the+most+important+%0A++++++aspect%2C+the+food.+Our+seafood+starters+were+delicious%2C+%0A++++++as+were+out+fillet+steak+mains.+%0A++++++The+one+and+only+real+disappointment+was+the+dessert+which+was+served+%0A++++++with+no+real+imagination+and+looked+like+it+had+been+purchased+%0A++++++yesterday+at+the+local+grocery+store.+%0A++++++All+in+all%2C+my+favourite+Sydney+restaurant+so+far.+%0A++++++So+many+positives+and+really+good+value+too.+Highly+recommend%21&domain=restaurants
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Aylien Text API Ruby Gem 0.6.0
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ X-Aylien-Textapi-Application-Id:
19
+ - "<PASSWORD>"
20
+ X-Aylien-Textapi-Application-Key:
21
+ - "<PASSWORD>"
22
+ response:
23
+ status:
24
+ code: 400
25
+ message: Bad Request
26
+ headers:
27
+ Server:
28
+ - openresty/1.9.3.2
29
+ Date:
30
+ - Thu, 28 Apr 2016 10:36:28 GMT
31
+ Content-Type:
32
+ - application/json;charset=UTF-8
33
+ Content-Length:
34
+ - '219'
35
+ Connection:
36
+ - keep-alive
37
+ X-Ratelimit-Limit:
38
+ - '207000'
39
+ X-Ratelimit-Remaining:
40
+ - '174112'
41
+ X-Ratelimit-Reset:
42
+ - '1461888000'
43
+ body:
44
+ encoding: UTF-8
45
+ string: |-
46
+ {
47
+ "error": "requirement failed: either text or url is required",
48
+ "errors": [{
49
+ "reason": "required",
50
+ "message": "either text or url is required",
51
+ "locationType": "parameter",
52
+ "location": "text"
53
+ }]
54
+ }
55
+ http_version:
56
+ recorded_at: Thu, 28 Apr 2016 10:36:28 GMT
57
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,229 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.aylien.com/api/v1/absa/restaurants
6
+ body:
7
+ encoding: US-ASCII
8
+ string: text=We+visited+here+during+our+recent+trip+to+Sydney+and+%0A++++++overall+we+were+very+impressed.+We+decided+to+make+a+reservation+online%2C+%0A++++++which+was+quick+and+easy+with+instant+confirmation.+%0A++++++It+was+nice+to+be+able+to+view+the+table+layout+and+select+our+own+online.+%0A++++++The+location+is+spectacular+with+stunning+views+of+the+harbour+%0A++++++and+Opera+House.+It+truly+was+amazing.+%0A++++++Despite+this%2C+however%2C+the+restaurant+was++only+about+25%25+%0A++++++full+and+so+the+atmosphere+was+a+bit+flat.+Perhaps+this+was+to+our+%0A++++++benefit+as+we+received+top+class+service+from+our+waiter%2C+%0A++++++Brandon%2C+who+was+not+only+friendly+and+funny+but+extremely+%0A++++++knowledgeable+when+it+came+to+food+and+wine+pairings.+%0A++++++Speaking+of+wine%2C+the+list+was+extensive+-+we+loved+it+-+%0A++++++and+it+took+us+what+seemed+like+an+hour+to+eventually+%0A++++++decide+on+a+local+Shiraz.+Now+on+to+the+most+important+%0A++++++aspect%2C+the+food.+Our+seafood+starters+were+delicious%2C+%0A++++++as+were+out+fillet+steak+mains.+%0A++++++The+one+and+only+real+disappointment+was+the+dessert+which+was+served+%0A++++++with+no+real+imagination+and+looked+like+it+had+been+purchased+%0A++++++yesterday+at+the+local+grocery+store.+%0A++++++All+in+all%2C+my+favourite+Sydney+restaurant+so+far.+%0A++++++So+many+positives+and+really+good+value+too.+Highly+recommend%21&domain=restaurants
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Aylien Text API Ruby Gem 0.6.0
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
18
+ X-Aylien-Textapi-Application-Id:
19
+ - "<PASSWORD>"
20
+ X-Aylien-Textapi-Application-Key:
21
+ - "<PASSWORD>"
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Server:
28
+ - openresty/1.9.3.2
29
+ Date:
30
+ - Thu, 28 Apr 2016 10:36:20 GMT
31
+ Content-Type:
32
+ - application/json;charset=UTF-8
33
+ Content-Length:
34
+ - '7589'
35
+ Connection:
36
+ - keep-alive
37
+ X-Ratelimit-Limit:
38
+ - '207000'
39
+ X-Ratelimit-Remaining:
40
+ - '174115'
41
+ X-Ratelimit-Reset:
42
+ - '1461888000'
43
+ body:
44
+ encoding: UTF-8
45
+ string: |-
46
+ {
47
+ "text": "We visited here during our recent trip to Sydney and \n overall we were very impressed. We decided to make a reservation online, \n which was quick and easy with instant confirmation. \n It was nice to be able to view the table layout and select our own online. \n The location is spectacular with stunning views of the harbour \n and Opera House. It truly was amazing. \n Despite this, however, the restaurant was only about 25% \n full and so the atmosphere was a bit flat. Perhaps this was to our \n benefit as we received top class service from our waiter, \n Brandon, who was not only friendly and funny but extremely \n knowledgeable when it came to food and wine pairings. \n Speaking of wine, the list was extensive - we loved it - \n and it took us what seemed like an hour to eventually \n decide on a local Shiraz. Now on to the most important \n aspect, the food. Our seafood starters were delicious, \n as were out fillet steak mains. \n The one and only real disappointment was the dessert which was served \n with no real imagination and looked like it had been purchased \n yesterday at the local grocery store. \n All in all, my favourite Sydney restaurant so far. \n So many positives and really good value too. Highly recommend!",
48
+ "domain": "restaurants",
49
+ "aspects": [{
50
+ "aspect": "food",
51
+ "aspect_confidence": 0.6389724388718605,
52
+ "polarity": "positive",
53
+ "polarity_confidence": 0.8153238445520401
54
+ }, {
55
+ "aspect": "reservations",
56
+ "aspect_confidence": 0.9852001070976257,
57
+ "polarity": "positive",
58
+ "polarity_confidence": 0.5800985991954803
59
+ }, {
60
+ "aspect": "value",
61
+ "aspect_confidence": 0.5432075262069702,
62
+ "polarity": "positive",
63
+ "polarity_confidence": 0.9174332618713379
64
+ }, {
65
+ "aspect": "desserts",
66
+ "aspect_confidence": 0.9849463701248169,
67
+ "polarity": "negative",
68
+ "polarity_confidence": 0.995750904083252
69
+ }, {
70
+ "aspect": "location",
71
+ "aspect_confidence": 0.9726915955543518,
72
+ "polarity": "positive",
73
+ "polarity_confidence": 0.9497880935668945
74
+ }, {
75
+ "aspect": "ambience",
76
+ "aspect_confidence": 0.972251832485199,
77
+ "polarity": "neutral",
78
+ "polarity_confidence": 0.781753480434418
79
+ }, {
80
+ "aspect": "staff",
81
+ "aspect_confidence": 0.6776668429374695,
82
+ "polarity": "positive",
83
+ "polarity_confidence": 0.9565765261650085
84
+ }, {
85
+ "aspect": "drinks",
86
+ "aspect_confidence": 0.5717937052249908,
87
+ "polarity": "positive",
88
+ "polarity_confidence": 0.8246689140796661
89
+ }],
90
+ "sentences": [{
91
+ "text": "We visited here during our recent trip to Sydney and \n overall we were very impressed.",
92
+ "polarity": "positive",
93
+ "polarity_confidence": 0.984675943851471,
94
+ "aspects": []
95
+ }, {
96
+ "text": "We decided to make a reservation online, \n which was quick and easy with instant confirmation.",
97
+ "polarity": "positive",
98
+ "polarity_confidence": 0.5614513158798218,
99
+ "aspects": [{
100
+ "aspect": "reservations",
101
+ "aspect_confidence": 0.9985753297805786,
102
+ "polarity": "positive",
103
+ "polarity_confidence": 0.5614513158798218
104
+ }]
105
+ }, {
106
+ "text": "It was nice to be able to view the table layout and select our own online.",
107
+ "polarity": "positive",
108
+ "polarity_confidence": 0.5987458825111389,
109
+ "aspects": [{
110
+ "aspect": "reservations",
111
+ "aspect_confidence": 0.9718248844146729,
112
+ "polarity": "positive",
113
+ "polarity_confidence": 0.5987458825111389
114
+ }]
115
+ }, {
116
+ "text": "The location is spectacular with stunning views of the harbour \n and Opera House.",
117
+ "polarity": "positive",
118
+ "polarity_confidence": 0.9497880935668945,
119
+ "aspects": [{
120
+ "aspect": "location",
121
+ "aspect_confidence": 0.9726915955543518,
122
+ "polarity": "positive",
123
+ "polarity_confidence": 0.9497880935668945
124
+ }]
125
+ }, {
126
+ "text": "It truly was amazing.",
127
+ "polarity": "positive",
128
+ "polarity_confidence": 0.9748669266700745,
129
+ "aspects": []
130
+ }, {
131
+ "text": "Despite this, however, the restaurant was only about 25% \n full and so the atmosphere was a bit flat.",
132
+ "polarity": "neutral",
133
+ "polarity_confidence": 0.781753480434418,
134
+ "aspects": [{
135
+ "aspect": "ambience",
136
+ "aspect_confidence": 0.972251832485199,
137
+ "polarity": "neutral",
138
+ "polarity_confidence": 0.781753480434418
139
+ }]
140
+ }, {
141
+ "text": "Perhaps this was to our \n benefit as we received top class service from our waiter, \n Brandon, who was not only friendly and funny but extremely \n knowledgeable when it came to food and wine pairings.",
142
+ "polarity": "positive",
143
+ "polarity_confidence": 0.9565765261650085,
144
+ "aspects": [{
145
+ "aspect": "staff",
146
+ "aspect_confidence": 0.6776668429374695,
147
+ "polarity": "positive",
148
+ "polarity_confidence": 0.9565765261650085
149
+ }, {
150
+ "aspect": "drinks",
151
+ "aspect_confidence": 0.17813384532928467,
152
+ "polarity": "positive",
153
+ "polarity_confidence": 0.9565765261650085
154
+ }, {
155
+ "aspect": "food",
156
+ "aspect_confidence": 0.13842013478279114,
157
+ "polarity": "positive",
158
+ "polarity_confidence": 0.9565765261650085
159
+ }]
160
+ }, {
161
+ "text": "Speaking of wine, the list was extensive - we loved it - \n and it took us what seemed like an hour to eventually \n decide on a local Shiraz.",
162
+ "polarity": "positive",
163
+ "polarity_confidence": 0.6927613019943237,
164
+ "aspects": [{
165
+ "aspect": "drinks",
166
+ "aspect_confidence": 0.965453565120697,
167
+ "polarity": "positive",
168
+ "polarity_confidence": 0.6927613019943237
169
+ }]
170
+ }, {
171
+ "text": "Now on to the most important \n aspect, the food.",
172
+ "polarity": "neutral",
173
+ "polarity_confidence": 0.7868802547454836,
174
+ "aspects": [{
175
+ "aspect": "food",
176
+ "aspect_confidence": 0.9815698862075806,
177
+ "polarity": "neutral",
178
+ "polarity_confidence": 0.7868802547454836
179
+ }]
180
+ }, {
181
+ "text": "Our seafood starters were delicious, \n as were out fillet steak mains.",
182
+ "polarity": "positive",
183
+ "polarity_confidence": 0.8636056184768677,
184
+ "aspects": [{
185
+ "aspect": "food",
186
+ "aspect_confidence": 0.9942842125892639,
187
+ "polarity": "positive",
188
+ "polarity_confidence": 0.8636056184768677
189
+ }]
190
+ }, {
191
+ "text": "The one and only real disappointment was the dessert which was served \n with no real imagination and looked like it had been purchased \n yesterday at the local grocery store.",
192
+ "polarity": "negative",
193
+ "polarity_confidence": 0.995750904083252,
194
+ "aspects": [{
195
+ "aspect": "desserts",
196
+ "aspect_confidence": 0.9849463701248169,
197
+ "polarity": "negative",
198
+ "polarity_confidence": 0.995750904083252
199
+ }]
200
+ }, {
201
+ "text": "All in all, my favourite Sydney restaurant so far.",
202
+ "polarity": "positive",
203
+ "polarity_confidence": 0.8425157070159912,
204
+ "aspects": []
205
+ }, {
206
+ "text": "So many positives and really good value too.",
207
+ "polarity": "positive",
208
+ "polarity_confidence": 0.9174332618713379,
209
+ "aspects": [{
210
+ "aspect": "value",
211
+ "aspect_confidence": 0.5432075262069702,
212
+ "polarity": "positive",
213
+ "polarity_confidence": 0.9174332618713379
214
+ }, {
215
+ "aspect": "food",
216
+ "aspect_confidence": 0.4416155219078064,
217
+ "polarity": "positive",
218
+ "polarity_confidence": 0.9174332618713379
219
+ }]
220
+ }, {
221
+ "text": "Highly recommend!",
222
+ "polarity": "positive",
223
+ "polarity_confidence": 0.9992091059684753,
224
+ "aspects": []
225
+ }]
226
+ }
227
+ http_version:
228
+ recorded_at: Thu, 28 Apr 2016 10:36:20 GMT
229
+ recorded_with: VCR 2.9.3