A pseudo-API for Dictionary.com that works by scraping its website.
Project description
dictcom
dictcom is a simple Python package that extract dictionary info from Dictionary.com via web scraping. It can be thought of as an unofficial “API” for Dictionary.com.
Installation
dictcom is available on PyPI:
$ pip install dictcom
Currently it only works under Python 3. Tested with Python 3.4 and 3.5.
Usage
The package itself exposes two main methods, get_word and get_word_pronunciation.
get_word downloads all the data found for the word provided and packages it into a Word object:
import dictcom
word = dictcom.get_word('something') # an instance of dictcom.models.Word
You can access the word’s pronunciation (the textual representation of it) via the pronunciation property:
word.pronunciation # '[suhm-thing]'
The definitions are found under the defs property, as a dictionary. Each key of the dictionary represents one definition subsection, which usually means a different part of speech (for example noun or pronoun):
word.defs.keys() # ['pronoun', 'noun', 'adverb']
The value under each key is a list of Definition instances. Each definition has two properties, text and example.
One can also download the audio file for the word’s pronunciation:
pronun = word.get_pronunciation_audio() # an instance of dictcom.models.WordPronunciation pronun.audio # raw audio buffer pronun.content_type # the MIME type of the buffer data
You can also immediately get the pronunciation audio with get_word_pronunciation, the other method exposed by the package.
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
File details
Details for the file dictcom-0.0.3.tar.gz.
File metadata
- Download URL: dictcom-0.0.3.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca6bf8535aca9d3670e00eca4a59de93abe83e771c2507ea4ff7a69100bfcd99
|
|
| MD5 |
bf405e2bdf7618b367d955ceeb9ab5fb
|
|
| BLAKE2b-256 |
4540ab5b3f61b7e2ef226ec19d8f339b720cda5ddb6ed4e50bea71ff06b32996
|