Skip to content

kampyo is a library for conveniently manipulating Cabocha and Mecab.

License

Notifications You must be signed in to change notification settings

arthur87/kampyo

Repository files navigation

kampyo

Gem Version

kampyo is a library for conveniently manipulating Cabocha and Mecab.

kampyo has its own analysis function.

Unique features already implemented are subject and predicate, and stylistic inference.

Guide

Basic usage with Cabocha.

text = Kampyo::Text.new
text.cabocha_parser("今日は雨です")

You will get the following result.

{:chunks=>[{:id=>1, :link=>2, :score=>0.0}, {:id=>2, :link=>-1, :score=>0.0}],
 :tokens=>
  [{:id=>1, :chunk=>1, :surface=>"今日", :feature1=>"名詞", :feature2=>"副詞可能", :baseform=>"今日", :reading=>"キョウ", :ext_reading=>nil},
   {:id=>2, :chunk=>1, :surface=>"は", :feature1=>"助詞", :feature2=>"係助詞", :baseform=>"は", :reading=>"ハ", :ext_reading=>nil},
   {:id=>3, :chunk=>2, :surface=>"雨", :feature1=>"名詞", :feature2=>"一般", :baseform=>"雨", :reading=>"アメ", :ext_reading=>nil},
   {:id=>4, :chunk=>2, :surface=>"です", :feature1=>"助動詞", :feature2=>"*", :baseform=>"です", :reading=>"デス", :ext_reading=>nil}]}

Guess the subject, predicate and sentence system.

text = Kampyo::Text.new
text.analysis(text.cabocha_parser("今日は雨です"))

You will get the following result.

{:subject=>{:id=>1, :chunk=>1, :surface=>"今日", :feature1=>"名詞", :feature2=>"副詞可能", :baseform=>"今日", :reading=>"キョウ", :ext_reading=>nil},
 :predicate=>{:id=>3, :chunk=>2, :surface=>"雨", :feature1=>"名詞", :feature2=>"一般", :baseform=>"雨", :reading=>"アメ", :ext_reading=>nil},
 :tod=>"断定"}

About

kampyo is a library for conveniently manipulating Cabocha and Mecab.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published