spacy-lancedb-linker
spaCy pipeline component for ANN Entity Linking using LanceDB
Installation
pip install spacy-lancedb-linker
Usage
import spacy
from spacy_lancedb_linker.kb import AnnKnowledgeBase
from spacy_lancedb_linker.linker import AnnLinker # noqa
from spacy_lancedb_linker.types import Alias, Entity
nlp = spacy.load("en_core_web_md")
kb = AnnKnowledgeBase(uri="data/sample-lancedb")
kb.add_entities(
[
Entity(**entity)
for entity in [
{
"entity_id": "a3",
"name": "Natural language processing",
"description": "Natural language processing (NLP) is a subfield of linguistics, computer science, information engineering, and artificial intelligence concerned with the interactions between computers and human (natural) languages, in particular how to program computers to process and analyze large amounts of natural language data.",
},
{
"entity_id": "a4",
"name": "Neuro-linguistic programming",
"description": "Neuro-linguistic programming (NLP) is a pseudoscientific approach to communication, personal development, and psychotherapy created by Richard Bandler and John Grinder in California, United States in the 1970s.",
},
]
]
)
kb.add_aliases(
[
Alias(**alias)
for alias in [
{"alias": "NLP", "entities": ["a3", "a4"], "probabilities": [0.5, 0.5]},
{
"alias": "Natural language processing",
"entities": ["a3"],
"probabilities": [1.0],
},
{
"alias": "Neuro-linguistic programming",
"entities": ["a4"],
"probabilities": [1.0],
},
]
]
)
ann_linker = nlp.add_pipe("ann_linker", last=True)
ann_linker.set_kb(kb)
doc = nlp("NLP is a subset of machine learn.")
print(doc.ents[0].kb_id_)
print(doc.ents[0]._.alias_candidates)
print(doc.ents[0]._.kb_candidates)
Test
poetry install
poetry shell
poetry run pytest
Metadata
Release files for spacy-lancedb-linker 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spacy_lancedb_linker-0.1.2.tar.gz | 10.0 kB | Without provenance | Details for spacy_lancedb_linker-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spacy_lancedb_linker-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for spacy_lancedb_linker-0.1.2-py3-none-any.whl |
Total release size: 20.8 kB
Release files / spacy_lancedb_linker-0.1.2.tar.gz
| Download URL | spacy_lancedb_linker-0.1.2.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd2a4a80d6e4a62102b61ea07252fcf9ac168075a6f8c14b18e11466b7518a77
|
|
BLAKE2b-256 checksum How to use checksums |
a4dca247c5a20b3a715124a4913527b1e5a4979c58a1b632b3cea25ae923d6d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / spacy_lancedb_linker-0.1.2-py3-none-any.whl
| Download URL | spacy_lancedb_linker-0.1.2-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dcc3dd3dc8fc3e60ad9e6a726f58083be09ec96bcaed4b5584b14fd9044de308
|
|
BLAKE2b-256 checksum How to use checksums |
0ca295bb64536c19876ac99710cf911212fea4b629905f8918e3d29f3221b592
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Security for spacy-lancedb-linker 0.1.2
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.