Skip to main content

NLP Annotations

A simple python package for dealing with different nlp annotation styles. No dependencies, and is very fast due to only using regular expressions.

You can install it with:

pip3 install nlp-annotations

Annotation Types

The following are the annotation types we support and how to convert it to another type.

(Used by Rasa, etc...), these are in the form:

The weather is [sunny](weather) and the sky is [blue](color).

To convert this to an entity list you can:

from nlp_annotations import markdown_links2entity_list
markdown_links2entity_list("The weather is [sunny](weather) and the sky is [blue](color).")
# ('The weather is sunny and the sky is blue.', {'entities': [(15, 20, 'weather'), (36, 40, 'color')]})

For other situations that you may wish to add extra logic, there is also a generator:

from nlp_annotations import markdown_string_link_generator

for link in markdown_string_link_generator("The weather is [sunny](weather) and the sky is [blue](color)."):
    print(f"- word={link.word}, entity={link.entity}, start={link.start}, end={link.end}")

# - word=sunny, entity=weather, start=15, end=31
# - word=blue, entity=color, start=47, end=60

Entity List

(Used by Spacy, etc...), these are in the form:

('The weather is sunny and the sky is blue.', {'entities': [(15, 20, 'weather'), (36, 40, 'color')]})

To convert this to a markdown links string, you can:

from nlp_annotations import entity_list2markdown_links
entity_list2markdown_links("The weather is sunny and the sky is blue.", [(15, 20, 'weather'), (36, 40, 'color')])
# 'The weather is [sunny](weather) and the sky is [blue](color).'

Metadata

Release files for nlp-annotations 1.0.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 nlp-annotations 1.0.1
File Size Uploaded Provenance Actions
nlp-annotations-1.0.1.tar.gz 2.2 kB Without provenance Details for nlp-annotations-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nlp-annotations 1.0.1
File Interpreter ABI Platform Actions
nlp_annotations-1.0.1-py3-none-any.whl Python 3 none any Details for nlp_annotations-1.0.1-py3-none-any.whl

Total release size: 4.7 kB

Release files / nlp-annotations-1.0.1.tar.gz

Download URL nlp-annotations-1.0.1.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ed264eabba322f45dc3d29eec174401758718def59da26fdd02d0b22db38ad9f
BLAKE2b-256 checksum
How to use checksums
48f6cf67f81475469585882dba4820f28ad08fdc1cf6aaa97124f37152371d80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

Release files / nlp_annotations-1.0.1-py3-none-any.whl

Download URL nlp_annotations-1.0.1-py3-none-any.whl
Size 2.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7efa97860266d195d11b2061a8d4f9e81ca0a932c048d760e27d78e636e01108
BLAKE2b-256 checksum
How to use checksums
c131b8f42d545a6f259e5cbd29868e5a8e5be3441a6745a8a5ca74ca27d9d684
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

Security for nlp-annotations 1.0.1

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