
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
= yacan Yahoo!テキスト解析APIをラップするgem
http://developer.yahoo.co.jp/webapi/jlp/
== Example === 準備
YaCan.appid = '*****'
=== 係り受け解析 http://developer.yahoo.co.jp/webapi/jlp/da/v1/parse.html
1文ずつ渡さないと変な結果になる
d = YaCan::Dependency.parse('DVDが終わるまで私はお二人の足台にさせられました。') d.chunks #=> [0 1 DVDが, 1 5 終わるまで, 2 5 私は, 3 4 お二人の, 4 5 足台に, 5 -1 させられました。] # 文中に含まれるChunk(文節)インスタンスの配列 d.morphems #=> [DVD: 名詞,名詞,,DVD,でぃーぶいでぃー,DVD, が: 助詞,格助詞,,が,が,が, 終わる: 動詞,ラ五,基本形,終わる,おわ,終わ, まで: 助詞,副助詞,,まで,まで,まで, 私: 名詞,名詞人,,私,わたし,私, は: 助詞,係助詞,,は,は,は, お: 接頭辞,接頭お,,お,お,お, 二人: 名詞,名詞人,,二人,ふたり,二人, の: 助詞,助詞連体化,,の,の,の, 足: 名詞,名詞,,足,あし,足, 台: 接尾辞,接尾地名,,台,だい,台, に: 助詞,助詞副詞化,,に,に,に, させ: 動詞,サ五,連用テ接続,させ,さ,さ, られ: 助動詞,助動詞一段,未然ウ接続,られ,られ,られ, まし: 助動詞,助動詞ます,未然ウ接続,まし,ま,ま, た: 助動詞,助動詞た,基本形,た,た,た, 。: 特殊,句点,,。,。,。] # 文中に含まれるMorphem(形態素)のインスタンスの配列
chunk = d.chunks[3] chunk.to_s #=> "3 4 お二人の" chunk.id #=> 3 ; 文節ID chunk.dependency #=> 4 ; 係り先のID、なければ-1 chunk.morphems #=> [お: 接頭辞,接頭お,,お,お,お, 二人: 名詞,名詞人,,二人,ふたり,二人, の: 助,助詞連体化,*,の,の,の] # Morphem(形態素)インスタンスの配列 chunk.depends_on #=> 4 5 足台に ; 係り先のChunk、なければnil chunk.depends_from #=> [] ; 係り元のChunkの配列
morphem = chunk.morphems[1] morphem.to_s #=> 二人: 名詞,名詞人,,二人,ふたり,二人 morphem.surface #=> "二人" ; 表記 morphem.reading #=> "ふたり" ; 読み morphem.baseform #=> "二人" ; 基本形 morphem.pos #=> "名詞" ; 品詞 morphem.feature #=> ["名詞", "名詞人", "", "二人", "ふたり", "二人"] ; 形態素の全情報
=== キーフレーズ抽出 http://developer.yahoo.co.jp/webapi/jlp/keyphrase/v1/extract.html
k = YaCan::Keyphrase.extract('DVDが終わるまで私はお二人の足台にさせられました。')
k.results #=> [["足台", 100], ["お二人", 85], ["DVD", 65], ["私", 35]] # キーフレーズとスコアのペアの配列 k.phrases #=> ["足台", "お二人", "DVD", "私"] k.scores #=> [100, 85, 65, 35]
=== 形態素解析 http://developer.yahoo.co.jp/webapi/jlp/ma/v1/parse.html
作ったけど係り受け解析使えば用は済みそう
m = YaCan::Morphem.parse('DVDが終わるまで私はお二人の足台にさせられました。', {'filter' => '9' }) # 抽出対象品詞のフィルタとか渡せる、APIのページ見れば分かる感じ m.ma_result.morphems.map(&:surface) #=> ["DVD", "私", "二人", "足", "台"]
あとはコード見てほしい
https://github.com/pokutuna/yacan/blob/master/lib/yacan/morphem.rb
== その他
== Contributing to yacan
== Copyright
Copyright (c) 2011 pokutuna. See LICENSE.txt for further details.
FAQs
Unknown package
We found that yacan demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.