Theme
9.7k
Back to gallery

Syntax-aware Code Chunking

Turn source code in 426 languages into structure-aware chunks, ready to embed for code search, assistants, and RAG.

Extract
document → structured outputextract()
parser.py
def extract(doc):
return parse(doc)
class Reader:
# 426 languages
{
"functions": 12,
"classes": 3
}

Feed code to an LLM as plain text and a naive splitter cuts on token count, handing the model half a function, an import torn from its body, a class split down the middle.

Xberg parses code with tree-sitter across 426 languages and splits on the syntax tree instead of token counts. Every chunk stays a coherent unit and carries its enclosing symbol, ready to embed for code search, assistants, and RAG.

More use cases

Xberg uses cookies to improve your experience, personalize content, and analyze traffic.

No analytics or advertising tags load unless you accept. You can change your choice at any time.