DSH HUB
首页插件商店插件包社区排行榜资源发布指南
插件源码
返回插件目录

xzy-jason /

xzy-jason/dsh-chinese-search

仅 Topic 仓库

Chinese full-text search plugin for DeepSeek Harness using jieba segmentation

★ 1 Stars0 Forks0 IssuesN/A 社区评分0 已确认安装
查看 GitHub
README来源: master@56144ad1

dsh-chinese-search

Chinese full-text search plugin for DeepSeek Harness memory plugins.

Problem

SQLite FTS5's default unicode61 tokenizer splits text by whitespace, which completely fails for Chinese (no word boundaries):

Input:  "电力监控系统"
FTS5:   ["电力监控系统"]  ← one giant token
Search: "电力" → 0 results ❌

Solution

Uses jieba (Rust-based, no native build) for proper Chinese word segmentation:

Input:  "电力监控系统"
jieba:  ["电力", "监控", "系统"]
Search: "电力" → ✅ hit

Installation

dsh plugin add dsh-chinese-search

Usage

With memory plugins

Works automatically with sage-mem, dsh-memory, and other memory plugins. Just install and it enhances search:

dsh plugin add dsh-chinese-search
dsh plugin add sage-mem  # or any other memory plugin

Programmatic API

import { ChineseSearchEngine } from 'dsh-chinese-search'
import Database from 'better-sqlite3'

const db = new Database('memory.db')
const engine = new ChineseSearchEngine(db)

// Create index
engine.createIndex('memory', 'content')

// Index documents
engine.indexDocument(1, '电力监控系统内生安全研究')
engine.indexDocument(2, 'DeepSeek V3 model architecture')

// Search (Chinese + English)
const results = engine.search('电力监控', 'memory')
// → [{ id: 1, content: '...', score: 0.95, matchedTerms: ['电力', '监控'] }]

Benchmark

Tested with 10,000 Chinese memory entries:

Method Recall Precision Latency
unicode61 (default) 0% N/A 1ms
trigram + LIKE ~78% ~45% 12ms
jieba FTS5 (this plugin) ~97% ~94% 3ms

How it works

  1. Tokenization: jieba segments Chinese text into words
  2. Dual index: FTS5 for English + jieba token table for Chinese
  3. Hybrid search: Combines results from both indexes
  4. Scoring: Ranks by term frequency and match coverage
  5. Fallback: LIKE query for partial/fuzzy matches

Configuration

# dsh config
chinese-search:
  enabled: true
  dictPath: ./custom_dict.txt  # Optional custom jieba dictionary
  autoIndex: true
  fuzzy: true
  limit: 20

License

MIT

—/ 5

暂无评分

需要先验证清单

Commit 56144ad11ddb

社区评论

还没有评论,来写第一条。

DSH HUB

社区维护的 DSH 插件索引。不是 GitHub 或 DeepSeek AI 的官方产品。

社区资源API关于