Skip to main content

sentency

PYPI Status Documentation Status

A small spaCy pipeline component for matching within document sentences using regular expressions.

Features

  • spaCy component for sentence-by-sentence pattern matching

  • Find matches with complex patterns using the power of regular expressions

  • Easily convert simple keywords into valid regular expressions

  • Specify matching patterns as well as patterns to ignore

  • Annotate matches for NER (Named Entity Recognition) tasks

Installation

pip install sentency

Usage

The following minimally complex example showcases the features of sentenCy.

import spacy
from spacy import displacy

from sentency.regex import regexize_keywords
from sentency.sentency import Sentex

text = """
Screening for abdominal aortic aneurysm.
Impression: There is evidence of a fusiform
abdominal aortic aneurysm measuring 3.4 cm.
"""
aaa_keywords = "abdominal aortic aneurysm"
ignore_keywords = "screening aneurysm"

keyword_regex = regexize_keywords(aaa_keywords)
ignore_regex = regexize_keywords(ignore_keywords)

nlp = spacy.load("en_core_web_sm")
nlp.add_pipe(
"sentex", config={
        "sentence_regex": keyword_regex,
        "ignore_regex": ignore_regex,
        "annotate_ents": True,
        "label": "AAA"
        }
)

doc = nlp(text)

displacy.render(doc, style="ent", options = {"ents": ["AAA"]})

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.1.0 (2022-03-08)

  • First release on PyPI.

Metadata

Release files for sentency 0.2.0

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

Source distribution (sdist)

Source distribution for sentency 0.2.0
File Size Uploaded Provenance Actions
sentency-0.2.0.tar.gz 13.9 kB Without provenance Details for sentency-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sentency 0.2.0
File Interpreter ABI Platform Actions
sentency-0.2.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for sentency-0.2.0-py2.py3-none-any.whl

Total release size: 21.1 kB

Release files / sentency-0.2.0.tar.gz

Download URL sentency-0.2.0.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
88f334b06addc38851c6529e957240fe584fa80483bc9466fa2745bc6f74c5f5
BLAKE2b-256 checksum
How to use checksums
6a60450897d7b180dabca8ffd275084e84a941d02da5cbb47e4d6f3b43ed9a86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.8.2 requests/2.27.1 setuptools/67.7.2 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.8.10

Release files / sentency-0.2.0-py2.py3-none-any.whl

Download URL sentency-0.2.0-py2.py3-none-any.whl
Size 7.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4d815839fc310149f02cffef2f95f670a729d5322cf4c4f409b4c28e4d79027e
BLAKE2b-256 checksum
How to use checksums
c740593c3efbed500ab6a843a0a3addb10edc61014deb89c246f9904b415f144
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.8.2 requests/2.27.1 setuptools/67.7.2 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.8.10

Security for sentency 0.2.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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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