paralleldots 1.0.15 → 3.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/paralleldots.rb +56 -21
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8f7634cb8e108fc94b4af13488080ed1dcfacd3
4
- data.tar.gz: fc6115ac944407a8bb11cfaf4f7eaf3256664955
3
+ metadata.gz: a5b397135bcdfc263e1f946e30fe4ff634519506
4
+ data.tar.gz: df2e6cc05b4e5b40ae04f6ee020396181364ac0c
5
5
  SHA512:
6
- metadata.gz: 53d74e5b9e6db81fb4e27d505da7f84d22db85ca7a30526a8ddca6d34f6fb17ac427a00d4824d5b0d0018967463de0e1c5f9495636c36da397487262fa48ed27
7
- data.tar.gz: 2ebf38371c462d4eb5656a09ea915136400529ffcb1685ef629afdf47888da7bbcd9d1ccb3f3bbe8990e524c2e14b7e97243075bd5b34422cb62b3e7468ff91f
6
+ metadata.gz: f5d9a90f1d5654965c9011af5efc0f325e1d4a01b43d94d47b63645926d1bf63f5d3d55a798bd4266ef39b51175e6ecd56817aeaed54470d54c27135b5d99bb0
7
+ data.tar.gz: 429fcf21c8d804a29c9f03621af138434d594cd8507c25c62ad7e33d8bc14849c7d3f8013920f4f1a1a7b2d7759ec74dcd697e47fe53b9b920b361f45ef4bf07
data/lib/paralleldots.rb CHANGED
@@ -16,13 +16,13 @@ def check( api_key, text )
16
16
  return true
17
17
  end
18
18
 
19
- def sentiment( text )
19
+ def sentiment( text, lang_code= "en" )
20
20
  api_key = get_api_key
21
21
  valid = check( api_key, text )
22
22
  if valid != true then
23
23
  return valid
24
24
  end
25
- response = RestClient.post "http://apis.paralleldots.com/v2/sentiment", { api_key: api_key, text: text }
25
+ response = RestClient.post "http://apis.paralleldots.com/v3/sentiment", { api_key: api_key, text: text, lang_code: lang_code }
26
26
  response = JSON.parse( response )
27
27
  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"
28
28
  return response
@@ -34,7 +34,7 @@ def ner( text )
34
34
  if valid != true then
35
35
  return valid
36
36
  end
37
- response = RestClient.post "http://apis.paralleldots.com/v2/ner", { api_key: api_key, text: text }
37
+ response = RestClient.post "http://apis.paralleldots.com/v3/ner", { api_key: api_key, text: text }
38
38
  response = JSON.parse( response )
39
39
  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"
40
40
  return response
@@ -46,7 +46,7 @@ def keywords( text )
46
46
  if valid != true then
47
47
  return valid
48
48
  end
49
- response = RestClient.post "http://apis.paralleldots.com/v2/keywords", { api_key: api_key, text: text }
49
+ response = RestClient.post "http://apis.paralleldots.com/v3/keywords", { api_key: api_key, text: text }
50
50
  response = JSON.parse( response )
51
51
  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" }
52
52
  return response
@@ -58,19 +58,19 @@ def intent( text )
58
58
  if valid != true then
59
59
  return valid
60
60
  end
61
- response = RestClient.post "http://apis.paralleldots.com/v2/intent", { api_key: api_key, text: text }
61
+ response = RestClient.post "http://apis.paralleldots.com/v3/intent", { api_key: api_key, text: text }
62
62
  response = JSON.parse( response )
63
63
  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"
64
64
  return response
65
65
  end
66
66
 
67
- def emotion( text )
67
+ def emotion( text, lang_code= "en" )
68
68
  api_key = get_api_key
69
69
  valid = check( api_key, text )
70
70
  if valid != true then
71
71
  return valid
72
72
  end
73
- response = RestClient.post "http://apis.paralleldots.com/v2/emotion", { api_key: api_key, text: text }
73
+ response = RestClient.post "http://apis.paralleldots.com/v3/emotion", { api_key: api_key, text: text, lang_code: lang_code }
74
74
  response = JSON.parse( response )
75
75
  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"
76
76
  return response
@@ -82,7 +82,7 @@ def abuse( text )
82
82
  if valid != true then
83
83
  return valid
84
84
  end
85
- response = RestClient.post "http://apis.paralleldots.com/v2/abuse", { api_key: api_key, text: text }
85
+ response = RestClient.post "http://apis.paralleldots.com/v3/abuse", { api_key: api_key, text: text }
86
86
  response = JSON.parse( response )
87
87
  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"
