mirror of
https://github.com/Oreolek/Togataltu.git
synced 2024-05-04 10:08:28 +03:00
19 lines
505 B
Ruby
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
|