Fix CJK-collapsing concept node ids in the graph builder#3
Open
SungFeng-Huang wants to merge 1 commit into
Open
Fix CJK-collapsing concept node ids in the graph builder#3SungFeng-Huang wants to merge 1 commit into
SungFeng-Huang wants to merge 1 commit into
Conversation
The inline slug pattern [^a-zA-Z0-9_] -> '_' maps every CJK character to an underscore, so all same-length Chinese concepts collapse into ONE node id: 語言模型 / 機器學習 / 深度學習 / 語音辨識 / 語音合成 ... all become concept_____ and overwrite each other (the shipped graph has 4 such collapsed buckets, each silently merging many distinct concepts). Extract a CJK-preserving slug() helper — keep ASCII alphanumerics plus kana, CJK ideographs (incl. Ext-A) and compatibility ideographs; collapse everything else to single underscores — and use it at all six node-id sites (4 concept, 2 series). Rebuilding the graph after this fix: the 4 collapsed buckets become 16 distinct CJK concept nodes (+12 recovered concepts), and graph query resolves e.g. 語音辨識 to its own node. Tracked wiki/graph outputs are intentionally NOT regenerated here to keep the diff reviewable — they refresh on the next `graph build`. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
SungFeng-Huang
added a commit
to SungFeng-Huang/hung-yi-lee-skill
that referenced
this pull request
Jul 6, 2026
Branch layout (mirror main / PR-clean fix branches / integration), the generic feature set (CJK node fix -> PR voidful#3, external corpus + provenance, alignment layer + miner, portability/sanitize, conda wiring), and the explicit non-goal: personal integration glue stays outside this fork — only the generic external-corpus contract ships here. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
SungFeng-Huang
added a commit
to SungFeng-Huang/hung-yi-lee-skill
that referenced
this pull request
Jul 8, 2026
Branch layout (mirror main / PR-clean fix branches / integration), the generic feature set (CJK node fix -> PR voidful#3, external corpus + provenance, alignment layer + miner, portability/sanitize, conda wiring), and the explicit non-goal: personal integration glue stays outside this fork — only the generic external-corpus contract ships here. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
SungFeng-Huang
force-pushed
the
fix/cjk-node-ids
branch
from
July 8, 2026 13:55
1caac82 to
ad3ae34
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
The inline slug pattern
[^a-zA-Z0-9_]→_inscripts/hungyi_graph.pymaps every CJK character to an underscore, so all same-length Chinese concepts collapse into one node id:語言模型,機器學習,深度學習,語音辨識,語音合成, … all slug toconcept_____-style ids (only the length varies)wiki/graph/graph.jsoncontains 4 such collapsed buckets, each silently merging many distinct concepts — the node label is just whichever concept was written last, andgraph queryfor a Chinese term returns a mixed-up nodeFix
Extract a CJK-preserving
slug()helper — keep ASCII alphanumerics plus kana (U+3040–30FF), CJK ideographs (incl. Ext-A) and compatibility ideographs, collapse everything else to single underscores — and use it at all six node-id sites (4 concept, 2 series).After rebuilding: the 4 collapsed buckets become 16 distinct CJK concept nodes (+12 recovered concepts), and e.g.
graph query "語音辨識"resolves to its own node with sensible neighbors.Notes
wiki/graphoutputs are intentionally not regenerated in this PR to keep the diff reviewable — they refresh on the nextpython3 scripts/hungyi_kb.py graph build._, edges stripped): safe because node ids are rebuilt from source on everygraph buildand never persisted across builds.