paralleldots 1.0.9 → 1.0.12

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 +4 -4
  2. data/README.md +55 -9
  3. data/lib/paralleldots.rb +3 -3
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a352eff98aa5c28992f2263b4dd10909fa35d464
4
- data.tar.gz: ab46549937f6266e0ade954a8dfebe177bc13c97
3
+ metadata.gz: 4324343aa54089aa5d7df1d828bd0103ffd0db99
4
+ data.tar.gz: 1c45f422f17ce8bf80e83180c0f533b3654cb4a1
5
5
  SHA512:
6
- metadata.gz: 7ac66b7ad420d7063eb8becca9e67c6a6678a9ed377968985a12ef48794113e7841443763b529f49fc4d4977015e201ed8a8e18a359a9e27b015af17595eb85c
7
- data.tar.gz: 758c07a3c2452e161be4162a3428ad005263e3786708cc516fa107b803262e08d217e4287ee88857cd977c2c628cc1252fbddc2e083d2ee0c0808847895e8a18
6
+ metadata.gz: ab7e2125fa630f38aceb91a1c6b757f09de4c4baaaab9758a250c37834b9322f38655fb9c870b207ee1a3032df4d05ba0462c61bdf8258dbd7350e06d26c4a9b
7
+ data.tar.gz: d63fac8cde5bd29c23f7acb641d1294691f1b8092136be4da897f4e7ff9302fb87605c4b51cda7f59b012afb4f8cc955abcf7186717baa438efa4c16ff5eb53f
data/README.md CHANGED
@@ -51,28 +51,74 @@ Examples
51
51
  > require 'paralleldots'
52
52
 
53
53
  > similarity( "Sachin is the greatest batsman", "Tendulkar is the finest cricketer" )
54
- {"actual_score": 0.8429316099720955, "normalized_score": 4.931468684177398, "similarity": 4.931468684177398}
54
+ {"actual_score"=>0.842932, "normalized_score"=>4.931469}
55
55
 
56
56
  > sentiment( "Come on, lets play together" )
57
- {"sentiment": 0.8513014912605286}
57
+ {"probabilities"=>{"positive"=>0.568817, "neutral"=>0.400776, "negative"=>0.030407}, "sentiment"=>"positive"}
58
58
 
59
59
  > taxonomy( "Narendra Modi is the prime minister of India" )
60
- {"tags": [[u"finance", 4.088], [u"government", 3.4284], [u"business", 1.2719]]}
60
+ {"taxonomy"=>[
61
+ {"tag"=>"terrorism", "confidence_score"=>0.531435},
62
+ {"tag"=>"world politics", "confidence_score"=>0.391963},
63
+ {"tag"=>"politics", "confidence_score"=>0.358955},
64
+ {"tag"=>"religion", "confidence_score"=>0.308195},
65
+ {"tag"=>"defense", "confidence_score"=>0.26187},
66
+ {"tag"=>"business", "confidence_score"=>0.20885},
67
+ {"tag"=>"entrepreneurship", "confidence_score"=>0.18349},
68
+ {"tag"=>"health", "confidence_score"=>0.171121},
69
+ {"tag"=>"technology", "confidence_score"=>0.168591},
70
+ {"tag"=>"law", "confidence_score"=>0.156953},
71
+ {"tag"=>"education", "confidence_score"=>0.146511},
72
+ {"tag"=>"science", "confidence_score"=>0.101002},
73
+ {"tag"=>"crime", "confidence_score"=>0.085016},
74
+ {"tag"=>"entertainment", "confidence_score"=>0.080634},
75
+ {"tag"=>"environment", "confidence_score"=>0.078024},
76
+ {"tag"=>"disaster", "confidence_score"=>0.075295},
77
+ {"tag"=>"weather", "confidence_score"=>0.06784},
78
+ {"tag"=>"accident", "confidence_score"=>0.066831},
79
+ {"tag"=>"sports", "confidence_score"=>0.058329},
80
+ {"tag"=>"advertising", "confidence_score"=>0.054868},
81
+ {"tag"=>"history", "confidence_score"=>0.043581},
82
+ {"tag"=>"mining", "confidence_score"=>0.03833},
83
+ {"tag"=>"travel", "confidence_score"=>0.025517},
84
+ {"tag"=>"geography", "confidence_score"=>0.022372},
85
+ {"tag"=>"nature", "confidence_score"=>0.013477},
86
+ {"tag"=>"lifestyle", "confidence_score"=>0.006467},
87
+ {"tag"=>"automobile", "confidence_score"=>0.001161},
88
+ {"tag"=>"personal care", "confidence_score"=>0.000275}
89
+ ]}
61
90
 
