sayou-wrapper
Overview
The Ontology Mapper for Sayou Fabric.
sayou-wrapper takes the fragmented chunks produced by sayou-chunking and wraps them into a standardized graph structure (SayouNode). This is the final preparation step before data is assembled into a Knowledge Graph or loaded into a Vector DB.
It applies the Sayou Ontology Schema (Namespace -> Class -> Predicate) to raw data, turning simple text into semantically rich entities.
1. Architecture & Role
The Wrapper sits between Chunking and Assembly. It transforms raw dictionaries (Chunks) into standardized Objects (Nodes) with globally unique URIs.
graph LR
Chunks[Raw Chunks] --> Pipeline[Wrapper Pipeline]
subgraph Logic
Schema[Schema Mapping]
URI[URI Generation]
Attr[Attribute Norm]
end
Pipeline --> Logic
Logic --> Nodes[SayouNodes]
1.1. Core Features
- Ontology Enforcement: Assigns strict classes (e.g.,
sayou:Topic,sayou:Function) based on chunk metadata. - URI Normalization: Generates idempotent IDs (e.g.,
sayou:doc:hash_123) to prevent duplication. - Metadata Preservation: Carries over source coordinates (page numbers, line numbers) into node attributes.
2. Available Strategies
sayou-wrapper applies different mapping rules based on the source domain.
| Strategy Key | Target Domain | Description |
|---|---|---|
document_chunk |
PDF, Markdown | Maps headers to sayou:Topic and text to sayou:TextFragment. Preserves hierarchy metadata. |
code_chunk |
Python, Java | Maps AST objects to sayou:Class, sayou:Function, or sayou:Module. |
video_chunk |
YouTube, MP4 | Maps timestamps to sayou:VideoSegment. Preserves start/end times. |
general |
Plain Text | [Default] Treats everything as generic sayou:Unstructured nodes. |
3. Installation
pip install sayou-wrapper
4. Usage
The WrapperPipeline converts a list of dictionaries (Chunks) into a WrapperOutput object containing nodes.
Case A: Document Processing (Default)
Converts hierarchical chunks into Topic and Fragment nodes.
from sayou.wrapper import WrapperPipeline
chunks = [
{
"content": "# Introduction",
"metadata": {
"chunk_id": "h_1",
"semantic_type": "heading",
"depth": 1
}
},
{
"content": "Sayou is great.",
"metadata": {
"chunk_id": "p_1",
"parent_id": "h_1",
"semantic_type": "text"
}
}
]
result = WrapperPipeline.process(
data=chunks,
strategy="document_chunk"
)
for node in result.nodes:
print(f"[{node.node_class}] {node.node_id}")
Case B: Code Processing
Converts AST-based chunks into structural code nodes.
from sayou.wrapper import WrapperPipeline
code_chunks = [
{
"content": "def my_func(): pass",
"metadata": {"type": "function", "name": "my_func"}
}
]
result = WrapperPipeline.process(
data=code_chunks,
strategy="code_chunk"
)
print(f"Node Class: {result.nodes[0].node_class}")
5. Configuration Keys
The config dictionary controls how IDs are generated and which schema strictness to apply.
namespace: The prefix for URIs (default:sayou:).id_strategy:hash(deterministic) oruuid(random).strict_mode: IfTrue, raises error for unknown semantic types.attribute_filter: List of metadata keys to exclude from the final Node attributes.
6. License
Apache 2.0 License © 2026 Sayouzone
7. Plugin List
| Plugin | Example | Description |
|---|---|---|
Code Chunk Wrapper |
▶ | |
Document Chunk Wrapper |
▶ | |
Video Chunk Wrapper |
▶ | |
Embedding Wrapper |
▶ | |
Metatdata Wrapper |
▶ |
Metadata
Release files for sayou-wrapper 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sayou_wrapper-0.5.1.tar.gz | 41.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sayou_wrapper-0.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 62.0 kB
Release files / sayou_wrapper-0.5.1.tar.gz
| Download URL | sayou_wrapper-0.5.1.tar.gz |
|---|---|
| Size | 41.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44fad919e9849c27891cfafa9a25d2a3c2b15110bb5985ef3864b6e7d8074585
|
|
BLAKE2b-256 checksum How to use checksums |
9a65829ff82f07f8c4ba66169ff44aec94667c0663528c980f3d0b8ff1e8f833
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / sayou_wrapper-0.5.1-py3-none-any.whl
| Download URL | sayou_wrapper-0.5.1-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a86045d84ad0e43a9a2663d613918ad5042ba94db45e2f9682287656c443c622
|
|
BLAKE2b-256 checksum How to use checksums |
258bee1336dc7550877b87a9e0fdf0bba7aabddf7462de34f249edad12dafa17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for sayou-wrapper 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.