alchemy-api-rb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/.gitignore +19 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +22 -0
  4. data/README.md +80 -0
  5. data/Rakefile +11 -0
  6. data/alchemy-api-rb.gemspec +24 -0
  7. data/lib/alchemy-api.rb +47 -0
  8. data/lib/alchemy-api/author_extraction.rb +21 -0
  9. data/lib/alchemy-api/base.rb +78 -0
  10. data/lib/alchemy-api/concept_tagging.rb +16 -0
  11. data/lib/alchemy-api/config.rb +34 -0
  12. data/lib/alchemy-api/entity_extraction.rb +15 -0
  13. data/lib/alchemy-api/keyword_extraction.rb +15 -0
  14. data/lib/alchemy-api/language_detection.rb +17 -0
  15. data/lib/alchemy-api/relation_extraction.rb +16 -0
  16. data/lib/alchemy-api/sentiment_analysis.rb +16 -0
  17. data/lib/alchemy-api/text_categorization.rb +21 -0
  18. data/lib/alchemy-api/text_extraction.rb +19 -0
  19. data/lib/alchemy-api/version.rb +3 -0
  20. data/spec/alchemy_api_spec.rb +70 -0
  21. data/spec/author_extraction_spec.rb +43 -0
  22. data/spec/base_spec.rb +20 -0
  23. data/spec/concept_tagging_spec.rb +44 -0
  24. data/spec/entity_extraction_spec.rb +44 -0
  25. data/spec/keyword_extraction_spec.rb +50 -0
  26. data/spec/language_detection_spec.rb +43 -0
  27. data/spec/relation_extraction_spec.rb +44 -0
  28. data/spec/sentiment_analysis_spec.rb +43 -0
  29. data/spec/spec_helper.rb +13 -0
  30. data/spec/text_categorization_spec.rb +43 -0
  31. data/spec/text_extraction_spec.rb +32 -0
  32. data/spec/vcr_cassettes/author_basic_html_json_search.yml +46 -0
  33. data/spec/vcr_cassettes/author_basic_url_json_search.yml +47 -0
  34. data/spec/vcr_cassettes/category_basic_html_json_search.yml +43 -0
  35. data/spec/vcr_cassettes/category_basic_text_json_search.yml +46 -0
  36. data/spec/vcr_cassettes/category_basic_url_json_search.yml +46 -0
  37. data/spec/vcr_cassettes/concept_basic_html_json_search.yml +54 -0
  38. data/spec/vcr_cassettes/concept_basic_text_json_search.yml +55 -0
  39. data/spec/vcr_cassettes/concept_basic_url_json_search.yml +75 -0
  40. data/spec/vcr_cassettes/entity_basic_html_json_search.yml +61 -0
  41. data/spec/vcr_cassettes/entity_basic_text_json_search.yml +60 -0
  42. data/spec/vcr_cassettes/entity_basic_url_json_search.yml +71 -0
  43. data/spec/vcr_cassettes/keyword_basic_html_json_search.yml +48 -0
  44. data/spec/vcr_cassettes/keyword_basic_text_json_search.yml +48 -0
  45. data/spec/vcr_cassettes/keyword_basic_url_json_search.yml +67 -0
  46. data/spec/vcr_cassettes/language_basic_html_json_search.yml +49 -0
  47. data/spec/vcr_cassettes/language_basic_text_json_search.yml +49 -0
  48. data/spec/vcr_cassettes/language_basic_url_json_search.yml +49 -0
  49. data/spec/vcr_cassettes/relation_basic_html_json_search.yml +53 -0
  50. data/spec/vcr_cassettes/relation_basic_text_json_search.yml +53 -0
  51. data/spec/vcr_cassettes/relation_basic_url_json_search.yml +58 -0
  52. data/spec/vcr_cassettes/sentiment_basic_html_json_search.yml +48 -0
  53. data/spec/vcr_cassettes/sentiment_basic_text_json_search.yml +48 -0
  54. data/spec/vcr_cassettes/sentiment_basic_url_json_search.yml +48 -0
  55. data/spec/vcr_cassettes/text_basic_html_json_search.yml +47 -0
  56. data/spec/vcr_cassettes/text_basic_url_json_search.yml +47 -0
  57. metadata +196 -0
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://access.alchemyapi.com/calls/url/URLGetLanguage
6
+ body:
7
+ encoding: US-ASCII
8
+ string: apikey=cbc80670767f2e9ccecc9a6f4df6f45f207d9cda&url=http://www.alchemyapi.com/&outputMode=json
9
+ headers:
10
+ content-type:
11
+ - application/x-www-form-urlencoded
12
+ accept:
13
+ - ! '*/*'
14
+ user-agent:
15
+ - Ruby
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ server:
24
+ - nginx
25
+ date:
26
+ - Sun, 17 Jun 2012 04:32:15 GMT
27
+ content-type:
28
+ - application/json
29
+ connection:
30
+ - close
31
+ content-length:
32
+ - '548'
33
+ cache-control:
34
+ - no-cache
35
+ access-control-allow-origin:
36
+ - ! '*'
37
+ - ! '*'
38
+ body:
39
+ encoding: US-ASCII
40
+ string: ! "{\r\n \"status\": \"OK\",\r\n \"usage\": \"By accessing AlchemyAPI
41
+ or using information generated by AlchemyAPI, you are agreeing to be bound
42
+ by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\",\r\n
43
+ \ \"url\": \"http://www.alchemyapi.com/\",\r\n \"language\": \"english\",\r\n
44
+ \ \"iso-639-1\": \"en\",\r\n \"iso-639-2\": \"eng\",\r\n \"iso-639-3\":
45
+ \"eng\",\r\n \"ethnologue\": \"http://www.ethnologue.com/show_language.asp?code=eng\",\r\n
46
+ \ \"native-speakers\": \"309-400 million\",\r\n \"wikipedia\": \"http://en.wikipedia.org/wiki/English_language\"\r\n}\r\n"
47
+ http_version: '1.1'
48
+ recorded_at: Sun, 17 Jun 2012 03:34:15 GMT
49
+ recorded_with: VCR 2.2.0
@@ -0,0 +1,53 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://access.alchemyapi.com/calls/html/HTMLGetRelations
6
+ body:
7
+ encoding: US-ASCII
8
+ string: apikey=cbc80670767f2e9ccecc9a6f4df6f45f207d9cda&html=<html><body>Google
9
+ is a large company</body></html>&outputMode=json
10
+ headers:
11
+ content-type:
12
+ - application/x-www-form-urlencoded
13
+ accept:
14
+ - ! '*/*'
15
+ user-agent:
16
+ - Ruby
17
+ connection:
18
+ - close
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ server:
25
+ - nginx
26
+ date:
27
+ - Sun, 17 Jun 2012 03:31:22 GMT
28
+ content-type:
29
+ - application/json
30
+ connection:
31
+ - close
32
+ content-length:
33
+ - '702'
34
+ cache-control:
35
+ - no-cache
36
+ access-control-allow-origin:
37
+ - ! '*'
38
+ body:
39
+ encoding: US-ASCII
40
+ string: ! "{\r\n \"status\": \"OK\",\r\n \"usage\": \"By accessing AlchemyAPI
41
+ or using information generated by AlchemyAPI, you are agreeing to be bound
42
+ by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\",\r\n
43
+ \ \"url\": \"\",\r\n \"language\": \"english\",\r\n \"relations\":
44
+ [\r\n {\r\n \"subject\": {\r\n \"text\":
45
+ \"Google\"\r\n },\r\n \"action\": {\r\n \"text\":
46
+ \"is\",\r\n \"lemmatized\": \"be\",\r\n \"verb\":
47
+ {\r\n \"text\": \"be\",\r\n \"tense\":
48
+ \"present\"\r\n }\r\n },\r\n \"object\":
49
+ {\r\n \"text\": \"a large company\"\r\n }\r\n }\r\n
50
+ \ ]\r\n}\r\n"
51
+ http_version: '1.1'
52
+ recorded_at: Sun, 17 Jun 2012 02:33:21 GMT
53
+ recorded_with: VCR 2.2.0
@@ -0,0 +1,53 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://access.alchemyapi.com/calls/text/TextGetRelations
6
+ body:
7
+ encoding: US-ASCII
8
+ string: apikey=cbc80670767f2e9ccecc9a6f4df6f45f207d9cda&text=Google is a large
9
+ company&outputMode=json
10
+ headers:
11
+ content-type:
12
+ - application/x-www-form-urlencoded
13
+ accept:
14
+ - ! '*/*'
15
+ user-agent:
16
+ - Ruby
17
+ connection:
18
+ - close
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ server:
25
+ - nginx
26
+ date:
27
+ - Sun, 17 Jun 2012 03:31:23 GMT
28
+ content-type:
29
+ - application/json
30
+ connection:
31
+ - close
32
+ content-length:
33
+ - '702'
34
+ cache-control:
35
+ - no-cache
36
+ access-control-allow-origin:
37
+ - ! '*'
38
+ body:
39
+ encoding: US-ASCII
40
+ string: ! "{\r\n \"status\": \"OK\",\r\n \"usage\": \"By accessing AlchemyAPI
41
+ or using information generated by AlchemyAPI, you are agreeing to be bound
42
+ by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\",\r\n
43
+ \ \"url\": \"\",\r\n \"language\": \"english\",\r\n \"relations\":
44
+ [\r\n {\r\n \"subject\": {\r\n \"text\":
45
+ \"Google\"\r\n },\r\n \"action\": {\r\n \"text\":
46
+ \"is\",\r\n \"lemmatized\": \"be\",\r\n \"verb\":
47
+ {\r\n \"text\": \"be\",\r\n \"tense\":
48
+ \"present\"\r\n }\r\n },\r\n \"object\":
49
+ {\r\n \"text\": \"a large company\"\r\n }\r\n }\r\n
50
+ \ ]\r\n}\r\n"
51
+ http_version: '1.1'
52
+ recorded_at: Sun, 17 Jun 2012 02:33:22 GMT
53
+ recorded_with: VCR 2.2.0
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://access.alchemyapi.com/calls/url/URLGetRelations
6
+ body:
7
+ encoding: US-ASCII
8
+ string: apikey=cbc80670767f2e9ccecc9a6f4df6f45f207d9cda&url=http://www.alchemy.com&outputMode=json
9
+ headers:
10
+ content-type:
11
+ - application/x-www-form-urlencoded
12
+ accept:
13
+ - ! '*/*'
14
+ user-agent:
15
+ - Ruby
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ server:
24
+ - nginx
25
+ date:
26
+ - Sun, 17 Jun 2012 03:32:45 GMT
27
+ content-type:
28
+ - application/json
29
+ connection:
30
+ - close
31
+ content-length:
32
+ - '1174'
33
+ cache-control:
34
+ - no-cache
35
+ access-control-allow-origin:
36
+ - ! '*'
37
+ body:
38
+ encoding: US-ASCII
39
+ string: ! "{\r\n \"status\": \"OK\",\r\n \"usage\": \"By accessing AlchemyAPI
40
+ or using information generated by AlchemyAPI, you are agreeing to be bound
41
+ by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\",\r\n
42
+ \ \"url\": \"http://www.alchemy.com/\",\r\n \"language\": \"english\",\r\n
43
+ \ \"relations\": [\r\n {\r\n \"subject\": {\r\n \"text\":
44
+ \"We\"\r\n },\r\n \"action\": {\r\n \"text\":
45
+ \"apologize\",\r\n \"lemmatized\": \"apologize\",\r\n \"verb\":
46
+ {\r\n \"text\": \"apologize\",\r\n \"tense\":
47
+ \"present\"\r\n }\r\n },\r\n \"object\":
48
+ {\r\n \"text\": \"for any inconvenience\"\r\n }\r\n
49
+ \ },\r\n {\r\n \"subject\": {\r\n \"text\":
50
+ \"you\"\r\n },\r\n \"action\": {\r\n \"text\":
51
+ \"need\",\r\n \"lemmatized\": \"need\",\r\n \"verb\":
52
+ {\r\n \"text\": \"need\",\r\n \"tense\":
53
+ \"present\"\r\n }\r\n },\r\n \"object\":
54
+ {\r\n \"text\": \"help with in the mean time\"\r\n }\r\n
55
+ \ }\r\n ]\r\n}\r\n"
56
+ http_version: '1.1'
57
+ recorded_at: Sun, 17 Jun 2012 02:34:45 GMT
58
+ recorded_with: VCR 2.2.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://access.alchemyapi.com/calls/html/HTMLGetTextSentiment
6
+ body:
7
+ encoding: US-ASCII
8
+ string: apikey=cbc80670767f2e9ccecc9a6f4df6f45f207d9cda&html=<html><body>Alchemy
9
+ is cool</body></html>&outputMode=json
10
+ headers:
11
+ content-type:
12
+ - application/x-www-form-urlencoded
13
+ accept:
14
+ - ! '*/*'
15
+ user-agent:
16
+ - Ruby
17
+ connection:
18
+ - close
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ server:
25
+ - nginx
26
+ date:
27
+ - Sun, 17 Jun 2012 03:15:12 GMT
28
+ content-type:
29
+ - application/json
30
+ connection:
31
+ - close
32
+ content-length:
33
+ - '352'
34
+ cache-control:
35
+ - no-cache
36
+ access-control-allow-origin:
37
+ - ! '*'
38
+ body:
39
+ encoding: US-ASCII
40
+ string: ! "{\r\n \"status\": \"OK\",\r\n \"usage\": \"By accessing AlchemyAPI
41
+ or using information generated by AlchemyAPI, you are agreeing to be bound
42
+ by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\",\r\n
43
+ \ \"url\": \"\",\r\n \"language\": \"english\",\r\n \"docSentiment\":
44
+ {\r\n \"type\": \"positive\",\r\n \"score\": \"0.147308\"\r\n
45
+ \ }\r\n}\r\n"
46
+ http_version: '1.1'
47
+ recorded_at: Sun, 17 Jun 2012 02:17:11 GMT
48
+ recorded_with: VCR 2.2.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://access.alchemyapi.com/calls/text/TextGetTextSentiment
6
+ body:
7
+ encoding: US-ASCII
8
+ string: apikey=cbc80670767f2e9ccecc9a6f4df6f45f207d9cda&text=Alchemy is cool&outputMode=json
9
+ headers:
10
+ content-type:
11
+ - application/x-www-form-urlencoded
12
+ accept:
13
+ - ! '*/*'
14
+ user-agent:
15
+ - Ruby
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ server:
24
+ - nginx
25
+ date:
26
+ - Sun, 17 Jun 2012 03:15:12 GMT
27
+ content-type:
28
+ - application/json
29
+ connection:
30
+ - close
31
+ content-length:
32
+ - '352'
33
+ cache-control:
34
+ - no-cache
35
+ access-control-allow-origin:
36
+ - ! '*'
37
+ - ! '*'
38
+ body:
39
+ encoding: US-ASCII
40
+ string: ! "{\r\n \"status\": \"OK\",\r\n \"usage\": \"By accessing AlchemyAPI
41
+ or using information generated by AlchemyAPI, you are agreeing to be bound
42
+ by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\",\r\n
43
+ \ \"url\": \"\",\r\n \"language\": \"english\",\r\n \"docSentiment\":
44
+ {\r\n \"type\": \"positive\",\r\n \"score\": \"0.147308\"\r\n
45
+ \ }\r\n}\r\n"
46
+ http_version: '1.1'
47
+ recorded_at: Sun, 17 Jun 2012 02:17:11 GMT
48
+ recorded_with: VCR 2.2.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://access.alchemyapi.com/calls/url/URLGetTextSentiment
6
+ body:
7
+ encoding: US-ASCII
8
+ string: apikey=cbc80670767f2e9ccecc9a6f4df6f45f207d9cda&url=http://www.alchemyapi.com&outputMode=json
9
+ headers:
10
+ content-type:
11
+ - application/x-www-form-urlencoded
12
+ accept:
13
+ - ! '*/*'
14
+ user-agent:
15
+ - Ruby
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ server:
24
+ - nginx
25
+ date:
26
+ - Sun, 17 Jun 2012 03:15:13 GMT
27
+ content-type:
28
+ - application/json
29
+ connection:
30
+ - close
31
+ content-length:
32
+ - '379'
33
+ cache-control:
34
+ - no-cache
35
+ access-control-allow-origin:
36
+ - ! '*'
37
+ - ! '*'
38
+ body:
39
+ encoding: US-ASCII
40
+ string: ! "{\r\n \"status\": \"OK\",\r\n \"usage\": \"By accessing AlchemyAPI
41
+ or using information generated by AlchemyAPI, you are agreeing to be bound
42
+ by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\",\r\n
43
+ \ \"url\": \"http://www.alchemyapi.com/\",\r\n \"language\": \"english\",\r\n
44
+ \ \"docSentiment\": {\r\n \"type\": \"positive\",\r\n \"score\":
45
+ \"0.0921735\"\r\n }\r\n}\r\n"
46
+ http_version: '1.1'
47
+ recorded_at: Sun, 17 Jun 2012 02:17:12 GMT
48
+ recorded_with: VCR 2.2.0
@@ -0,0 +1,47 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://access.alchemyapi.com/calls/html/HTMLGetText
6
+ body:
7
+ encoding: US-ASCII
8
+ string: apikey=cbc80670767f2e9ccecc9a6f4df6f45f207d9cda&html=<html><body>foo
9
+ bar</body></html>&outputMode=json
10
+ headers:
11
+ content-type:
12
+ - application/x-www-form-urlencoded
13
+ accept:
14
+ - ! '*/*'
15
+ user-agent:
16
+ - Ruby
17
+ connection:
18
+ - close
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ server:
25
+ - nginx
26
+ date:
27
+ - Sun, 17 Jun 2012 03:00:54 GMT
28
+ content-type:
29
+ - application/json
30
+ connection:
31
+ - close
32
+ content-length:
33
+ - '252'
34
+ cache-control:
35
+ - no-cache
36
+ access-control-allow-origin:
37
+ - ! '*'
38
+ - ! '*'
39
+ body:
40
+ encoding: US-ASCII
41
+ string: ! "{\r\n \"status\": \"OK\",\r\n \"usage\": \"By accessing AlchemyAPI
42
+ or using information generated by AlchemyAPI, you are agreeing to be bound
43
+ by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\",\r\n
44
+ \ \"url\": \"\",\r\n \"text\": \"\"\r\n}\r\n"
45
+ http_version: '1.1'
46
+ recorded_at: Sun, 17 Jun 2012 02:02:53 GMT
47
+ recorded_with: VCR 2.2.0
@@ -0,0 +1,47 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://access.alchemyapi.com/calls/url/URLGetText
6
+ body:
7
+ encoding: US-ASCII
8
+ string: apikey=cbc80670767f2e9ccecc9a6f4df6f45f207d9cda&url=http://www.google.com&outputMode=json
9
+ headers:
10
+ content-type:
11
+ - application/x-www-form-urlencoded
12
+ accept:
13
+ - ! '*/*'
14
+ user-agent:
15
+ - Ruby
16
+ connection:
17
+ - close
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ server:
24
+ - nginx
25
+ date:
26
+ - Sun, 17 Jun 2012 03:00:54 GMT
27
+ content-type:
28
+ - application/json
29
+ connection:
30
+ - close
31
+ content-length:
32
+ - '433'
33
+ cache-control:
34
+ - no-cache
35
+ access-control-allow-origin:
36
+ - ! '*'
37
+ body:
38
+ encoding: US-ASCII
39
+ string: ! "{\r\n \"status\": \"OK\",\r\n \"usage\": \"By accessing AlchemyAPI
40
+ or using information generated by AlchemyAPI, you are agreeing to be bound
41
+ by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html\",\r\n
42
+ \ \"url\": \"http://www.google.com/\",\r\n \"text\": \"Search the world's
43
+ information, including webpages, images, videos and more. Google has many
44
+ special features to help you find exactly what you're looking for.\"\r\n}\r\n"
45
+ http_version: '1.1'
46
+ recorded_at: Sun, 17 Jun 2012 02:02:53 GMT
47
+ recorded_with: VCR 2.2.0