Skip to main content

Mutato Synonym Swapping API

Project description

mutato

Python Version License Monthly Downloads Total Downloads Tests

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

from mutato.parser import owl_parse

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

Installation

make all

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

Or step by step:

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

CLI

The parse command parses input text against an OWL ontology and prints canonical forms:

poetry run parse --ontology path/to/ontology.owl --input-text "fiscal policy analysis"

Three modes are available:

Mode Flag Effect
Cached (default) none Load JSON snapshot; build it on first run
Rebuild cache --force-cache Regenerate snapshot, then parse
Live OWL --live Parse directly from the OWL file; no cache

See docs/cli.md for the full reference, including the MIXED-schema caveat for --live.

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 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 for dependency management
  • spaCy en_core_web_sm model (installed via make get_model)

Links

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

mutato-1.1.1.tar.gz (65.7 kB view details)

Uploaded Source

Built Distribution

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

mutato-1.1.1-py3-none-any.whl (113.5 kB view details)

Uploaded Python 3

File details

Details for the file mutato-1.1.1.tar.gz.

File metadata

  • Download URL: mutato-1.1.1.tar.gz
  • Upload date:
  • Size: 65.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.11.9 Darwin/24.6.0

File hashes

Hashes for mutato-1.1.1.tar.gz
Algorithm Hash digest
SHA256 a6a433ae7863547bdfff144e8a30a295c62aa6cc245a38c9d0ee8974c6e1fd56
MD5 1c4be2fdc6528ee210cd84e8ab80563a
BLAKE2b-256 f5ed3ea15e1b6758976f2a7bfcc8fe647b3b7d78104d30d3d948dbb118dd5805

See more details on using hashes here.

File details

Details for the file mutato-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: mutato-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 113.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.11.9 Darwin/24.6.0

File hashes

Hashes for mutato-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 abaf50ce2480794ce19bf204b117f3132c395f451930f402e9c3ef74e336751c
MD5 bfcea4718ad29416fce2577d58dc0e16
BLAKE2b-256 c653ac2293d6c453db90799bd967269f77dbe57d3ee9276a026c3871bc9ee634

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