Pure Python package for getting synonyms for words.
Project description
A simple Python package that looks up synonyms for words.
Synnamon: Offline synonyms for English words (Python 3.8+)
What is it?
Synnamon is a simple Python package that looks up synonyms using a built in thesaurus shelve file instead of reaching out to web resources (PyDictionary) or using large English lexical databases (nltk WordNet).
Where to get it
Source code: https://github.com/eddiethedean/synnamon
# PyPI
pip install synnamon
Requirements
- Python 3.8+
- Dependency:
inflex(used to convert plural word lookups to singular and then convert singular synonym results to plural)
Usage
import synnamon
syns = synnamon.get_syns('jump')
print(syns.get('verb', [])[:5])
Behavior
- Input is normalized to lowercase and trimmed.
- If the plural form is not found,
get_synswill try the singular form and pluralize only the noun synonyms. - Returns
{}for unknown words or empty/whitespace input.
API
from synnamon import get_syns
def get_syns(word: str) -> dict:
"""Get synonyms for a word from the built-in thesaurus."""
Development
Run tests with pytest:
pytest -q
Test configuration lives in pyproject.toml and collects coverage for synnnamon.
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 synnamon-0.2.0.tar.gz.
File metadata
- Download URL: synnamon-0.2.0.tar.gz
- Upload date:
- Size: 6.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23dffa3863e6a1e35443375d243307cb3345d1532600073dd1fb90e3bdca4644
|
|
| MD5 |
88c5aa623c587cd45e242996cc7ad7b9
|
|
| BLAKE2b-256 |
e54e6b922474f3c0ba43633595e2337a7acbc825656c167621281f54beaa80cb
|
File details
Details for the file synnamon-0.2.0-py3-none-any.whl.
File metadata
- Download URL: synnamon-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a49356975c512bf8e231b8dab40ccbdd511ab7c2ce06ef888ae90408b05c564
|
|
| MD5 |
570f4f27a4588e277f858daebee6b4cf
|
|
| BLAKE2b-256 |
c8ce8a12e5994ed435f1ddbc2aaaa860c7f27229756506c029477129ee982c5b
|