Skip to content

Instantly share code, notes, and snippets.

@smison
Created February 27, 2015 02:49
Show Gist options
  • Save smison/55351c73b468f0cf4008 to your computer and use it in GitHub Desktop.
Save smison/55351c73b468f0cf4008 to your computer and use it in GitHub Desktop.
ruby-mecabインストール手順
### mecab, ruby-mecab導入
http://sourceforge.jp/projects/sfnet_mecab/downloads/mecab/0.97/mecab-0.97.tar.gz/
$ sudo rpm -ivh http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm
$ sudo yum install mecab
$ sudo yum install mecab-devel
$ sudo rpm -ivh http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm
$ sudo yum install -y groonga-tokenizer-mecab
「$ mecab -v」でバージョンを確認して、
同じバージョンのmecab-rubyをダウンロードする(バージョンが違うとmake出来ないので注意)
$ wget http://mecab.googlecode.com/files/mecab-ruby-0.996.tar.gz
$ tar xzvf mecab-ruby-0.996.tar.gz
$ cd mecab-ruby-0.996
$ ruby extconf.rb
$ make
$ make install
- 使い方
require 'MeCab'
MeCab::Tagger.new()
node = mecab.parseToNode('最近の夜は寒い')
while node do
puts "#{node.surface}\t#{node.feature}"
node = node.next
end
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment