Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct the tokenizer for the chinese example #7

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ pip install baguetter
## 快速入门

```python
from baguetter.indices import BMXSparseIndex
from typing import List
from baguetter.indices import BMXSparseIndex, TextPreprocessorConfig

# 自定义中文 tokenizer
def cjk_tokenizer(text: str) -> List[str]:
return list(text.replace(" ", ""))

# 创建索引
idx = BMXSparseIndex()
idx = BMXSparseIndex(preprocessor_or_config=TextPreprocessorConfig(
custom_tokenizer=cjk_tokenizer))

# 添加文档
docs = [
Expand Down