Poetic Ontology Builder
Author: Willinton Triana Cardona
Version: 1.1.0
"Every text carries emotional weight. This tool extracts its meaning, weaves it into an ontology, and illuminates its emotional resonance"
Poetic Ontology Builder transforms any text into a living knowledge graph enriched with emotional embeddings.
It combines Google Gemini 2.5 Flash for knowledge extraction, Rosa (a fine‑tuned BERT model for GoEmotions), and ontology construction (OWL + RDF) into an interactive, beautiful visualization — including a full Enneagram personality profile derived from the text's emotional field.
Features
- Knowledge graph extraction:
Extracts subject‑predicate‑object triplets with contextual qualifiers from any text using Gemini 2.5 Flash. - Emotional embedding:
Integrates ROSA — a fine‑tuned BERT model trained on the GoEmotions dataset — to detect the full probability distribution across 28 emotion labels per triplet. - Precise emotional analytics:
Computes mean, std dev, max, and total per emotion across all triplets. Outputs a dark‑themed bar chart with error bars and percentage labels. - Enneagram chart:
Maps the aggregated emotion distribution onto the 9 Enneagram types and renders a polar radar chart showing the dominant personality archetype of the text. - Ontology export:
Generates GraphDB‑ready OWL files for semantic storage and querying. - Interactive graph visualization:
Force‑directed, emotion‑color‑coded graphs with poetic tooltips. - Timestamped outputs:
Each run produces a clean folder:outputs/YYYYMMDD_HHMMSS/ ├── sublime_graph.owl ├── sublime_graph.html ├── emotion_stats.json ├── emotion_stats.png ├── enneagram_stats.json └── enneagram_chart.png
Requirements
- Python 3.10 or higher
- A Gemini API key (Google AI Studio)
- A Hugging Face token with access to
willt-dc/Rosa-V1
Installation
From PyPI:
pip install poetic-ontology-builder
For local development (editable):
git clone https://github.com/willt08/poetic_ontology_builder.git
cd poetic_ontology_builder
pip install -e .
Configuration
Create a .env file in the project root:
GEMINI_API_KEY=your_gemini_api_key
HF_TOKEN=your_huggingface_token
Usage
From a text file:
poetic-ontology path/to/textfile.txt
From an inline string:
poetic-ontology "And Socrates said: When the soul returns into itself..."
Open all outputs automatically after generation:
poetic-ontology rilke.txt --open
Output
- Ontology:
sublime_graph.owl— RDF/OWL representation, GraphDB‑ready. - Interactive Graph:
sublime_graph.html— force‑directed graph with emotion‑colored nodes and tooltips. - Emotion Analytics:
emotion_stats.json— mean, std dev, max, min, total per emotion + dominant emotion counts per triplet.emotion_stats.png— dark‑themed bar chart of mean probability scores ± std dev.
- Enneagram Profile:
enneagram_stats.json— score and normalized score for each of the 9 types, plus dominant type.enneagram_chart.png— polar radar chart of the text's Enneagram emotional profile.
Enneagram Mapping
Each GoEmotions label is mapped to its primary Enneagram type based on core motivational emotion clusters:
| Type | Name | Key Emotions |
|---|---|---|
| 1 | Reformer | annoyance, disapproval, disgust |
| 2 | Helper | caring, love, gratitude, approval |
| 3 | Achiever | admiration, pride, optimism |
| 4 | Individualist | sadness, grief, disappointment, remorse, embarrassment |
| 5 | Investigator | curiosity, confusion, realization |
| 6 | Loyalist | fear, nervousness |
| 7 | Enthusiast | joy, excitement, amusement, desire, surprise |
| 8 | Challenger | anger |
| 9 | Peacemaker | neutral, relief |
Emotional Palette
Each emotion is mapped to a distinct color based on its polarity and tone:
- Joy / Love / Pride → Warm yellows & pinks
- Grief / Fear / Anger → Deep blues & reds
- Neutral → Gray
Roadmap
- BFO/SUMO alignment for deeper ontological grounding
- PyPI release for global access
- Web interface for non‑technical users
- Multi‑modal inputs (image + text)
Acknowledgements
- ROSA: Emotional BERT model fine‑tuned on GoEmotions
- Google Gemini 2.5 Flash: Triplet & knowledge extraction
- OWLready2: Ontology management
- PyVis: Interactive graph visualization
License
MIT License © 2025 Willinton Triana Cardona
Metadata
Release files for poetic-ontology-builder 1.1.0
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 | |
|---|---|---|---|---|
| poetic_ontology_builder-1.1.0.tar.gz | 12.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| poetic_ontology_builder-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.3 kB
Release files / poetic_ontology_builder-1.1.0.tar.gz
| Download URL | poetic_ontology_builder-1.1.0.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b531283055fafeb0656c0a54a7329f32e952f3bc943b4ad29995519f5053fb38
|
|
BLAKE2b-256 checksum How to use checksums |
3022926e2d7090ab4395535fb3f05612266a46e68ffd4509670566c1584411c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / poetic_ontology_builder-1.1.0-py3-none-any.whl
| Download URL | poetic_ontology_builder-1.1.0-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d37e8d584f152280ea4bc16b42bf9e60b094ec11da1ec1177431c4525e1ea22
|
|
BLAKE2b-256 checksum How to use checksums |
a6dc1bf899e79e31bbd1cbd685c6036a5f8521ba80f4182862e87f19dad548c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for poetic-ontology-builder 1.1.0
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.