Python package for Word Sentence Disambiguation (WSD) using GlossBERT model and NLTK WordNet.
Project description
GlossBERT Wrapper Class
This Python package provides a convenient wrapper for using GlossBERT, allowing you to easily perform word sense disambiguation (WSD) by searching WordNet through NLTK.
The source code in this repository is adapted from this script from the original GlossBERT project.
Features
- Simplifies the use of GlossBERT for WSD tasks.
- Provides integration with WordNet via NLTK.
Installation
Install the package using pip:
pip install glossbert
Alternatively, install directly from the GitHub repository:
pip install git+https://github.com/cruzlorite/glossbert.git
Usage
Here is an example of how to use the GlossBERT class:
>>> from glossbert import GlossBERT
>>>
>>> # initialize the GlossBERT instance
>>> gloss = GlossBERT()
>>>
>>> # define a sentence and specify the target word
>>> sent = "I love dogs!"
>>> start_idx, end_idx, target_word = 7, 11, "dog"
>>>
>>> # perform word sense disambiguation
>>> gloss(sent, start_idx, end_idx, target_word)
[
(0.9973864, Synset('dog.n.01')),
(0.025929835, Synset('frank.n.02')),
(0.0030947044, Synset('dog.n.03')),
(0.0024504508, Synset('cad.n.01')),
(0.001387376, Synset('andiron.n.01')),
(0.00057538506, Synset('pawl.n.01')),
(0.0005529578, Synset('chase.v.01')),
(0.00046094437, Synset('frump.n.01'))
]
License
This project is licensed under the MIT License, consistent with the original GlossBERT project.
Acknowledgements
Special thanks to the authors of the original GlossBERT for their foundational work.
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
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 glossbert-1.0.3.tar.gz.
File metadata
- Download URL: glossbert-1.0.3.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dec5ed30ed2a89ff9ce18a199c461980fc34aa1d5641fedf7d6513359544e52a
|
|
| MD5 |
41a00dd69237ebf563de45fa50d144ba
|
|
| BLAKE2b-256 |
e6b47e59623ee7dc664e5636b37c6f9af8bc93eb5f09db7fc9e37bc70a2b91df
|
Provenance
The following attestation bundles were made for glossbert-1.0.3.tar.gz:
Publisher:
publish-pypi.yaml on cruzlorite/glossbert
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glossbert-1.0.3.tar.gz -
Subject digest:
dec5ed30ed2a89ff9ce18a199c461980fc34aa1d5641fedf7d6513359544e52a - Sigstore transparency entry: 149935091
- Sigstore integration time:
-
Permalink:
cruzlorite/glossbert@130910f638d6944d5bbe04a167bc1e888d0b4e78 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/cruzlorite
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yaml@130910f638d6944d5bbe04a167bc1e888d0b4e78 -
Trigger Event:
release
-
Statement type:
File details
Details for the file glossbert-1.0.3-py3-none-any.whl.
File metadata
- Download URL: glossbert-1.0.3-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56b886b6bc5cb3aff8ab31d5a8d31078cc7b4fe79700d59f8eb27c6c2362f178
|
|
| MD5 |
59c19ea49285212c002c0cefdd4ca9ba
|
|
| BLAKE2b-256 |
1674eb7314788249e299de474997444e6438d5d05a215a8c75bc2a1f5345b260
|
Provenance
The following attestation bundles were made for glossbert-1.0.3-py3-none-any.whl:
Publisher:
publish-pypi.yaml on cruzlorite/glossbert
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
glossbert-1.0.3-py3-none-any.whl -
Subject digest:
56b886b6bc5cb3aff8ab31d5a8d31078cc7b4fe79700d59f8eb27c6c2362f178 - Sigstore transparency entry: 149935093
- Sigstore integration time:
-
Permalink:
cruzlorite/glossbert@130910f638d6944d5bbe04a167bc1e888d0b4e78 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/cruzlorite
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yaml@130910f638d6944d5bbe04a167bc1e888d0b4e78 -
Trigger Event:
release
-
Statement type: