cnbe32 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cnbe32/__init__.py ADDED
@@ -0,0 +1,21 @@
1
+ """CNBE-32: Chinese Native Binary Encoding - Python SDK"""
2
+ from .core import CNBE32, encode_cnbe, decode_cnbe, hamming_distance
3
+ from .skill_table import SkillTable
4
+ from .constants import (
5
+ RADIX_SHIFT, STROKE_SHIFT, STRUCT_SHIFT, INDEX_SHIFT, EXT_SHIFT,
6
+ RADIX_MASK, STROKE_MASK, STRUCT_MASK, INDEX_MASK, EXT_MASK,
7
+ STRUCT_NAMES, CNBE_STRUCT_MIN, CNBE_STRUCT_MAX,
8
+ CNBE_STROKE_MIN, CNBE_STROKE_MAX, CNBE_RADIX_MIN, CNBE_RADIX_MAX,
9
+ CNBE_EXT_FLAGS_MIN, CNBE_EXT_FLAGS_MAX, CNBE_SUB_TYPE_MIN, CNBE_SUB_TYPE_MAX,
10
+ CNBE_VALUE_MIN, CNBE_VALUE_MAX, CNBE_DEFAULT_ENCODING, CNBE_DEFAULT_DATA_DIR,
11
+ CJK_UNICODE_START, CJK_UNICODE_COUNT, SKILL_TABLE_FILE, RADIX_TABLE_FILE,
12
+ )
13
+ from .exceptions import (
14
+ CNBEError, CNBECodePointError, CNBEValueError,
15
+ CNBEFormatError, CNBECharNotInTableError, CNBEStructureError,
16
+ )
17
+ from .encoders import (
18
+ TreeEncoder, TyphoonEncoder, BlackHoleEncoder,
19
+ SocialEncoder, MathEncoder, RawEncoder, OneHotEncoder, RandomEncoder,
20
+ )
21
+ __version__ = "1.0.0"
cnbe32/constants.py ADDED
@@ -0,0 +1,43 @@
1
+ """CNBE-32 encoding constants and bitfield definitions"""
2
+
3
+ # Bitfield shifts and widths
4
+ RADIX_SHIFT, RADIX_BITS = 24, 8
5
+ STROKE_SHIFT, STROKE_BITS = 19, 5
6
+ STRUCT_SHIFT, STRUCT_BITS = 15, 4
7
+ INDEX_SHIFT, INDEX_BITS = 4, 11
8
+ EXT_SHIFT, EXT_BITS = 0, 4
9
+
10
+ # Field boundaries
11
+ CNBE_STRUCT_MIN, CNBE_STRUCT_MAX = 0, 15
12
+ CNBE_STROKE_MIN, CNBE_STROKE_MAX = 0, 31
13
+ CNBE_RADIX_MIN, CNBE_RADIX_MAX = 0, 255
14
+ CNBE_EXT_FLAGS_MIN, CNBE_EXT_FLAGS_MAX = 0, 15
15
+ CNBE_SUB_TYPE_MIN, CNBE_SUB_TYPE_MAX = 0, 15
16
+ CNBE_VALUE_MIN, CNBE_VALUE_MAX = 0x00000000, 0xFFFFFFFF
17
+
18
+ # Encoding masks (auto-calculated from bit widths)
19
+ RADIX_MASK = (1 << RADIX_BITS) - 1
20
+ STROKE_MASK = (1 << STROKE_BITS) - 1
21
+ STRUCT_MASK = (1 << STRUCT_BITS) - 1
22
+ INDEX_MASK = (1 << INDEX_BITS) - 1
23
+ EXT_MASK = (1 << EXT_BITS) - 1
24
+
25
+ # Default paths and encoding
26
+ CNBE_DEFAULT_ENCODING = "utf-8"
27
+ CNBE_DEFAULT_DATA_DIR = "data"
28
+
29
+ # Structure type names
30
+ STRUCT_NAMES = {
31
+ 0: "single", 1: "left-right", 2: "left-mid-right", 3: "up-down",
32
+ 4: "up-mid-down", 5: "top-left-wrap", 6: "top-right-wrap",
33
+ 7: "bottom-left-wrap", 8: "top-wrap", 9: "bottom-wrap",
34
+ 10: "left-wrap", 11: "full-wrap", 12: "triangle",
35
+ }
36
+
37
+ # CJK basic set
38
+ CJK_UNICODE_START = 0x4E00
39
+ CJK_UNICODE_COUNT = 20902
40
+
41
+ # Default data files
42
+ SKILL_TABLE_FILE = "skill_table.bin"
43
+ RADIX_TABLE_FILE = "radix_table.csv"
cnbe32/core.py ADDED
@@ -0,0 +1,70 @@
1
+ """CNBE-32 core encoding/decoding — uses constants.py + typed exceptions"""
2
+ import numpy as np
3
+ import warnings
4
+
5
+ from .constants import (
6
+ RADIX_SHIFT, STROKE_SHIFT, STRUCT_SHIFT, INDEX_SHIFT, EXT_SHIFT,
7
+ RADIX_MASK, STROKE_MASK, STRUCT_MASK, INDEX_MASK, EXT_MASK,
8
+ STRUCT_NAMES, CNBE_STRUCT_MIN, CNBE_STRUCT_MAX,
9
+ CNBE_STROKE_MIN, CNBE_STROKE_MAX, CNBE_RADIX_MIN, CNBE_RADIX_MAX,
10
+ CJK_UNICODE_START, CJK_UNICODE_COUNT,
11
+ )
12
+ from .exceptions import CNBEValueError, CNBEFormatError, CNBECharNotInTableError
13
+
14
+
15
+ def encode_cnbe(radix=0, stroke=0, struct=0, index=0, ext=0):
16
+ """Encode CJK fields into 32-bit CNBE code with boundary validation"""
17
+ for (name, val, lo, hi) in [
18
+ ("radix", radix, CNBE_RADIX_MIN, CNBE_RADIX_MAX),
19
+ ("stroke", stroke, CNBE_STROKE_MIN, CNBE_STROKE_MAX),
20
+ ("struct", struct, CNBE_STRUCT_MIN, CNBE_STRUCT_MAX),
21
+ ]:
22
+ if not lo <= val <= hi:
23
+ raise CNBEValueError(f"{name}={val} is out of range [{lo}, {hi}]")
24
+ return ((radix & 0xFF) << RADIX_SHIFT) | \
25
+ ((stroke & 0x1F) << STROKE_SHIFT) | \
26
+ ((struct & 0xF) << STRUCT_SHIFT) | \
27
+ ((index & INDEX_MASK) << INDEX_SHIFT) | \
28
+ (ext & 0xF)
29
+
30
+
31
+ def decode_cnbe(code):
32
+ """Decode 32-bit CNBE code into fields; raises CNBEFormatError on invalid code"""
33
+ if not 0 <= code <= 0xFFFFFFFF:
34
+ raise CNBEFormatError(f"code 0x{code:08X} is out of 32-bit range")
35
+ return {
36
+ "radix": (code >> RADIX_SHIFT) & 0xFF,
37
+ "stroke": (code >> STROKE_SHIFT) & 0x1F,
38
+ "structure": (code >> STRUCT_SHIFT) & 0xF,
39
+ "index": (code >> INDEX_SHIFT) & INDEX_MASK,
40
+ "extension": code & 0xF,
41
+ "struct_name": STRUCT_NAMES.get((code >> STRUCT_SHIFT) & 0xF, "unknown"),
42
+ }
43
+
44
+
45
+ def hamming_distance(a, b):
46
+ """Weighted Hamming distance between two CNBE codes (radix*8 + stroke*5 + struct*4)"""
47
+ ra = (a >> RADIX_SHIFT) & 0xFF
48
+ rb = (b >> RADIX_SHIFT) & 0xFF
49
+ sa = (a >> STROKE_SHIFT) & 0x1F
50
+ sb = (b >> STROKE_SHIFT) & 0x1F
51
+ ta = (a >> STRUCT_SHIFT) & 0xF
52
+ tb = (b >> STRUCT_SHIFT) & 0xF
53
+ return abs(ra - rb) * 8 + abs(sa - sb) * 5 + abs(ta - tb) * 4
54
+
55
+
56
+ class CNBE32:
57
+ """CNBE-32 encoding/decoding for Chinese characters (wraps constants + SkillTable)"""
58
+
59
+ def encode(self, char):
60
+ code_point = ord(char)
61
+ idx = code_point - CJK_UNICODE_START
62
+ if 0 <= idx < CJK_UNICODE_COUNT:
63
+ return getattr(self, "_table", np.zeros(CJK_UNICODE_COUNT, dtype=np.uint32))[idx]
64
+ raise CNBECharNotInTableError(char, code_point)
65
+
66
+ def decode(self, code):
67
+ return decode_cnbe(code)
68
+
69
+ def distance(self, a, b):
70
+ return hamming_distance(a, b)
cnbe32/encoders.py ADDED
@@ -0,0 +1,46 @@
1
+ """Domain-specific CNBE encoders from v9.0-v10.8 experiments"""
2
+ import numpy as np
3
+
4
+ class TreeEncoder:
5
+ """v9.0: Tree growth [species(4)+height(6)+crown(6)+health(4)+light(4)+water(4)+age(4)]"""
6
+ def encode(self, species, height, crown, health, light, water, age):
7
+ return (min(species,15)&0xF)<<28|(min(height,63)&0x3F)<<22|(min(crown,63)&0x3F)<<16|\
8
+ (min(health,15)&0xF)<<12|(min(light,15)&0xF)<<8|(min(water,15)&0xF)<<4|(min(age,15)&0xF)
9
+
10
+ class TyphoonEncoder:
11
+ """v10.3: Typhoon path [lat(8)+lon(8)+wind(8)+pressure(8)]"""
12
+ def encode(self, lat, lon, wind, pressure):
13
+ return (int(lat/50*255)&0xFF)<<24|(int((lon-100)/80*255)&0xFF)<<16|(int(wind/85*255)&0xFF)<<8|(int((pressure-900)/120*255)&0xFF)
14
+
15
+ class BlackHoleEncoder:
16
+ """v10.5: BH spacetime [r_Rs(8)+redshift(8)+tidal(8)+deflection(8)]"""
17
+ def encode(self, r_rs, redshift, tidal, deflection):
18
+ code = 0
19
+ code |= (min(int((r_rs - 1) / 99 * 255), 255) & 0xFF) << 24
20
+ code |= (min(redshift, 255) & 0xFF) << 16
21
+ code |= (min(tidal, 255) & 0xFF) << 8
22
+ code |= (min(deflection, 255) & 0xFF)
23
+ return code
24
+
25
+ class SocialEncoder:
26
+ """v10.6: Urban state [traffic(8)+livelihood(6)+infra(6)+env(4)+emergency(3)+region(3)+time(2)]"""
27
+ def encode(self, traffic, livelihood, infra, env, emergency, region, time_slot):
28
+ return (min(traffic,255)&0xFF)<<24|(min(livelihood,63)&0x3F)<<18|(min(infra,63)&0x3F)<<12|\
29
+ (min(env,15)&0xF)<<8|(min(emergency,7)&0x7)<<5|(min(region,7)&0x7)<<2|(min(time_slot,3)&0x3)
30
+
31
+ class MathEncoder:
32
+ """v10.7-10.8: Math token [type(4)+value(4)]"""
33
+ def encode(self, token_type, value):
34
+ return (token_type&0xF)<<28|(value&0xF)<<24
35
+
36
+ class RawEncoder:
37
+ def encode(self, x): return x
38
+
39
+ class OneHotEncoder:
40
+ def __init__(self, dim=20): self.dim=dim
41
+ def encode(self, x):
42
+ oh=np.zeros(self.dim); oh[x]=1.0; return oh
43
+
44
+ class RandomEncoder:
45
+ def __init__(self, dim=32): self.dim=dim
46
+ def encode(self, x): return np.random.randn(self.dim)
cnbe32/exceptions.py ADDED
@@ -0,0 +1,24 @@
1
+ """CNBE-32 专用异常类体系"""
2
+
3
+ class CNBEError(Exception):
4
+ """CNBE-32 基础异常类——所有 CNBE 异常的基类"""
5
+
6
+ class CNBECodePointError(CNBEError):
7
+ """Unicode 码点映射失败"""
8
+
9
+ class CNBEValueError(CNBEError, ValueError):
10
+ """数值超出有效位域范围"""
11
+
12
+ class CNBEFormatError(CNBEError):
13
+ """编码格式错误(位布局异常)"""
14
+
15
+ class CNBECharNotInTableError(CNBEError):
16
+ """字符不在 CNBE 编码表中"""
17
+ def __init__(self, char, code_point=None):
18
+ self.char = char
19
+ self.code_point = code_point
20
+ msg = f"字符 '{char}' (U+{code_point:04X}) 不在 CNBE 编码表中" if code_point else f"字符 '{char}' 不在 CNBE 编码表中"
21
+ super().__init__(msg)
22
+
23
+ class CNBEStructureError(CNBEError):
24
+ """结构类型解析错误"""
cnbe32/skill_table.py ADDED
@@ -0,0 +1,24 @@
1
+ """Skill table loader (v6.0 8105-character CJK encoding)"""
2
+ import numpy as np
3
+ import os
4
+
5
+ class SkillTable:
6
+ """81.6KB Skill table for 20902 CJK characters"""
7
+ def __init__(self, path=None):
8
+ self.table = np.zeros(20902, dtype=np.uint32)
9
+ if path and os.path.exists(path):
10
+ self.load(path)
11
+ def load(self, path):
12
+ if path.endswith(".npy"):
13
+ self.table = np.load(path)
14
+ elif path.endswith(".bin"):
15
+ self.table = np.frombuffer(open(path,"rb").read(), dtype=np.uint32)
16
+ print(f"Loaded SkillTable: {len(self.table)} chars")
17
+ def lookup(self, unicode):
18
+ if 0x4E00 <= unicode <= 0x9FA5:
19
+ idx = unicode - 0x4E00
20
+ if idx < len(self.table):
21
+ return self.table[idx]
22
+ return 0
23
+ def __getitem__(self, char):
24
+ return self.lookup(ord(char))
@@ -0,0 +1,592 @@
1
+ Metadata-Version: 2.4
2
+ Name: cnbe32
3
+ Version: 1.0.0
4
+ Summary: CNBE-32: Chinese Native Binary Encoding — Structured 32-bit CJK encoding for AI and hardware
5
+ Author: zairkliu
6
+ License: Mulan PSL v2
7
+ Project-URL: Homepage, https://github.com/zairkliu/CNBE-32-Chinese-Native-Binary-Encoding
8
+ Project-URL: Repository, https://github.com/zairkliu/CNBE-32-Chinese-Native-Binary-Encoding
9
+ Project-URL: Bug Tracker, https://github.com/zairkliu/CNBE-32-Chinese-Native-Binary-Encoding/issues
10
+ Keywords: chinese,encoding,cjk,riscv,nlp,structured-encoding
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: Other/Proprietary License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Software Development :: Embedded Systems
21
+ Classifier: Topic :: Text Processing :: Linguistic
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: numpy>=2.0
26
+ Dynamic: license-file
27
+
28
+ # CNBE-32
29
+
30
+ **Chinese Native Binary Encoding**
31
+
32
+ A 32-bit encoding that embeds the structural semantics of Chinese characters (radical, stroke count, and structure type) directly into binary, enabling CPUs and AI to natively understand Chinese.
33
+
34
+ A structured 32-bit encoding for 97,686 CJK characters that embeds radical, stroke count, and structure type directly into the encoding space.
35
+
36
+ <p align="center">
37
+ <a href="docs/specification/bit-layout.md"><img src="https://img.shields.io/badge/Encoding-32--bit%20CNBE-blue?style=for-the-badge" alt="Encoding"></a>
38
+ <a href="docs/specification/riscv-instructions.md"><img src="https://img.shields.io/badge/ISA-RISC--V%20Custom-green?style=for-the-badge" alt="ISA"></a>
39
+ <a href="v84_riscv_os_full/"><img src="https://img.shields.io/badge/OS-Full%20Chinese%20Shell-orange?style=for-the-badge" alt="OS"></a>
40
+ <a href="docs/VISION.md"><img src="https://img.shields.io/badge/Vision-2035%20Digital%20China-red?style=for-the-badge" alt="Vision"></a>
41
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-Mulan%20PSL%20v2-lightgrey?style=for-the-badge" alt="License"></a>
42
+ </p>
43
+
44
+ <p align="center">
45
+ <a href="#quick-start"><strong>[ Quick Start ]</strong></a>
46
+ <a href="#key-experiments"><strong>[ Key Experiments ]</strong></a>
47
+ <a href="#tech-stack"><strong>[ Tech Stack ]</strong></a>
48
+ <a href="#how-to-contribute"><strong>[ How to Contribute ]</strong></a>
49
+ <a href="README_ZH.md"><strong>[ 中文 ]</strong></a> <a href="README_EN.md"><strong>[ English ]</strong></a>
50
+ </p>
51
+
52
+ ---
53
+
54
+ ## <span id="architecture-panorama">Architecture Panorama</span>
55
+
56
+ ```mermaid
57
+ graph TD
58
+ A[Chinese Character Input] -->|Radical/Stroke Count/Structure| B(CNBE-32 Encoder)
59
+ B -->|32-bit Binary| C{RISC-V Custom Instruction Set}
60
+ C -->|cnhe.map / cnhe.cmp| D[Hardware Layer: Spike/QEMU/FPGA]
61
+ D --> E[System Layer: Full Chinese Shell]
62
+ E --> F[Chinese BASIC / JEPA Semantic Engine]
63
+ ```
64
+
65
+ ---
66
+
67
+ ## <span id="vision--mission">Vision & Mission</span>
68
+
69
+ Inspired by the **Digital China 2035** strategy, CNBE-32's goal is:
70
+
71
+ > **To let every Chinese speaker seamlessly enter the AI era through their native language.**
72
+
73
+ This is a mature system with a complete closed-loop, but as an early-stage exploration in the field of native Chinese computing, it remains in an open research phase. In the AI Agent era, the dreams of previous generations of scientists about full-Chinese computer systems finally have a chance to be realized.
74
+
75
+ ---
76
+
77
+ ## Table of Contents
78
+
79
+ - [Architecture Panorama](#architecture-panorama)
80
+ - [Vision & Mission](#vision--mission)
81
+ - [Code Quick Look](#code-quick-look)
82
+ - [Why CNBE?](#why-cnbe)
83
+ - [JEPA Exploration](#jepa-exploration)
84
+ - [Cognitive Equity](#cognitive-equity)
85
+ - [Key Experiments](#key-experiments)
86
+ - [Key Insights I](#key-insights-large-models-vs-small-models)
87
+ - [Experimental Limitations & Future Directions](#experimental-limitations--future-directions)
88
+ - [Tech Stack](#tech-stack)
89
+ - [AI Agent Driven / AI Factory](#ai-agent-driven--ai-factory)
90
+ - [Quick Start](#quick-start)
91
+ - [Project Structure](#project-structure)
92
+ - [Roadmap](#roadmap)
93
+ - [How to Contribute](#how-to-contribute)
94
+ - [Disclaimer](#disclaimer)
95
+ - [License](#license)
96
+
97
+ ---
98
+
99
+ ## <span id="code-quick-look">Code Quick Look</span>
100
+
101
+ **Core Idea: Transform Chinese characters into 32-bit integers containing radical, stroke count, and structure type — letting the machine "see" the glyph directly.**
102
+
103
+ ### CJK Character Mode (v6.0 Final)
104
+
105
+ ```
106
+ Bit: 31 24 23 19 18 15 14 4 3 0
107
+ +----------------+--------+--------+------------------------+-------+
108
+ | Radical (8bit)|Stroke(5)|Struct(4)| Glyph Index (11bit) | Ext(4)|
109
+ +----------------+--------+--------+------------------------+-------+
110
+ ```
111
+
112
+ | Field | Bit Range | Description | Range |
113
+ |-------|-----------|-------------|-------|
114
+ | Radical | `[31:24]` | 214 Kangxi radicals + 41 extensions | 0-255 |
115
+ | Stroke Count | `[23:19]` | Number of strokes | 1-31 |
116
+ | Structure Type | `[18:15]` | Structural composition type | 9 types (single/left-right/top-bottom/enclosure, etc.) |
117
+ | Glyph Index | `[14:4]` | Intra-group index | 20,902 basic CJK characters |
118
+ | Extension | `[3:0]` | Traditional/Simplified, ancient/modern, dialect, reserved flags | Reserved |
119
+
120
+ ### Encoding Examples
121
+
122
+ | Character | Unicode | CNBE-32 Encoding | Radical (ID) | Stroke Count | Structure Type |
123
+ |-----------|---------|-----------------|--------------|--------------|----------------|
124
+ | 一 (one) | U+4E00 | `0x01080000` | 一 (1) | 1 | Single (独体) |
125
+ | 汉 (Chinese) | U+6C49 | `0x0F288101` | 氵 (water, 15) | 5 | Left-Right (左右) |
126
+ | 国 (country) | U+56FD | `0x1F400B0B` | 囗 (enclosure, 31) | 8 | Full Enclosure (全包围) |
127
+ | 明 (bright) | U+660E | `0x48400801` | 日 (sun, 72) | 8 | Left-Right (左右) |
128
+
129
+ ---
130
+
131
+ ## Important: This is Not Base32
132
+
133
+ CNBE-32 is **not** a "Chinese-localized" or "character-replacement" version of Base32.
134
+
135
+ | Dimension | Base32 | CNBE-32 |
136
+ |-----------|--------|---------|
137
+ | **Encoding target** | Arbitrary binary data | **97,686 CJK characters themselves** |
138
+ | **Code space** | Fixed 32 letters | **Structured 32-bit bitfield** (radical, stroke, structure) |
139
+ | **Goal** | Data compression / transmission | **Let machines "understand" character semantics** |
140
+ | **Target audience** | Human-readable (transcription) | **AI models, CPU instruction sets, OS kernels** |
141
+
142
+ **In one sentence**: Base32 turns data "into letters", CNBE-32 turns characters "into semantics".
143
+
144
+ ### Who is it for?
145
+
146
+ - **AI models**: Structured prior knowledge input (radical=spatial anchor, stroke=discrete feature, structure=spatial relationship)
147
+ - **CPU instruction sets**: `cnhe.map` / `cnhe.extract` / `cnhe.cmp` operate at the hardware level
148
+ - **OS kernels**: Filenames, paths, system messages natively support CNBE-32 encoding
149
+ - **Not recommended**: URL transmission, database primary keys, human transcription (use Base64/Base32)
150
+
151
+ ---
152
+
153
+ ## <span id="why-cnbe">Why CNBE?</span>
154
+
155
+ | Dimension | Unicode / UTF-8 | CNBE-32 |
156
+ |-----------|-----------------|---------|
157
+ | Objective | Character display and exchange | AI understanding and hardware acceleration |
158
+ | Encoding Method | Lookup table (Flat ID) | Semantic structuring |
159
+ | Machine Cognition | Identifies the character | Understands structural composition |
160
+ | AI Compatibility | Learns from data | Provides structural priors |
161
+
162
+ **10 cross-domain validations passed (incl. LLM LoRA training)**: Linguistics, Ecology, Meteorology, Finance, Biology, Physics, Sociology, Pre-training, Mathematics
163
+
164
+ ---
165
+
166
+ ## <span id="jepa-exploration">JEPA Exploration</span>
167
+
168
+ CNBE is not a patch for today's Transformers, but foundational infrastructure for tomorrow's JEPA.
169
+
170
+ Yann LeCun's JEPA emphasizes prediction in representation space — and CNBE provides exactly the most structured representation space:
171
+
172
+ - **Radical = Spatial Anchor**: Characters sharing the same radical naturally cluster in binary space
173
+ - **Stroke Count = Discrete Feature**: Provides fine-grained morphological differentiation
174
+ - **Structure = Spatial Relationship**: Left-right, top-bottom, enclosure, etc. directly map to topological relationships
175
+
176
+ Completed JEPA validations: v9 tree structure prediction + v10 cross-9-domain generalization
177
+
178
+ ---
179
+
180
+ ## <span id="cognitive-equity">Cognitive Equity</span>
181
+
182
+ The underlying logic of modern computers (from instruction sets to OS kernels) is built entirely on English/Latin alphabets. This creates a cognitive barrier for non-native English speakers who must first translate their thoughts before performing low-level development.
183
+
184
+ The ultimate significance of CNBE-32 is to enable Chinese speakers to define underlying logic directly through their native linguistic thinking, breaking down professional vocabulary barriers and achieving true technological cognitive equity.
185
+
186
+ > **In the AI era, every Chinese user — regardless of age, education level, or professional background — should be able to engage in deep dialogue with AI, define rules, and even write underlying logic using their native language.**
187
+
188
+ ### Core Performance Overview
189
+
190
+ | Metric | Value | Equity Value Explanation |
191
+ |--------|:-----:|-------------------------|
192
+ | Small model (<1B) comprehension improvement | **+81%** (48%→87%) | Edge devices can achieve high-quality Chinese comprehension without cloud connectivity, breaking the compute monopoly of large tech companies |
193
+ | Medium model (1-7B) improvement | +9% ~ +17% | Mid-range mobile chips can smoothly run complex Chinese tasks without relying on high-end GPUs |
194
+ | Large model (>7B) benefit | ~0% (diminishing returns) | Validates that large models don't need this encoding; resources should be prioritized for small-to-medium intelligence scenarios |
195
+ | Hardware lookup extreme latency | 0.8 ns (x86) / 1 Cycle (FPGA) | Ultra-fast response for real-time interaction; suitable for low-frequency, low-power embedded chips |
196
+ | Minimal memory footprint | Only 81.6 KB (SRAM/BRAM) | Fits easily into any L1/L2 cache or on-chip storage without external DRAM, reducing BOM cost |
197
+ | Encoding semantic density | 32 bits containing radical/stroke/structure | Single encoding equivalent to dozens of text annotation tokens, greatly reducing learning and inference overhead for small models |
198
+ | CJK coverage breadth | **97,686** characters | Covers ancient texts, rare names, and dialect characters, ensuring cultural diversity isn't marginalized in the AI era |
199
+ | Hard-task rare character handling | **+17.4 pp** (vs Unicode) | Dominates traditional encoding in traditional/variant/chemical equation scenarios, ensuring professional knowledge equity |
200
+ | Lookup collision rate | **0%** (full coverage verified) | Zero-ambiguity lookup, ensuring stability and reliability on edge devices |
201
+
202
+ ---
203
+
204
+ ## <span id="key-experiments">Key Experiments</span>
205
+
206
+ ### Small Model, Big Improvement (v2)
207
+
208
+ **Hypothesis**: Structured encoding compensates for insufficient small model parameters.
209
+ **Method**: Qwen 3.5 0.8B, CNBE vs standard input.
210
+
211
+ | Input | Accuracy | Improvement |
212
+ |-------|----------|-------------|
213
+ | Standard input | 48% | -- |
214
+ | **CNBE-32** | **87%** | **+81%** |
215
+
216
+ ### CNBE Surpasses Unicode (v6.5.2)
217
+
218
+ **Hypothesis**: Structured bit fields carry more semantic information than Unicode code points.
219
+ **Method**: Gemma 4B Chinese hard tasks.
220
+
221
+ | Input | Accuracy |
222
+ |-------|----------|
223
+ | Unicode | 26.1% |
224
+ | **CNBE-32** | **43.5%** |
225
+
226
+ **Conclusion**: A brand-new encoding without prior training outperforms the 30-year standard on first attempt (+17.4 pp).
227
+
228
+ ### Full Chinese Operating System (v8.4)
229
+
230
+ - Full Chinese Shell (output/get encoding/compare commands)
231
+ - Chinese BASIC interpreter (7 keywords)
232
+ - Text editor (built-in Tao Te Ching, 205 lines)
233
+ - RISC-V custom instructions: `cnhe.map` / `cnhe.extract` / `cnhe.cmp`
234
+
235
+ ### Mathematical Reasoning Foundation (v10.8)
236
+
237
+ **Method**: TinyGPT on odd/even/prime/sequence reasoning tasks comparing 4 encodings.
238
+
239
+ | Task | CNBE Loss | OneHot Loss | Winner |
240
+ |------|-----------|-------------|--------|
241
+ | Odd/Even | 0.3174 | 0.3427 | **CNBE** |
242
+ | Prime | 0.3894 | 0.5061 | **CNBE** |
243
+ | Sequence | 1.0726 | 1.2344 | **CNBE** |
244
+
245
+ ---
246
+
247
+ ### Complete Experimental Data (v1~v10)
248
+
249
+ <details>
250
+ <summary><b>Click to expand v1~v10 core experiment overview</b></summary>
251
+
252
+ | Version | Validation Dimension | Model / Platform | Core Metric | Key Conclusion |
253
+ | :---: | :--- | :--- | :--- | :--- |
254
+ | **v1** | Zero-shot single character understanding | Qwen 0.8B | 200 characters, **100%** effective | Encoding is inherently semantically interpretable |
255
+ | **v2** | Small model sentence understanding | Qwen 0.8B | 48% **→ 87%** (**+81%**) | Structured encoding provides significant compensation for small models |
256
+ | **v3** | Annotation format optimization | Qwen 0.8B | Character-by-character full annotation **87%** effective | Optimal format: character-by-character full annotation |
257
+ | **v4** | Long text (paper-level) | Qwen 0.8B | 90.9% **→ 100%** | Effective in long-text scenarios, eliminates ambiguity |
258
+ | **v5** | Multi-model horizontal comparison | 7 models | <1B: +81%; 1-7B: +9~17%; >7B: ~0% | **Diminishing marginal returns** |
259
+ | **v6** | Unicode hard task comparison | Gemma 4B | Unicode 26.1% **vs** **CNBE 43.5%** | **CNBE > Unicode** (+17.4 pp) |
260
+ | **v7** | RISC-V hardware implementation | C / QEMU / Spike / FPGA | x86 0.8 ns → FPGA **1 Cycle** | Complete hardware path closed-loop |
261
+ | **v8** | Full Chinese operating system | RISC-V QEMU | Chinese Shell + BASIC + Tao Te Ching editor | Encoding can seamlessly integrate into OS underlying layer |
262
+ | **v9** | JEPA tree structure prediction | JEPA architecture | Error **0.0899 → 0.000001** | Extremely strong high-noise temporal feature extraction |
263
+ | **v10** | Cross-9-domain generalization | Multi-domain | Mathematics wins; typhoon error **−19%** | Effective across mathematics/physics/biology/finance and other domains |
264
+
265
+ </details>
266
+
267
+ <details>
268
+ <summary><b>Click to expand v1~v10 detailed experimental data</b></summary>
269
+
270
+ | Version | Sub-item / Task | Test Environment | Specific Data Metrics | Conclusion / Notes |
271
+ | :---: | :--- | :--- | :--- | :--- |
272
+ | **v1** | Single character radical/stroke/structure extraction | Qwen 0.8B | 200 Chinese characters, **100%** zero-shot effective | Proves encoding space IS semantic space |
273
+ | **v2** | Chinese sentence understanding | Qwen 0.8B | Text input 48% → CNBE **87%** | Accuracy improvement 39 pp |
274
+ | **v3** | Encoding format ablation experiment | Qwen 0.8B | Character-by-character 87% > segmented 60% > compact 50% | Optimal: `中(丨,4 strokes, single)` |
275
+ | **v4** | Paper-level semantic understanding | Qwen 0.8B | 90.9% → **100%** | Complements small model long-context reasoning shortcomings |
276
+ | **v5a-5.9** | 7-model horizontal comparison | 0.8B~20B | Domestic 2B **90%**; 8B+ approaches 0 | Less compute power = more important structural priors |
277
+ | **v6.3-6.5** | Numerical format optimization | Qwen 0.8B | **Format F (bare numbers)** optimal | Hardware recommends bare number input |
278
+ | **v6.5.2** | CNBE vs Unicode | Gemma 4B | Unicode 26.1% **vs** CNBE **43.5%** | Outperforms thirty-year industry standard on first attempt |
279
+ | **v7.0** | C language benchmark | x86-64 | Single lookup **0.8 ns** | Software performance baseline established |
280
+ | **v7.0.1** | RISC-V cross-compilation | QEMU | Single lookup 2.5 ns | Validates RISC-V portability |
281
+ | **v7.1.1** | Instruction integration | Spike | `map`(2 cycles) / `extract`(1) / `cmp`(3) | Three Custom-0 instruction behaviors verified |
282
+ | **v7.2** | FPGA logic synthesis | Verilog+BRAM | **Single cycle** lookup complete | 81.6 KB table entries fit BRAM resources |
283
+ | **v8.4** | Full Chinese system | RISC-V QEMU | Shell commands + BASIC 7 keywords + Tao Te Ching | "Full Chinese computing" feasibility validated |
284
+ | **v9.0** | Tree growth JEPA | JEPA | CNBE **86%** better than Raw | Structured encoding improves abstract representation |
285
+ | **v9.1** | Typhoon lifecycle | JEPA | 0.089981 → **0.000001** | Error reduced by 4 orders of magnitude |
286
+ | **v10.3** | Typhoon Bavi path | Meteorological model | 216 km → **174 km** | Actual path prediction accuracy improved 19% |
287
+ | **v10.4** | Protein Q3 structure | Bioinformatics | OH 44.6% vs CNBE 41.0% | Slightly below OH; biological sequence still has optimization room |
288
+ | **v10.5** | Black hole gravitational field | Physics simulation | R² **0.60-0.77** | Good performance in physics field simulation |
289
+ | **v10.7** | TinyGPT frozen embedding | TinyGPT | Learned 1.3653 vs CNBE 1.4568 | Frozen embedding performance close to learned embedding |
290
+ | **v10.8** | Mathematical reasoning foundation | TinyGPT | Odd/Even(0.3174<0.3427) Prime(0.3894<0.5061) Sequence(1.07<1.23) | Universally better than One-Hot |
291
+ | **LLM** | CNBE knowledge LoRA fine-tuning | Qwen3.5-0.8B | 5000 steps, loss **0.6424**, 500-steps 0.7524 | Knowledge injection feasible, edge deployment validated |
292
+
293
+
294
+ </details>
295
+
296
+ ### Complete Evidence Chain Logic Closure
297
+
298
+ | Stage | Corresponding Version | Logical Role |
299
+ | :--- | :--- | :--- |
300
+ | **Semantic Validity** | v1 ~ v4 | Prove encoding itself contains semantics |
301
+ | **Comparative Superiority** | v5 ~ v6 | Prove encoding outperforms Unicode |
302
+ | **Hardware Implementability** | v7 | Prove from software to FPGA is feasible |
303
+ | **System-level Compatibility** | v8 | Prove encoding can support complete OS ecosystem |
304
+ | **Cross-domain Generalization** | v9 ~ v10 | Prove equally effective in physics/biology/finance and other domains |
305
+
306
+ Complete experimental data → [docs/EXPERIMENTS.md](docs/EXPERIMENTS.md)
307
+
308
+ ---
309
+
310
+ <details>
311
+ <summary><b>Click to expand v1-v10.8 complete experiment data</b></summary>
312
+
313
+ ### Table 1: CNBE-32 Core Experiment Overview (v1~v10)
314
+
315
+ | Version | Dimension | Model / Platform | Key Metric | Key Conclusion |
316
+ | :---: | :--- | :--- | :--- | :--- |
317
+ | **v1** | Zero-shot char understanding | Qwen 0.8B | 200 chars, **100%** effective | Encoding inherently semantically interpretable |
318
+ | **v2** | Small model sentence understanding | Qwen 0.8B | 48% **→ 87%** (**+81%**) | Structured encoding compensates small models significantly |
319
+ | **v3** | Annotation format optimization | Qwen 0.8B | Full char annotation **87%** effective | Optimal format: per-character annotation |
320
+ | **v4** | Long text (paper-level) | Qwen 0.8B | 90.9% **→ 100%** | Effective in long-context scenarios |
321
+ | **v5** | Multi-model comparison | 7 models | <1B: +81%; 1-7B: +9~17%; >7B: ~0% | **Diminishing returns law** |
322
+ | **v6** | Unicode hard task comparison | Gemma 4B | Unicode 26.1% **vs** **CNBE 43.5%** | **CNBE > Unicode** (+17.4pp) |
323
+ | **v7** | RISC-V hardware implementation | C/QEMU/Spike/FPGA | x86 0.8ns → FPGA **1 Cycle** | Complete hardware path closed-loop |
324
+ | **v8** | Full Chinese OS | RISC-V QEMU | Chinese Shell + BASIC + Dao De Jing | Encoding integrates seamlessly into OS |
325
+ | **v9** | JEPA tree structure prediction | JEPA architecture | Error **0.0899 → 0.000001** | Powerful feature extraction for noisy data |
326
+ | **v10** | Cross 9-domain generalization | Multi-domain models | Math wins, typhoon error **-19%** | Effective in math/physics/biology/finance |
327
+
328
+ ---
329
+
330
+ ### Table 2: Detailed Experiment Data (v1~v10)
331
+
332
+ | Version | Sub-task | Environment | Specific Metric | Conclusion |
333
+ | :---: | :--- | :--- | :--- | :--- |
334
+ | **v1** | Char radical/stroke/structure extraction | Qwen 0.8B | 200 chars, **100%** zero-shot | Encoding space = semantic space |
335
+ | **v2** | Chinese sentence understanding | Qwen 0.8B | Text 48% → CNBE **87%** | +39pp absolute improvement |
336
+ | **v3** | Encoding format ablation | Qwen 0.8B | Per-char 87% > segment 60% > compact 50% | Optimal: full per-char annotation |
337
+ | **v4** | Paper-level semantic understanding | Qwen 0.8B | 90.9% → **100%** | Fills small model long-context gap |
338
+ | **v6.5.2** | CNBE vs Unicode | Gemma 4B | Unicode 26.1% **vs** CNBE **43.5%** | Surpassed 30-year standard first try |
339
+ | **v7.1.1** | Custom instruction integration | Spike | map(2 cycles)/extract(1)/cmp(3) | Three Custom-0 instructions verified |
340
+ | **v7.2** | FPGA logic synthesis | Verilog+BRAM | **Single cycle** lookup | 81.6KB table fits BRAM |
341
+ | **v8.4** | Full Chinese system | RISC-V QEMU | Shell + BASIC 7 keywords + Dao De Jing | Chinese computing feasibility proven |
342
+ | **v9.0** | Tree growth JEPA | JEPA | CNBE **86%** better than Raw | Structured encoding boosts abstraction |
343
+ | **v9.1** | Typhoon lifecycle JEPA | JEPA | 0.089981 → **0.000001** | Error reduced 4 orders of magnitude |
344
+ | **v10.3** | Typhoon Barijat path | Meteorological model | 216 km → **174 km** | Path prediction accuracy +19% |
345
+ | **v10.4** | Protein Q3 structure | Bioinformatics | OH 44.6% vs CNBE 41.0% | Slightly below OH, room for improvement |
346
+ | **v10.5** | Black hole gravity simulation | Physics simulation | R² **0.60-0.77** | Physical field simulation performs well |
347
+ | **v10.7** | TinyGPT frozen embedding | TinyGPT | Learned 1.3653 vs CNBE 1.4568 | Close to learned as frozen embedding |
348
+ | **v10.8** | Math reasoning base | TinyGPT | Parity/Prime/Seq CNBE wins all | Comprehensive win over One-Hot |
349
+
350
+ ---
351
+
352
+ ### Table 3: Evidence Chain Logic Closure
353
+
354
+ | Phase | Version | Role |
355
+ | :--- | :--- | :--- |
356
+ | **Semantic validity** | v1~v4 | Proves encoding contains semantics |
357
+ | **Comparative superiority** | v5~v6 | Proves encoding > Unicode |
358
+ | **Hardware feasibility** | v7 | Proves software-to-FPGA path |
359
+ | **System-level compatibility** | v8 | Proves encoding supports full OS ecosystem |
360
+ | **Cross-domain generalization** | v9~v10 | Proves effective across multiple domains |
361
+ </details>
362
+
363
+ Full experiment data → [docs/EXPERIMENTS.md](docs/EXPERIMENTS.md)
364
+
365
+ ---
366
+
367
+ ## <span id="key-insights-large-models-vs-small-models">Key Insights: Large Models vs Small Models</span>
368
+
369
+ Why do 8B+ large models show diminishing returns (~0%) from CNBE, while 0.8B small models achieve massive +81% improvement?
370
+
371
+ - **Large Model Brute Force Aesthetics**: Massive parameters can implicitly memorize Unicode through brute-force training, masking the structural flaws of the encoding
372
+ - **Small Model Structural Priors**: On compute-constrained edge devices, CNBE transforms glyph structure directly into computational priors
373
+
374
+ This is the breakthrough path for edge-side AI processing of Chinese.
375
+
376
+
377
+ > ## Key Insights III: CNBE Encoding Knowledge LoRA Fine-Tuning
378
+ >
379
+ > — Injecting CNBE-32 encoding knowledge into Qwen3.5-0.8B via LoRA
380
+ >
381
+ > - **LoRA knowledge injection works**: 500 steps (22 min) + 5000 steps (4.14 h) with 25K diverse Chat Template data, loss from 0.7524 → **0.6424** (↓14.6%), augmentation artifacts eliminated
382
+ > - **Model understands encoding concepts**: After fine-tuning, the model recognizes character radicals, stroke counts, and structure types, outputting CNBE-32 encoded information
383
+ > - **Minimal GPU requirements**: RTX 4060 Ti (8GB) handles the entire pipeline, with peak memory usage of only 1.5GB
384
+ > - **Edge deployment validated**: For the first time, CNBE-32 advances from inference-level semantic validation to training-level knowledge injection
385
+ > - **Complete cross-domain chain**: From linguistics to finance to physics to biology to LLM training, CNBE's structured encoding is validated across encoding, hardware, OS, cross-domain prediction, and model fine-tuning
386
+ >
387
+ > Full methodology → [cnbe-llm training(demo)/](./cnbe-llm%20training(demo)/)
388
+
389
+
390
+ ---
391
+
392
+ ## <span id="experimental-limitations--future-directions">Experimental Limitations & Future Directions</span>
393
+
394
+ > **We have faithfully documented failures and limitations in all experiments. The following are known boundaries disclosed directly in this README.**
395
+
396
+ ### Known Limitations
397
+
398
+ | Experiment | Limitation | Future Direction |
399
+ |------------|------------|------------------|
400
+ | v5/v6 (LLM validation) | Some models (DeepSeek 8B / GPT-OSS 20B) showed empty responses or insufficient Chinese capability | Focus on Chinese-friendly small models like Qwen/Gemma |
401
+ | v6.5.3 (Hard task 0.8B) | Overall only 12.5%, CNBE and Unicode showed no difference | 0.8B model capability boundary; requires larger model validation |
402
+ | v9.0 (Tree growth) | Simulated environment, not real climate/economic data | Validate on real temporal data |
403
+ | v10.0/v10.1 (Financial backtesting) | A-share high-frequency trading costs (0.14%/trade) consumed all strategy returns; break-even point not reached | Pivot to low-frequency strategies (daily/weekly) to unlock predictive value |
404
+ | v10.4 (Protein) | Used simplified single-residue method, not standard sliding window; first contact with 30-year domain standard gap of 3.6 pp | Sliding window + CB513 dataset complete experiment |
405
+ | v10.5 (Black hole) | Single-variable input scenario (only r/Rs), continuous value KNN naturally precise; CNBE quantization introduces error | Multi-dimensional input scenario (with observation noise) validation |
406
+ | v10.6 (Sociology) | **CNBE inferior to One-hot in strong classification feature scenarios** (MSE 0.0124 vs OneHot 0.0019) | Field weighting, hierarchical encoding optimization |
407
+ | v10.7 (Pre-training) | Task too simple (13 token vocabulary), difference not statistically significant | Large-scale corpus, larger model validation |
408
+
409
+ ### Applicability Boundaries (Based on All Experimental Data)
410
+
411
+ | Scenario Type | CNBE Performance | Typical Domains | Reason |
412
+ |---------------|:----------------:|-----------------|--------|
413
+ | Multi-dimensional continuous value + structured temporal | ✅ Significantly better than baseline | Meteorology, ecology, finance, mathematics | Bit-field structured encoding naturally matches |
414
+ | Strong classification features | ❌ Inferior to One-hot | Sociology (8 regions + 4 time periods) | Bit-field mixed encoding cannot distinguish classification field weights |
415
+ | Single-variable deterministic systems | ⚠️ Equal to Raw | Physics (gravitational field) | Continuous value single-variable scenario Raw is optimal |
416
+ | Zero-shot unfamiliar domains | ⚠️ Close to domain standard | Biology (protein) | First attempt approaches 30-year optimized standard |
417
+ | Pattern recognition tasks | ✅ Universally better than One-hot | Mathematical reasoning | Structured encoding matches pattern recognition |
418
+
419
+ ---
420
+
421
+ ## <span id="tech-stack">Tech Stack</span>
422
+
423
+ ```
424
+ Application Layer: Chinese BASIC interpreter + Text Editor + Tao Te Ching
425
+ System Layer: Full Chinese Shell + CNBE Runtime (map/extract/cmp)
426
+ Hardware Layer: RISC-V 1GHz + 1GB RAM (QEMU + Spike)
427
+ Instruction Layer: cnhe.map / cnhe.extract / cnhe.cmp
428
+ Encoding Layer: 32-bit CJK Structured Bit Fields (Radical/Stroke/Structure)
429
+ ```
430
+
431
+ ---
432
+
433
+ ## <span id="ai-agent-driven--ai-factory">AI Agent Driven / AI Factory</span>
434
+
435
+ This is a project that was previously impossible to complete, but is destined to be born in the AI era.
436
+
437
+ | Past | Present |
438
+ |------|---------|
439
+ | 97,686 Chinese character annotations required thousands of linguist man-years | AI Agent assisted automated annotation |
440
+ | Full-stack validation required top-tier teams for years | LLM-assisted code generation + validation |
441
+ | Single-team siloed development | Open source community collaborative exploration |
442
+
443
+ The dreams of scientists from the last century finally have a chance to be realized in the AI Agent era.
444
+
445
+ ---
446
+
447
+ ## <span id="quick-start">Quick Start</span>
448
+
449
+ ### Environment Requirements
450
+ - Python 3.8+
451
+ - numpy, torch, scikit-learn (for experiment reproduction)
452
+
453
+ ### Install Python SDK
454
+
455
+ ```bash
456
+ pip install numpy torch scikit-learn
457
+ ```
458
+
459
+ ### Usage Example
460
+
461
+ ```python
462
+ import sys; sys.path.insert(0, 'src')
463
+ from cnbe32 import encode_cnbe, hamming_distance
464
+
465
+ code_ming = encode_cnbe(72, 8, 1) # 明 (bright) = 日(sun, 72) + 8 strokes + left-right structure
466
+ code_an = encode_cnbe(72, 9, 1) # 暗 (dark) = 日(sun, 72) + 9 strokes + left-right structure
467
+ print(hamming_distance(code_ming, code_an))
468
+ ```
469
+
470
+ ### Run RISC-V Simulator
471
+
472
+ ```bash
473
+ cd hardware/simulator
474
+ gcc -o cnhe_sim cnhe_sim.c -Wall -O2 && ./cnhe_sim
475
+ ```
476
+
477
+ ### Launch Full Chinese Operating System (QEMU)
478
+
479
+ ```bash
480
+ # Ubuntu dependencies
481
+ sudo apt-get install -y gcc-riscv64-linux-gnu qemu-system-misc
482
+
483
+ cd v84_riscv_os_full
484
+ make all && make run
485
+ ```
486
+
487
+ ### Reproduce Experiments
488
+
489
+ ```bash
490
+ cd v10_8_math_reasoning && python run_v108.py
491
+ cd v10_3_typhoon && python v10_3_typhoon.py
492
+ ```
493
+
494
+ ---
495
+
496
+ ## Application Scenarios
497
+
498
+ CNBE-32 is designed for **AI-era Chinese computing infrastructure**, not as a general-purpose encoding tool.
499
+
500
+ | Scenario | Suitability | Description |
501
+ |----------|:-----------:|-------------|
502
+ | AI model structured input | **Recommended** | Provides radical/stroke/structure priors, improves small model comprehension |
503
+ | RISC-V hardware acceleration | **Recommended** | Custom instructions operate directly on encoding bitfields |
504
+ | Chinese-native OS | **Recommended** | Native support for filenames, paths, system messages |
505
+ | Chinese compiler/BASIC | **Recommended** | Direct encoding operations at the language level |
506
+ | Data compression/obfuscation | Not recommended | Semantic encoding, not compression |
507
+ | URL transmission | Not recommended | Characters broken by %-encoding in URLs |
508
+ | Human transcription | Not recommended | Visually similar characters cause errors |
509
+ | Database primary keys | Use with caution | 32-bit integers are storable but CNBE is not a unique identifier |
510
+
511
+ ---
512
+
513
+ ## <span id="project-structure">Project Structure</span>
514
+
515
+ ```
516
+ CNBE-32-Chinese-Native-Binary-Encoding/
517
+ |-- docs/specification/ # Encoding specification
518
+ |-- docs/EXPERIMENTS.md # Experiment overview
519
+ |-- docs/VISION.md # Strategic vision
520
+ |-- src/cnbe32/ # Python SDK
521
+ |-- include/cnbe32.h # C header file
522
+ |-- data/ # Encoding database
523
+ |-- tests/ # Test suite
524
+ |-- tools/ # Development tools
525
+ |-- bindings/rust/ # Rust bindings
526
+ |-- hardware/ # RISC-V simulator
527
+ |-- v9_jepa_tree/ # JEPA experiments (v9)
528
+ |-- v10_5~v10_8/ # Cross-domain experiments (v10)
529
+ |-- v84_riscv_os_full/ # Chinese OS prototype
530
+ |-- results/ # White papers (41 documents)
531
+ |-- LICENSE # Mulan License
532
+ ```
533
+
534
+ ---
535
+
536
+ ## <span id="roadmap">Roadmap</span>
537
+
538
+ | Phase | Status | Content |
539
+ |-------|--------|---------|
540
+ | Encoding & semantic validation | Completed | v1-v6 CJK encoding design |
541
+ | Hardware & system | Completed | v7-v8 RISC-V + Chinese OS |
542
+ | Complex prediction validation | Completed | v9-v10 9-domain validation |
543
+ | AI compiler | Planned | Chinese natural language → machine code |
544
+ | Edge AI integration | Planned | Edge AI default standard |
545
+ | Ecosystem collaboration | Vision | Open source community + industry standards |
546
+
547
+ ---
548
+
549
+ ## <span id="how-to-contribute">How to Contribute</span>
550
+
551
+ ### Current Directions Most Needing Community Support
552
+
553
+ - Chinese BASIC interpreter optimization - improve lexical analyzer
554
+ - RISC-V lookup logic acceleration - optimize 81.6 KB L2 Cache hit rate
555
+ - JEPA architecture extension experiments - more physics/biology system tests
556
+ - Frontend visualization tools - Web interface showing encoding decomposition process
557
+
558
+ | Level | Direction |
559
+ |-------|-----------|
560
+ | Low barrier | Encoding dictionary / Test cases / Documentation |
561
+ | High barrier | RISC-V pipeline / FPGA / LLM adaptation / Compiler |
562
+
563
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for details
564
+
565
+ ---
566
+
567
+ ## <span id="disclaimer">Disclaimer</span>
568
+
569
+ v10.x stage financial time series (US stocks / A-shares) backtesting is solely for validating CNBE-32's feature extraction and structured prior capabilities in high-noise, non-stationary time series data, and does not constitute any investment advice.
570
+
571
+ ---
572
+
573
+ ## <span id="license">License</span>
574
+
575
+ **Mulan Permissive Software License v2 (Mulan PSL v2)**
576
+
577
+ [![License](https://img.shields.io/badge/License-MulanPSL2-blue.svg)](http://license.coscl.org.cn/MulanPSL2)
578
+
579
+ ---
580
+
581
+ **Let Chinese speakers enter the AI era through their native language.**
582
+
583
+ From the "Digital China 2035" vision to AI Agent era engineering practice.
584
+
585
+ **Born for Chinese AI ecosystem — from encoding to hardware, from single character to operating system.**
586
+
587
+ [GitHub](https://github.com/zairkliu/CNBE-32-Chinese-Native-Binary-Encoding)
588
+
589
+
590
+
591
+
592
+
@@ -0,0 +1,11 @@
1
+ cnbe32/__init__.py,sha256=LM957vCqrET0xRXh5Wr4TvZNewIZCTJvd8TRuBXwOZc,1030
2
+ cnbe32/constants.py,sha256=OlzrRBSDEwNSp9EYnSSQ48LlwT3CmURGIy8u6l70qh4,1355
3
+ cnbe32/core.py,sha256=uF-6Qb2tmRvIFpyYvWr1BF4hsE9ZKkaD7gbepsoadyg,2772
4
+ cnbe32/encoders.py,sha256=JIN9U0GmPvMpyl3HjM_ST-zLeWCsjmZFWDd7MEvvwYA,2083
5
+ cnbe32/exceptions.py,sha256=TqkP8rTMc4NfbKF6Jrw9geWftTz1kaiZ42Or-IMjcEk,817
6
+ cnbe32/skill_table.py,sha256=ZT4Bw5NJBQdfRs4-REE6FTupODUOGQGWpygQW0eogFs,892
7
+ cnbe32-1.0.0.dist-info/licenses/LICENSE,sha256=t4RvFoJlvXXzkj4C-51QcuYkC6xKMOX-W5x8oewPkO0,11487
8
+ cnbe32-1.0.0.dist-info/METADATA,sha256=HVI2t7wqdRzoN2b1-4rkxpFSseFfgDOZsdi2yS0LkQE,33019
9
+ cnbe32-1.0.0.dist-info/WHEEL,sha256=YLJXdYXQ2FQ0Uqn2J-6iEIC-3iOey8lH3xCtvFLkd8Q,91
10
+ cnbe32-1.0.0.dist-info/top_level.txt,sha256=LZGD_30mG5X9xF71cjKnfWT7pUfoVhch5kZdh9cgooM,7
11
+ cnbe32-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (81.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,149 @@
1
+ 木兰宽松许可证, 第2版
2
+
3
+ 木兰宽松许可证,第2版
4
+
5
+ 2020年1月 http://license.coscl.org.cn/MulanPSL2
6
+
7
+ 您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(MulanPSL v2)的约束。如果您不满足本许可证的任何条件,您无权对“软件”进行复制、使用、修改及分发。
8
+
9
+ 1. 定义
10
+
11
+ “贡献” 是指由“贡献者”许可在“软件”中的受版权法保护的作品,包括最初由“贡献者”许可在“软件”中的作品及后续“贡献者”许可在“软件”中的作品。
12
+
13
+ “贡献者” 是指将受版权法保护的作品许可在“软件”中的自然人或“法人实体”。
14
+
15
+ “法人实体” 是指提交贡献的机构及其“关联实体”。
16
+
17
+ “关联实体” 是指控制、受控制或共同受控制的机构,此处的控制是指拥有该机构百分之五十(50%)或更多的有表决权的股份、证券或其他有投票权的所有权利益,或者是拥有该机构百分之五十(50%)或更多的利润权益或资本权益。
18
+
19
+ “软件” 是指“贡献者”许可在“本许可证”下的受版权法保护的作品,包括计算机软件及文档。
20
+
21
+ “您” 是指行使“本许可证”授予的权利的自然人或“法人实体”。
22
+
23
+ “相应源代码” 是指生成、安装和(对于可执行作品)运行“软件”目标代码所需的全部源代码,包括与目标代码链接的任何接口定义文件,以及控制这些活动所需的脚本。但是,“相应源代码”不包括“系统库”或一般不为“软件”目标代码部分所需且不作为“软件”常规操作部分使用的工具或程序。
24
+
25
+ “系统库” 是指包含在“软件”中或用于与“软件”链接的作品,但不是“软件”本身的衍生作品,且其目的是:
26
+
27
+ (a) 以不违反“本许可证”限制的方式,与主要组件一起进行编译或链接,而主要组件是运行该作品的操作系统、编译器或启动器;或
28
+
29
+ (b) 用于与“软件”链接的应用程序接口库或工具。
30
+
31
+ 2. 授予版权许可
32
+
33
+ 每个“贡献者”根据“本许可证”授予“您”永久的、全球性的、免费的、非独占的、不可撤销的版权许可,以复制、使用、修改、分发其“贡献”,不论修改与否。
34
+
35
+ 3. 授予专利许可
36
+
37
+ 每个“贡献者”根据“本许可证”授予“您”永久的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销的除外)专利许可,供“您”制作、让其制作、使用、销售、许诺销售、进口或以其他方式转让其“贡献”或“软件”。如果“您”或您的“关联实体”直接或间接地对任何机构就“软件”提起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,则该“贡献者”依据“本许可证”授予“您”的专利许可自“您”提起该诉讼或行动之日起终止。前述专利维权行动是指就“软件”或“贡献”中的任何技术主张专利侵权。
38
+
39
+ 4. 无商标许可
40
+
41
+ “本许可证”不提供针对“贡献者”或第三方的任何名称、商标、服务标记或产品标识的许可,不论明示或默示。
42
+
43
+ 5. 分发限制
44
+
45
+ 您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。
46
+
47
+ 6. 免责声明与责任限制
48
+
49
+ “软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。
50
+
51
+ 7. 语言
52
+
53
+ “本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。
54
+
55
+ 条款结束
56
+
57
+ 如何将木兰宽松许可证,第2版应用到您的软件
58
+
59
+ 如果您希望将木兰宽松许可证,第2版应用到您的软件,为了方便接收者识别,建议您完成如下三步:
60
+
61
+ 1. 请将如下声明文本放入每个源文件(包括脚本等)的头部注释中:
62
+
63
+ Copyright (c) [Year] [Name of copyright holder]
64
+ [Software Name] is licensed under Mulan PSL v2.
65
+ You can use this software according to the terms and conditions of the Mulan PSL v2.
66
+ You may obtain a copy of Mulan PSL v2 at:
67
+ http://license.coscl.org.cn/MulanPSL2
68
+ THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
69
+ EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
70
+ MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
71
+ See the Mulan PSL v2 for more details.
72
+
73
+ 2. 请将“木兰宽松许可证,第2版”的完整文本放入软件中的 LICENSE 或 COPYING 文件中。
74
+
75
+ 3. 请将“木兰宽松许可证,第2版”的声明文本放入软件的 NOTICE 文件中,如果软件中没有 NOTICE 文件,则将其放入 README 文件中。
76
+
77
+ Mulan Permissive Software License,Version 2
78
+
79
+ Mulan Permissive Software License,Version 2 (Mulan PSL v2)
80
+
81
+ January 2020 http://license.coscl.org.cn/MulanPSL2
82
+
83
+ Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following conditions.
84
+
85
+ 1. Definitions
86
+
87
+ "Contribution" means the copyrightable work licensed by a particular Contributor in the Software.
88
+
89
+ "Contributor" means the Individual or Legal Entity who licenses its copyrightable work under this License.
90
+
91
+ "Legal Entity" means the entity making a Contribution and all its Affiliates.
92
+
93
+ "Affiliates" means entities that control, are controlled by, or are under common control with the acting entity under this License, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
94
+
95
+ "Software" means the copyrightable work licensed under this License.
96
+
97
+ "You" means an Individual or Legal Entity exercising permissions granted by this License.
98
+
99
+ "Corresponding Source Code" means all of the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work.
100
+
101
+ "System Libraries" means anything that is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component" means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
102
+
103
+ 2. Grant of Copyright License
104
+
105
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.
106
+
107
+ 3. Grant of Patent License
108
+
109
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer its Contribution or the Software. If You or Your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a lawsuit) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to You under this License for the Software shall terminate as of the date such litigation or activity is filed or taken. "Patent litigation or enforcement activities" means any lawsuit or other action alleging that the Software or any Contribution in it infringes any patent.
110
+
111
+ 4. No Trademark License
112
+
113
+ No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributors or third parties, except as required to comply with the terms of this License.
114
+
115
+ 5. Distribution Restriction
116
+
117
+ You may distribute the Software in any medium with or without modification, whether in source or executable form, provided that You provide recipients a copy of this License and retain copyright, patent, trademark, and disclaimer statements in the Software.
118
+
119
+ 6. Disclaimer of Warranty and Limitation of Liability
120
+
121
+ THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT'S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
122
+
123
+ 7. Language
124
+
125
+ THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL.
126
+
127
+ END OF THE TERMS AND CONDITIONS
128
+
129
+ How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software
130
+
131
+ To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps:
132
+
133
+ 1. Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner;
134
+
135
+ Copyright (c) [Year] [Name of copyright holder]
136
+ [Software Name] is licensed under Mulan PSL v2.
137
+ You can use this software according to the terms and conditions of the Mulan PSL v2.
138
+ You may obtain a copy of Mulan PSL v2 at:
139
+ http://license.coscl.org.cn/MulanPSL2
140
+ THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
141
+ EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
142
+ MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
143
+ See the Mulan PSL v2 for more details.
144
+
145
+ 2. Create a LICENSE and a COPYING file in the top-level directory of your software and copy the Mulan PSL v2 into it.
146
+
147
+ 3. Create a NOTICE file in the top-level directory of your software and copy the following statement into it. If there is no top-level NOTICE file in your software, you can copy the statement into a README file or any other file containing the top-level license statement.
148
+
149
+ Licensed under the Mulan PSL v2.
@@ -0,0 +1 @@
1
+ cnbe32