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.55.3
- httpsx==0.28.1
- beautifulsoup4==4.12.2
- 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",
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)
- 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.
Release files for py-entity-linking 0.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_entity_linking-0.1.8.tar.gz | 7.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_entity_linking-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.2 kB
Release files / py_entity_linking-0.1.8.tar.gz
| Download URL | py_entity_linking-0.1.8.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9bc1689edb11fb38fb820483d0d58d89bee5c320dcc7989596d0fcf5aca5507d
|
|
BLAKE2b-256 checksum How to use checksums |
2730b828b9e13122a280acda3fe3a5b73484d8e0e2d60b19b92dfb51a9be4004
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.1
|
Release files / py_entity_linking-0.1.8-py3-none-any.whl
| Download URL | py_entity_linking-0.1.8-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd319370765698f90f94583474eb2367efb6004740107d7ef664f87d2b2f26a2
|
|
BLAKE2b-256 checksum How to use checksums |
a6a319fde56ad015c2c64af27d7257341f8417704ff654fa52f73c336f2fd40c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.1
|