Skip to main content

spaCy ANN Linker, a pipeline component for generating spaCy KnowledgeBase Alias Candidates for Entity Linking.

Project description

spaCy ANN Linker, a pipeline component for generating spaCy KnowledgeBase Alias Candidates for Entity Linking.

Build Status Package version Code Coverage


Documentation: https://microsoft.github.io/spacy-ann-linker

Source Code: https://github.com/microsoft/spacy-ann-linker


spaCy ANN Linker is a spaCy a pipeline component for generating alias candidates for spaCy entities in doc.ents. It provides an optional interface for linking ambiguous aliases based on descriptions for each entity.

The key features are:

  • Easy spaCy Integration: spaCy ANN Linker provides completely serializable spaCy pipeline components that integrate directly into your existing spaCy model.

  • CLI for simple Index Creation: Simply run spacy_ann create_index with your data to create an Approximate Nearest Neighbors index from your data, make an ann_linker pipeline component and save a spaCy model.

  • Built in Web API for easy deployment and Batch Entity Linking queries

Requirements

Python 3.6+

spaCy ANN Linker is convenient wrapper built on a few comprehensive, high-performing packages.

Installation

$ pip install spacy-ann-linker
---> 100%
Successfully installed spacy-ann-linker

Data Prerequisites

To use this spaCy ANN Linker you need pre-existing Knowledge Base data. spaCy ANN Linker expects data to exist in 2 JSONL files together in a directory

kb_dir
│   aliases.jsonl
│   entities.jsonl

For testing the package, you can use the example data in examples/tutorial/data

examples/tutorial/data
│   aliases.jsonl
│   entities.jsonl

entities.jsonl Record Format

{"id": "Canonical Entity Id", "description": "Entity Description used for Disambiguation"}

Example data

{"id": "a1", "description": "Machine learning (ML) is the scientific study of algorithms and statistical models..."}
{"id": "a2", "description": "ML (\"Meta Language\") is a general-purpose functional programming language. It has roots in Lisp, and has been characterized as \"Lisp with types\"."}
{"id": "a3", "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."}
{"id": "a4", "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."}
...

aliases.jsonl Record Format

{"alias": "alias string", "entities": ["list", "of", "entity", "ids"], "probabilities": [0.5, 0.5]}

Example data

{"alias": "ML", "entities": ["a1", "a2"], "probabilities": [0.5, 0.5]}
{"alias": "Machine learning", "entities": ["a1"], "probabilities": [1.0]}
{"alias": "Meta Language", "entities": ["a2"], "probabilities": [1.0]}
{"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]}
...

spaCy prerequisites

If you don't have a pretrained spaCy model, download one now. The model needs to have vectors so download a model bigger than en_core_web_sm

$ spacy download en_core_web_md
---> 100%
Successfully installed en_core_web_md

Follow the Tutorial

Once you have the Data and spaCy prerequisites completed follow along with the Tutorial to for a step-by-step guide for using the spacy_ann package.

License

This project is licensed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spacy-ann-linker-0.1.0.tar.gz (200.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spacy_ann_linker-0.1.0-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file spacy-ann-linker-0.1.0.tar.gz.

File metadata

  • Download URL: spacy-ann-linker-0.1.0.tar.gz
  • Upload date:
  • Size: 200.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.22.0

File hashes

Hashes for spacy-ann-linker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6b025091588b872d96f1812d38ca31d7521371d4fc9c9a06edf0d984dd2147cc
MD5 2160750ac561339d7b0352aa3b70e0a9
BLAKE2b-256 1439ff46317aeda16f740b2726178ef2f07a817dd4de622e813f4ec40e77aee6

See more details on using hashes here.

File details

Details for the file spacy_ann_linker-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spacy_ann_linker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 176ce70c5b36c1d010a36169f95ce9d633a131f054d896738b74cabdf73d72ba
MD5 a438f6324f16b857b58d43c6f90d4444
BLAKE2b-256 64ddf2f0d18e32c67784379dd54440f21c2ba059fae14c5fc490a6d5d31932cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page