Sha256: 0ee3910c9f01f867fe7162a9aa7a152da801eb5e1a45f796f4548ed83473b2bd

Contents?: true

Size: 698 Bytes

Versions: 1

Compression:

Stored size: 698 Bytes

Contents

class MecabStandalone
  LD_LIBRARY_PATH = File.join( $LOAD_PATH.grep(/mecab\_standalone\-/).first, 'lib' )

  def self.reading(input, rcfile = "#{__dir__ }/etc/mecabrc", dic = "#{__dir__ }/lib/mecab/dic/ipadic/")
    io = IO.popen({'LD_LIBRARY_PATH' => LD_LIBRARY_PATH},
      "echo \"#{input}\" | #{__dir__ }/bin/mecab -r #{rcfile} -d #{dic} -Oyomi")
    reading = io.read
    io.close
    reading
  end

  def self.parse(input, rcfile = "#{__dir__ }/etc/mecabrc", dic = "#{__dir__ }/lib/mecab/dic/ipadic/")
    io = IO.popen({'LD_LIBRARY_PATH' => LD_LIBRARY_PATH},
      "echo \"#{input}\" | #{__dir__ }/bin/mecab -r #{rcfile} -d #{dic}")
    reading = io.read
    io.close
    reading
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mecab_standalone-0.1.2 lib/mecab_standalone.rb