https://github.com/arthur87/kampyo
kampyo is a library for conveniently manipulating Cabocha and Mecab.
https://github.com/arthur87/kampyo
cabocha japansese mecab ruby
Last synced: over 1 year ago
JSON representation
kampyo is a library for conveniently manipulating Cabocha and Mecab.
- Host: GitHub
- URL: https://github.com/arthur87/kampyo
- Owner: arthur87
- License: mit
- Created: 2025-03-02T04:56:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-18T13:44:13.000Z (over 1 year ago)
- Last Synced: 2025-03-18T14:35:19.245Z (over 1 year ago)
- Topics: cabocha, japansese, mecab, ruby
- Language: Ruby
- Homepage: https://www.daispot.com
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kampyo
[](https://badge.fury.io/rb/kampyo)
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=>"断定"}
```