Skip to main content

A dictonary library

Project description

Dicthon

Test Library Documentation Status
Test Package and Publish

This library is meant to be a convenient wrapper around the Dictonary API

Installation:

pip install Dicthon

Support:

Currently, this library only displays english words.

Get started:

Instantiate a Dictionary API Entry object

To use the library, first you need to import it and then instatiate a variable.

Important: The class auto starts, you can use either the methods or the class vars to retrieve the desired result

from Dicthon import Dictionary_API_Entry

myWord = Dictionary_API_Entry('hello')

Examples with outputs

from Dicthon import Dictionary_API_Entry

myWord = Dictionary_API_Entry('hello')

print(myWord.raw_entry)
print(myWord.get_dict_entry())
''' 
Returns the raw answer from the API in a JSON style
Just as the example: https://dictionaryapi.dev/
'''

print(myWord.antonyms)
print(myWord.get_all_antonyms())
# returns: [['bye', 'goodbye']]

print(myWord.audio_links)
print(myWord.get_all_audio_links())
# returns: ['https://api.dictionaryapi.dev/media/pronunciations/en/hello-au.mp3', 'https://api.dictionaryapi.dev/media/pronunciations/en/hello-uk.mp3']

print(myWord.definitions)
print(myWord.get_all_definitions())
# returns: ['"Hello!" or an equivalent greeting.', 'To greet with "hello".', ...]

print(myWord.definitions_with_example)
print(myWord.get_all_definitions_with_example())
# returns: [{'definition': 'A greeting (salutation) said when meeting someone or acknowledging someone’s arrival or presence.', 'example': 'Hello, everyone.'}]

print(myWord.phonetic_texts)
print(myWord.get_all_phonetic_text_representation())
# ['/həˈləʊ/', '/həˈloʊ/']

print(myWord.synonyms)
print(myWord.get_all_synonyms())
# [['greeting']]

print(myWord.parts_of_speech)
print(myWord.get_all_parts_of_speech())
# return: ['noun', 'verb', 'interjection']

print(myWord.meanings_list)
print(myWord.get_all_meanings())
'''
Returns something similar to the following
[[{'antonyms': [],
   'definitions': [{'antonyms': [],
                    'definition': '"Hello!" or an equivalent greeting.',
                    'synonyms': []}],
   'partOfSpeech': 'noun',
   'synonyms': ['greeting']},
  {'antonyms': [],
   'definitions': [{'antonyms': [],
                    'definition': 'To greet with "hello".',
                    'synonyms': []}],
   'partOfSpeech': 'verb',
   'synonyms': []}]]
'''

print(myWord.phonetics)
print(myWord.get_all_phonetics())
'''
return something like:
[[{'audio': 'https://api.dictionaryapi.dev/media/pronunciations/en/hello-au.mp3',
   'sourceUrl': 'https://commons.wikimedia.org/w/index.php?curid=75797336', 
   'license': {'name': 'BY-SA 4.0', 'url': 'https://creativecommons.org/licenses/by-sa/4.0'}},
]]
'''

Contributing

Contributing Guidelines.

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

Dicthon-0.1.6.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Dicthon-0.1.6-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file Dicthon-0.1.6.tar.gz.

File metadata

  • Download URL: Dicthon-0.1.6.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for Dicthon-0.1.6.tar.gz
Algorithm Hash digest
SHA256 c2489375d8e4b96c25b4fbe7a28d0f678bdbabe5f5de85a58b61ddecc2fecfaa
MD5 33c8a12c14a5ffb87c48f657a0fb5f32
BLAKE2b-256 00e9285899ce5b907ca4fe561b889c5857dbc645ad213b24b90f3d0ec1c78d09

See more details on using hashes here.

File details

Details for the file Dicthon-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: Dicthon-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for Dicthon-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 55a37bd33615406b475c48690c67a2218f15ab373bc368eb70cc57894a009a43
MD5 36b5635a436eb755e71a475a06e8d4b3
BLAKE2b-256 ad4295557f8621577ef19e28fcca10d33b13b468b9022ccb2239f88bbf072449

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page