Text::...b::Dict(3pm)
๐ Text::MeCab::Dict โ the manual, but make it cute ๐
okay bestie, sit down, hydrate, and let me tell you about Text::MeCab::Dict โ that's the Text::MeCab::Dict page from the User Contributed Perl Documentation, and she's a Utility To Work With MeCab Dictionary. literally that's the NAME, no notes. โจ
๐ธ SYNOPSIS ๐ธ
here's the whole vibe in one go, direct from the source, don't touch anything:
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, # ๅทฆๆ่ID
right_id => $right_id, # ๅณๆ่ID
cost => $cost, # ใณในใ
pos => $part_of_speech, # ๅ่ฉ
category1 => $category1, # ๅ่ฉ็ดฐๅ้ก1
category2 => $category2, # ๅ่ฉ็ดฐๅ้ก2
category3 => $category3, # ๅ่ฉ็ดฐๅ้ก3
# XXX this below two parameter names need blessing from a knowing
# expert, and is subject to change
inflect => $inflect, # ๆดป็จๅฝข
inflect_type => $inflect_type, # ๆดป็จๅ
original => $original, # ๅๅฝข
yomi => $yomi, # ่ชญใฟ
pronounce => $pronounce, # ็บ้ณ
extra => \@extras, # ใฆใผใถใผ่จญๅฎ
);
$dict->write('foo.csv');
$dict->rebuild();
๐ซถ heads up: those two parameter namesinflectandinflect_typeare literally flagged in the source as needing blessing from a knowing expert, and they're subject to change. so don't build your whole personality around them, okay? ๐
๐ METHODS ๐
โจ new
Creates a new instance of Text::MeCab::Dict. new instance, new me, main character energy ๐
The path to the source of mecab-ipadic is required, bestie, you can't skip it:
my $dict = Text::MeCab::Dict->new(
dict_source => "/path/to/mecab-ipadic-source"
);
and if you're in an environment where mecab-config is NOT available, you also have to 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/",
);
that's it, that's the whole constructor. no cap. ๐
๐ add
Adds a new entry to be appended to the dictionary. Please see SYNOPSIS for arguments โ yeah, go look up there, I already laid them all out for you, you're welcome ๐
๐ฆ write
Writes out the entries that were added via add() to the specified file location. ๐ธ
and here's the lil plot twist: if the file name does not look like an absolute path, the name will be treated relatively from dict_source. so like, know where you're standing, girlie. โจ
โญ rebuild
Rebuilds the index. ๐ฅ
โ ๏ธ This usually requires that you are have root privileges โ yes that's exactly how the original says it and I'm not fixing it, it's iconic. go get your sudo, bestie.
๐ SEE ALSO ๐
go read it, it's giving documentation, iykyk ๐ง
and that's the tea, bestie ๐ this whole page came to you courtesy of perl v5.42.3 and the date 2026-08-20, filed under Text::MeCab::Dict(3pm). slay, go add some dictionary entries, periodt ๐
โจ๐
๐ฆ where this page comes from
- ubuntu stonking: libtext-mecab-perl 0.20016-5build2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms