paralleldots 3.0.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +28 -3
  3. data/lib/paralleldots.rb +24 -0
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 78031e9d223767180ec3aa0832ca5e2140b48684
4
- data.tar.gz: 582b4f3982a249d24697b531ebecc1b92e2432d1
2
+ SHA256:
3
+ metadata.gz: e92bdffb451f3e176c72ef95a7bfd0fd737dca8f0aec914a42efbb5d4e0ee57f
4
+ data.tar.gz: 8011e3df6e1142b5969684abf30937949216b8268a01b2508aff0bbcdefc09f2
5
5
  SHA512:
6
- metadata.gz: cd4ef61aada8078d6cf2c697f074dc84bfd27ad803a9ab180523802443f82c86d8519820b598add243ab993409d9ad0f27563ad562ea9b45539b185b6754034d
7
- data.tar.gz: b5d8f4dc3af3224b98aa4be3b2b4e474eee4a3bc72d4a5f2118dfa26cd0f15081a86b0413a9148272099cdc4e0ac329937ffebe46dfe793929cfa635b90cb066
6
+ metadata.gz: 0cb23f891eade84b8b9edb46df2ce621085acec5286c946a1d15a810ecb487dd41decf9f07ea3898489bba6a1bf0aee3e9576fc7a418b7868686178c532f53ed
7
+ data.tar.gz: 18ba5e18e271a22e8f54464c1355e33646ec63a1c18541a7633ff2f5f202454a1e5b3015fb655e475e9bdef1ba1f03592021f4fd5535ae0021ae682275cfbd47
data/README.md CHANGED
@@ -3,7 +3,7 @@ ParallelDots Ruby API
3
3
 
4
4
  A wrapper for the [ParallelDots API](http://www.paralleldots.com).
5
5
 
6
-
6
+
7
7
  Installation
8
8
  ------------
9
9
  From Gem:
@@ -28,12 +28,29 @@ Configuration:
28
28
  > get_api_key()
29
29
 
30
30
 
31
+ Languages Supported:
32
+ -------------------
33
+
34
+ - Portuguese ( pt )
35
+ - Chinese ( zh )
36
+ - Spanish ( es )
37
+ - German ( de )
38
+ - French ( fr )
39
+ - Dutch ( nl )
40
+ - Italian (it)
41
+ - Japanese ( ja )
42
+ - Indonesian ( id )
43
+ - Thai ( th )
44
+ - Danish ( da )
45
+ - Finish ( fi )
46
+
47
+
31
48
  Supported APIs:
32
49
  ---------------
33
50
 
34
51
  - Abuse
35
52
  - Custom Classifier
36
- - Emotion ( Supports all [ISO 639-1 Languages via their language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) )
53
+ - Emotion
37
54
  - Intent
38
55
  - Keywords
39
56
  - Multilanguage Keywords ( Supports Multiple Languages )
@@ -41,7 +58,7 @@ Supported APIs:
41
58
  - Not Safe For Work ( NSFW Image Classifier )
42
59
  - Phrase Extractor
43
60
  - Popularity ( Image Classifier )
44
- - Sentiment Analysis ( Supports all [ISO 639-1 Languages via their language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) )
61
+ - Sentiment Analysis
45
62
  - Semantic Similarity
46
63
  - Taxonomy
47
64
  - Text Parser
@@ -75,6 +92,10 @@ Examples
75
92
  > puts( emotion( lang_text, lang_code ) )
76
93
  {"emotion"=>{"emotion"=>"Angry", "probabilities"=>{"Sarcasm"=>0.052613839507102966, "Angry"=>0.07304570078849792, "Sad"=>0.051657479256391525, "Fear"=>0.07096020132303238, "Bored"=>0.0, "Excited"=>0.0, "Happy"=>0.0}}, "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"}
77
94
 
95
+ > puts( "\nFacial Emotion".blue )
96
+ > puts( facial_emotion( path ) )
97
+ {"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", "output"=>"No face detected."}
98
+
78
99
  > puts( "\nIntent" )
79
100
  > puts( intent( text ) )
80
101
  {"probabilities"=>{"marketing"=>0.042, "spam/junk"=>0.003, "news"=>0.927, "feedback/opinion"=>0.024, "query"=>0.004}, "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", "intent"=>"news"}
@@ -95,6 +116,10 @@ Examples
95
116
  > puts( nsfw( path ) )
96
117
  {"Popular"=>"38.1271243095", "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", "Not Popular"=>"61.8728756905"}
97
118
 
119
+ > puts( "\nObject Recognizer" )
120
+ > puts( object_recognizer( path ) )
121
+
122
+
98
123
  > puts( "\nPhrase Extractor" )
99
124
  > puts( phrase_extractor( text ) )
100
125
  {"keywords"=>[{"relevance_score"=>3, "keyword"=>"Hyderabad Central University"}, {"relevance_score"=>2, "keyword"=>"Rohith Vemula"}, {"relevance_score"=>2, "keyword"=>"JNU row"}, {"relevance_score"=>6, "keyword"=>"Human Resource Development Minister Smriti Irani"}, {"relevance_score"=>2, "keyword"=>"Lok Sabha"}, {"relevance_score"=>4, "keyword"=>"Prime Minister Narendra Modi"}, {"relevance_score"=>2, "keyword"=>"Dalit scholar"}], "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"}
@@ -186,6 +186,30 @@ def nsfw( path )
186
186
  return response
187
187
  end
188
188
 
189
+ def facial_emotion( path )
190
+ api_key = get_api_key
191
+ valid = check( api_key, path )
192
+ if valid != true then
193
+ return valid
194
+ end
195
+ response = RestClient.post "http://apis.paralleldots.com/v3/facial_emotion", { api_key: api_key, file: File.new( path ) }
196
+ response = JSON.parse( response )
197
+ 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"
198
+ return response
199
+ end
200
+
201
+ def object_recognizer( path )
202
+ api_key = get_api_key
203
+ valid = check( api_key, path )
204
+ if valid != true then
205
+ return valid
206
+ end
207
+ response = RestClient.post "http://apis.paralleldots.com/v3/object_recognizer", { api_key: api_key, file: File.new( path ) }
208
+ response = JSON.parse( response )
209
+ 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"
210
+ return response
211
+ end
212
+
189
213
  def usage()
190
214
  api_key = get_api_key
191
215
  if api_key == nil or api_key == "" then
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: 3.0.2
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Meghdeep Ray
@@ -78,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - ">="
80
80
  - !ruby/object:Gem::Version
81
- version: '0'
81
+ version: 2.3.1
82
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  requirements:
84
84
  - - ">="
@@ -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.2.1
89
+ rubygems_version: 2.7.6
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: Ruby Wrapper for ParallelDots APIs