16 breaking releases

0.18.0 Nov 4, 2023
0.16.0 Jun 11, 2023
0.15.0 Feb 12, 2023
0.14.0 Jul 13, 2022
0.1.0 Sep 18, 2018

#12 in #tantivy

Download history 25/week @ 2023-12-24 29/week @ 2024-01-07 18/week @ 2024-01-14 9/week @ 2024-01-21 2/week @ 2024-01-28 5/week @ 2024-02-11 62/week @ 2024-02-18 87/week @ 2024-02-25 36/week @ 2024-03-03 45/week @ 2024-03-10 33/week @ 2024-03-17 32/week @ 2024-03-24 304/week @ 2024-03-31

417 downloads per month
Used in 8 crates (5 directly)

MIT license

7KB
101 lines

cang-jie(仓颉)

Crates.io latest document dependency status

A Chinese tokenizer for tantivy, based on jieba-rs.

As of now, only support UTF-8.

Example

    let mut schema_builder = SchemaBuilder::default();
    let text_indexing = TextFieldIndexing::default()
        .set_tokenizer(CANG_JIE) // Set custom tokenizer
        .set_index_option(IndexRecordOption::WithFreqsAndPositions);
    let text_options = TextOptions::default()
        .set_indexing_options(text_indexing)
        .set_stored();
    // ... Some code   
     let index = Index::create(RAMDirectory::create(), schema.clone())?;
     let tokenizer = CangJieTokenizer {
                        worker: Arc::new(Jieba::empty()), // empty dictionary
                        option: TokenizerOption::Unicode,
                     };
     index.tokenizers().register(CANG_JIE, tokenizer); 
    // ... Some code

Full example

Dependencies

~25–57MB
~759K SLoC