Corpus
corpus
Corpus extractor -- public symbols + their embeddable text.
Ported from the POC docstring_corpus.py, but rebranched onto
axm-ast (tree-sitter) instead of the stdlib ast module: symbols,
signatures, and docstrings now come from axm_ast.core.parser and the
first docstring line from axm_ast.docstring_parser.parse_docstring.
The unified embedding text (AC3) is, per symbol::
embed_text = docstring if present else normalized code/signature
so a public documented symbol contributes its intent while an undocumented one still contributes its code shape -- one engine, one vector space, the registry picked per symbol.
Symbol
dataclass
A single public symbol projected into the corpus.
Source code in packages/axm-echo/src/axm_echo/corpus.py
embed_text
property
Unified embed text: docstring if present, else code/signature.
has_doc
property
Whether the symbol carries a non-empty docstring.
as_dict()
Flat dict view (qualname, package, signature, embed_text, ...).
Source code in packages/axm-echo/src/axm_echo/corpus.py
discover_package_roots()
Discover every package directory across the configured scope.
Walks each workspace root from :func:axm_echo.scope.load_scope,
covering both the <ws>/packages/<pkg> convention and the flat
other/<pkg> layout. The set of roots is data-driven (no frozen
package list), so newly added packages are picked up automatically
(AC4).
Returns:
| Type | Description |
|---|---|
list[Path]
|
Sorted, de-duplicated package directories. |
Source code in packages/axm-echo/src/axm_echo/corpus.py
extract_monorepo()
Extract public symbols across every discovered package (corpus).
Returns:
| Type | Description |
|---|---|
list[SymbolDict]
|
The concatenated symbol corpus for the configured scope. |
Source code in packages/axm-echo/src/axm_echo/corpus.py
| Python | |
|---|---|
extract_package(pkg_root)
Extract every public function/class of a package via axm-ast.
"Public" follows the axm-ast convention: a symbol exported in the
module's __all__ when present, else any module-level name without
a leading underscore. Test files and empty __init__ files are
skipped; unparseable files are silently ignored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pkg_root
|
Path
|
Package directory (containing |
required |
Returns:
| Type | Description |
|---|---|
list[SymbolDict]
|
One |
list[SymbolDict]
|
|
list[SymbolDict]
|
|