Skip to main content

coreason-tagger

A High-Throughput Biomedical Semantic Extraction Engine

License CI Code Style Docs

Coreason-Tagger is a high-throughput, latency-aware NLP engine designed to normalize unstructured clinical and biomedical text into structured Knowledge Graph nodes. It utilizes a Strategy Pattern Architecture to dynamically switch extraction engines at runtime based on the complexity of the request.

Features

  • Dynamic Extraction Strategies:
    • Speed (GLiNER): Single-pass inference for high-volume ETL and real-time UI highlighting.
    • Precision (NuNER Zero): Token-classification for fixed schemas where boundary precision is critical.
    • Reasoning (Ensemble): LLM-verified candidates for complex, ambiguous text using GLiNER recall + LLM verification.
  • Contextualization: Lightweight assertion detection (Negation, Speculation, History, Family) to prevent false positives using rules or DistilBERT.
  • Normalization: Maps ambiguous text spans to canonical IDs (e.g., SNOMED, RxNorm) using Vector Retrieval (Bi-Encoder) and Semantic Re-ranking.
  • Resilience: Built-in Circuit Breakers and fallback mechanisms (L1/L2 Caching, Offline Mode) for robust operation.

Installation

pip install -r requirements.txt

Usage

Here is a quick example of how to initialize and use the CoreasonTagger:

import asyncio
from coreason_tagger.tagger import CoreasonTagger
from coreason_tagger.ner import ExtractorFactory
from coreason_tagger.assertion_detector import RegexBasedAssertionDetector
from coreason_tagger.codex_real import RealCoreasonCodex
from coreason_tagger.linker import VectorLinker
from coreason_tagger.schema import ExtractionStrategy

async def main():
    # Initialize components
    ner = ExtractorFactory()
    assertion = RegexBasedAssertionDetector()
    codex_client = RealCoreasonCodex(api_url="http://localhost:8000")
    linker = VectorLinker(codex_client=codex_client)

    # Initialize Tagger
    tagger = CoreasonTagger(ner=ner, assertion=assertion, linker=linker)

    # Tag text
    text = "Patient complains of severe migraine and nausea."
    results = await tagger.tag(
        text,
        labels=["Symptom", "Condition"],
        strategy=ExtractionStrategy.SPEED_GLINER
    )

    for entity in results:
        print(f"{entity.text}: {entity.label} (Assertion: {entity.assertion})")

if __name__ == "__main__":
    asyncio.run(main())

For more details, please refer to the Product Requirements.

Metadata

Release files for coreason-tagger 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coreason-tagger 0.2.1
File Size Uploaded
coreason_tagger-0.2.1.tar.gz 24.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for coreason-tagger 0.2.1
File Interpreter ABI Platform
coreason_tagger-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 59.5 kB

Release files / coreason_tagger-0.2.1.tar.gz

Download URL coreason_tagger-0.2.1.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b4e5c0581264e4a219847dcf8c5080987b34dc6d7f3c672306878c6cab0496f7
BLAKE2b-256 checksum
How to use checksums
c7f6bc58625a08a6b234470036bf056263f23b08a6e7cc9730f22095ddd9a041
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.

Transparency log

Release files / coreason_tagger-0.2.1-py3-none-any.whl

Download URL coreason_tagger-0.2.1-py3-none-any.whl
Size 34.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5851f8251af293f1f43261545a014a043cbaa25f2aaa4dc9d28a5eef01a17e4
BLAKE2b-256 checksum
How to use checksums
b2470e0f6fd69183c30132a00439663498dbc1483f1fef72544cc0fb8a3b7214
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page