Class: CheckSpell::YandexSpell

Inherits:
Object
  • Object
show all
Defined in:
lib/checkspell/yandexspell.rb

Constant Summary collapse

YANDEX_API =
"http://speller.yandex.net/services/spellservice.json/checkText?text="

Instance Method Summary collapse

Instance Method Details

#checkObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/checkspell/yandexspell.rb', line 10

def check
  spell = []
  uri = URI.escape (YANDEX_API + @text)
  get_uri = open(uri).read
  result = JSON.parse(get_uri)
  result.each do |r|
    result = "Ошибка в слове: #{r['word']}. Правильно писать: #{r['s']}"
    puts result
    spell.push result
    #return result
  end
  return spell
end