Project

nimono

0.0
No commit activity in last 3 years
No release in over 3 years
nimono is a interface to CaboCha for CRuby(mri/yarv) and JRuby(jvm). It depends on the CaboCha library so the library will have to install first.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 10.0
~> 3.0

Runtime

>= 1.9.0
 Project Readme

nimono Gem Version

nimono is an interface of CaboCha for MRI Ruby and JRuby, and parsing Japanese sentences using the library. It depends on the CaboCha library so the library will have to install first.

Requirements

nimono requires the following:

Installation

Install it as:

$ gem install nimono

Usage

Create an instance of Nimono::Cabocha and parse the sentence. By default, the result is outpeuuted by displaying Sumple Tree.

require 'nimono'

nc = Nimono::Cabocha.new
puts nc.parse('太郎は花子が読んでいる本を次郎に渡した')
    太郎は---------D
      花子が-D     |
    読んでいる-D   |
            本を---D
            次郎に-D
              渡した
EOS

Example of analyzing dependency:

require 'nimono'

nc = Nimono::Cabocha.new('-n1')
nc.parse('太郎は花子が読んでいる本を次郎に渡した')

nc.chunks.each do |chunk|
  puts "* #{chunk.id} #{chunk.link}D #{chunk.head_pos}/#{chunk.func_pos} #{'%6f' % chunk.score}"
  chunk.tokens.each do |token|
    puts "#{token.surface}\t#{token.feature}\t#{token.ne}"
  end
end

* 0 5D 0/1 -0.742128
太郎	名詞,固有名詞,人名,,*,*,太郎,タロウ,タロー	B-PERSON
	助詞,係助詞,*,*,*,*,,,	O
* 1 2D 0/1 1.700175
花子	名詞,固有名詞,人名,,*,*,花子,ハナコ,ハナコ	B-PERSON
	助詞,格助詞,一般,*,*,*,,,	O
* 2 3D 0/2 1.825021
読ん	動詞,自立,*,*,五段・マ行,連用タ接続,読む,ヨン,ヨン	O
	助詞,接続助詞,*,*,*,*,,,	O
いる	動詞,非自立,*,*,一段,基本形,いる,イル,イル	O
* 3 5D 0/1 -0.742128
	名詞,一般,*,*,*,*,,ホン,ホン	O
	助詞,格助詞,一般,*,*,*,,,	O
* 4 5D 1/2 -0.742128
	名詞,一般,*,*,*,*,,ツギ,ツギ	O
	名詞,一般,*,*,*,*,,ロウ,ロー	O
	助詞,格助詞,一般,*,*,*,,,	O
* 5 -1D 0/1 0.000000
渡し	動詞,自立,*,*,五段・サ行,連用形,渡す,ワタシ,ワタシ	O
	助動詞,*,*,*,特殊・タ,基本形,,,	O

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/TakayoshiYamazaki/nimono. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.