paralleldots 0.0.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -4
- data/lib/paralleldots.rb +41 -39
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d927991acfef9f04a06505bf14ed567c94e94804
|
4
|
+
data.tar.gz: 0902465ffaac4ce6aca33a758ece944079e73ef1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f51ca08b502b2a75e79a39f74b75b4268b04ce1abaea1fa4f9fcc29b43edd016af21395e41678fd5c92ebffb3c9d635434e12e2075113271266c2dd4fbeebeec
|
7
|
+
data.tar.gz: b643f1e075042d48f652d0ed633f090e516b19f0cf538d1ef624870b8c6082da35d999e07e111968384630103662b2337015b4ef04f9753598cfa368c974ff28
|
data/README.md
CHANGED
@@ -14,12 +14,11 @@ From Gem:
|
|
14
14
|
|
15
15
|
API Keys & Setup
|
16
16
|
----------------
|
17
|
-
Signup and get your free API key from
|
17
|
+
Signup and get your free API key from [ParallelDots](http://www.paralleldots.com/pricing).
|
18
18
|
You will receive a mail containing the API key at the registered email id.
|
19
19
|
|
20
20
|
Configuration:
|
21
21
|
|
22
|
-
|
23
22
|
> require 'paralleldots'
|
24
23
|
|
25
24
|
# Setting your API key
|
@@ -43,10 +42,10 @@ Supported APIs:
|
|
43
42
|
- [Semantic Similarity](https://tinyurl.com/k23nqs9)
|
44
43
|
- [Sentiment Analysis](https://tinyurl.com/km99mzb)
|
45
44
|
- Taxonomy
|
46
|
-
- [Named Entity Extraction ( NER )](https://tinyurl.com/k9yglwc)
|
45
|
+
- [Named Entity Extraction/Recognition ( NER )](https://tinyurl.com/k9yglwc)
|
47
46
|
- [Keywords](https://tinyurl.com/kujcu8o)
|
48
47
|
- [Intent](https://tinyurl.com/n568bqw)
|
49
|
-
- Emotion
|
48
|
+
- [Emotion](http://blog.paralleldots.com/technology/deep-learning/emotion-detection-using-machine-learning/)
|
50
49
|
- Abuse
|
51
50
|
- Multiple Language Sentiment
|
52
51
|
- Portuguese ( pt )
|
data/lib/paralleldots.rb
CHANGED
@@ -2,6 +2,8 @@ require_relative 'config'
|
|
2
2
|
require 'rest-client'
|
3
3
|
require 'json'
|
4
4
|
|
5
|
+
url = "35.202.76.177"
|
6
|
+
|
5
7
|
def check( api_key, text )
|
6
8
|
if api_key == nil or api_key == "" then
|
7
9
|
return { "error": "API Key cannot be nil or an empty String." }
|
@@ -16,133 +18,133 @@ def check( api_key, text )
|
|
16
18
|
end
|
17
19
|
|
18
20
|
def sentiment( text )
|
19
|
-
api_key =
|
21
|
+
api_key = post_api_key
|
20
22
|
valid = check( api_key, text )
|
21
23
|
if valid != true then
|
22
24
|
return valid
|
23
25
|
end
|
24
|
-
response = RestClient.
|
26
|
+
response = RestClient.post "http://%s/sentiment"%url, { api_key: api_key, text: text }
|
25
27
|
response = JSON.parse( response )
|
26
28
|
response[ "usage" ] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"
|
27
29
|
return response
|
28
30
|
end
|
29
31
|
|
30
32
|
def ner( text )
|
31
|
-
api_key =
|
33
|
+
api_key = post_api_key
|
32
34
|
valid = check( api_key, text )
|
33
35
|
if valid != true then
|
34
36
|
return valid
|
35
37
|
end
|
36
|
-
response = RestClient.post "http
|
38
|
+
response = RestClient.post "http://%s/ner"%url, { api_key: api_key, text: text }
|
37
39
|
response = JSON.parse( response )
|
38
40
|
response[ "usage" ] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"
|
39
41
|
return response
|
40
42
|
end
|
41
43
|
|
42
44
|
def keywords( text )
|
43
|
-
api_key =
|
45
|
+
api_key = post_api_key
|
44
46
|
valid = check( api_key, text )
|
45
47
|
if valid != true then
|
46
48
|
return valid
|
47
49
|
end
|
48
|
-
response = RestClient.post "http
|
50
|
+
response = RestClient.post "http://%s/keywords"%url, { api_key: api_key, text: text }
|
49
51
|
response = JSON.parse( response )
|
50
52
|
response = { "keywords": response, "usage": "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions" }
|
51
53
|
return response
|
52
54
|
end
|
53
55
|
|
54
56
|
def intent( text )
|
55
|
-
api_key =
|
57
|
+
api_key = post_api_key
|
56
58
|
valid = check( api_key, text )
|
57
59
|
if valid != true then
|
58
60
|
return valid
|
59
61
|
end
|
60
|
-
response = RestClient.post "http
|
62
|
+
response = RestClient.post "http://%s/intent"%url, { api_key: api_key, text: text }
|
61
63
|
response = JSON.parse( response )
|
62
64
|
response[ "usage" ] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"
|
63
65
|
return response
|
64
66
|
end
|
65
67
|
|
66
68
|
def emotion( text )
|
67
|
-
api_key =
|
69
|
+
api_key = post_api_key
|
68
70
|
valid = check( api_key, text )
|
69
71
|
if valid != true then
|
70
72
|
return valid
|
71
73
|
end
|
72
|
-
response = RestClient.post "http
|
74
|
+
response = RestClient.post "http://%s/emotion"%url, { api_key: api_key, text: text }
|
73
75
|
response = JSON.parse( response )
|
74
76
|
response[ "usage" ] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"
|
75
77
|
return response
|
76
78
|
end
|
77
79
|
|
78
80
|
def abuse( text )
|
79
|
-
api_key =
|
81
|
+
api_key = post_api_key
|
80
82
|
valid = check( api_key, text )
|
81
83
|
if valid != true then
|
82
84
|
return valid
|
83
85
|
end
|
84
|
-
response = RestClient.post "http
|
86
|
+
response = RestClient.post "http://%s/abuse"%url, { api_key: api_key, text: text }
|
85
87
|
response = JSON.parse( response )
|
86
88
|
response[ "usage" ] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"
|
87
89
|
return response
|
88
90
|
end
|
89
91
|
|
90
92
|
def taxonomy( text )
|
91
|
-
api_key =
|
93
|
+
api_key = post_api_key
|
92
94
|
valid = check( api_key, text )
|
93
95
|
if valid != true then
|
94
96
|
return valid
|
95
97
|
end
|
96
|
-
response = RestClient.post "http
|
98
|
+
response = RestClient.post "http://%s/taxonomy"%url, { api_key: api_key, text: text }
|
97
99
|
response = JSON.parse( response )
|
98
100
|
response[ "usage" ] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"
|
99
101
|
return response
|
100
102
|
end
|
101
103
|
|
102
104
|
def similarity( text_1, text_2 )
|
103
|
-
api_key =
|
105
|
+
api_key = post_api_key
|
104
106
|
valid_1 = check( api_key, text_1 )
|
105
107
|
valid_2 = check( api_key, text_2 )
|
106
108
|
if valid_1 != true or valid_2 != true then
|
107
109
|
return { "text_1": valid_1, "text_2": valid_2 }
|
108
110
|
end
|
109
|
-
response = RestClient.
|
111
|
+
response = RestClient.post "http://%s/semanticsimilarity"%url, { api_key: api_key, text_1: text_1, text_2: text_2 }
|
110
112
|
response = JSON.parse( response )
|
111
113
|
response[ "usage" ] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"
|
112
114
|
return response
|
113
115
|
end
|
114
116
|
|
115
117
|
def multilang_sentiment( text, lang )
|
116
|
-
api_key =
|
118
|
+
api_key = post_api_key
|
117
119
|
valid_1 = check( api_key, text )
|
118
120
|
valid_2 = check( api_key, lang )
|
119
121
|
if valid_1 != true or valid_2 != true then
|
120
122
|
return { "text": valid_1, "lang": valid_2 }
|
121
123
|
end
|
122
|
-
response = RestClient.post "http
|
124
|
+
response = RestClient.post "http://%s/multilang_sentiment"%url, { api_key: api_key, text: text, lang: lang }
|
123
125
|
response = JSON.parse( response )
|
124
126
|
response[ "usage" ] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"
|
125
127
|
return response
|
126
128
|
end
|
127
129
|
|
128
|
-
def hit_count()
|
129
|
-
api_key =
|
130
|
-
if api_key == nil or api_key == "" then
|
131
|
-
return { "error": "API Key cannot be nil or an empty String." }
|
132
|
-
end
|
133
|
-
response = RestClient.post "http
|
134
|
-
response = JSON.parse( response )
|
135
|
-
response[ "usage" ] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"
|
136
|
-
return response
|
137
|
-
end
|
138
|
-
|
139
|
-
def specific_hit_count( end_point )
|
140
|
-
api_key =
|
141
|
-
if api_key == nil or api_key == "" then
|
142
|
-
return { "error": "API Key cannot be nil or an empty String." }
|
143
|
-
end
|
144
|
-
response = RestClient.post "http
|
145
|
-
response = JSON.parse( response )
|
146
|
-
response[ "usage" ] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"
|
147
|
-
return response
|
148
|
-
end
|
130
|
+
#def hit_count()
|
131
|
+
# api_key = post_api_key
|
132
|
+
# if api_key == nil or api_key == "" then
|
133
|
+
# return { "error": "API Key cannot be nil or an empty String." }
|
134
|
+
# end
|
135
|
+
# response = RestClient.post "http://%s/hit_count"%url, { api_key: api_key }
|
136
|
+
# response = JSON.parse( response )
|
137
|
+
# response[ "usage" ] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"
|
138
|
+
# return response
|
139
|
+
#end
|
140
|
+
#
|
141
|
+
#def specific_hit_count( end_point )
|
142
|
+
# api_key = post_api_key
|
143
|
+
# if api_key == nil or api_key == "" then
|
144
|
+
# return { "error": "API Key cannot be nil or an empty String." }
|
145
|
+
# end
|
146
|
+
# response = RestClient.post "http://%s/specific_hit_count"%url, { api_key: api_key, end_point: end_point }
|
147
|
+
# response = JSON.parse( response )
|
148
|
+
# response[ "usage" ] = "By accessing ParallelDots API or using information generated by ParallelDots API, you are agreeing to be bound by the ParallelDots API Terms of Use: http://www.paralleldots.com/terms-and-conditions"
|
149
|
+
# return response
|
150
|
+
#end
|