0.0
No commit activity in last 3 years
No release in over 3 years
Use a sequence of morphemes as an Enumerable object.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

MeCab::Light

Use a sequence of morphemes as an Enumerable object.

Installation

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

Usage

require 'mecab/light'

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

model = MeCab::Light::Model.new('')
tagger = MeCab::Light::Tagger.new(model)
lattice = MeCab::Light::Lattice.new(model)
lattice.sentence = 'この文を形態素解析してください。'
result = tagger.parse(lattice)
result.map(&:surface)
#=> ["この", "文", "を", "形態素", "解析", "し", "て", "ください", "。"]

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.

Contributing

  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