dict_index: Compile a MeCab user dictionary

View source: R/dict.R

dict_indexR Documentation

Compile a MeCab user dictionary

Description

dict_index compiles a user dictionary CSV file into a binary dictionary that can be used with pos and posParallel.

Usage

dict_index(
  dic_csv,
  out_dic,
  dic_dir,
  dic_charset = "utf-8",
  out_charset = "utf-8"
)

Arguments

dic_csv

Character scalar. Path to the user dictionary CSV file(s). Multiple CSV files can be provided as a character vector.

out_dic

Character scalar. Path for the output compiled dictionary file.

dic_dir

Character scalar. Path to the system dictionary directory. This is required so that MeCab can reference the system dictionary configuration during compilation.

dic_charset

Character scalar. Charset of the input CSV file. Default is "utf-8".

out_charset

Character scalar. Charset of the output dictionary. Default is "utf-8".

Details

This function wraps MeCab's mecab-dict-index internally, so you do not need the command-line tool installed separately.

Value

Invisible TRUE on success.

Examples

## Not run: 
dict_index(
  dic_csv = "user_words.csv",
  out_dic = "user.dic",
  dic_dir = "/usr/local/lib/mecab/dic/ipadic"
)

# Then use the compiled dictionary:
pos("some text", user_dic = "user.dic")

## End(Not run)


RcppMeCab documentation built on March 24, 2026, 9:08 a.m.