========
sentency
========
.. image:: https://img.shields.io/pypi/v/sentency.svg
:target: https://pypi.python.org/pypi/sentency
:alt: PYPI Status
.. image:: https://readthedocs.org/projects/sentency/badge/?version=latest
:target: https://sentency.readthedocs.io/en/latest/?version=latest
:alt: Documentation Status
A small spaCy pipeline component for matching within document sentences using regular expressions.
* Free software: MIT license
* Documentation: https://sentency.readthedocs.io.
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
------------
.. code-block:: shell
pip install sentency
Usage
--------
The following minimally complex example showcases the features of sentenCy.
.. code-block:: python
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.
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
=======
History
=======
0.1.0 (2022-03-08)
------------------
* First release on PyPI.
Raw data
{
"_id": null,
"home_page": "https://github.com/g-delong/sentency",
"name": "sentency",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "sentency",
"author": "Grant DeLong",
"author_email": "gdelong1@geisinger.edu",
"download_url": "https://files.pythonhosted.org/packages/6a/60/450897d7b180dabca8ffd275084e84a941d02da5cbb47e4d6f3b43ed9a86/sentency-0.2.0.tar.gz",
"platform": null,
"description": "========\nsentency\n========\n\n\n.. image:: https://img.shields.io/pypi/v/sentency.svg\n :target: https://pypi.python.org/pypi/sentency\n :alt: PYPI Status\n\n.. image:: https://readthedocs.org/projects/sentency/badge/?version=latest\n :target: https://sentency.readthedocs.io/en/latest/?version=latest\n :alt: Documentation Status\n\n\n\n\nA small spaCy pipeline component for matching within document sentences using regular expressions.\n\n\n* Free software: MIT license\n* Documentation: https://sentency.readthedocs.io.\n\n\nFeatures\n--------\n\n* spaCy component for sentence-by-sentence pattern matching\n* Find matches with complex patterns using the power of regular expressions\n* Easily convert simple keywords into valid regular expressions\n* Specify matching patterns as well as patterns to ignore\n* Annotate matches for NER (Named Entity Recognition) tasks\n\nInstallation\n------------\n\n.. code-block:: shell\n\n pip install sentency\n\n \n\nUsage\n--------\n\nThe following minimally complex example showcases the features of sentenCy.\n\n\n.. code-block:: python\n\n import spacy\n from spacy import displacy\n\n from sentency.regex import regexize_keywords\n from sentency.sentency import Sentex\n\n text = \"\"\"\n Screening for abdominal aortic aneurysm. \n Impression: There is evidence of a fusiform \n abdominal aortic aneurysm measuring 3.4 cm.\n \"\"\"\n aaa_keywords = \"abdominal aortic aneurysm\"\n ignore_keywords = \"screening aneurysm\"\n\n keyword_regex = regexize_keywords(aaa_keywords)\n ignore_regex = regexize_keywords(ignore_keywords)\n\n nlp = spacy.load(\"en_core_web_sm\")\n nlp.add_pipe(\n \"sentex\", config={\n \"sentence_regex\": keyword_regex, \n \"ignore_regex\": ignore_regex,\n \"annotate_ents\": True,\n \"label\": \"AAA\"\n }\n )\n\n doc = nlp(text)\n\n displacy.render(doc, style=\"ent\", options = {\"ents\": [\"AAA\"]})\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n\n\n=======\nHistory\n=======\n\n0.1.0 (2022-03-08)\n------------------\n\n* First release on PyPI.\n",
"bugtrack_url": null,
"license": "MIT license",
"summary": "A small lspaCy pipeline component for matching within document sentences using regular expressi",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/g-delong/sentency"
},
"split_keywords": [
"sentency"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c740593c3efbed500ab6a843a0a3addb10edc61014deb89c246f9904b415f144",
"md5": "0b95a1fe0f91c2bf02847454ca0bbe2b",
"sha256": "4d815839fc310149f02cffef2f95f670a729d5322cf4c4f409b4c28e4d79027e"
},
"downloads": -1,
"filename": "sentency-0.2.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "0b95a1fe0f91c2bf02847454ca0bbe2b",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 7245,
"upload_time": "2023-05-08T14:30:41",
"upload_time_iso_8601": "2023-05-08T14:30:41.229918Z",
"url": "https://files.pythonhosted.org/packages/c7/40/593c3efbed500ab6a843a0a3addb10edc61014deb89c246f9904b415f144/sentency-0.2.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6a60450897d7b180dabca8ffd275084e84a941d02da5cbb47e4d6f3b43ed9a86",
"md5": "af5fc61371cebf863c0a75e90fd1fd4c",
"sha256": "88f334b06addc38851c6529e957240fe584fa80483bc9466fa2745bc6f74c5f5"
},
"downloads": -1,
"filename": "sentency-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "af5fc61371cebf863c0a75e90fd1fd4c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 13892,
"upload_time": "2023-05-08T14:30:42",
"upload_time_iso_8601": "2023-05-08T14:30:42.904255Z",
"url": "https://files.pythonhosted.org/packages/6a/60/450897d7b180dabca8ffd275084e84a941d02da5cbb47e4d6f3b43ed9a86/sentency-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-08 14:30:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "g-delong",
"github_project": "sentency",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"requirements": [],
"tox": true,
"lcname": "sentency"
}