Skip to main content

An interface to ISLEX, a pronunciation dictionary with stress markings.

Project description

https://travis-ci.org/timmahrt/pysle.svg?branch=master https://coveralls.io/repos/github/timmahrt/pysle/badge.svg?branch=master https://img.shields.io/badge/license-MIT-blue.svg?

Pronounced like ‘p’ + ‘isle’.

An interface to a pronunciation dictionary with stress markings (ISLEX - the international speech lexicon), along with some tools for working with comparing and aligning pronunciations (e.g. a list of phones someone said versus a standard or canonical dictionary pronunciation).

1 Common Use Cases

What can you do with this library?

  • look up the list of phones and syllables for canonical pronunciations of a word:

    pysle.isletool.LexicalTool.lookup('cat')
  • map an actual pronunciation to a dictionary pronunciation (can be used to automatically find speech errors):

    pysle.pronunciationtools.findClosestPronunciation(isleDict, 'cat', ['k', 'æ',])
  • automatically syllabify a praat textgrid containing words and phones (e.g. force-aligned text) – requires my praatIO library:

    pysle.syllabifyTextgrid(isleDict, praatioTextgrid, "words", "phones")
  • search for words based on pronunciation:

    e.g. Words that start with a sound, or have a sound word medially, or
    in stressed vowel position, etc.
    
    see /tests/dictionary_search.py

2 Major revisions

Ver 1.5 (March 3, 2017)

  • substantial bugfixes made, particularly to the syllable-marking code

Ver 1.4 (July 9, 2016)

  • added search functionality

  • ported code to use the new unicode IPA-based isledict (the old one was ascii)

  • (Oct 20, 2016) Integration tests added; using Travis CI and Coveralls for build automation. No new functionality added.

Ver 1.3 (March 15, 2016)

  • added indicies for stressed vowels

Ver 1.2 (June 20, 2015)

  • Python 3.x support

Ver 1.1 (January 30, 2015)

  • word lookup ~65 times faster

Ver 1.0 (October 23, 2014)

  • first public release.

3 Requirements

  • Before you use this library (before or after installing it) you will need to download the ILSEX dictionary. It can be downloaded here under the section ‘English’ linked under the text ‘English Pronlex’ (with a file name of ISLEdict.txt):

    ISLEX project page

    Direct link to the ISLEX file used in this project (ISLEdict.txt)

  • Python 2.7.* or above

  • Python 3.3.* or above (or below, probably)

  • The praatIO library is required IF you want to use the textgrid functionality. It is not required for normal use.

4 Installation

If you on Windows, you can use the installer found here (check that it is up to date though) Windows installer

PraatIO is on pypi and can be installed or upgraded from the command-line shell with pip like so:

pip install praatio --upgrade

Otherwise, to manually install, after downloading the source from github, from a command-line shell, navigate to the directory containing setup.py and type:

python setup.py install

If python is not in your path, you’ll need to enter the full path e.g.:

C:\Python27\python.exe setup.py install

5 Example usage

Here is a typical common usage:

from pysle import isle
isleDict = isle.LexicalTool('C:\islev2.dict')
print isleDict.lookup('catatonic')[0] # Get the first pronunciation
>> [['k', 'ˌæ'], ['t˺', 'ə'], ['t', 'ˈɑ'], ['n', 'ɪ', 'k']] [2, 0]

and another:

from pysle import isle
from psyle import pronunciationTools

searchWord = 'another'
anotherPhoneList = ['n', '@', 'th', 'r'] # Actually produced (ASCII or IPA ok here)

returnList = pronunciationTools.findBestSyllabification(isleDict,
                                                        searchWord,
                                                        anotherPhoneList)
print syllableList
>> [["''"], ['n', '@'], ['th', 'r']]

Please see \examples for example usage

6 Citing pysle

Pysle is general purpose coding and doesn’t need to be cited (you should cite the ISLEX project instead) but if you would like to, it can be cited like so:

Tim Mahrt. Pysle. https://github.com/timmahrt/pysle, 2016.

7 Acknowledgements

Development of Pysle was possible thanks to NSF grant IIS 07-03624 to Jennifer Cole and Mark Hasegawa-Johnson, NSF grant BCS 12-51343 to Jennifer Cole, José Hualde, and Caroline Smith, and to the A*MIDEX project (n° ANR-11-IDEX-0001-02) to James Sneed German funded by the Investissements d’Avenir French Government program, managed by the French National Research Agency (ANR).

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

pysle-1.5.7.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

pysle-1.5.7-py2.py3-none-any.whl (18.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pysle-1.5.7.tar.gz.

File metadata

  • Download URL: pysle-1.5.7.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.2

File hashes

Hashes for pysle-1.5.7.tar.gz
Algorithm Hash digest
SHA256 de59a72651147a4d7c4455445de9089c9d49ff84068f90799993e532e52f9d75
MD5 a7c3ccaa321c8f17a16b323871b9b32a
BLAKE2b-256 4636f73e213cd72a00fb2f9227b5858e4941edaa6bddc90b754e91a102a1d529

See more details on using hashes here.

File details

Details for the file pysle-1.5.7-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pysle-1.5.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 39b72706a8c43789026a18ddf3eed092642078a23b7f8bc0bc36cc48c0fd3bdb
MD5 58439e4b591f869cabe6f41f228a8863
BLAKE2b-256 3cf2a988a5fd35351dc510c82a944b3f9287818360e40c7ab04701d85ff8ced4

See more details on using hashes here.

Supported by

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