grammar-inference-engine/bex
tobjend 93d53f164a fix: byte/char offset mismatch in tree-sitter text extraction
Root cause: parser.parse(code.encode()) returns byte offsets, but
code[node.start_byte:node.end_byte] indexed into a Python string
(character offsets). Non-ASCII chars caused cumulative drift → truncated symbols.

Fix: store code_bytes = code.encode(), index into that, decode only final text.

Impact:
- Zod: 653 truncated symbols → 0
- RAGSAK: 653 truncated symbols → 0
- RAGSAK grammars: 8 → 27 (3.4×)
- FastAPI grammars: 33 → 111 (3.4×)
- Malformed: 6 → 2 (RAGSAK), 0 (FastAPI/Flask)

Also removed sanitize_symbol() (dead code after fix) and call_only parameter.
2026-07-12 15:57:27 +02:00
..
tag_preprocessor fix: byte/char offset mismatch in tree-sitter text extraction 2026-07-12 15:57:27 +02:00
__init__.py feat: CRX refined — cluster-then-infer for tighter grammars 2026-07-12 01:50:40 +02:00
__main__.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
automaton.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
baum_welch.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
cli.py purge make_charts.py, examples/, full-text papers, blog_post (moved to ~/Desktop/kesai/); translate German CLI to English 2026-07-01 11:28:42 +02:00
crx.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
crx_refined.py feat: CRX refined — cluster-then-infer for tighter grammars 2026-07-12 01:50:40 +02:00
ensemble.py perf: iDRegEx opt-in, GBNF newline fix, OverflowError fix 2026-07-12 02:52:05 +02:00
expr.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
gbnf.py feat: grammar_structure_score + min_structure filter 2026-07-12 03:02:50 +02:00
grammar_index.py feat: grammar index for runtime lookup 2026-07-12 14:08:05 +02:00
idregex.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
ikoa.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
ilocal.py fix badge position; purge remaining German user-reference comments 2026-07-01 13:28:55 +02:00
koa.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
kore.py Revert "parallelize kORE outer (k, n) trials via ProcessPoolExecutor" 2026-07-11 20:36:48 +02:00
marking.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
mcp_server.py feat: runtime grammar lookup via MCP + fix YAML output 2026-07-12 14:08:12 +02:00
mdl.py WIP: language size scoring + diversity threshold (step 1 pending) 2026-07-11 22:56:42 +02:00
pta.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
reduce.py feat: add reduce slicing, fix rwr0 timeout, fix sequence format 2026-07-12 13:13:16 +02:00
repair.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
rwr0.py feat: add reduce slicing, fix rwr0 timeout, fix sequence format 2026-07-12 13:13:16 +02:00
rwrsq.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
shrink.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
soa.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00
template.py fix badge position; purge remaining German user-reference comments 2026-07-01 13:28:55 +02:00
tokenizer.py fix badge position; purge remaining German user-reference comments 2026-07-01 13:28:55 +02:00
twotinf.py Initial commit: BEX-based grammar inference engine 2026-07-01 08:01:16 +02:00