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.
Metadata
Release files for glossbert 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| glossbert-1.0.6.tar.gz | 7.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| glossbert-1.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / glossbert-1.0.6.tar.gz
| Download URL | glossbert-1.0.6.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74598bf8a4632e30f5fc9b26180a65672e479294c6a9ae249f551c43335b2da7
|
|
BLAKE2b-256 checksum How to use checksums |
054b6e15c771a45f0dd38e4dcda3871aa58299e9efbb1b9ed3503467a10322c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2024.
Transparency logRelease files / glossbert-1.0.6-py3-none-any.whl
| Download URL | glossbert-1.0.6-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97e084e04b2c2487287f5a3b992604c9ad2eaad09ebdcb8673b5ccc1786150ce
|
|
BLAKE2b-256 checksum How to use checksums |
6b4e50556b6ee2be0b348609d4c203622730f4a9d4fc6432ecf8d73857dba3d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2024.
Transparency logSecurity for glossbert 1.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for glossbert-1.0.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2024.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.