rubospeller 1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e6931074a025ce7a46b3022102247ec5c6fd56d0
4
+ data.tar.gz: d6200e5e479bcc4553ea5b78c4cf8d85c0c00e03
5
+ SHA512:
6
+ metadata.gz: 28e3beda19a671918e478305712c10a1e6bba300fb0170711821f59b90ab4bbd610b75758b297e87868790240c9675cb3319e398af751dec5b18ef405039e08a
7
+ data.tar.gz: fd1b4cc607a331423775a064cb72c5c0f1da7ffa44291296cc98a05cec0b1fbd6d142ce005be35eafe54fb0162b7ca6091d18fadc9cc44eef957ff289f15b382
data/bin/rubospeller ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubospeller'
4
+ phrase = ARGV.join(" ")
5
+ RuboSpeller.print phrase
@@ -0,0 +1,14 @@
1
+ require_relative 'rubospeller/data'
2
+
3
+ module RuboSpeller
4
+
5
+ def self.print phrase = ""
6
+ puts Data.check phrase
7
+ end
8
+ end
9
+
10
+ # example(irb or rails console):
11
+ # RuboSpeller.print 'yllow autumnn' # {"yllow"=>["yellow"], "autumnn"=>["autumn"]}
12
+
13
+ # example from terminal:
14
+ # rubospeller yllow autumnn # {"yllow"=>["yellow"], "autumnn"=>["autumn"]}
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ require 'open-uri'
4
+ require 'json'
5
+
6
+ module RuboSpeller
7
+ module Data
8
+
9
+ DATA_URL = "http://speller.yandex.net/services/spellservice.json/checkText?text="
10
+
11
+ def self.check phrase
12
+ special_format = format phrase
13
+ result = JSON.load(open(URI.parse(URI.encode(DATA_URL+special_format))))
14
+ result.empty? ? {} : result.inject({}) { |hash, word| hash[word['word']] = word['s']; hash }
15
+ end
16
+
17
+ def self.format phrase
18
+ phrase_in_array = phrase.split
19
+ phrase_in_array.join("+")
20
+ end
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubospeller
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrey Gedeonov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-11-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Spell checking using Yandex peller
14
+ email: ag82pishi@yandex.ru
15
+ executables:
16
+ - rubospeller
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/rubospeller
21
+ - lib/rubospeller.rb
22
+ - lib/rubospeller/data.rb
23
+ homepage: http://rubygems.org/gems/rubospeller
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.5.1
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: yandex speller!
47
+ test_files: []