An interface to ISLEX, an IPA pronunciation dictionary for English with stress and syllable markings.
Project description
pysle
Questions? Comments? Feedback?
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).
Table of contents
- Documentation
- Common Use Cases
- Version History
- Requirements
- Optional resources
- Installation
- Example usage
- Citing psyle
- Acknowledgements
Documentation
Automatically generated pdocs can be found here:
http://timmahrt.github.io/pysle/
Common Use Cases
What can you do with this library?
-
look up the list of phones and syllables for canonical pronunciations of a word
isletool.LexicalTool('ISLEdict.txt').lookup('cat')
-
map an actual pronunciation to a dictionary pronunciation (can be used to automatically find speech errors)
pronunciationtools.findClosestPronunciation(isleDict, 'cat', ['k', 'æ',])
-
automatically syllabify a praat textgrid containing words and phones (e.g. force-aligned text) -- requires the praatIO library
pysle.syllabifyTextgrid(isleDict, praatioTextgrid, "words", "phones")
-
search for words based on pronunciation
isletool.LexicalTool('ISLEdict.txt').search('dVV') # Any word containing a 'd' followed by two vowels
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
Version History
Pysle uses semantic versioning (Major.Minor.Patch)
Ver 2.3 (Nov 18, 2020)
- add exactMatch to isletool.search()
- when True, will return exact phonetic matches, ignoring stress, syllable, and word markers
- see examples/dictionary_search.py
Ver 2.2 (Nov 17, 2020)
- the ISLEdict is now bundled with pysle--no need to download it separately!
- loading the isleDict is ~10% faster
Ver 2.1 (May 31, 2020)
- add transcribe function, given a word or series of words, get a possible pronunciation;
- see examples/isletool_examples.py
Ver 2.0 (May 27, 2020)
- cleaned up the api a little, including some functions that weren't usable
- updated documentation and readme files. Added pdoc documentation
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.
Requirements
-
Python 2.7.*
or above -
Python 3.7.*
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.
Optional resources
pysle requires the ISLEdict pronunciation dictionary (copyright Mark Hasegawa-Johnson, licensed under the MIT open source license). This is bundled with psyle. However, you may want to use a subset of the pronunciations or you may want to add your own pronunciations.
In that case, please get the original file.
Direct link to the ISLEX file used in this project (ISLEdict.txt)
See examples/isletool_examples.py for an example of how to load a custom ISLEdict file.
Installation
Pysle is on pypi and can be installed or upgraded from the command-line shell with pip like so
python -m pip install pysle --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:\Python36\python.exe setup.py install
Example usage
Here is a typical usage
from pysle import isletool
isleDict = isletool.LexicalTool('C:\islev2.dict')
print(isleDict.lookup('catatonic')[0]) # Get the first pronunciation
# >> (([['k', 'ˌæ'], ['ɾ', 'ə'], ['t', 'ˈɑ'], ['n', 'ɪ', 'k']], [2, 0], [1, 1]),)
and another
from pysle import isletool
from pysle import pronunciationtools
isleDict = isletool.LexicalTool('C:\islev2.dict')
searchWord = 'another'
phoneList = ['n', '@', 'th', 'r'] # Actually produced (ASCII or IPA ok here)
returnList = pronunciationtools.findBestSyllabification(isleDict, searchWord, phoneList)
syllableList = returnList[2]
print(syllableList)
# >> [["''"], ['n', '@'], ['th', 'r']]
Please see \examples for example usage
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.
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
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
File details
Details for the file pysle-2.3.0.tar.gz
.
File metadata
- Download URL: pysle-2.3.0.tar.gz
- Upload date:
- Size: 2.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f97f42046bfa381547de42d25214ad0e14cca3fcc69a8ca9bbaa44f99a5e1fb7 |
|
MD5 | cf62a9f9cafe6bb84b9735ef42eb31ac |
|
BLAKE2b-256 | 3e16e5f6e58a45d6f34bdc4631980c02a03737abbe94c19aba145711f0fd64dc |
File details
Details for the file pysle-2.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pysle-2.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 2.8 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2abf91b6ce960f4c4f1e2f5894f5976fe43fd81138edadd22217641f4760c0e |
|
MD5 | aa21193dbd3f3a7abd6a715d80065aef |
|
BLAKE2b-256 | 204c638bb380c5d9473331b401984fc5e17b5bc5ed067ef1aa3393e5e5efde40 |