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.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/LICENSE +1 -1
- data/aylien_text_api.gemspec +2 -2
- data/lib/aylien_text_api.rb +1 -1
- data/lib/aylien_text_api/client.rb +59 -15
- data/lib/aylien_text_api/configuration.rb +3 -2
- data/lib/aylien_text_api/connection.rb +1 -1
- data/lib/aylien_text_api/error.rb +1 -1
- data/lib/aylien_text_api/version.rb +2 -2
- data/spec/fixtures/aylien_text_api/client/absa_with_invalid_client.yml +38 -0
- data/spec/fixtures/aylien_text_api/client/absa_with_invalid_params.yml +57 -0
- data/spec/fixtures/aylien_text_api/client/absa_with_text.yml +229 -0
- data/spec/fixtures/aylien_text_api/client/absa_with_unauthenticated_client.yml +42 -0
- data/spec/fixtures/aylien_text_api/client/absa_with_valid_url.yml +407 -0
- data/spec/fixtures/aylien_text_api/client/absa_with_value_as_text.yml +229 -0
- data/spec/fixtures/aylien_text_api/client/absa_with_value_as_valid_url.yml +407 -0
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_taxonomy.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_valid_url.yml +100 -100
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_value_as_valid_url.yml +100 -100
- data/spec/fixtures/aylien_text_api/client/classify_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/classify_with_invalid_params.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/classify_with_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/classify_with_valid_url.yml +90 -90
- data/spec/fixtures/aylien_text_api/client/classify_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/classify_with_value_as_valid_url.yml +90 -90
- data/spec/fixtures/aylien_text_api/client/combined_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/combined_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/combined_with_text.yml +9 -9
- data/spec/fixtures/aylien_text_api/client/combined_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/combined_with_valid_url.yml +259 -255
- data/spec/fixtures/aylien_text_api/client/combined_with_value_as_text.yml +9 -9
- data/spec/fixtures/aylien_text_api/client/combined_with_value_as_valid_url.yml +259 -255
- data/spec/fixtures/aylien_text_api/client/concepts_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/concepts_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/concepts_with_text.yml +10 -10
- data/spec/fixtures/aylien_text_api/client/concepts_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/concepts_with_valid_url.yml +25 -85
- data/spec/fixtures/aylien_text_api/client/concepts_with_value_as_text.yml +10 -10
- data/spec/fixtures/aylien_text_api/client/concepts_with_value_as_valid_url.yml +25 -85
- data/spec/fixtures/aylien_text_api/client/entities_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/entities_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/entities_with_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/entities_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/entities_with_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/entities_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/entities_with_value_as_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/extract_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/extract_with_invalid_params.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/extract_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/extract_with_valid_url.yml +255 -255
- data/spec/fixtures/aylien_text_api/client/extract_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/extract_with_value_as_valid_url.yml +255 -255
- data/spec/fixtures/aylien_text_api/client/hashtags_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/hashtags_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/hashtags_with_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/hashtags_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/hashtags_with_valid_url.yml +13 -42
- data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_valid_url.yml +13 -42
- data/spec/fixtures/aylien_text_api/client/image_tags_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/image_tags_with_invalid_params.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/image_tags_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/image_tags_with_valid_url.yml +8 -8
- data/spec/fixtures/aylien_text_api/client/image_tags_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/image_tags_with_value_as_valid_url.yml +8 -8
- data/spec/fixtures/aylien_text_api/client/language_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/language_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/language_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/language_with_valid_text.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/language_with_valid_url.yml +13 -37
- data/spec/fixtures/aylien_text_api/client/language_with_value_as_text.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/language_with_value_as_valid_url.yml +13 -37
- data/spec/fixtures/aylien_text_api/client/microformats_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/microformats_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/microformats_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/microformats_with_valid_url.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/microformats_with_value_as_valid_url.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/rate_limits.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/rate_limits_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/rate_limits_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/related_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/related_with_invalid_params.yml +6 -6
- data/spec/fixtures/aylien_text_api/client/related_with_phrase.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/related_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/related_with_value_as_phrase.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/related_with_value_as_valid_url.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/sentiment_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/sentiment_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/sentiment_with_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/sentiment_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/sentiment_with_valid_url.yml +15 -40
- data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_valid_url.yml +15 -40
- data/spec/fixtures/aylien_text_api/client/summarize_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/summarize_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/summarize_with_title_and_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/summarize_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/summarize_with_valid_url.yml +12 -52
- data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_text_and_title.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_text_and_without_title.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_valid_url.yml +12 -52
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_invalid_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_invalid_params.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_unauthenticated_client.yml +3 -3
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_valid_url.yml +42 -42
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_text.yml +5 -5
- data/spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_valid_url.yml +42 -42
- data/spec/lib/aylien_text_api/absa.rb +102 -0
- data/spec/lib/aylien_text_api/classify.rb +1 -1
- data/spec/lib/aylien_text_api/client_spec.rb +1 -0
- metadata +21 -6
@@ -0,0 +1,102 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "ABSA endpoint" do
|
4
|
+
before do
|
5
|
+
@url = "http://techcrunch.com/2014/10/20/the-super-slim-kindle-voyage-is-a-great-travel-companion/"
|
6
|
+
@text = %q(We visited here during our recent trip to Sydney and
|
7
|
+
overall we were very impressed. We decided to make a reservation online,
|
8
|
+
which was quick and easy with instant confirmation.
|
9
|
+
It was nice to be able to view the table layout and select our own online.
|
10
|
+
The location is spectacular with stunning views of the harbour
|
11
|
+
and Opera House. It truly was amazing.
|
12
|
+
Despite this, however, the restaurant was only about 25%
|
13
|
+
full and so the atmosphere was a bit flat. Perhaps this was to our
|
14
|
+
benefit as we received top class service from our waiter,
|
15
|
+
Brandon, who was not only friendly and funny but extremely
|
16
|
+
knowledgeable when it came to food and wine pairings.
|
17
|
+
Speaking of wine, the list was extensive - we loved it -
|
18
|
+
and it took us what seemed like an hour to eventually
|
19
|
+
decide on a local Shiraz. Now on to the most important
|
20
|
+
aspect, the food. Our seafood starters were delicious,
|
21
|
+
as were out fillet steak mains.
|
22
|
+
The one and only real disappointment was the dessert which was served
|
23
|
+
with no real imagination and looked like it had been purchased
|
24
|
+
yesterday at the local grocery store.
|
25
|
+
All in all, my favourite Sydney restaurant so far.
|
26
|
+
So many positives and really good value too. Highly recommend!)
|
27
|
+
@domain = "restaurants"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "shouldn't be nil with valid url" do
|
31
|
+
VCR.use_cassette('absa_with_valid_url') do
|
32
|
+
result = @client.aspect_based_sentiment(url: @url, domain: @domain)
|
33
|
+
result.wont_be_nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "shouldn't be nil with text" do
|
38
|
+
VCR.use_cassette('absa_with_text') do
|
39
|
+
result = @client.aspect_based_sentiment(text: @text, domain: @domain)
|
40
|
+
result.wont_be_nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it "shouldn't be nil with value as valid url" do
|
45
|
+
VCR.use_cassette('absa_with_value_as_valid_url') do
|
46
|
+
result = @client.aspect_based_sentiment(@url, domain: @domain)
|
47
|
+
result.wont_be_nil
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it "shouldn't be nil with value as value" do
|
52
|
+
VCR.use_cassette('absa_with_value_as_text') do
|
53
|
+
result = @client.aspect_based_sentiment(@text, domain: @domain)
|
54
|
+
result.wont_be_nil
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should be nil with invalid params" do
|
59
|
+
VCR.use_cassette('absa_with_invalid_params') do
|
60
|
+
result = @client.aspect_based_sentiment(wrong_param: @text, domain: @domain)
|
61
|
+
result.must_be_nil
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should be nil with unauthenticated client" do
|
66
|
+
VCR.use_cassette('absa_with_unauthenticated_client') do
|
67
|
+
result = @unauthenticated_client.aspect_based_sentiment(text: @text, domain: @domain)
|
68
|
+
result.must_be_nil
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should raise Forbidden with unauthenticated client" do
|
73
|
+
VCR.use_cassette('absa_with_unauthenticated_client') do
|
74
|
+
proc {
|
75
|
+
@unauthenticated_client.aspect_based_sentiment!(text: @text, domain: @domain)
|
76
|
+
}.must_raise AylienTextApi::Error::Forbidden
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should be nil with invalid client" do
|
81
|
+
VCR.use_cassette('absa_with_invalid_client') do
|
82
|
+
result = @invalid_client.aspect_based_sentiment(text: @text, domain: @domain)
|
83
|
+
result.must_be_nil
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should raise Forbidden with invalid client" do
|
88
|
+
VCR.use_cassette('absa_with_invalid_client') do
|
89
|
+
proc {
|
90
|
+
@invalid_client.aspect_based_sentiment!(text: @text, domain: @domain)
|
91
|
+
}.must_raise AylienTextApi::Error::Forbidden
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should raise BadRequest with invalid params" do
|
96
|
+
VCR.use_cassette('absa_with_invalid_params') do
|
97
|
+
proc {
|
98
|
+
@client.aspect_based_sentiment!(wrong_param: @text, domain: @domain)
|
99
|
+
}.must_raise AylienTextApi::Error::BadRequest
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -79,7 +79,7 @@ describe "Classify endpoint" do
|
|
79
79
|
it "should raise BadRequest with invalid params" do
|
80
80
|
VCR.use_cassette('classify_with_invalid_params') do
|
81
81
|
proc {
|
82
|
-
@
|
82
|
+
@client.classify!(wrong_param: @text)
|
83
83
|
}.must_raise AylienTextApi::Error::BadRequest
|
84
84
|
end
|
85
85
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aylien_text_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aylien Inc.
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -71,7 +71,7 @@ description: AYLIEN Text Analysis API is a package of Natural Language Processin
|
|
71
71
|
and Machine Learning-powered tools for analyzing and extracting various kinds of
|
72
72
|
information from text and images.
|
73
73
|
email:
|
74
|
-
-
|
74
|
+
- support@aylien.com
|
75
75
|
- hamed.r.nik@gmail.com
|
76
76
|
executables: []
|
77
77
|
extensions: []
|
@@ -91,6 +91,13 @@ files:
|
|
91
91
|
- lib/aylien_text_api/connection.rb
|
92
92
|
- lib/aylien_text_api/error.rb
|
93
93
|
- lib/aylien_text_api/version.rb
|
94
|
+
- spec/fixtures/aylien_text_api/client/absa_with_invalid_client.yml
|
95
|
+
- spec/fixtures/aylien_text_api/client/absa_with_invalid_params.yml
|
96
|
+
- spec/fixtures/aylien_text_api/client/absa_with_text.yml
|
97
|
+
- spec/fixtures/aylien_text_api/client/absa_with_unauthenticated_client.yml
|
98
|
+
- spec/fixtures/aylien_text_api/client/absa_with_valid_url.yml
|
99
|
+
- spec/fixtures/aylien_text_api/client/absa_with_value_as_text.yml
|
100
|
+
- spec/fixtures/aylien_text_api/client/absa_with_value_as_valid_url.yml
|
94
101
|
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_client.yml
|
95
102
|
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_params.yml
|
96
103
|
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_taxonomy.yml
|
@@ -189,6 +196,7 @@ files:
|
|
189
196
|
- spec/fixtures/aylien_text_api/client/unsupervised_classify_with_valid_url.yml
|
190
197
|
- spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_text.yml
|
191
198
|
- spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_valid_url.yml
|
199
|
+
- spec/lib/aylien_text_api/absa.rb
|
192
200
|
- spec/lib/aylien_text_api/classify.rb
|
193
201
|
- spec/lib/aylien_text_api/classify_by_taxonomy.rb
|
194
202
|
- spec/lib/aylien_text_api/client_spec.rb
|
@@ -208,7 +216,7 @@ files:
|
|
208
216
|
- spec/spec_helper.rb
|
209
217
|
homepage: https://github.com/AYLIEN/aylien_textapi_ruby
|
210
218
|
licenses:
|
211
|
-
- Apache
|
219
|
+
- Apache-2.0
|
212
220
|
metadata: {}
|
213
221
|
post_install_message:
|
214
222
|
rdoc_options: []
|
@@ -226,13 +234,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
234
|
version: '0'
|
227
235
|
requirements: []
|
228
236
|
rubyforge_project:
|
229
|
-
rubygems_version: 2.
|
237
|
+
rubygems_version: 2.6.1
|
230
238
|
signing_key:
|
231
239
|
specification_version: 4
|
232
240
|
summary: AYLIEN Text Analysis API is a package of Natural Language Processing and
|
233
241
|
Machine Learning-powered tools for analyzing and extracting various kinds of information
|
234
242
|
from text and images.
|
235
243
|
test_files:
|
244
|
+
- spec/fixtures/aylien_text_api/client/absa_with_invalid_client.yml
|
245
|
+
- spec/fixtures/aylien_text_api/client/absa_with_invalid_params.yml
|
246
|
+
- spec/fixtures/aylien_text_api/client/absa_with_text.yml
|
247
|
+
- spec/fixtures/aylien_text_api/client/absa_with_unauthenticated_client.yml
|
248
|
+
- spec/fixtures/aylien_text_api/client/absa_with_valid_url.yml
|
249
|
+
- spec/fixtures/aylien_text_api/client/absa_with_value_as_text.yml
|
250
|
+
- spec/fixtures/aylien_text_api/client/absa_with_value_as_valid_url.yml
|
236
251
|
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_client.yml
|
237
252
|
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_params.yml
|
238
253
|
- spec/fixtures/aylien_text_api/client/classify_by_taxonomy_with_invalid_taxonomy.yml
|
@@ -331,6 +346,7 @@ test_files:
|
|
331
346
|
- spec/fixtures/aylien_text_api/client/unsupervised_classify_with_valid_url.yml
|
332
347
|
- spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_text.yml
|
333
348
|
- spec/fixtures/aylien_text_api/client/unsupervised_classify_with_value_as_valid_url.yml
|
349
|
+
- spec/lib/aylien_text_api/absa.rb
|
334
350
|
- spec/lib/aylien_text_api/classify.rb
|
335
351
|
- spec/lib/aylien_text_api/classify_by_taxonomy.rb
|
336
352
|
- spec/lib/aylien_text_api/client_spec.rb
|
@@ -348,4 +364,3 @@ test_files:
|
|
348
364
|
- spec/lib/aylien_text_api/summarize.rb
|
349
365
|
- spec/lib/aylien_text_api/unsupervised_classify.rb
|
350
366
|
- spec/spec_helper.rb
|
351
|
-
has_rdoc:
|