返回目录
文件与数据 插件

dsh-chinese-search

xzy-jason/dsh-chinese-search

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

Stars
1
Forks
0
Issues
0
更新
4 天前

PROJECT TOPICS

项目标签

INSTALL REFERENCE

安装参考

未验证
dsh plugin --profile web add github:xzy-jason/dsh-chinese-search

该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。

PROJECT README

README

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

CLASSIFICATION EVIDENCE

分类依据

项目类型插件
功能分类文件与数据
规则置信度

系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: chinese-search、full-text-search。