grammar-inference-engine/bex
tobjend 841f5efcf5 feat: distributional clustering for better grouping (Phase 1)
Inspired by Crucio's distributional matrix (ICSE 2026).
Groups symbols by context similarity instead of first-symbol.

New module: bex/distributional.py
- extract_contexts(): get (left, right) context pairs
- build_distribution_matrix(): symbol × context counts
- cluster_symbols(): agglomerative clustering by similarity
- split_by_cluster(): split sequences by cluster membership
- distributional_split(): drop-in replacement for _split_by_first_symbol

CLI: --cluster-method distributional (opt-in, first-symbol is default)

Example: 'if' and 'while' both appear before 'return'
→ first-symbol: 3 groups (if, while, return)
→ distributional: 2 groups (if/while merged, return)

23 tests pass. Full suite: 257 tests pass.
2026-07-12 17:37:36 +02:00
..
tag_preprocessor feat: distributional clustering for better grouping (Phase 1) 2026-07-12 17:37:36 +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
distributional.py feat: distributional clustering for better grouping (Phase 1) 2026-07-12 17:37:36 +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