-
Notifications
You must be signed in to change notification settings - Fork 16
N Best 読み
Brooke M. Fujita edited this page Feb 10, 2015
·
1 revision
Natto::MeCab
can also iterate through a list of kanji and obtain their most probable readings, using the yomi
option for output_format_type
and specifying output of the 2 nbest
candidate readings:
nm = Natto::MeCab.new('-Oyomi -N2')
=> #<Natto::MeCab:0x288f6d08
@tagger=#<FFI::Pointer address=0x28d3ab80>,
@libpath="/usr/local/lib/libmecab.so",
@options={:output_format_type=>"yomi", :nbest=>2},
@dicts=[#<Natto::DictionaryInfo:0x288f6ba0
@filepath="/usr/local/lib/mecab/dic/ipadic/sys.dic",
charset=utf-8,
type=0>],
@version=0.996>
%w( 日本語 大人気 初心 ).each do |kanji|
puts "#{nm.parse(kanji)}\n"
end
ニホンゴ
ニッポンゴ
ダイニンキ
オトナゲ
ショシン
ウブ