Skip to main content

Wrapper components for the Sayou Data Platform

Project description

sayou-wrapper

PyPI version License Docs

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.

💡 Core Philosophy

"From Data to Knowledge."

While Chunking slices the data, Wrapper gives it meaning.

  • It assigns Ontology Classes (e.g., sayou:Topic, sayou:Table) based on metadata.
  • It defines Relationships (e.g., sayou:hasParent) to preserve context.
  • It normalizes IDs into URIs (e.g., sayou:doc:123) for global uniqueness.

📦 Installation

pip install sayou-wrapper

⚡ Quick Start

from sayou.wrapper.pipeline import WrapperPipeline

def run_demo():
    # 1. Initialize
    pipeline = WrapperPipeline()
    pipeline.initialize()

    # 2. Input Data (Simulated output from sayou-chunking)
    chunks = [
        {
            "content": "# Introduction",
            "metadata": {
                "chunk_id": "h_1", 
                "semantic_type": "heading", 
                "is_header": True
            }
        },
        {
            "content": "Sayou is great.",
            "metadata": {
                "chunk_id": "p_1", 
                "parent_id": "h_1",
                "semantic_type": "text"
            }
        }
    ]

    # 3. Run Wrapper
    output = pipeline.run(chunks, strategy="document_chunk")

    # 4. Result (SayouNodes)
    for node in output.nodes:
        print(f"[{node.node_class}] {node.node_id}")
        print(f"   Attrs: {node.attributes}")
        print(f"   Rels : {node.relationships}")

if __name__ == "__main__":
    run_demo()

🔑 Key Components

Adapters

  • DocumentChunkAdapter: The standard adapter. Converts document chunks into sayou:Topic, sayou:TextFragment, etc., and links them via sayou:hasParent.

Schema (Sayouzone Standard)

  • SayouNode: The atomic unit of the Knowledge Graph. Contains ID, Class, Attributes, and Relationships.
  • WrapperOutput: A container holding a list of nodes and global metadata.

🤝 Contributing

We welcome adapters for other data sources (e.g., SqlRecordAdapter, LogAdapter).

📜 License

Apache 2.0 License © 2025 Sayouzone

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sayou_wrapper-0.2.3.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sayou_wrapper-0.2.3-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file sayou_wrapper-0.2.3.tar.gz.

File metadata

  • Download URL: sayou_wrapper-0.2.3.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sayou_wrapper-0.2.3.tar.gz
Algorithm Hash digest
SHA256 8d365f4feeaa65dbcb112825544608824218f4e90f1c80771ac16c5ce369ca23
MD5 9cf6d618f10a88333d73560e9fff35b7
BLAKE2b-256 c77f58f9e60c29a38fda219295aa4ed51605c5ab21bfc69992060ee2b061325f

See more details on using hashes here.

File details

Details for the file sayou_wrapper-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: sayou_wrapper-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sayou_wrapper-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b2e9d10d3851921e57317188b5ce0ba96c3d0b6b8092b06889a3d7bbf15e7a0a
MD5 3d7fa7deea098f5a3160a524e5e7b3c4
BLAKE2b-256 80e277af172662795b34c7c0ed3ae31820eeabddd1e099887c10fbb4993bec6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page