related_word 0.1.5 → 0.1.6
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/README.md +3 -9
- data/lib/related_word.rb +13 -11
- data/lib/related_word/semantic_service.rb +14 -0
- metadata +2 -5
- data/lib/related_word/version.rb +0 -3
- data/related_word-0.1.0.gem +0 -0
- data/related_word-0.1.1.gem +0 -0
- data/related_word-0.1.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb098d732eb20c852bb4991b8c494e50de53e493
|
4
|
+
data.tar.gz: 3a9b894523ceb27f2b72a2ca2d0f80143d08a28f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a965c0c6095c02039b89566f8dd6dd23dab1e0856b8e1fb2eae0f3d49592675b3002b98b64f75d341b5711466d06fec01ac8f46273b28428e9983db086cea10a
|
7
|
+
data.tar.gz: dd3845d1d752eb2819b5734b89938de07249f25092f2c004bf78a5f2df87451c26f56bbb681d19e8a6508efd310f1c663766fe2fb8be911466f4160b42f8c04d
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# RelatedWord
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Get the list of related words of a specific word.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -24,16 +22,12 @@ Or install it yourself as:
|
|
24
22
|
|
25
23
|
#### RelatedWord.find
|
26
24
|
```ruby
|
25
|
+
require 'related_word'
|
26
|
+
|
27
27
|
word = 'school'
|
28
28
|
RelatedWord.find(word)
|
29
29
|
```
|
30
30
|
|
31
|
-
## Development
|
32
|
-
|
33
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
34
|
-
|
35
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
36
|
-
|
37
31
|
## Contributing
|
38
32
|
|
39
33
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/related_word. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
data/lib/related_word.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
require
|
2
|
-
require "json"
|
3
|
-
require "net/http"
|
4
|
-
require "uri"
|
1
|
+
require 'related_word/semantic_service'
|
5
2
|
|
6
|
-
|
7
|
-
|
3
|
+
class RelatedWord
|
4
|
+
def initialize(service = :semantic)
|
5
|
+
@service = service
|
6
|
+
end
|
7
|
+
|
8
|
+
def find(word)
|
9
|
+
UnknownService = CLass.new(StandardError)
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
if service == :semantic
|
12
|
+
SemanticService.new.find(word)
|
13
|
+
else
|
14
|
+
raise UnknownService
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "json"
|
2
|
+
require "net/http"
|
3
|
+
require "uri"
|
4
|
+
|
5
|
+
class RelatedWord::SemanticService
|
6
|
+
LINK = "http://semantic-link.com/related.php?word="
|
7
|
+
|
8
|
+
def find(word)
|
9
|
+
link = "#{LINK}#{word}"
|
10
|
+
uri = URI.parse(link)
|
11
|
+
response = Net::HTTP.get_response(uri)
|
12
|
+
JSON.parse(response.body)
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: related_word
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MatBi
|
@@ -83,10 +83,7 @@ files:
|
|
83
83
|
- bin/console
|
84
84
|
- bin/setup
|
85
85
|
- lib/related_word.rb
|
86
|
-
- lib/related_word/
|
87
|
-
- related_word-0.1.0.gem
|
88
|
-
- related_word-0.1.1.gem
|
89
|
-
- related_word-0.1.2.gem
|
86
|
+
- lib/related_word/semantic_service.rb
|
90
87
|
- related_word.gemspec
|
91
88
|
homepage: https://github.com/lmduc/related_word
|
92
89
|
licenses:
|
data/lib/related_word/version.rb
DELETED
data/related_word-0.1.0.gem
DELETED
Binary file
|
data/related_word-0.1.1.gem
DELETED
Binary file
|
data/related_word-0.1.2.gem
DELETED
Binary file
|