Skip to contents

Parse a supported Chinese input-method dictionary with the Rust cidian parser and add all parsed words to an existing jieba_worker. The file extension selects the parser automatically. Supported formats are .scel, .qcel, .qpyd, .bdict, and .bcd.

Usage

import_cidian(worker, path, ..., tag = NULL)

Arguments

worker

A jieba_worker object to update in place.

path

A path to a supported input-method dictionary file.

...

Must be empty. This enforces that the optional tag argument is supplied by name.

tag

An optional single non-empty character string assigned to every imported word. NULL leaves the tag empty.

Value

NULL, invisibly. The supplied worker is modified in place.

Details

The source dictionary's coding and weight fields are ignored. Imported words are added without an explicit frequency, so jieba-rs infers each frequency from the current dictionary. The same tag is assigned to every imported word. By default, imported words have no tag (tag = NULL).

See also

Examples

if (FALSE) { # \dontrun{
cutter <- worker()
import_cidian(cutter, "dictionary.scel")
segment("\u8bcd\u5e93\u4e2d\u7684\u8bcd\u8bed", cutter)
} # }