Use a sequence of morphemes as an Enumerable object.


Add this line to your application's Gemfile:

gem 'mecab-light'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mecab-light

Install on Windows:

$ gem install mecab-light -- --with-mecab-folder=C:/MeCab # assign yours


require 'mecab/light'

tagger ='')
string = 'この文を形態素解析してください。'
result = tagger.parse(string)
result.kind_of?(Enumerable) #=> true
#=> ["この", "文", "を", "形態素", "解析", "し", "て", "ください", "。"]

model ='')
tagger =
lattice =
lattice.sentence = 'この文を形態素解析してください。'
result = tagger.parse(lattice)
#=> ["この", "文", "を", "形態素", "解析", "し", "て", "ください", "。"]

MeCab::Light is a lightweight tool. This gem works without the official binding. Note that this supports less methods than those of C API for now.


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request