messense / jieba-rs

The Jieba Chinese Word Segmentation Implemented in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Jieba::add_word` panics when given empty `word`

usaoc opened this issue · comments

Example:

use jieba_rs::Jieba;

fn main() {
    let mut jieba = Jieba::new();
    jieba.add_word("", None, None);
}

gives

thread 'main' panicked at /path/to/cedarwood-0.4.6/src/lib.rs:302:13:
failed to insert zero-length key

Should the panic message be improved, and a note be added to the doc?