Crates.io | tantivy-jieba |
lib.rs | tantivy-jieba |
version | 0.11.0 |
source | src |
created_at | 2019-02-13 20:05:21.563709 |
updated_at | 2024-04-28 09:32:15.803819 |
description | A library that bridges between tantivy and jieba-rs |
homepage | |
repository | https://github.com/jiegec/tantivy-jieba |
max_upload_size | |
id | 114610 |
size | 10,202 |
An adapter that bridges between tantivy and jieba-rs.
Add dependency tantivy-jieba
to your Cargo.toml
.
use tantivy::tokenizer::*;
let mut tokenizer = tantivy_jieba::JiebaTokenizer {};
let mut token_stream = tokenizer.token_stream("测试");
assert_eq!(token_stream.next().unwrap().text, "测试");
assert!(token_stream.next().is_none());
use tantivy::schema::Schema;
use tantivy::tokenizer::*;
use tantivy::Index;
let tokenizer = tantivy_jieba::JiebaTokenizer {};
let index = Index::create_in_ram(schema);
index.tokenizers()
.register("jieba", tokenizer);