2014年10月22日水曜日

形態素解析

テキストマイニングにおいて、単語に分解するのは必須ですが、日本語は英語のように簡単にはいきません。
しかし、Javaでこんな便利な形態素解析ライブラリがありました。



今回は、JPAの辞書のものを使用しました。


早速、分解。

すもももももももものうち
=====
surface : すもも
cost : 4632
length : 3
start : 0
basicForm : *
conjugationalForm : *
conjugationalType : *
partOfSpeech : 名詞-一般
pronunciations : [スモモ]
readings : [スモモ]
=====
surface : も
cost : 6035
length : 1
start : 3
basicForm : *
conjugationalForm : *
conjugationalType : *
partOfSpeech : 助詞-係助詞
pronunciations : [モ]
readings : [モ]
=====
surface : もも
cost : 10308
length : 2
start : 4
basicForm : *
conjugationalForm : *
conjugationalType : *
partOfSpeech : 名詞-一般
pronunciations : [モモ]
readings : [モモ]
=====
surface : も
cost : 11711
length : 1
start : 6
basicForm : *
conjugationalForm : *
conjugationalType : *
partOfSpeech : 助詞-係助詞
pronunciations : [モ]
readings : [モ]
=====
surface : もも
cost : 15984
length : 2
start : 7
basicForm : *
conjugationalForm : *
conjugationalType : *
partOfSpeech : 名詞-一般
pronunciations : [モモ]
readings : [モモ]
=====
surface : の
cost : 16653
length : 1
start : 9
basicForm : *
conjugationalForm : *
conjugationalType : *
partOfSpeech : 助詞-連体化
pronunciations : [ノ]
readings : [ノ]
=====
surface : うち
cost : 18658
length : 2
start : 10
basicForm : *
conjugationalForm : *
conjugationalType : *
partOfSpeech : 名詞-非自立-副詞可能
pronunciations : [ウチ]
readings : [ウチ]

そのまま、jarとして使えるのでとても便利です。

http://www.mwsoft.jp/programming/munou/lucene_gosen.html
を参考にさせていただきました。

0 件のコメント:

コメントを投稿