# mutato

[![Python](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)](https://www.python.org)
[![Version](https://img.shields.io/badge/version-0.5.22-informational)](https://github.com/Maryville-University-DLX/transcriptiq)
[![Status](https://img.shields.io/badge/status-beta-yellow)](https://github.com/Maryville-University-DLX/transcriptiq)
[![License](https://img.shields.io/badge/license-proprietary-red)](LICENSE)
[![Built with Poetry](https://img.shields.io/badge/built%20with-poetry-blueviolet)](https://python-poetry.org)
[![spaCy](https://img.shields.io/badge/NLP-spaCy%203.8-09a3d5)](https://spacy.io)

Ontology-driven synonym swapping for semantic text enrichment. Mutato identifies terms in input text and replaces them with semantically equivalent synonyms sourced from OWL ontologies, enabling consistent, structured analysis of natural language content.

## Use Cases

- Normalize terminology across transcripts before downstream analysis
- Enrich tokens with ontology-backed synonym candidates
- Bridge informal language to structured vocabulary in NLP pipelines

## Quick Start

```python
from mutato.parser import owl_parse

results = owl_parse(tokens=["student", "learned", "math"], ontologies=[...])
```

## Installation

```bash
make all
```

This downloads the spaCy model, installs dependencies, runs tests, builds the package, and freezes requirements.

Or step by step:

```bash
make get_model   # download en_core_web_sm
make install     # poetry lock + install
make test        # run pytest
make build       # install + test + poetry build
make freeze      # export requirements.txt
```

## Architecture

Mutato is organized into four modules:

| Module | Purpose |
|---|---|
| `mutato.parser` | Main API -- synonym swapping and token matching |
| `mutato.finder` | Ontology lookup across single and multiple OWL graphs |
| `mutato.mda` | Metadata and NER enrichment generation |
| `mutato.core` | Shared utilities (file I/O, text, validation, timing) |

See [docs/architecture.md](docs/architecture.md) for design details.

## Matching Strategies

The parser applies multiple matching passes in order:

1. **Exact** -- literal string match against ontology terms
2. **Span** -- multi-token window matching
3. **Hierarchy** -- parent/child concept traversal
4. **spaCy** -- lemma and POS-aware NLP matching

## Requirements

- Python >= 3.10, < 3.14
- [Poetry](https://python-poetry.org) for dependency management
- spaCy `en_core_web_sm` model (installed via `make get_model`)

## Links

- [Issue Tracker](https://github.com/Maryville-University-DLX/transcriptiq/issues)
- [Source](https://github.com/Maryville-University-DLX/transcriptiq/libs/core/mutato-core)