88
88
  return response
@@ -94,7 +94,7 @@ def taxonomy( text )
94
94
  if valid != true then
95
95
  return valid
96
96
  end
97
- response = RestClient.post "http://apis.paralleldots.com/v2/taxonomy", { api_key: api_key, text: text }
97
+ response = RestClient.post "http://apis.paralleldots.com/v3/taxonomy", { api_key: api_key, text: text }
98
98
  response = JSON.parse( response )
99
99
  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"
100
100
  return response
@@ -107,45 +107,80 @@ def similarity( text_1, text_2 )
107
107
  if valid_1 != true or valid_2 != true then
108
108
  return { text_1: valid_1, text_2: valid_2 }
109
109
  end
110
- response = RestClient.post "http://apis.paralleldots.com/v2/similarity", { api_key: api_key, text_1: text_1, text_2: text_2 }
110
+ response = RestClient.post "http://apis.paralleldots.com/v3/similarity", { api_key: api_key, text_1: text_1, text_2: text_2 }
111
111
  response = JSON.parse( response )
112
112
  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"
113
113
  return response
114
114
  end
115
115
 
116
- def multilang( text, lang_code )
117
- text = URI::encode( text )
116
+ def custom_classifier( text, category )
118
117
  api_key = get_api_key
119
- valid_1 = check( api_key, text )
120
- valid_2 = check( api_key, lang_code )
121
- if valid_1 != true or valid_2 != true then
122
- return { text: valid_1, lang_code: valid_2 }
118
+ valid = check( api_key, text )
119
+ if valid != true then
120
+ return valid
121
+ end
122
+ category = category.to_json
123
+ response = RestClient.post "http://apis.paralleldots.com/v3/custom_classifier", { api_key: api_key, text: text, category: category }
124
+ response = JSON.parse( response )
125
+ 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"
126
+ return response
127
+ end
128
+
129
+ def phrase_extractor( text )
130
+ api_key = get_api_key
131
+ valid = check( api_key, text )
132
+ if valid != true then
133
+ return valid
123
134
  end
124
- response = RestClient.post "http://apis.paralleldots.com/v2/multilang", { api_key: api_key, text: text, lang_code: lang_code }
135
+ response = RestClient.post "http://apis.paralleldots.com/v3/phrase_extractor", { api_key: api_key, text: text }
125
136
  response = JSON.parse( response )
126
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"
127
138
  return response
128
139
  end
129
140
 
130
- def sentiment_social( text )
141
+ def text_parser( text )
131
142
  api_key = get_api_key
132
143
  valid = check( api_key, text )
133
144
  if valid != true then
134
145
  return valid
135
146
  end
136
- response = RestClient.post "http://apis.paralleldots.com/v2/sentiment_social", { api_key: api_key, text: text }
147
+ response = RestClient.post "http://apis.paralleldots.com/v3/text_parser", { api_key: api_key, text: text }
137
148
  response = JSON.parse( response )
138
149
  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"
139
150
  return response
140
151
  end
141
152
 
142
- def custom_classifier( text, id )
153
+ def multilang_keywords( text, lang_code= "en" )
143
154
  api_key = get_api_key
144
155
  valid = check( api_key, text )
145
156
  if valid != true then
146
157
  return valid
147
158
  end
148
- response = RestClient.post "http://apis.paralleldots.com/v2/custom_classifier", { api_key: api_key, text: text, id: id }
159
+ response = RestClient.post "http://apis.paralleldots.com/v3/multilang_keywords", { api_key: api_key, text: text, lang_code: lang_code }
160
+ response = JSON.parse( response )
161
+ 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"
162
+ return response
163
+ end
164
+
165
+ def popularity( path )
166
+ api_key = get_api_key
167
+ valid = check( api_key, path )
168
+ if valid != true then
169
+ return valid
170
+ end
171
+ response = RestClient.post "http://apis.paralleldots.com/v3/popularity", { api_key: api_key, file: File.new( path ) }
172
+ response = JSON.parse( response )
173
+ 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"
174
+ return response
175
+ end
176
+
177
+ def nsfw( path )
178
+ api_key = get_api_key
179
+ valid = check( api_key, path )
180
+ if valid != true then
181
+ return valid
182
+ end
183
+ response = RestClient.post "http://apis.paralleldots.com/v3/popularity", { api_key: api_key, file: File.new( path ) }
149
184
  response = JSON.parse( response )
150
185
  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"
151
186
  return response
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paralleldots
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Meghdeep Ray
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.5.1
89
+ rubygems_version: 2.5.2.1
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: Ruby Wrapper for ParallelDots APIs