semtree-parse
Tree-sitter parsing and chunk extraction for semtree.
Turns source files into structured Chunks (functions, structs, methods, classes) ready to embed. Non-code files fall back to overlapping fixed-size text windows.
Usage
[]
= "0.2"
= "0.2"
use Language;
use ;
// From a string with a known language:
let chunks = parse_and_extract?;
// Or from a path, with the language inferred from the extension:
let chunks = parse_and_extract_file?;
API
| Item | Purpose |
|---|---|
parse_and_extract(source, lang) |
Parse a string and extract chunks |
parse_and_extract_file(path) |
Parse a file, inferring the language from its extension |
extract_file(path) |
Extract chunks, using the text-window fallback for non-code files |
SemtreeParser / ParsedTree |
Lower-level tree-sitter parsing |
Extractor |
Language-aware chunk extraction from a parsed tree |
chunk_text / is_text_file |
Fixed-window chunking for plain-text and config files |
Supported languages
Rust, Python, TypeScript, JavaScript, and Go extract structured chunks (functions, types, methods). Other files (.md, .json, .toml, .yaml, ...) are chunked into overlapping line windows. See the workspace README for the full support matrix.
License
MIT