import_cidian: Import an input-method dictionary into a worker

View source: R/cidian.R

import_cidianR Documentation

Import an input-method dictionary into a worker

Description

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.

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).

Value

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

See Also

read_cidian().

Examples

## Not run: 
cutter <- worker()
import_cidian(cutter, "dictionary.scel")
segment("\u8bcd\u5e93\u4e2d\u7684\u8bcd\u8bed", cutter)

## End(Not run)

jiebaRS documentation built on Oct. 13, 2026, 5:07 p.m.