g2p-zh-en
Project description
g2p_zh_en
Introduction
g2p_zh_en is an open-source project that provides a mixed Grapheme-to-Phoneme (G2P) conversion between Chinese and English based on Bigcidian’s translation table. It aims to convert text between Chinese and English phonemes, allowing for pronunciation and speech-related applications.
Features
G2P conversion from Chinese to English
G2P conversion from English to Chinese
Handling of special characters, such as numbers and currencies
Installation
.
Make sure your environment meets the following requirements:
Python 3.x
Other dependencies (listed in requirements.txt)
.
Install the required dependencies by running the following command:
pip install -r requirements.txt
. Install g2p_zh_en using pip:
pip install g2p_zh_en
Usage
Import the G2P class from g2p_zh_en and create an instance:
from g2p_zh_en.g2p_zh_en import G2P
g2p = G2P()
text = "我有100美元,i'm so rich."
output = g2p.g2p(text)
print(output)
['w', 'uɔ3', 'y', 'əu3', 'y', 'ii4', 'b', 'ai3', 'm', 'ei3', 'yu', 'an2', ',', ' ', 'ai', 'm', ' ', 's', 'əu', ' ', 'r', 'i', 'ch', ' ', '.']
text = "i have 100 dollar,我是不是很富有?"
output = g2p.g2p(text, language='en-us')
print(output)
['ai', ' ', 'h', 'æ', 'v', ' ', 'w', 'ʌ', 'n', ' ', 'h', 'ʌ', 'n', 'd', 'r', 'ə', 'd', ' ', 'd', 'a', 'l', 'ər', ' ', ',', ' ', 'w', 'uɔ3', 'sh', 'iii4', 'b', 'uu2', 'sh', 'iii4', 'h', 'ən3', 'f', 'uu4', 'y', 'əu3', ' ', '?']
Please note that the output represents the phonetic representation of the input text.
In Progress
The following features are currently being developed:
[x] G2P conversion with Chinese as the primary language.
[x] G2P conversion with English as the primary language.
[ ] Handling various special characters, such as numbers and currencies. Contribution
If you would like to contribute to this project, you can:
Submit bug reports or feature requests on the project’s issue page. Fork the project, create your own branch, and submit a pull request. Improve documentation and code comments. Thank you for your support and contributions!
License
This project is licensed under the GNU General Public License.
History
0.1.0 (2023-07-14)
First release on PyPI.
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 g2p_zh_en-0.1.1.tar.gz.
File metadata
- Download URL: g2p_zh_en-0.1.1.tar.gz
- Upload date:
- Size: 3.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b24b6f8b674c75db6bf9a1dfef9a7320a7e7adc62d096dc2ba3b4cce6e1ac18b
|
|
| MD5 |
21aac17b2125c468a936d409298cbad3
|
|
| BLAKE2b-256 |
833ea28441b7ed78157527591d768d447078a94a3dff70fe09827b0cae4a187f
|