1
0
Fork 0
mirror of https://github.com/Oreolek/Togataltu.git synced 2024-05-04 10:08:28 +03:00
Togataltu/morphology.rb
2011-04-22 18:32:32 +07:00

19 lines
505 B
Ruby

#!/usr/bin/env ruby
#encoding: utf-8
require 'net/http'
require 'uri'
class Morphology
def initialize (log)
@log = log
end
def process(word)
#res = Net::HTTP.post_form( URI.parse('http://www.morphology.ru/'), { "word" => URI.escape("#{word}")})
#returning = res.body.scan(/<li>(\w+)<\/li>/)
#if returning.empty? then return false end
#return returning
res = %x[php phpmorphy/cli.php "#{word}"].encode("UTF-8")
if res.match("Error") then return false end
return res.split(", ")
end
end