Skip to main content

A lightweight library for entity linking in English

Project description

Lightweight entity linking solution for the English language.

Please consider citing our works if you use code from this repository. Also, we recommend using a Colab T4 GPU for faster results.

Main dependencies

  • python>=3.10
  • numpy==1.26.4
  • SPARQLWrapper==2.0.0
  • sentence_transformers==3.1.1
  • aiohttp==3.9.5
  • openai==1.54.2
  • beautifulsoup4==4.12.2
  • fake-useragent==1.5.1
  • nest_asyncio==1.5.8

Example & Usage

from linking import main

# Your API token which can be found here (https://github.com/marketplace/models/azure-openai/gpt-4o)
api_token = "YOUR_API_TOKEN"

main.EL(api_token=api_token,
	sentence="We used PCA and FA for our experiments.",
	mention="PCA and FA",
	single="No",
	combination="No",
	disambiguation="Yes",
	embedding_model="Lajavaness/bilingual-embedding-large")
The correct entity for 'PCA' is:

Wikipedia: https://en.wikipedia.org/wiki/Principal_component_analysis

Wikidata: https://www.wikidata.org/wiki/Q2873

DBpedia: http://dbpedia.org/resource/Principal_component_analysis



The correct entity for 'FA' is:

Wikipedia: https://en.wikipedia.org/wiki/Factor_analysis

Wikidata: https://www.wikidata.org/wiki/Q726474

DBpedia: http://dbpedia.org/resource/Factor_analysis

Execution Time: 00:00:35

Parameters

  • api_token: Your API token from here. (Required)
  • sentence: An English text. (Required)
  • mention: The mention you want to perform the linking, the mention should be from inside the provided sentence. (Required)
  • disambiguation: Used when the mention has acronyms or the mention has two different entities inside (e.g. PCA and FA), (deafult="Yes"), (Values: "Yes", "No"). (Optional)
  • single: Usually used for difficult mentions, it searches each word of the mention individually, (deafult="No"), (Values: "Yes", "No"). (Optional)
  • combination: Usually used for difficult mentions, it makes combinations for each word of the mention, (deafult="No"), (Values: "Yes", "No"). (Optional)
  • embedding_model: A sentence-transformers model to perform text similarity, (deafault="Lajavaness/bilingual-embedding-large"), (Values: str of the name of any sentence-transformers model). (Optional)

Licence

This library is licensed under the CC-BY-NC 4.0 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

py_entity_linking-0.1.3.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

py_entity_linking-0.1.3-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file py_entity_linking-0.1.3.tar.gz.

File metadata

  • Download URL: py_entity_linking-0.1.3.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for py_entity_linking-0.1.3.tar.gz
Algorithm Hash digest
SHA256 59d6df776f4309de0196d5ba2e2ae8b51a18460bceab5529e4d074b184f72d3c
MD5 9ee66c02f36832bfa5f626adf747cc7b
BLAKE2b-256 611341076ccb72f369757037bc5c9b4d10c711591a13b3dfc5418eaae1f0b40d

See more details on using hashes here.

File details

Details for the file py_entity_linking-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for py_entity_linking-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d23fa514776d6c12b61689d7d2ed2aaca9efe5d059714ff62a80202195b203ea
MD5 4ea36c662d6864edbb0f27ea171a1024
BLAKE2b-256 d56cdd541d883b77b2e0b81ad32f88ee11181ccf098e4a9f43afb4b7b9842672

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