62
91
  > ner( "Narendra Modi is the prime minister of India" )
63
- {"entities": [[u"Modi", 1.0, [u"person"], u""], [u"India", 1.0, [u"org"], u""], [u"Narendra", 1.0, [u"org"], u""]]}
92
+ {"entities"=>[{"category"=>"name", "name"=>"Narendra Modi", "confidence_score"=>0.951439}, {"category"=>"place", "name"=>"India", "confidence_score"=>0.9263}]}
64
93
 
65
94
  > keywords( "Prime Minister Narendra Modi tweeted a link to the speech Human Resource Development Minister Smriti Irani made in the Lok Sabha during the debate on the ongoing JNU row and the suicide of Dalit scholar Rohith Vemula at the Hyderabad Central University." )
66
- {"keywords": [[u"Human Resource Development Minister Smriti Irani", 6], [u"Prime Minister Narendra Modi", 4], [u"Hyderabad Central University", 3], [u"ongoing JNU row", 3], [u"Dalit scholar", 2], [u"Lok Sabha", 2], [u"Rohith Vemula", 2]]}
95
+ {:keywords=>{"keywords"=>[{"relevance_score"=>4, "keyword"=>"Prime Minister Narendra Modi"}, {"relevance_score"=>1, "keyword"=>"link"}, {"relevance_score"=>3, "keyword"=>"speech Human Resource"}, {"relevance_score"=>1, "keyword"=>"Smriti"}, {"relevance_score"=>1, "keyword"=>"Lok"}], "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"}}
67
96
 
68
97
  > emotion("Did you hear the latest Porcupine Tree song ? It's rocking !")
69
- {"emotion": "happy"}
98
+ {"emotion"=>"other", "probabilities"=>{"angry"=>0.010629, "other"=>0.453988, "sad"=>0.028748, "excited"=>0.2596, "happy"=>0.247035}}
70
99
 
71
100
  > intent("Finance ministry calls banks to discuss new facility to drain cash")
72
- {"intent": "news"}
101
+ {"probabilities"=>{"news"=>0.946028, "other"=>0.015853, "query"=>0.000412, "feedback/opinion"=>0.014115, "spam"=>0.023591}, "intent"=>"news"}
73
102
 
74
103
  > abuse("you f**king a$$hole")
75
104
  {"confidence_score"=>0.998047, "sentence_type"=>"Abusive"}
76
105
 
77
- > multilang("La ville de Paris est très belle", "fr")
78
- {"sentiment": "positive", "confidence_score": 0.998047}
106
+ > multilang("Me encanta jugar al baloncesto", "es") # The text is encoded in the function
107
+ {"sentiment": "positive", "confidence_score": 1.0}
108
+
109
+ > sentiment_social("I left my camera at home")
110
+ {"probabilities"=>{"positive"=>0.040374, "neutral"=>0.491032, "negative"=>0.468594}, "sentiment"=>"neutral"}
111
+
112
+ > usage()
113
+ {
114
+ "emotion": 100,
115
+ "sentiment": 100,
116
+ "similarity": 100,
117
+ "taxonomy": 100,
118
+ "abuse": 100,
119
+ "intent": 100,
120
+ "keywords": 100,
121
+ "ner": 100,
122
+ "multilang": 100,
123
+ "sentiment_social": 100
124
+ }
data/lib/paralleldots.rb CHANGED
@@ -105,9 +105,9 @@ def similarity( text_1, text_2 )
105
105
  valid_1 = check( api_key, text_1 )
106
106
  valid_2 = check( api_key, text_2 )
107
107
  if valid_1 != true or valid_2 != true then
108
- return { "text_1": valid_1, "text_2": valid_2 }
108
+ return { text_1: valid_1, text_2: valid_2 }
109
109
  end
110
- response = RestClient.post "http://apis.paralleldots.com/v2/semanticsimilarity", { api_key: api_key, text_1: text_1, text_2: text_2 }
110
+ response = RestClient.post "http://apis.paralleldots.com/v2/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
@@ -119,7 +119,7 @@ def multilang( text, lang_code )
119
119
  valid_1 = check( api_key, text )
120
120
  valid_2 = check( api_key, lang_code )
121
121
  if valid_1 != true or valid_2 != true then
122
- return { "text": valid_1, "lang_code": valid_2 }
122
+ return { text: valid_1, lang_code: valid_2 }
123
123
  end
124
124
  response = RestClient.post "http://apis.paralleldots.com/v2/multilang", { api_key: api_key, text: text, lang_code: lang_code }
125
125
  response = JSON.parse( 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.9
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Meghdeep Ray