dandelionapi 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +10 -1
- data/README.md +4 -4
- data/dandelionapi.gemspec +5 -5
- data/lib/dandelionapi.rb +3 -1
- data/lib/dandelionapi/base.rb +2 -0
- data/lib/dandelionapi/entity_extraction.rb +7 -2
- data/lib/dandelionapi/language_detection.rb +5 -0
- data/lib/dandelionapi/text_similarity.rb +2 -0
- data/lib/dandelionapi/version.rb +3 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60d3e32d3e0ace88c7ac96380733d7b3968e1175
|
4
|
+
data.tar.gz: 648a796836193a56970191832d2f617f6616f029
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38e9f41a10552bb8eb437ac5c5e861d78023258faec7dd6fda4410dea1281b69644936016b45684e4186f0857f41483589532286c88b27cca5909b2633f0ec04
|
7
|
+
data.tar.gz: d3279f1b0da0686284b87db77f835b94ba90615c5e3cf677b9a17b79cfce495809da31537ec86312bb06cbb97fb43ad2d04b36555e9845f14547f747372ae68f
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
-
|
3
|
+
- ruby-1.9.3
|
4
|
+
- ruby-2.0.0
|
5
|
+
- ruby-2.1.5
|
6
|
+
- ruby-2.2.1
|
7
|
+
- jruby
|
8
|
+
- rbx-2.4.1
|
9
|
+
- rbx-2.5.2
|
4
10
|
before_install: gem install bundler -v 1.10.5
|
11
|
+
addons:
|
12
|
+
code_climate:
|
13
|
+
repo_token: c29ce9f7996f73f58b0d180bf8f0432e1f7ab65950bef51e33bc44e1db244d8d
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# [![Ruby Gem Icon](https://raw.githubusercontent.com/zenkay/dandelionapi-ruby/master/rubygem.png)](https://rubygems.org/gems/dandelionapi) Dandelion API Ruby Gem
|
2
2
|
|
3
|
-
[![Code Climate](https://codeclimate.com/github/zenkay/dandelionapi-ruby/badges/gpa.svg)](https://codeclimate.com/github/zenkay/dandelionapi-ruby) [![Travis CI](https://travis-ci.org/zenkay/dandelionapi-ruby.svg?branch=master)](https://travis-ci.org/zenkay/dandelionapi-ruby) [![Gem Version](https://badge.fury.io/rb/dandelionapi.svg)](http://badge.fury.io/rb/dandelionapi) [![Coverage Status](https://coveralls.io/repos/zenkay/dandelionapi-ruby/badge.
|
3
|
+
[![Code Climate](https://codeclimate.com/github/zenkay/dandelionapi-ruby/badges/gpa.svg)](https://codeclimate.com/github/zenkay/dandelionapi-ruby) [![Travis CI](https://travis-ci.org/zenkay/dandelionapi-ruby.svg?branch=master)](https://travis-ci.org/zenkay/dandelionapi-ruby) [![Gem Version](https://badge.fury.io/rb/dandelionapi.svg)](http://badge.fury.io/rb/dandelionapi) [![Coverage Status](https://coveralls.io/repos/zenkay/dandelionapi-ruby/badge.svg)](https://coveralls.io/r/zenkay/dandelionapi-ruby)
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -31,21 +31,21 @@ end
|
|
31
31
|
|
32
32
|
_Methods references are taken from [Dandelion API's documentation](https://dandelion.eu/docs/)._
|
33
33
|
|
34
|
-
**Entity Extraction API**: is a named entity extraction & linking API that performs very well even on short texts, on which many other similar services do not. dataTXT-NEX currently works on English, French, German, Italian and Portuguese texts. With this API you will be able to automatically tag your texts, extracting Wikipedia entities and enriching your data.
|
34
|
+
**[Entity Extraction API](https://dandelion.eu/docs/api/datatxt/nex/v1/)**: is a named entity extraction & linking API that performs very well even on short texts, on which many other similar services do not. dataTXT-NEX currently works on English, French, German, Italian and Portuguese texts. With this API you will be able to automatically tag your texts, extracting Wikipedia entities and enriching your data.
|
35
35
|
|
36
36
|
```
|
37
37
|
element = Dandelionapi::EntityExtraction.new
|
38
38
|
response = element.analyze(text: "This is a test")
|
39
39
|
```
|
40
40
|
|
41
|
-
**Text Similarity API**: is a semantic sentence similarity API optimized on short sentences. With this API you will be able to compare two sentences and get a score of their semantic similarity. It works even if the two sentences don't have any word in common.
|
41
|
+
**[Text Similarity API](https://dandelion.eu/docs/api/datatxt/sim/v1/)**: is a semantic sentence similarity API optimized on short sentences. With this API you will be able to compare two sentences and get a score of their semantic similarity. It works even if the two sentences don't have any word in common.
|
42
42
|
|
43
43
|
```
|
44
44
|
element = Dandelionapi::TextSimilarity.new
|
45
45
|
response = element.analyze(text1: "This is a test", text2: "This is another test")
|
46
46
|
```
|
47
47
|
|
48
|
-
**Language Detection API**: is a simple language identification API; it is a tool that may be useful when dealing with texts, so we decided to open it to all our users. It currently supports more than 50 languages.
|
48
|
+
**[Language Detection API](https://dandelion.eu/docs/api/datatxt/li/v1/)**: is a simple language identification API; it is a tool that may be useful when dealing with texts, so we decided to open it to all our users. It currently supports more than 50 languages.
|
49
49
|
|
50
50
|
```
|
51
51
|
element = Dandelionapi::LanguageDetection.new
|
data/dandelionapi.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.required_ruby_version = '
|
22
|
+
spec.required_ruby_version = '>= 1.9.3'
|
23
23
|
|
24
24
|
spec.add_dependency "faraday", '~> 0.9', '>= 0.9.0'
|
25
25
|
spec.add_dependency "faraday_middleware", '~> 0.9', '>= 0.9.1'
|
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.10"
|
28
28
|
spec.add_development_dependency "rake", "~> 10.1"
|
29
29
|
spec.add_development_dependency "rspec","~> 3.3"
|
30
|
-
spec.add_development_dependency "vcr", "~> 2.
|
31
|
-
spec.add_development_dependency "webmock", "~> 1.
|
32
|
-
spec.add_development_dependency "simplecov", "~> 0.
|
33
|
-
spec.add_development_dependency "coveralls", "~> 0.
|
30
|
+
spec.add_development_dependency "vcr", "~> 2.9"
|
31
|
+
spec.add_development_dependency "webmock", "~> 1.21"
|
32
|
+
spec.add_development_dependency "simplecov", "~> 0.10"
|
33
|
+
spec.add_development_dependency "coveralls", "~> 0.8"
|
34
34
|
end
|
data/lib/dandelionapi.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
require "dandelionapi/version"
|
2
4
|
|
3
5
|
require "dandelionapi/base"
|
@@ -19,5 +21,5 @@ module Dandelionapi
|
|
19
21
|
end
|
20
22
|
|
21
23
|
class BadResponse < Exception; end
|
22
|
-
class
|
24
|
+
class MissingParameters < Exception; end
|
23
25
|
end
|
data/lib/dandelionapi/base.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
require "faraday"
|
2
4
|
require "faraday_middleware"
|
3
5
|
require "json"
|
@@ -8,11 +10,14 @@ module Dandelionapi
|
|
8
10
|
|
9
11
|
ENDPOINT = "/datatxt/nex/v1"
|
10
12
|
|
11
|
-
attr_accessor :text, :url, :html, :html_fragment,
|
13
|
+
attr_accessor :text, :url, :html, :html_fragment,
|
14
|
+
:lang, :min_confidence, :min_length, :social_hashtag,
|
15
|
+
:social_mention, :include, :extra_types, :country,
|
16
|
+
:custom_spots
|
12
17
|
|
13
18
|
def analyze(options)
|
14
19
|
|
15
|
-
raise
|
20
|
+
raise MissingParameters.new("Please provide one of the following parameters: text, url, html or html_fragment") if ([:text, :url, :html, :html_fragment] & options.keys).empty?
|
16
21
|
|
17
22
|
params = options
|
18
23
|
call(ENDPOINT, params)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
require "faraday"
|
2
4
|
require "faraday_middleware"
|
3
5
|
require "json"
|
@@ -11,6 +13,9 @@ module Dandelionapi
|
|
11
13
|
attr_accessor :text, :url, :html, :html_fragment, :clean
|
12
14
|
|
13
15
|
def analyze(options)
|
16
|
+
|
17
|
+
raise MissingParameters.new("Please provide one of the following parameters: text, url, html or html_fragment") if ([:text, :url, :html, :html_fragment] & options.keys).empty?
|
18
|
+
|
14
19
|
params = options
|
15
20
|
call(ENDPOINT, params)
|
16
21
|
end
|
data/lib/dandelionapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dandelionapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrea Mostosi
|
@@ -98,56 +98,56 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - "~>"
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: '2.
|
101
|
+
version: '2.9'
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: '2.
|
108
|
+
version: '2.9'
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: webmock
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: '1.
|
115
|
+
version: '1.21'
|
116
116
|
type: :development
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: '1.
|
122
|
+
version: '1.21'
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: simplecov
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - "~>"
|
128
128
|
- !ruby/object:Gem::Version
|
129
|
-
version: '0.
|
129
|
+
version: '0.10'
|
130
130
|
type: :development
|
131
131
|
prerelease: false
|
132
132
|
version_requirements: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
134
|
- - "~>"
|
135
135
|
- !ruby/object:Gem::Version
|
136
|
-
version: '0.
|
136
|
+
version: '0.10'
|
137
137
|
- !ruby/object:Gem::Dependency
|
138
138
|
name: coveralls
|
139
139
|
requirement: !ruby/object:Gem::Requirement
|
140
140
|
requirements:
|
141
141
|
- - "~>"
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: '0.
|
143
|
+
version: '0.8'
|
144
144
|
type: :development
|
145
145
|
prerelease: false
|
146
146
|
version_requirements: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
148
|
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: '0.
|
150
|
+
version: '0.8'
|
151
151
|
description: 'Ruby Gem for Dandelion API service. Available endpoint: Entity Extraction,
|
152
152
|
Text Similarity and Language Detection'
|
153
153
|
email:
|
@@ -184,9 +184,9 @@ require_paths:
|
|
184
184
|
- lib
|
185
185
|
required_ruby_version: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
|
-
- - "
|
187
|
+
- - ">="
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
version:
|
189
|
+
version: 1.9.3
|
190
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
192
|
- - ">="
|