Skip to content

Clarify Chinese query segmentation scope - #1026

Merged
safishamsi merged 1 commit into
Graphify-Labs:v8from
candy-Tong:fix/chinese-query-segmentation-cache
May 26, 2026
Merged

Clarify Chinese query segmentation scope#1026
safishamsi merged 1 commit into
Graphify-Labs:v8from
candy-Tong:fix/chinese-query-segmentation-cache

Conversation

@candy-Tong

Copy link
Copy Markdown
Contributor

Summary

  • Rebase the query tokenization fix onto the latest v8 branch (68863a7).
  • Keep the scope explicitly Chinese-only by renaming the CJK helpers and optional extra to Chinese.
  • Cache the optional jieba import at module level and keep the bigram fallback when jieba is unavailable.
  • Add regression coverage for Chinese segmentation, cached jieba usage, no-jieba fallback, mixed Chinese/English terms, and non-Chinese kana/Hangul strings staying unsegmented.

Fixes #962
Supersedes #964

Tests

  • uv run --with pytest pytest tests/test_serve.py tests/test_query_cli.py tests/test_benchmark.py
  • uv run --with pytest --with jieba pytest tests/test_serve.py -k "chinese or non_chinese"
  • graphify update .

Keep Graphify query segmentation focused on Chinese terms: rename the CJK helpers and extra to Chinese scope, cache the optional jieba import at module load, and keep a bigram fallback when jieba is unavailable.

Constraint: Reviewer asked either to broaden Hiragana/Katakana/Hangul support or rename CJK helpers; user chose Chinese-only because Japanese segmentation accuracy is uncertain.

Rejected: Broaden to Japanese and Korean segmentation | jieba is Chinese-oriented and the user explicitly limited scope to Chinese.

Confidence: high

Scope-risk: narrow

Directive: Do not label this path as CJK unless Hiragana/Katakana/Hangul segmentation is intentionally supported and tested.

Tested: uv run --with pytest pytest tests/test_serve.py tests/test_query_cli.py tests/test_benchmark.py

Tested: uv run --with pytest --with jieba pytest tests/test_serve.py -k "chinese or non_chinese"

Tested: graphify update .

Not-tested: Full test suite.

Co-authored-by: OmX <omx@oh-my-codex.dev>
@candy-Tong
candy-Tong force-pushed the fix/chinese-query-segmentation-cache branch from c525716 to 951eebe Compare May 26, 2026 09:32
@candy-Tong

Copy link
Copy Markdown
Contributor Author

Closing this duplicate because the fix has been moved back to #1014.

@candy-Tong candy-Tong closed this May 26, 2026
@safishamsi
safishamsi merged commit c7a05d6 into Graphify-Labs:v8 May 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is graphify will filter string that length < 2?

2 participants