Learn R Programming

RcppMeCab (version 0.0.1.7)

dict_index: 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"
)

Value

Invisible TRUE on success.

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.

Examples

Run this code
if (FALSE) {
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")
}

Run the code above in your browser using DataLab