All Projects → prosegrinder → python-cmudict

prosegrinder / python-cmudict

Licence: GPL-3.0 license
A versioned python wrapper package for cmudict (https://github.com/cmusphinx/cmudict).

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to python-cmudict

cmudict-tools
Tools for working with the CMU Pronunciation Dictionary
Stars: ✭ 29 (-29.27%)
Mutual labels:  cmudict
Countable
Add live paragraph-, word- and character-counting to an HTML element.
Stars: ✭ 1,622 (+3856.1%)
Mutual labels:  counting
Complete-Blood-Cell-Count-Dataset
The complete blood count (CBC) dataset contains a total of 360 blood smear images of red blood cells (RBCs), white blood cells (WBCs), and Platelets with annotations.
Stars: ✭ 31 (-24.39%)
Mutual labels:  counting
g2pK
g2pK: g2p module for Korean
Stars: ✭ 137 (+234.15%)
Mutual labels:  cmudict
wikt2pron
A Python toolkit converting pronunciation in enwiktionary xml dump to cmudict format
Stars: ✭ 26 (-36.59%)
Mutual labels:  cmudict

CMUdict: Python wrapper for cmudict

Latest PyPI version GitHub Workflow Status

CMUdict is a versioned python wrapper package for The CMU Pronouncing Dictionary data files. The main purpose is to expose the data with little or no assumption on how it is to be used.

Installation

cmudict is available on PyPI. Simply install it with pip:

pip install cmudict

You can also install it from source:

$ git clone https://github.com/prosegrinder/python-cmudict.git
Cloning into 'python-cmudict'...
...

$ cd python-cmudict
$ git submodule update --init --recursive
Submodule 'cmudict/data' (https://github.com/cmusphinx/cmudict.git) registered for path 'cmudict/data'...
...

$ python setup.py install
...

Usage

The cmudict data set includes 4 data files: cmudict.dict, cmudict.phones, cmudict.symbols, and cmudict.vp. See The CMU Pronouncing Dictionary for details on the data. Chances are, if you're here, you already know what's in the files.

Each file can be accessed through three functions, one which returns the raw (string) contents, one which returns a binary stream of the file, and one which does minimal processing of the file into an appropriate structure:

>>> import cmudict

>>> cmudict.dict() # Compatible with NLTK
>>> cmudict.dict_string()
>>> cmudict.dict_stream()

>>> cmudict.phones()
>>> cmudict.phones_string()
>>> cmudict.phones_stream()

>>> cmudict.symbols()
>>> cmudict.symbols_string()
>>> cmudict.symbols_stream()

>>> cmudict.vp()
>>> cmudict.vp_string()
>>> cmudict.vp_stream()

Three additional functions are included to maintain compatibility with NLTK: cmudict.entries(), cmudict.raw(), and cmudict.words(). See the nltk.corpus.reader.cmudict documentation for details:

>>> cmudict.entries() # Compatible with NLTK
>>> cmudict.raw() # Compatible with NLTK
>>> cmudict.words() # Compatible with NTLK

And finally, the license for the cmudict data set is available as well:

>>> cmudict.license_string() # Returns the cmudict license as a string

Credits

Built on or modeled after the following open source projects:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].