A library for lightweight entity linking
Project description
Lightweight entity linking solution.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_entity_linking-0.0.7.tar.gz.
File metadata
- Download URL: py_entity_linking-0.0.7.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b9b03fa4cb83326c20f4dfe1aff0fa5cf05a5465c4ff4287e3fb68db24a1c17
|
|
| MD5 |
a5eb8195412dcc1847c54f1d4a292a88
|
|
| BLAKE2b-256 |
16d5eaa322469de335a3adaa704deb770a647659a94f195078f13cbaaf88895b
|
File details
Details for the file py_entity_linking-0.0.7-py3-none-any.whl.
File metadata
- Download URL: py_entity_linking-0.0.7-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acee3b55574cf17b252f4b67567c1871a1d92a607b3e8abe178d151eed8c1291
|
|
| MD5 |
185091f9a0fdc768a12a7c9cff951528
|
|
| BLAKE2b-256 |
64559176fcfde35bb80560671c8d9c9d6e5402c18205a4f035f886c5686b0e1b
|