.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Text::MeCab::Dict 3pm" .TH Text::MeCab::Dict 3pm 2024-03-08 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Text::MeCab::Dict \- Utility To Work With MeCab Dictionary .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& 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 => \e@extras, # ユーザー設定 \& ); \& $dict\->write(\*(Aqfoo.csv\*(Aq); \& $dict\->rebuild(); .Ve .SH METHODS .IX Header "METHODS" .SS new .IX Subsection "new" Creates a new instance of Text::MeCab::Dict. .PP The path to the source of mecab-ipadic is required: .PP .Vb 3 \& my $dict = Text::MeCab::Dict\->new( \& dict_source => "/path/to/mecab\-ipadic\-source" \& ); .Ve .PP 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: .PP .Vb 4 \& my $dict = Text::MeCab::Dict\->new( \& dict_source => "/path/to/mecab\-ipadic\-source", \& libexecdir => "/path/to/mecab/libexec/", \& ); .Ve .SS add .IX Subsection "add" Adds a new entry to be appended to the dictionary. Please see SYNOPSIS for arguments. .SS write .IX Subsection "write" Writes out the entries that were added via \fBadd()\fR 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 .SS rebuild .IX Subsection "rebuild" Rebuilds the index. This usually requires that you are have root privileges .SH "SEE ALSO" .IX Header "SEE ALSO" http://mecab.sourceforge.net/dic.html