pronunciation-dictionary-utils
Utils to modify pronunciation dictionaries.
https://github.com/stefantaubert/pronunciation-dictionary-utils
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 5 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.1%) to scientific vocabulary
Keywords
Repository
Utils to modify pronunciation dictionaries.
Basic Info
Statistics
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
- Releases: 5
Topics
Metadata Files
README.md
pronunciation-dictionary-utils
Library and CLI to modify pronunciation dictionaries (any language).
Features
export-vocabulary: export vocabulary from dictionariesexport-phonemes: export phoneme set from dictionariesmerge: merge dictionaries togetherextract: extract subset of dictionary vocabularymap-symbols-in-pronunciations: map phonemes/symbols in pronunciations to another phoneme/symbol, e.g., mapping ARPAbet to IPAmap-symbols-in-pronunciations-json: map phonemes/symbols in pronunciations to phoneme/symbol specified in fileremove-symbols-from-vocabulary: remove phonemes/symbols from vocabularyremove-symbols-from-pronunciations: remove phonemes/symbols from pronunciationsremove-symbols-from-words: remove characters/symbols from wordschange-formatting: change formatting of dictionariesselect-single-pronunciation: select single pronunciationchange-word-casing: transform all words to upper- or lower-casesort-words: sort dictionary after wordssort-pronunciations: sort dictionary pronunciationsnormalize-weights: normalize pronunciation weights for each word
Roadmap
- Adding tests
- Implementation of printing of statistics
- Add change of pronunciation for a word via CLI
Installation
sh
pip install pronunciation-dictionary-utils --user
Usage
```txt usage: dict-cli [-h] [-v] {export-vocabulary,export-phonemes,merge,extract,map-symbols-in-pronunciations,map-symbols-in-pronunciations-json,remove-symbols-from-vocabulary,remove-symbols-from-pronunciations,remove-symbols-from-words,change-formatting,select-single-pronunciation,change-word-casing,sort-words,sort-pronunciations,normalize-weights} ...
This program provides methods to modify pronunciation dictionaries.
positional arguments: {export-vocabulary,export-phonemes,merge,extract,map-symbols-in-pronunciations,map-symbols-in-pronunciations-json,remove-symbols-from-vocabulary,remove-symbols-from-pronunciations,remove-symbols-from-words,change-formatting,select-single-pronunciation,change-word-casing,sort-words,sort-pronunciations,normalize-weights} description export-vocabulary export vocabulary from dictionaries export-phonemes export phoneme set from dictionaries merge merge dictionaries together extract extract subset of dictionary vocabulary map-symbols-in-pronunciations map phonemes/symbols in pronunciations to another phoneme/symbol, e.g., mapping ARPAbet to IPA map-symbols-in-pronunciations-json map phonemes/symbols in pronunciations to phoneme/symbol specified in file remove-symbols-from-vocabulary remove phonemes/symbols from vocabulary remove-symbols-from-pronunciations remove phonemes/symbols from pronunciations remove-symbols-from-words remove characters/symbols from words change-formatting change formatting of dictionaries select-single-pronunciation select single pronunciation change-word-casing transform all words to upper- or lower-case sort-words sort dictionary after words sort-pronunciations sort dictionary pronunciations normalize-weights normalize pronunciation weights for each word
optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit ```
Example
```sh
Download CMU dictionary
wget https://raw.githubusercontent.com/cmusphinx/cmudict/master/cmudict.dict \ -O "/tmp/example.dict"
Change formatting to remove numbers from words, comments and save as UTF-8
dict-cli change-formatting \ "/tmp/example.dict" \ --deserialization-encoding "ISO-8859-1" \ --consider-numbers \ --consider-pronunciation-comments \ --serialization-encoding "UTF-8"
Export phoneme set
dict-cli export-phonemes \ "/tmp/example.dict" \ "/tmp/example-phoneme-set.txt"
Export vocabulary
dict-cli export-vocabulary \ "/tmp/example.dict" \ "/tmp/example-vocabulary.txt"
Keep first pronunciation for each word and discard the rest
dict-cli select-single-pronunciation \ "/tmp/example.dict" \ --mode "first"
Replace all "ER0" phonemes with "ER"
dict-cli map-symbols-in-pronunciations \ "/tmp/example.dict" \ "ER0" "ER" ```
Contributing
Development setup
```sh
update
sudo apt update
install Python 3.8-3.12 for ensuring that tests can be run
sudo apt install python3-pip \ python3.8 python3.8-dev python3.8-distutils python3.8-venv \ python3.9 python3.9-dev python3.9-distutils python3.9-venv \ python3.10 python3.10-dev python3.10-distutils python3.10-venv \ python3.11 python3.11-dev python3.11-distutils python3.11-venv \ python3.12 python3.12-dev python3.12-distutils python3.12-venv
install pipenv for creation of virtual environments
python3.8 -m pip install pipenv --user
check out repo
git clone https://github.com/stefantaubert/pronunciation-dictionary-utils.git cd pronunciation-dictionary-utils
create virtual environment
python3.8 -m pipenv install --dev ```
Running the tests
```sh
first install the tool like in "Development setup"
then, navigate into the directory of the repo (if not already done)
cd pronunciation-dictionary-utils
activate environment
python3.8 -m pipenv shell
run tests
tox ```
Final lines of test result output:
log
py38: commands succeeded
py39: commands succeeded
py310: commands succeeded
py311: commands succeeded
py312: commands succeeded
congratulations :)
Acknowledgments
Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) Project-ID 416228727 CRC 1410
Citation
If you want to cite this repo, you can use this BibTeX-entry generated by GitHub (see About => Cite this repository).
txt
Taubert, S., and Przybysz, N. (2024). pronunciation-dictionary-utils (Version 0.0.5) [Computer software]. https://doi.org/10.5281/zenodo.10560153
Owner
- Name: Stefan Taubert
- Login: stefantaubert
- Kind: user
- Location: Chemnitz, Germany
- Company: Chemnitz University of Technology
- Website: https://stefantaubert.com
- Twitter: Stefan_Taubert
- Repositories: 75
- Profile: https://github.com/stefantaubert
Currently I am working on my PhD about the topic of speech synthesis at Chemnitz University of Technology.
Citation (CITATION.cff)
cff-version: 1.2.0
title: pronunciation-dictionary-utils
abstract: CLI and library to modify pronunciation dictionaries (any language).
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- email: github@stefantaubert.com
given-names: Stefan
family-names: Taubert
affiliation: Chemnitz University of Technology
orcid: 'https://orcid.org/0000-0002-4932-2874'
website: 'https://stefantaubert.com/'
- given-names: Natalia
family-names: Przybysz
affiliation: Chemnitz University of Technology
version: 0.0.5
date-released: 2024-01-24
license: MIT
url: https://github.com/stefantaubert/pronunciation-dictionary-utils
doi: 10.5281/zenodo.10560153
GitHub Events
Total
Last Year
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Stefan Taubert | 2****t | 81 |
| Natalia Przybysz | n****z@g****m | 68 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 1
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 1 minute
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- stefantaubert (1)
Pull Request Authors
- stefantaubert (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 28 last-month
- Total dependent packages: 3
- Total dependent repositories: 1
- Total versions: 5
- Total maintainers: 1
pypi.org: pronunciation-dictionary-utils
CLI and library to modify pronunciation dictionaries (any language).
- Homepage: https://github.com/stefantaubert/pronunciation-dictionary-utils
- Documentation: https://pronunciation-dictionary-utils.readthedocs.io/
- License: MIT
-
Latest release: 0.0.5
published about 2 years ago
Rankings
Maintainers (1)
Dependencies
- autoflake * develop
- autopep8 * develop
- cx-freeze * develop
- isort * develop
- pronunciation-dictionary-utils * develop
- pycodestyle * develop
- pylint * develop
- pytest * develop
- rope * develop
- twine * develop
- ordered-set >=4.1.0
- pronunciation-dictionary >=0.0.4
- tqdm *
- astroid ==2.11.3 develop
- attrs ==21.4.0 develop
- autoflake ==1.4 develop
- autopep8 ==1.6.0 develop
- bleach ==5.0.0 develop
- certifi ==2021.10.8 develop
- cffi ==1.15.0 develop
- charset-normalizer ==2.0.12 develop
- commonmark ==0.9.1 develop
- cryptography ==36.0.2 develop
- cx-freeze ==6.10 develop
- dill ==0.3.4 develop
- docutils ==0.18.1 develop
- idna ==3.3 develop
- importlib-metadata ==4.11.3 develop
- iniconfig ==1.1.1 develop
- isort ==5.10.1 develop
- jeepney ==0.8.0 develop
- keyring ==23.5.0 develop
- lazy-object-proxy ==1.7.1 develop
- mccabe ==0.7.0 develop
- ordered-set ==4.1.0 develop
- packaging ==21.3 develop
- patchelf ==0.14.5.0 develop
- pkginfo ==1.8.2 develop
- platformdirs ==2.5.2 develop
- pluggy ==1.0.0 develop
- pronunciation-dictionary-utils * develop
- py ==1.11.0 develop
- pycodestyle ==2.8.0 develop
- pycparser ==2.21 develop
- pyflakes ==2.4.0 develop
- pygments ==2.12.0 develop
- pylint ==2.13.7 develop
- pyparsing ==3.0.8 develop
- pytest ==7.1.2 develop
- readme-renderer ==35.0 develop
- requests ==2.27.1 develop
- requests-toolbelt ==0.9.1 develop
- rfc3986 ==2.0.0 develop
- rich ==12.2.0 develop
- rope ==1.0.0 develop
- secretstorage ==3.3.2 develop
- setuptools ==62.1.0 develop
- six ==1.16.0 develop
- toml ==0.10.2 develop
- tomli ==2.0.1 develop
- tqdm ==4.64.0 develop
- twine ==4.0.0 develop
- typing-extensions ==4.2.0 develop
- urllib3 ==1.26.9 develop
- webencodings ==0.5.1 develop
- wheel ==0.37.1 develop
- wrapt ==1.14.0 develop
- zipp ==3.8.0 develop
- ordered-set ==4.1.0
- pronunciation-dictionary ==0.0.4
- tqdm ==4.64.0
- ordered-set >= 4.1.0
- pronunciation-dictionary >= 0.0.5
- tqdm *