NAME
Text::MeCab::Dict - Utility To Work With MeCab Dictionary
SYNOPSIS
use Text::MeCab::Dict;my $dict = Text::MeCab::Dict->new(dict_source => "/path/to/mecab-ipadic-source");$dict->add(surface => $surface, # 表層形left_id => $left_id, # 左文脈IDright_id => $right_id, # 右文脈IDcost => $cost, # コストpos => $part_of_speech, # 品詞category1 => $category1, # 品詞細分類1category2 => $category2, # 品詞細分類2category3 => $category3, # 品詞細分類3# XXX this below two parameter names need blessing from a knowing# expert, and is subject to changeinflect => $inflect, # 活用形inflect_type => $inflect_type, # 活用型original => $original, # 原形yomi => $yomi, # 読みpronounce => $pronounce, # 発音extra => \@extras, # ユーザー設定);$dict->write('foo.csv');$dict->rebuild();
METHODS
new
Creates a new instance of Text::MeCab::Dict.
The path to the source of mecab-ipadic is required:
my $dict = Text::MeCab::Dict->new(dict_source => "/path/to/mecab-ipadic-source");
If you are in an environment where mecab-config is NOT available, you must also specify libexecdir, which is where mecab-dict-index is installed:
my $dict = Text::MeCab::Dict->new(dict_source => "/path/to/mecab-ipadic-source",libexecdir => "/path/to/mecab/libexec/",);
add
Adds a new entry to be appended to the dictionary. Please see SYNOPSIS for arguments.
write
Writes out the entries that were added via add() to the specified file location. If the file name does not look like an absolute path, the name will be treated relatively from dict_source
rebuild
Rebuilds the index. This usually requires that you are have root privileges
SEE ALSO
http://mecab.sourceforge.net/dic.html